/* ==========================================================================
   Colorfall — The Fall Foliage Lab
   Design system + all page styles. Mobile-first.
   ========================================================================== */

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }

ul[class], ol[class] { padding: 0; list-style: none; }

img, svg, canvas { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: inherit; }

/* ---------- Tokens ---------- */
:root {
  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --maple: #c0392b;
  --amber: #d9822b;
  --gold: #e9b949;
  --moss: #6e7f3c;
  --plum: #7a2e4a;
  --rust: #a9502f;

  --bg: #fbf4e8;
  --bg-soft: #f5e9d6;
  --surface: #fffdf8;
  --surface-2: #f8efe0;
  --ink: #2b1b12;
  --ink-soft: #5b4638;
  --muted: #8a7562;
  --line: #e6d7c1;
  --line-strong: #d8c3a6;
  --accent: var(--maple);
  --accent-2: var(--amber);
  --shadow: 0 1px 2px rgba(43, 27, 18, .06), 0 10px 30px -14px rgba(43, 27, 18, .35);
  --shadow-sm: 0 1px 2px rgba(43, 27, 18, .08), 0 4px 14px -8px rgba(43, 27, 18, .3);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --ring: 0 0 0 3px rgba(192, 57, 43, .35);
  --maxw: 1120px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #17100d;
  --bg-soft: #201713;
  --surface: #241a15;
  --surface-2: #2c201a;
  --ink: #f7ecdc;
  --ink-soft: #dcc9b3;
  --muted: #a9917c;
  --line: #3d2c23;
  --line-strong: #513a2d;
  --accent: #ec6a58;
  --accent-2: #f0a44b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -18px rgba(0, 0, 0, .8);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px -10px rgba(0, 0, 0, .7);
  --ring: 0 0 0 3px rgba(236, 106, 88, .4);
  color-scheme: dark;
}

/* ---------- Base ---------- */
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(80vw 60vh at 12% -10%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 70%),
    radial-gradient(70vw 55vh at 105% 8%, color-mix(in srgb, var(--maple) 16%, transparent), transparent 70%);
  opacity: .8;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.015em;
  color: var(--ink);
}

h1 { font-size: clamp(2.1rem, 7vw, 4rem); }
h2 { font-size: clamp(1.55rem, 4.4vw, 2.5rem); }
h3 { font-size: clamp(1.15rem, 2.6vw, 1.5rem); }

p { color: var(--ink-soft); }

a { text-decoration: none; }

strong { color: var(--ink); font-weight: 650; }

::selection { background: color-mix(in srgb, var(--gold) 55%, transparent); }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 28px); }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; transition: top .2s;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

/* ---------- Header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.head-in { display: flex; align-items: center; gap: 12px; min-height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.24rem; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name small { display: block; font-family: var(--font-body); font-size: .58rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: -2px; }

.main-nav { display: none; margin-left: auto; gap: 4px; align-items: center; }
.main-nav a {
  padding: 8px 12px; border-radius: 999px; font-size: .92rem; font-weight: 550;
  color: var(--ink-soft); transition: background .18s, color .18s;
}
.main-nav a:hover { background: var(--surface-2); color: var(--ink); }
.main-nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

.head-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.main-nav + .head-actions { margin-left: 6px; }

.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 12px;
  color: var(--ink-soft); transition: background .18s, color .18s, border-color .18s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.icon-btn svg { width: 20px; height: 20px; }

.nav-toggle { display: grid; }
:root[data-theme="dark"] .sun-icon,
:root:not([data-theme="dark"]) .moon-icon { display: none; }

@media (min-width: 860px) {
  .main-nav { display: flex; }
  .nav-toggle { display: none; }
}

/* mobile nav panel */
@media (max-width: 859px) {
  .main-nav.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; left: 12px; right: 12px; top: 66px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow);
  }
  .main-nav.open a { padding: 12px 14px; border-radius: 12px; }
}

/* ---------- Buttons & chips ---------- */
.btn {
  --b: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--b); color: #fff; font-weight: 600; font-size: .95rem;
  transition: transform .16s ease, filter .18s, box-shadow .18s, background .18s;
  box-shadow: var(--shadow-sm);
}
:root[data-theme="dark"] .btn { color: #1a120e; background: var(--gold); }
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: linear-gradient(120deg, var(--maple), var(--rust)); color: #fff; }
:root[data-theme="dark"] .btn.primary { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #1a120e; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 8px 14px; font-size: .85rem; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px; font-size: .82rem; font-weight: 550;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft);
  white-space: nowrap; transition: background .16s, color .16s, border-color .16s, transform .16s;
}
button.chip:hover { background: var(--surface); color: var(--ink); transform: translateY(-1px); }
.chip.active, .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
:root[data-theme="dark"] .chip.active, :root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--gold); color: #1a120e; border-color: var(--gold); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft);
  border: 1px solid var(--line);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Cards & sections ---------- */
.section { padding: clamp(40px, 8vw, 84px) 0; }
.section-head { max-width: 720px; margin-bottom: 26px; }
.section-head.center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .76rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 12px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; border-radius: 2px; }
.lead { font-size: clamp(1.02rem, 2.4vw, 1.22rem); color: var(--ink-soft); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(18px, 3vw, 26px); box-shadow: var(--shadow-sm);
}
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr; }
.grid.three { grid-template-columns: 1fr; }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
@media (min-width: 640px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(30px, 6vw, 70px); }
.hero-grid { display: grid; gap: clamp(24px, 5vw, 48px); align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.08fr .92fr; } }
.hero h1 { margin-bottom: 16px; }
.hero h1 .grad {
  background: linear-gradient(96deg, var(--maple), var(--amber) 55%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme="dark"] .hero h1 .grad { background: linear-gradient(96deg, var(--accent), var(--accent-2) 55%, var(--gold)); -webkit-background-clip: text; background-clip: text; }
.hero .lead { margin-bottom: 24px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.hero-note { font-size: .84rem; color: var(--muted); }

.hero-art { position: relative; display: grid; place-items: center; }
.hero-leaf { width: min(88%, 380px); filter: drop-shadow(0 24px 40px rgba(120, 50, 20, .28)); animation: sway 9s ease-in-out infinite; transform-origin: 50% 0%; }
:root[data-theme="dark"] .hero-leaf { filter: drop-shadow(0 24px 50px rgba(0, 0, 0, .6)); }

@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-leaf { animation: none; }
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* stat row */
.stat-row { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 24px; }
.stat { display: flex; flex-direction: column; }
.stat b { font-family: var(--font-display); font-size: 1.5rem; line-height: 1; }
.stat span { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

/* ---------- Foliage pulse ---------- */
.pulse { border-radius: var(--radius-lg); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }
.pulse-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pulse-head h3 { display: flex; align-items: center; gap: 10px; }
.pulse-body { display: grid; gap: 0; }
.pulse-regions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.pulse-region { padding: 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; }
.pulse-region .pr-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.pulse-region .pr-name { font-weight: 650; font-size: .92rem; }
.pulse-region .pr-stage { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.pulse-region .pr-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pulse-region .pr-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.pulse-region .pr-meta { margin-top: 7px; font-size: .78rem; color: var(--muted); }

/* stage colors */
.stage-0 { --stage: #6e7f3c; }
.stage-1 { --stage: #b6a13a; }
.stage-2 { --stage: #d9822b; }
.stage-3 { --stage: #c0392b; }
.stage-4 { --stage: #a9502f; }
.stage-5 { --stage: #8a7562; }
.stage-text-0 { color: #6e7f3c; } .stage-text-1 { color: #b6a13a; }
.stage-text-2 { color: #d9822b; } .stage-text-3 { color: #c0392b; }
.stage-text-4 { color: #a9502f; } .stage-text-5 { color: #8a7562; }
:root[data-theme="dark"] .stage-text-0 { color: #9db26a; } :root[data-theme="dark"] .stage-text-1 { color: #e2cd5c; }
:root[data-theme="dark"] .stage-text-2 { color: #f0a44b; } :root[data-theme="dark"] .stage-text-3 { color: #ec6a58; }
:root[data-theme="dark"] .stage-text-4 { color: #cf7a4f; } :root[data-theme="dark"] .stage-text-5 { color: #a9917c; }

/* ---------- Wave chart ---------- */
.chart-card { padding: 0; overflow: hidden; }
.chart-toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.chart-wrap { position: relative; padding: 8px 8px 0; overflow-x: auto; }
#waveChart { width: 100%; min-width: 560px; height: auto; touch-action: pan-y; }
.wave-dot { cursor: pointer; transition: r .15s ease, opacity .15s; }
.wave-dot:hover { r: 9; }
.wave-label { font-family: var(--font-body); font-size: 10px; fill: var(--muted); }
.wave-axisline { stroke: var(--line-strong); stroke-width: 1; }
.wave-band { fill: color-mix(in srgb, var(--surface-2) 70%, transparent); }

.week-slider { display: flex; align-items: center; gap: 12px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--moss), var(--gold), var(--amber), var(--maple), var(--rust)); }
input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--moss), var(--gold), var(--amber), var(--maple), var(--rust)); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: -7px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--ink); box-shadow: var(--shadow-sm); cursor: pointer;
}
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 3px solid var(--ink); cursor: pointer; }

/* ---------- Destination explorer ---------- */
.explorer { display: grid; gap: 18px; }
@media (min-width: 940px) { .explorer { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; } }
.dest-list { display: grid; gap: 10px; max-height: none; }
@media (min-width: 940px) { .dest-list { max-height: 620px; overflow-y: auto; padding-right: 6px; } }
.dest-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; text-align: left; width: 100%;
  transition: border-color .16s, transform .16s, background .16s;
}
.dest-item:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.dest-item.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.dest-swatch { width: 40px; height: 40px; border-radius: 12px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.dest-swatch.mini { width: 30px; height: 30px; border-radius: 9px; }
.dest-info { min-width: 0; }
.dest-info strong { display: block; font-size: .96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dest-info span { font-size: .8rem; color: var(--muted); }
.dest-stage { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }

.detail-panel { position: relative; }
@media (min-width: 940px) { .detail-panel { position: sticky; top: 84px; } }
.detail-hero { height: 110px; border-radius: var(--radius-sm); margin-bottom: 16px; display: flex; align-items: flex-end; padding: 12px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.detail-hero .badge { background: rgba(255,255,255,.88); color: #2b1b12; border-color: transparent; }
.detail-name { font-size: 1.4rem; margin-bottom: 2px; }
.detail-sub { color: var(--muted); font-size: .88rem; margin-bottom: 14px; }
.detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.detail-stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.detail-stat dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.detail-stat dd { font-weight: 650; font-size: .95rem; }
.swatch-row { display: flex; gap: 6px; margin-top: 6px; }
.swatch-row i { width: 100%; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.progress-note { font-size: .8rem; color: var(--muted); margin-top: 10px; }

/* ---------- Game ---------- */
.game-shell { display: grid; gap: 20px; }
@media (min-width: 900px) { .game-shell { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } }
.game-stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(18px, 4vw, 32px); box-shadow: var(--shadow); }
.game-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 18px; }
.game-progress { font-size: .82rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.game-score { font-family: var(--font-display); font-size: 1.5rem; }
.leaf-display { display: grid; place-items: center; min-height: 220px; padding: 10px; }
.leaf-display svg { width: min(64%, 230px); height: auto; filter: drop-shadow(0 16px 22px rgba(80,40,20,.25)); transition: transform .4s ease; }
.leaf-display.correct svg { transform: scale(1.06) rotate(-4deg); }
.leaf-display.wrong svg { transform: rotate(6deg); }
.options { display: grid; gap: 10px; margin-top: 18px; }
@media (min-width: 560px) { .options.two-col { grid-template-columns: 1fr 1fr; } .options.three-col { grid-template-columns: repeat(4, 1fr); } }
.option {
  text-align: left; padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: .95rem;
  display: flex; align-items: center; gap: 10px; transition: transform .14s, border-color .14s, background .14s;
}
.options.two-col .option { text-align: center; justify-content: center; }
.options.three-col .option { text-align: center; justify-content: center; padding: 12px 8px; }
.option small { display: block; font-weight: 500; color: var(--muted); font-size: .74rem; }
.option:hover { transform: translateY(-1px); border-color: var(--accent); }
.option.correct { border-color: var(--moss); background: color-mix(in srgb, var(--moss) 16%, var(--surface)); }
.option.wrong { border-color: var(--maple); background: color-mix(in srgb, var(--maple) 14%, var(--surface)); }
.option:disabled { cursor: default; }
.option .key { font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.feedback { margin-top: 18px; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); display: none; }
.feedback.show { display: block; animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.feedback h4 { margin-bottom: 4px; }
.feedback p { font-size: .92rem; }
.feedback .fact { color: var(--ink-soft); }

/* result card */
.result-card { text-align: center; padding: clamp(20px, 5vw, 40px); }
.result-emoji { font-size: 2.6rem; letter-spacing: .1em; margin-bottom: 10px; }
.result-score { font-family: var(--font-display); font-size: clamp(2.6rem, 9vw, 4rem); line-height: 1; }
.result-rank { font-size: 1.05rem; color: var(--accent); font-weight: 700; margin: 6px 0 4px; }
.share-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

/* side rail */
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.side-card + .side-card { margin-top: 14px; }
.side-card h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; font-family: var(--font-body); font-weight: 700; }
.best-score { font-family: var(--font-display); font-size: 2rem; line-height: 1; }
.collection { display: flex; flex-wrap: wrap; gap: 6px; }
.collection .collect { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.collection .collect svg { width: 22px; height: 22px; }
.collection .collect.got { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }

/* ---------- Lab ---------- */
.lab-grid { display: grid; gap: 22px; }
@media (min-width: 900px) { .lab-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.lab-preview { display: grid; place-items: center; padding: 20px; background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 60%, transparent), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.lab-preview svg { width: min(76%, 280px); height: auto; filter: drop-shadow(0 18px 26px rgba(80,40,20,.25)); }
.slider-row { display: grid; grid-template-columns: 120px 1fr 48px; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.slider-row:last-of-type { border-bottom: 0; }
.slider-row label { font-size: .88rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.pig-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.slider-val { font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); font-size: .85rem; }
.toggle-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.switch { display: inline-flex; align-items: center; gap: 9px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; background: var(--surface); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch:focus-within { box-shadow: var(--ring); }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .track { background: var(--moss); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch.on { border-color: var(--moss); }

.palette { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.palette .sw { border-radius: 12px; height: 76px; min-width: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 8px; cursor: pointer; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .16s; }
.palette .sw:hover { transform: translateY(-2px); }
.palette .sw span { font-size: .58rem; font-weight: 700; letter-spacing: .03em; background: rgba(255,255,255,.86); color: #2b1b12; padding: 2px 5px; border-radius: 6px; white-space: nowrap; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Field guide ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.search-input {
  flex: 1 1 220px; min-width: 180px; padding: 11px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.search-input::placeholder { color: var(--muted); }

.species-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.species-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; transition: transform .16s, border-color .16s; }
.species-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.species-top { height: 84px; position: relative; }
.species-top .sp-swatches { position: absolute; inset: auto 0 0 0; display: flex; height: 16px; }
.species-top .sp-swatches i { flex: 1; }
.species-body { padding: 14px 15px; }
.species-body h3 { font-size: 1.05rem; margin-bottom: 2px; }
.species-body .latin { font-style: italic; color: var(--muted); font-size: .8rem; margin-bottom: 8px; }
.species-body p { font-size: .86rem; }
.species-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }

/* shapes 101 */
.shape-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.shape-card { text-align: center; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.shape-card svg { width: 62px; height: 62px; margin: 0 auto 8px; }
.shape-card h4 { font-size: .95rem; margin-bottom: 2px; }
.shape-card p { font-size: .78rem; }

/* ---------- Quiz ---------- */
.quiz { max-width: 720px; margin-inline: auto; }
.quiz-progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-bottom: 20px; }
.quiz-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--moss), var(--gold), var(--maple)); transition: width .3s ease; }
.quiz-q { font-family: var(--font-display); font-size: clamp(1.3rem, 4vw, 1.9rem); margin-bottom: 18px; }
.quiz-a { margin-top: 14px; font-size: .92rem; color: var(--ink-soft); }

/* ---------- Timeline / traditions ---------- */
.timeline { position: relative; margin-top: 10px; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--line-strong); }
.timeline li { position: relative; padding: 0 0 20px 0; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--bg); }
.timeline h4 { font-size: 1rem; }
.timeline p { font-size: .88rem; }

/* ---------- Facts / accordion ---------- */
details.acc { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 0; overflow: hidden; }
details.acc + details.acc { margin-top: 10px; }
details.acc summary { padding: 15px 18px; font-weight: 650; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: "+"; font-size: 1.3rem; color: var(--accent); font-family: var(--font-display); }
details.acc[open] summary::after { content: "\2013"; }
details.acc .acc-body { padding: 0 18px 18px; color: var(--ink-soft); font-size: .93rem; }

/* ---------- Footer ---------- */
.site-foot { margin-top: clamp(40px, 8vw, 80px); border-top: 1px solid var(--line); background: var(--bg-soft); }
.foot-grid { display: grid; gap: 26px; padding: 44px 0 24px; }
@media (min-width: 760px) { .foot-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.foot-grid h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 12px; font-family: var(--font-body); font-weight: 700; }
.foot-grid a { display: block; padding: 4px 0; color: var(--ink-soft); font-size: .9rem; }
.foot-grid a:hover { color: var(--accent); }
.foot-note { border-top: 1px solid var(--line); padding: 16px 0 40px; font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px;
  font-size: .88rem; font-weight: 600; box-shadow: var(--shadow); opacity: 0;
  pointer-events: none; transition: opacity .25s, transform .25s; z-index: 300; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
:root[data-theme="dark"] .toast { background: var(--gold); color: #1a120e; }

/* ---------- Utilities ---------- */
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 10px; } .mt-2 { margin-top: 20px; } .mt-3 { margin-top: 32px; }
.mb-2 { margin-bottom: 20px; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 14px; }
.nowrap { white-space: nowrap; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 26px 0; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* reveal on scroll */
.reveal { transition: opacity .6s ease, transform .6s ease; }
html.js .reveal:not(.in) { opacity: 0; transform: translateY(16px); }
html.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html.js .reveal:not(.in) { opacity: 1; transform: none; } }

/* map-ish banner */
.banner {
  border-radius: var(--radius-lg); padding: clamp(24px, 5vw, 48px); color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #7a2e4a, #c0392b 45%, #d9822b 100%);
}
:root[data-theme="dark"] .banner { background: linear-gradient(120deg, #4a1f30, #a53b2f 45%, #c9772e 100%); }
.banner h2 { color: #fff; }
.banner p { color: rgba(255,255,255,.9); }
.banner .btn { background: #fff; color: #2b1b12; }
.banner::after { content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.12); }
