/*
 * Chrome shared across every page on the domain: colour tokens, the shared
 * typeface, the site <nav>, the mini-chain depiction, and the handful of
 * in-game panel class names (.about-cite, .about-copyright, .tut-lede) that
 * the generated pages reuse from their React source so their static and
 * in-game renderings need only one set of class names between them.
 *
 * This is now the *only* file that restates colour tokens - legal.css used to
 * carry its own copy, on the reasoning that these pages predate a shared
 * stylesheet and still don't require one to render correctly on their own,
 * but every page that loads legal.css also loads this file straight after it
 * (see each hand-authored page's <head> and tools/site-shell.mjs's
 * pageShell()), so a second copy there was drift waiting to happen rather
 * than independence. index.html already depended on this file rather than
 * carrying tokens inline, and now carries no font-family of its own either -
 * see its own body rule.
 *
 * --bg/surface/line/text/muted/accent mirror PALETTES['midnight'] in
 * src/lib/palettes.ts, the game's shipped default, the same way
 * src/styles.css's own :root restates it for the same reason: this file has
 * to be legible on its own, and Node tooling aside, nothing here can import
 * TypeScript. --accent-contrast does too - it is not itself a card colour,
 * only the text colour anything filled with an accent needs to stay legible.
 *
 * --accent-wordcaterpillar is a second, separate restatement - of
 * DIFFICULTY_DEFAULTS.base.paletteOverride.accent in src/lib/difficulty.ts,
 * not of the plain --accent above. Base is the only difficulty ever
 * presented (see "Difficulty is on ice" in CLAUDE.md), so its accent, not the
 * bare palette default, is what a player actually sees the game painted in -
 * that's what the WordCaterpillar card and the "Caterpillar" half of its title
 * are tinted with, rather than the same generic --accent every other future
 * card would fall back to. node tools/verify_site_colors.mjs checks this
 * file against both TypeScript sources so a retune of either does not go
 * unnoticed here.
 */

:root {
  --bg: #12141a;
  --surface: #1b1e27;
  --line: #2c3040;
  --text: #e8eaf0;
  --muted: #9aa1b4;
  --accent: #6ea8fe;
  --accent-contrast: #0b1020;
  --accent-turtle: #a6f3ff;
  --accent-wordcaterpillar: #a3d329;
  color-scheme: dark;

  /*
   * Body font. Restated from src/styles.css's own --font-body, which is
   * itself restated from FONTS['nunito'] in src/lib/fonts.ts - see that
   * file's comment for the full chain. Self-hosted below rather than fetched
   * from Google Fonts, for the same reason src/main.tsx gives: a third-party
   * runtime dependency is avoided wherever the game (or, now, the site) can
   * just ship the file. site/ofl.txt is the licence text OFL 1.1 requires
   * alongside any copy of the font, already served for the game's own copy -
   * see site/terms.html's Typeface clause, which already covers this one too
   * without needing an edit.
   */
  --font-body: 'Nunito Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
    sans-serif;
}

/*
 * One cut, not the six src/main.tsx's import pulls in: every site page is
 * plain English UI text, so only the Latin block ever has anything to draw,
 * the same reasoning that keeps the game's own download to one file in
 * practice (see the comment above the import in src/main.tsx). A codepoint
 * outside this range - the back-link's arrow glyphs, U+2190/U+2192, notably -
 * falls through to the next family in --font-body's own stack, exactly as it
 * did before this file loaded any webfont at all.
 */
@font-face {
  font-family: 'Nunito Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('/fonts/nunito-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The one declaration, so every page that links this file gets the typeface
   with nothing of its own to state - index.html and legal.css each still own
   the rest of their body rule (background, padding, line-height), which are
   too page-specific to hoist here, but font-family is not one of those. */
body {
  font-family: var(--font-body);
}

/* Shared with src/styles.css, which carries the same class name and the same
   restated hex for the in-game header's own "Caterpillar" - see that file's
   comment by .header h1. */
.brand-accent {
  color: var(--accent-wordcaterpillar);
}

/* Nav ----------------------------------------------------------------- */

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
}
.site-nav a[aria-current='page'] {
  color: var(--text);
  font-weight: 600;
}

/* Mini-chain ------------------------------------------------------------
 * A small depiction of a chain, built the same way the in-game tutorial
 * builds its figures: from real markup (a spine of dots and words), not a
 * screenshot - see tools/site-shell.mjs renderMiniChain(). Deliberately not
 * the live game's own .chain CSS, which is entangled with ceremony and
 * docked-layout rules this static page has no use for.
 */
.mini-chain { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.9rem 0 1rem; }
.mini-row { display: flex; align-items: center; gap: 0.55rem; }
.mini-node-col { position: relative; flex: 0 0 auto; width: 0.65rem; }
.mini-node-col::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -0.15rem;
  bottom: -0.15rem;
  width: 2px;
  transform: translateX(-50%);
  background: var(--line);
}
.mini-row:first-child .mini-node-col::before { top: 50%; }
.mini-row:last-child .mini-node-col::before { bottom: 50%; }
.mini-node {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--muted);
}
.mini-row.is-endpoint .mini-node {
  width: 0.65rem;
  height: 0.65rem;
  background: var(--card-accent, var(--accent));
}
/* The unreached Target: outlined rather than filled, so a static figure can
   show "still ahead" without the live board's animation to lean on. */
.mini-row.is-ghost .mini-node {
  background: transparent;
  border: 2px solid var(--card-accent, var(--accent));
}
.mini-word { font-size: 0.85rem; color: var(--muted); text-transform: capitalize; }
.mini-row.is-endpoint .mini-word { color: var(--text); }
.mini-row.is-target .mini-word { color: var(--card-accent, var(--accent)); font-weight: 700; }
.mini-row.is-ghost .mini-word { color: var(--muted); }
.mini-chain.is-solved .mini-node { background: var(--card-accent, var(--accent)); border-color: transparent; }
.mini-chain.is-solved .mini-word { color: var(--text); }
/* The tutorial's stand-in for the entry row: a sentence about a word rather
   than a word, so not capitalised, and in italic like the board's own. The
   word it points at is upright and in the accent, as there. */
.mini-row.is-placeholder .mini-word { font-style: italic; text-transform: none; }
.mini-row.is-cased .mini-word { text-transform: none; }
.mini-row.is-placeholder .mini-word strong {
  font-style: normal;
  font-weight: 600;
  color: var(--card-accent, var(--accent));
}
.mini-role {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* About page reuse ------------------------------------------------------
 * Same class names AboutContent.tsx renders in-game; the in-game rules live
 * in src/styles.css and are out of reach here, so the static /about page
 * needs its own copy of just these two.
 */
.about-cite {
  padding-left: 0.75rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.about-copyright {
  margin-bottom: 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

/* How-to-play page reuse -------------------------------------------------
 * Same reasoning: the lede paragraphs, the Example label and the step captions
 * are shared markup with the in-game tutorial, so they carry the same class
 * names. The in-game rules are in src/styles.css and out of reach here.
 */
.tut-lede { color: var(--muted); }
.tut-lede strong,
.tut-caption strong { color: var(--text); font-weight: 600; }
.tut-caption { color: var(--muted); margin-bottom: 0.5rem; }
/* The label above has already paid for the space between them. */
.tut-section + .tut-caption { margin-top: 0; }
/* A subheading over the worked example: full-strength ink against the muted
   copy either side, uppercase and tracked out so a one-word line does not read
   as another sentence. Mirrors .tut-section in src/styles.css. */
.tut-section {
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
