:root {
  --bg: oklch(0.16 0.03 255);
  --bg-hero: oklch(0.14 0.03 255);
  --bg-panel: oklch(0.185 0.032 255);
  --bg-card: oklch(0.21 0.035 255);
  --line: oklch(0.26 0.035 255);
  --text: oklch(0.96 0.01 250);
  --text-body: oklch(0.82 0.02 250);
  --text-muted: oklch(0.66 0.03 255);
  --blue: oklch(0.74 0.14 240);
  --blue-btn: oklch(0.6 0.17 245);
  --violet: oklch(0.74 0.13 295);
  --violet-btn: oklch(0.52 0.17 295);
  --coral: oklch(0.76 0.13 32);

  --gutter: clamp(18px, 4vw, 40px);
  --ease: 150ms ease;
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--text); text-decoration: none; transition: color var(--ease), border-color var(--ease), background-color var(--ease); }
a:hover { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }

.container { max-width: 1200px; margin: 0 auto; padding-inline: var(--gutter); }

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 10;
  padding: 10px 14px; background: var(--blue-btn); color: #fff; border-radius: 8px;
}
.skip:focus { top: 8px; color: #fff; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.atom { position: relative; width: 38px; height: 38px; flex: none; }
.atom span { position: absolute; inset: 11px 2px; border: 1.5px solid var(--blue); border-radius: 50%; }
.atom span:nth-child(2) { transform: rotate(60deg); }
.atom span:nth-child(3) { transform: rotate(-60deg); }
.atom span:nth-child(4) { inset: 16px; border: 0; background: var(--blue); }
.wordmark { display: flex; flex-direction: column; line-height: 1.05; letter-spacing: 0.08em; font-size: 15px; font-weight: 700; }
.wordmark span:last-child { font-weight: 500; color: var(--blue); }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .container {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 32px; padding-block: 14px;
}
.nav {
  display: flex; align-items: center; gap: 2px; max-width: 100%;
  font-size: 14px; font-weight: 500; overflow-x: auto; scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; white-space: nowrap; }
.nav a[aria-current="page"] { color: var(--blue); box-shadow: inset 0 -2px 0 var(--blue); }
.nav .icon-link { display: grid; place-items: center; width: 44px; padding: 0; }
.nav-kofi {
  display: flex; align-items: center; gap: 7px; min-height: 36px; margin-left: -24px; padding: 0 15px 0 12px;
  border-radius: 999px; background: var(--blue-btn); color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.site-footer .nav-kofi { margin: 4px 0 4px 8px; min-height: 36px; font-size: 13px; }
.nav-kofi:hover { background: oklch(0.66 0.17 245); color: #fff; }
.site-header .nav { margin-left: auto; }
/* Phones: Ko-fi sits beside the logo, the menu takes its own row below. */
@media (max-width: 720px) {
  .site-header .nav-kofi { order: 1; margin-left: auto; }
  .site-header .nav { order: 2; flex-basis: 100%; }
}

.search-icon { position: relative; width: 16px; height: 16px; flex: none; }
.search-icon::before {
  content: ""; position: absolute; left: 0; top: 0; width: 11px; height: 11px;
  border: 2px solid currentColor; border-radius: 50%;
}
.search-icon::after {
  content: ""; position: absolute; right: 0; bottom: 1px; width: 6px; height: 2px;
  background: currentColor; transform: rotate(45deg);
}

/* ---------- Hero ---------- */
.hero { background: var(--bg-hero); border-bottom: 1px solid var(--line); }
.hero .container {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: clamp(32px, 5vw, 56px); align-items: center; padding-block: clamp(28px, 3.6vw, 48px);
}
.hero-copy { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.hero h1 {
  margin: 0; font-size: clamp(36px, 4.6vw, 54px); font-weight: 700; line-height: 1.05;
  letter-spacing: -0.03em; text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--blue); }
/* Each half of the headline on its own line. */
.hero h1 > span, .hero h1 > em { display: block; }
.hero-heading { display: flex; flex-direction: column; gap: 14px; }
.hero-sub { margin: 0; font-size: clamp(19px, 2vw, 24px); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; color: var(--text); }
.hero-lede {
  margin: 0; font-size: clamp(16px, 1.6vw, 18px); line-height: 1.6; color: var(--text-body);
  max-width: 52ch; text-wrap: pretty;
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 22px;
  border-radius: 8px; font-weight: 600; font-size: 15px; border: 1px solid transparent;
}
.btn--primary { background: var(--blue-btn); color: #fff; }
.btn--primary:hover { background: oklch(0.66 0.17 245); color: #fff; }
.btn--ghost { border-color: oklch(0.45 0.04 255); }
.btn--ghost:hover { border-color: var(--violet-btn); color: var(--text); }
.hero-meta { font-size: 13px; color: var(--text-muted); }
.hero-meta a { color: var(--text-body); font-weight: 600; }
.hero-meta a:hover { color: var(--blue); }

/* The search box leads the hero; featured tools sit under it as quick links. */
.hero-find { display: flex; flex-direction: column; gap: 12px; }
.hero .search--hero { flex: none; max-width: 520px; min-height: 56px; }
.hero .search--hero input { height: 54px; font-size: 17px; }
.hero-picks { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0; font-size: 13px; }
.hero-picks span { color: var(--text-muted); }
.hero-picks a { color: var(--text-body); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.hero-picks a:hover { color: var(--blue); text-decoration-color: currentColor; }

.hero-figure { margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hero-figure figcaption { font-size: 12px; color: var(--text-muted); text-align: right; }
.hero-figure figcaption a { color: inherit; }
.hero-figure figcaption a:hover { color: var(--blue); }

/* Image frames show a quiet stripe until the screenshot loads (or if it's missing). */
.frame {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: repeating-linear-gradient(135deg, var(--stripe-a) 0 10px, var(--stripe-b) 10px 20px);
}
.frame img { width: 100%; height: 100%; object-fit: cover; }
.hero-figure .frame {
  --stripe-a: oklch(0.2 0.035 255); --stripe-b: oklch(0.18 0.032 255);
  border-radius: 12px; border: 1px solid oklch(0.3 0.04 255);
}

/* ---------- Path cards ---------- */
.paths {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: clamp(16px, 2vw, 24px); padding: clamp(32px, 4vw, 48px) 0 clamp(48px, 6vw, 72px);
}
.path {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  border: 1px solid var(--bd); background: var(--card); border-radius: 14px; overflow: hidden;
}
.path:hover { border-color: var(--bd-hover); color: var(--text); }
.path--explore { --h: 245; --card: oklch(0.21 0.05 248); --bd: oklch(0.34 0.08 245); --bd-hover: var(--blue); --btn: var(--blue-btn); }
.path--play { --h: 295; --card: oklch(0.21 0.05 295); --bd: oklch(0.36 0.09 295); --bd-hover: oklch(0.7 0.15 295); --btn: var(--violet-btn); }

.path-body { display: flex; flex-direction: column; gap: 16px; padding: clamp(22px, 2.6vw, 30px); }
.path-head { display: flex; align-items: center; gap: 14px; }
.path-icon {
  display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 10px;
  border: 1px solid oklch(0.46 0.11 var(--h)); background: oklch(0.265 0.075 var(--h));
}
.path-icon .diamond {
  width: 16px; height: 16px; border: 2px solid oklch(0.8 0.12 240); border-radius: 2px;
  transform: rotate(45deg) skew(8deg, 8deg);
}
.path-title { display: flex; flex-direction: column; gap: 2px; }
.path-title strong { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.path-title span { font-size: 14px; color: oklch(0.83 0.045 var(--h)); }
.path-body p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text-body); text-wrap: pretty; }
.path-btn {
  margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--btn); color: #fff;
  font-weight: 600; font-size: 14px;
}
.path-media { --stripe-a: oklch(0.25 0.06 var(--h)); --stripe-b: oklch(0.23 0.055 var(--h)); aspect-ratio: auto; min-height: 200px; }
.path-media img { position: absolute; inset: 0; }

/* ---------- Section headers ---------- */
.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 12px 24px; margin-bottom: 24px;
}
.section-head > div { display: flex; flex-direction: column; gap: 6px; }
.section-head h2 { margin: 0; font-size: clamp(24px, 2.8vw, 30px); font-weight: 700; letter-spacing: -0.02em; }
.section-head p { margin: 0; font-size: 15px; color: var(--text-muted); }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--blue); }
.link-arrow:hover { color: var(--text); }


/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.tile {
  --tile-bg: oklch(0.2 0.035 255);
  display: flex; flex-direction: column; background: var(--tile-bg);
  border: 1px solid oklch(0.28 0.04 255); border-radius: 10px; overflow: hidden;
}
.tile:hover { border-color: oklch(0.5 0.08 245); color: var(--text); }
.tile-media { --stripe-a: oklch(0.23 0.035 255); --stripe-b: oklch(0.21 0.033 255); }
.tile-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: repeating-linear-gradient(135deg, var(--stripe-a) 0 8px, var(--stripe-b) 8px 16px); }
.tile-media img { width: 100%; height: 100%; object-fit: cover; }
.tile-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; }
.tile-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.tile-blurb {
  margin: 0; font-size: 13px; line-height: 1.5; color: oklch(0.76 0.02 250); text-wrap: pretty;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
.tile-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: oklch(0.3 0.06 var(--h)); color: oklch(0.86 0.1 var(--h));
}
.tile-pills { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
/* Level sits beside the subject pill: outlined and neutral so the two never read as one scale */
.pill--level {
  background: transparent; color: var(--text-body);
  box-shadow: inset 0 0 0 1px oklch(0.4 0.04 255); padding: 4px 9px;
}
/* Games keep their violet on hover, as the Play side of the site. */
.tile--play:hover { border-color: oklch(0.55 0.12 295); }

/* ---------- Catalogue panel ---------- */
.catalogue {
  margin-bottom: clamp(48px, 6vw, 72px); padding: clamp(20px, 3vw, 32px);
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 14px;
  scroll-margin-top: 16px;
}
/* Straight after the hero (no path cards above it), it needs its own gap. */
main > .catalogue:first-child { margin-top: clamp(24px, 3vw, 36px); }
.section-head--compact { align-items: baseline; justify-content: flex-start; gap: 4px 14px; }
.catalogue .section-head--compact { margin-bottom: 16px; }
.section-head--compact h2 { font-size: 22px; }
.catalogue .section-head { gap: 16px 24px; margin-bottom: 20px; }
.catalogue .tile { --tile-bg: var(--bg-card); }
.catalogue .tile-media { --stripe-a: oklch(0.24 0.035 255); --stripe-b: oklch(0.22 0.033 255); }

.search {
  display: flex; align-items: center; gap: 12px; flex: 1 1 280px; max-width: 420px;
  min-height: 48px; padding: 0 14px; background: oklch(0.15 0.03 255);
  border: 1px solid oklch(0.32 0.04 255); border-radius: 8px; transition: border-color var(--ease);
}
.search:focus-within { border-color: var(--blue); }
.search .search-icon { width: 15px; height: 15px; color: var(--text-muted); }
.search .search-icon::before { width: 10px; height: 10px; }
.search input {
  flex: 1; min-width: 0; height: 46px; background: transparent; border: 0; outline: none;
  color: var(--text); font: inherit; font-size: 16px;
}
.search input::placeholder { color: oklch(0.62 0.03 255); }
.search input::-webkit-search-cancel-button { filter: invert(0.7); }

.filters {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 20px; margin-bottom: 24px;
}
.filter-groups { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.segmented { display: flex; gap: 4px; padding: 3px; border: 1px solid oklch(0.3 0.04 255); border-radius: 999px; align-self: center; }
.seg {
  min-height: 38px; padding: 0 14px; border-radius: 999px; border: 0; background: transparent;
  color: var(--text-body); font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background-color var(--ease), color var(--ease);
}
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] { background: var(--blue-btn); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid oklch(0.32 0.04 255);
  background: transparent; color: oklch(0.8 0.02 250); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}
.chip:hover { border-color: oklch(0.45 0.06 245); }
.chip[aria-pressed="true"] { background: oklch(0.3 0.07 245); border-color: oklch(0.6 0.14 245); color: oklch(0.9 0.06 240); }

/* Topic tabs sit beside Explore / Play; subject and level fold away behind one button. */
.filter-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.filter-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1px solid oklch(0.32 0.04 255); background: transparent;
  color: oklch(0.8 0.02 250); font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: border-color var(--ease), color var(--ease);
}
.filter-toggle::after {
  content: ""; width: 6px; height: 6px; margin: -3px 0 0 2px; border: solid currentColor;
  border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform var(--ease);
}
.filter-toggle[aria-expanded="true"]::after { transform: rotate(-135deg); margin-top: 3px; }
.filter-toggle:hover, .filter-toggle[aria-expanded="true"] { border-color: oklch(0.45 0.06 245); color: var(--text); }
.filter-badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--blue-btn); color: #fff; font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.more-filters {
  flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px 16px;
  padding-top: 12px; border-top: 1px solid var(--line);
}

/* ---------- Shelves ---------- */
.shelves { display: flex; flex-direction: column; gap: clamp(28px, 3.4vw, 40px); }
.shelf-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.shelf-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.shelf-count {
  font-size: 12px; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums;
  padding: 2px 9px; border-radius: 999px; box-shadow: inset 0 0 0 1px oklch(0.34 0.04 255);
}
.shelf-more {
  min-height: 40px; padding: 0 4px; background: none; border: 0; flex: none;
  color: var(--blue); font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.shelf-more:hover { color: var(--text); }
.shelf[data-shelf="games"] .shelf-more { color: var(--violet); }

.text-btn { min-height: 44px; padding: 0 4px; background: none; border: 0; color: var(--blue); font-size: 13px; font-weight: 600; }
.text-btn:hover { color: var(--text); }
[hidden] { display: none !important; }

.empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: 40px 24px; border: 1px dashed oklch(0.34 0.04 255); border-radius: 10px;
}
.empty strong { font-size: 18px; font-weight: 600; }
.empty span { font-size: 14px; color: oklch(0.76 0.02 250); }
.empty button {
  min-height: 44px; padding: 0 18px; background: var(--blue-btn); color: #fff; border: 0;
  border-radius: 8px; font-weight: 600; font-size: 14px;
}
.empty button:hover { background: oklch(0.66 0.17 245); }

/* ---------- Sister site ---------- */
/* One strip linking Savage Science Tools and Savage Language Tools to each other. */
.sister {
  display: flex; align-items: center; gap: 18px; margin-bottom: clamp(16px, 2vw, 24px);
  padding: 18px clamp(18px, 2.6vw, 30px); background: var(--bg-panel);
  border: 1px solid var(--line); border-radius: 14px;
}
.sister:hover { border-color: var(--sister-accent, var(--blue)); color: var(--text); }
.sister .atom, .sister .bubbles { width: 38px; height: 38px; --bubble-cut: var(--bg-panel); }
.sister-copy { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.sister-copy strong { font-size: 16px; font-weight: 700; }
.sister-copy span { font-size: 14px; line-height: 1.5; color: var(--text-body); }
.sister-go { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--sister-accent, var(--blue)); white-space: nowrap; }
/* The link across to languages keeps its coral, so it reads as the other site. */
.nav-sister { color: oklch(0.82 0.1 32); }
.sister { --sister-accent: var(--coral); }
@media (max-width: 520px) { .sister { flex-wrap: wrap; } .sister-go { margin-left: 56px; } }

/* Two speech bubbles: the Savage Language Tools mark, the atom's counterpart. */
.bubbles { width: 38px; height: 38px; flex: none; overflow: visible; }
.bubbles path:first-child { fill: none; stroke: var(--coral); stroke-width: 1.5; stroke-linejoin: round; }
.bubbles path:last-child { fill: var(--coral); stroke: var(--bubble-cut, var(--bg)); stroke-width: 2; stroke-linejoin: round; }

/* ---------- Feedback & support ---------- */
.support {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: clamp(16px, 2vw, 24px); margin-bottom: clamp(48px, 6vw, 72px);
}
.support-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: clamp(22px, 2.6vw, 30px); background: var(--bg-panel);
  border: 1px solid var(--line); border-radius: 14px;
}
.support-card h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.support-card p { margin: 0 0 6px; font-size: 15px; line-height: 1.6; color: var(--text-body); text-wrap: pretty; flex: 1; }
.support-card .btn { max-width: 100%; overflow-wrap: anywhere; }
.support { scroll-margin-top: 16px; }
button.btn { font: inherit; font-weight: 600; font-size: 15px; color: var(--text); background: transparent; cursor: pointer; }
button.btn--primary { background: var(--blue-btn); color: #fff; }
button.btn--primary:disabled { opacity: 0.6; cursor: default; }

.feedback {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0;
  background: var(--bg-panel); color: var(--text-body); border: 1px solid var(--line); border-radius: 14px;
}
.feedback::backdrop { background: oklch(0.1 0.03 255 / 0.75); }
.feedback-form { display: flex; flex-direction: column; gap: 16px; padding: clamp(20px, 4vw, 28px); }
.feedback-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feedback-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.feedback-close {
  width: 44px; height: 44px; margin: -8px -10px -8px 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-muted); font-size: 26px; line-height: 1; cursor: pointer;
}
.feedback-close:hover { color: var(--text); }
.feedback label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.feedback label span { font-weight: 400; color: var(--text-muted); }
.feedback select, .feedback textarea, .feedback input {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 8px;
  background: oklch(0.15 0.03 255); border: 1px solid oklch(0.32 0.04 255);
  color: var(--text); font: inherit; font-size: 16px; font-weight: 400;
}
.feedback textarea { resize: vertical; line-height: 1.5; }
.feedback select:focus, .feedback textarea:focus, .feedback input:focus { outline: none; border-color: var(--blue); }
.feedback-trap { position: absolute; left: -9999px; width: 1px; height: 1px; }
.feedback-status { margin: 0; min-height: 1.4em; font-size: 14px; color: var(--text-body); }
.feedback-status:empty { display: none; }
.feedback-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
@media (max-width: 480px) { .nav a { padding: 0 10px; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.site-footer .container {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px 32px; padding-top: 28px; padding-bottom: 36px;
}
.site-footer .wordmark { font-size: 14px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; }
.site-footer nav a { display: flex; align-items: center; min-height: 44px; padding: 0 10px; }
.site-footer small { font-size: 12px; color: var(--text-muted); }

/* ---------- Theme toggle ---------- */
/* sst.js (loaded with data-bar="none") sets the theme and runs this button. */
.theme-toggle {
  display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px;
  background: none; border: 0; color: var(--text); font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.theme-toggle:hover { color: var(--blue); }
.sst-theme-icon { display: inline-flex; font-style: normal; flex: none; }
.sst-theme-icon svg { width: 16px; height: 16px; }

/* ---------- Light theme ----------
   The viewer's choice from the Light / Dark button, shared with every tool
   (sst.js puts .theme-light on <html>). Same layout, light surfaces. */
.theme-light {
  --bg: oklch(0.968 0.006 250);
  --bg-hero: oklch(0.945 0.012 250);
  --bg-panel: oklch(0.985 0.004 250);
  --bg-card: oklch(1 0 0);
  --line: oklch(0.89 0.012 250);
  --text: oklch(0.24 0.035 255);
  --text-body: oklch(0.37 0.03 255);
  --text-muted: oklch(0.5 0.028 255);
  --blue: oklch(0.5 0.15 245);
  --blue-btn: oklch(0.55 0.17 245);
  --violet: oklch(0.5 0.16 295);
  --violet-btn: oklch(0.52 0.17 295);
  --coral: oklch(0.56 0.16 32);
  color-scheme: light;
}
.theme-light :is(.nav-kofi, .btn--primary, .empty button):hover { background: oklch(0.5 0.17 245); }
.theme-light .btn--ghost { border-color: oklch(0.8 0.02 255); }
.theme-light .hero-figure .frame { --stripe-a: oklch(0.93 0.01 250); --stripe-b: oklch(0.95 0.01 250); border-color: oklch(0.86 0.015 250); }
.theme-light .path--explore { --card: oklch(0.965 0.02 245); --bd: oklch(0.85 0.05 245); }
.theme-light .path--play { --card: oklch(0.965 0.02 295); --bd: oklch(0.86 0.05 295); --bd-hover: oklch(0.55 0.15 295); }
.theme-light .path-icon { border-color: oklch(0.8 0.07 var(--h)); background: oklch(0.92 0.04 var(--h)); }
.theme-light .path-icon .diamond { border-color: oklch(0.5 0.15 240); }
.theme-light .path-title span { color: oklch(0.45 0.08 var(--h)); }
.theme-light .path-media { --stripe-a: oklch(0.93 0.025 var(--h)); --stripe-b: oklch(0.95 0.02 var(--h)); }
.theme-light .tile { --tile-bg: oklch(1 0 0); border-color: oklch(0.88 0.012 250); }
.theme-light .tile:hover { border-color: oklch(0.6 0.1 245); }
.theme-light .tile--play:hover { border-color: oklch(0.6 0.12 295); }
.theme-light :is(.tile-media, .catalogue .tile-media) { --stripe-a: oklch(0.93 0.01 250); --stripe-b: oklch(0.95 0.01 250); }
.theme-light .tile-blurb { color: var(--text-body); }
.theme-light .pill { background: oklch(0.93 0.04 var(--h)); color: oklch(0.42 0.1 var(--h)); }
.theme-light .pill--level { background: transparent; color: var(--text-body); box-shadow: inset 0 0 0 1px oklch(0.8 0.02 255); }
.theme-light .search { background: oklch(1 0 0); border-color: oklch(0.82 0.02 255); }
.theme-light .search input::placeholder { color: oklch(0.55 0.025 255); }
.theme-light .search input::-webkit-search-cancel-button { filter: none; }
.theme-light .segmented { border-color: oklch(0.85 0.015 255); }
.theme-light .chip { border-color: oklch(0.85 0.015 255); color: var(--text-body); }
.theme-light .chip:hover { border-color: oklch(0.7 0.06 245); }
.theme-light .filter-toggle { border-color: oklch(0.85 0.015 255); color: var(--text-body); }
.theme-light .filter-toggle:hover, .theme-light .filter-toggle[aria-expanded="true"] { border-color: oklch(0.7 0.06 245); color: var(--text); }
.theme-light .shelf-count { box-shadow: inset 0 0 0 1px oklch(0.85 0.015 255); }
.theme-light .chip[aria-pressed="true"] { background: oklch(0.93 0.04 245); border-color: oklch(0.55 0.15 245); color: oklch(0.4 0.12 245); }
.theme-light .empty { border-color: oklch(0.85 0.015 255); }
.theme-light .empty span { color: var(--text-body); }
.theme-light .nav-sister { color: oklch(0.55 0.15 32); }
.theme-light .feedback select, .theme-light .feedback textarea, .theme-light .feedback input { background: oklch(1 0 0); border-color: oklch(0.82 0.02 255); }
.theme-light .feedback::backdrop { background: oklch(0.3 0.03 255 / 0.45); }

/* On a phone the topic tabs scroll sideways rather than stacking three rows deep. */
@media (max-width: 640px) {
  .filter-groups { flex-wrap: nowrap; flex-direction: column; min-width: 0; width: 100%; }
  #topic-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * clamp(20px, 3vw, 32px)); padding: 0 clamp(20px, 3vw, 32px); }
  #topic-filter::-webkit-scrollbar { display: none; }
  .segmented { align-self: flex-start; }
}
/* On a phone the hero screenshot only pushes the tools a screen further down. */
@media (max-width: 640px) { .hero-copy ~ .hero-figure { display: none; } }
