:root {
  --ink: #17231e;
  --muted: #5b6d64;
  --line: #d6e0da;
  --paper: #f7faf8;
  --card: #ffffff;
  --accent: #1d5b43;
  --accent-dark: #123f2f;
  --accent-soft: #e6f0ea;
  --gold: #d9ad55;
  --danger: #9a3d2e;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--accent-dark) 94%, transparent);
  color: white;
  border-bottom: 3px solid var(--gold);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 800; letter-spacing: 0.01em; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border: 1px solid color-mix(in srgb, white 28%, transparent); border-radius: 9px; display: grid; place-items: center; color: var(--gold); font-size: 1.15rem; }
.top-link { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem 0.8rem; border: 1px solid rgba(255,255,255,0.3); border-radius: 9px; font-size: 0.875rem; font-weight: 800; color: white; text-decoration: none; }

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 7vw, 5.5rem) clamp(1rem, 5vw, 3rem) clamp(2rem, 5vw, 4rem);
  color: white;
  background:
    radial-gradient(circle at 86% 20%, color-mix(in srgb, var(--gold) 24%, transparent) 0 3%, transparent 4%),
    radial-gradient(circle at 76% 72%, color-mix(in srgb, white 10%, transparent) 0 7%, transparent 8%),
    linear-gradient(135deg, var(--accent-dark), var(--accent));
}
.hero::after { content: ""; position: absolute; inset: auto -10% -80px 45%; height: 170px; transform: rotate(-6deg); border: 1px solid rgba(255,255,255,0.14); border-radius: 50%; }
.hero-inner { position: relative; max-width: 1180px; margin: 0 auto; z-index: 1; }
.eyebrow { margin: 0 0 0.6rem; color: var(--gold); font-size: 0.8rem; font-weight: 850; letter-spacing: 0.14em; text-transform: uppercase; }
h1 { max-width: 900px; margin: 0; font-size: clamp(2rem, 8vw, 4.8rem); line-height: 0.98; letter-spacing: -0.055em; }
.latin { font-style: italic; font-weight: 560; }
.hero-copy { max-width: 720px; margin: 1rem 0 0; color: rgba(255,255,255,0.8); font-size: clamp(1rem, 2.2vw, 1.15rem); line-height: 1.6; }

.content { width: min(1180px, calc(100% - 2rem)); margin: -1.4rem auto 0; padding-bottom: 5rem; position: relative; z-index: 2; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
.quick-card { min-height: 126px; padding: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 10px 30px rgba(14, 49, 36, 0.08); }
.quick-card .label { color: var(--muted); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.quick-card .value { display: block; margin-top: 0.45rem; color: var(--accent-dark); font-size: clamp(1.25rem, 3vw, 1.75rem); line-height: 1.05; font-weight: 850; letter-spacing: -0.035em; }
.quick-card small { display: block; margin-top: 0.45rem; color: var(--muted); line-height: 1.35; }

.toolbar { display: flex; gap: 0.65rem; flex-wrap: wrap; margin: 1rem 0 1.75rem; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; padding: 0.72rem 0.95rem; border-radius: 10px; background: var(--accent); color: white; font-weight: 800; font-size: 0.9rem; text-decoration: none; border: 1px solid var(--accent); }
.button.secondary { color: var(--accent-dark); background: white; border-color: var(--line); }
.button:focus-visible, .species-card:focus-visible, .top-link:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.section { margin-top: 2rem; scroll-margin-top: 84px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 0.85rem; }
h2 { margin: 0; color: var(--accent-dark); font-size: clamp(1.45rem, 3.5vw, 2.1rem); letter-spacing: -0.035em; }
.section-note { margin: 0; color: var(--muted); font-size: 0.85rem; }

.month-panel { display: grid; grid-template-columns: 0.74fr 1.26fr; gap: 1rem; padding: 1.15rem; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, white); border-left: 5px solid var(--accent); border-radius: 14px; }
.month-panel h3 { margin: 0; color: var(--accent-dark); font-size: 1.4rem; }
.month-panel p { margin: 0.45rem 0 0; line-height: 1.5; color: var(--muted); }
.month-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; }
.month-stat { padding: 0.75rem; background: rgba(255,255,255,0.72); border-radius: 10px; }
.month-stat b { display: block; color: var(--accent-dark); font-size: 1rem; }
.month-stat span { color: var(--muted); font-size: 0.76rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 8px 25px rgba(16,50,38,0.05); }
table { width: 100%; min-width: 960px; border-collapse: collapse; font-size: 0.86rem; }
th { position: sticky; top: 64px; padding: 0.85rem 0.75rem; text-align: left; background: var(--accent-dark); color: white; font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap; }
td { padding: 0.75rem; border-top: 1px solid var(--line); vertical-align: top; line-height: 1.4; }
tbody tr:nth-child(even) { background: #f8fbf9; }
tbody tr.current { background: color-mix(in srgb, var(--gold) 22%, white); box-shadow: inset 4px 0 0 var(--gold); }
tbody td:first-child { font-weight: 850; color: var(--accent-dark); }

.notes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.note-card { padding: 1.2rem; background: white; border: 1px solid var(--line); border-radius: 14px; }
.note-card h3 { margin: 0 0 0.55rem; color: var(--accent-dark); font-size: 1.05rem; }
.note-card p, .note-card li { color: #3c4e46; line-height: 1.58; }
.note-card p { margin: 0.45rem 0; }
.note-card ul { margin: 0.5rem 0 0; padding-left: 1.15rem; }
.warning { border-color: #e1b2aa; background: #fff8f6; }
.warning h3 { color: var(--danger); }

.footer { padding: 1.5rem 1rem 5rem; color: var(--muted); text-align: center; font-size: 0.8rem; }
.updated { margin-top: 0.4rem; }

.home { width: min(980px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem, 8vw, 5rem) 0; }
.home-head { padding: clamp(1.5rem, 5vw, 3rem); border-radius: 22px; color: white; background: linear-gradient(135deg, #123f2f, #216348); border-bottom: 4px solid var(--gold); }
.home-head h1 { font-size: clamp(2.4rem, 8vw, 5rem); }
.home-head p { max-width: 640px; color: rgba(255,255,255,0.78); line-height: 1.6; }
.home-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.85rem 1rem; margin-top: 1.35rem; }
.home-actions .library-button { background: var(--gold); border-color: var(--gold); color: #173126; }
.home-actions span { color: rgba(255,255,255,0.72); font-size: 0.86rem; }
.species-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.species-card { display: block; padding: 1.25rem; min-height: 220px; text-decoration: none; background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 30px rgba(14,49,36,0.07); transition: transform 160ms ease, box-shadow 160ms ease; }
.species-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(14,49,36,0.11); }
.species-card .habitat { color: var(--muted); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.species-card h2 { margin-top: 0.5rem; font-size: 1.7rem; }
.species-card p { color: var(--muted); line-height: 1.55; }
.arrow { display: inline-block; margin-top: 0.8rem; color: var(--accent); font-weight: 850; }

.library-hero { padding-bottom: clamp(3rem, 7vw, 5rem); }
.library-hero h1 { font-size: clamp(2.5rem, 8vw, 5rem); }
.library-content { width: min(1040px, calc(100% - 2rem)); margin: -1.4rem auto 0; padding-bottom: 4rem; position: relative; z-index: 2; }
.library-summary { display: flex; justify-content: space-between; gap: 0.75rem 1.5rem; padding: 1rem 1.15rem; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(14,49,36,0.08); }
.library-summary strong { color: var(--accent-dark); }
.library-summary span { color: var(--muted); font-size: 0.88rem; text-align: right; }
.file-list { display: grid; gap: 0.85rem; margin-top: 1rem; }
.file-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: 1.15rem; background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(14,49,36,0.055); }
.file-card .habitat { color: var(--muted); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.file-card h2 { margin-top: 0.35rem; font-size: 1.45rem; }
.file-card p { margin: 0.3rem 0 0; color: var(--muted); }
.file-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
.file-actions .button { white-space: nowrap; }

.desert { --accent: #75572f; --accent-dark: #42321e; --accent-soft: #f2eadc; --gold: #e5b65b; }

@media (max-width: 820px) {
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .month-panel { grid-template-columns: 1fr; }
  .notes-grid, .species-list { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; }
  .file-card { grid-template-columns: 1fr; align-items: start; }
  .file-actions { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .topbar { min-height: 58px; }
  .top-link { min-height: 38px; padding: 0.45rem 0.65rem; }
  .hero { padding-top: 2rem; }
  .content { width: min(100% - 1rem, 1180px); margin-top: -0.8rem; }
  .quick-card { min-height: 112px; }
  .quick-card .value { font-size: 1.2rem; }
  .month-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  th { top: 58px; }
  .library-content { width: min(100% - 1rem, 1040px); margin-top: -0.8rem; }
  .library-summary { flex-direction: column; }
  .library-summary span { text-align: left; }
  .file-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .file-actions .button:first-child { grid-column: 1 / -1; }
}

@media print {
  .topbar, .toolbar { display: none; }
  .hero { padding: 1.5rem; }
  .content { width: 100%; margin: 0; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 8pt; }
  th { position: static; }
  .note-card, .quick-card { break-inside: avoid; }
}

/* Species page additions and table-header overlap correction. */
table th { position: static; }
.nav-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.uv-guidance { padding: 1.2rem; background: #edf5ef; border: 1px solid #b8cebe; border-radius: 16px; }
.uv-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 1rem; }
.estimate-tag { display: inline-block; padding: .4rem .65rem; background: #fff7e4; border: 1px solid #e1c484; border-radius: 8px; color: #59421f; font-size: .8rem; font-weight: 750; }
.uv-label { font-weight: 700; color: var(--accent-dark) !important; }
.uv-reading { font-size: 2.5rem; line-height: 1.1 !important; color: var(--accent-dark) !important; font-weight: 800; }
.uv-reading span { display: block; margin-top: .5rem; font-size: .85rem; font-weight: 500; line-height: 1.4; }
.uv-method, .uv-evidence { margin: 1rem 0 0; color: #334a3d; line-height: 1.6; }
.source-links p { line-height: 1.7; }
.source-links a { color: var(--accent-dark); text-underline-offset: .2em; }
@media (max-width: 820px) { .uv-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .topbar { gap: .5rem; padding: .6rem .5rem; } .brand { gap: .4rem; } .brand-mark { display: none; } .top-link { font-size: .78rem; } .uv-guidance { padding: .8rem; } }

/* October 2026 collection audit: keep table headers inside their scroll region. */
table th {position:static;}
.uv-guidance a {color:var(--accent-dark);text-underline-offset:.2em;}
.uv-evidence {font-size:.9rem;}
@media(max-width:520px){.hero h1{overflow-wrap:anywhere}.nav-actions{gap:.35rem}.uv-reading{font-size:2rem}}
