/* ============================================================
   cadence.report — shared site chrome
   ------------------------------------------------------------
   The desk/paper palette plus the parts every page wears: the
   sticky paper nav, the buttons, the desk footer, the launch
   toggle and the subpage sheet.

   Who loads it
     · how-it-works/   — indirectly: styles/home.css @imports it.
       That page is frozen at tokens.css + home.css, so an
       @import is the only way to give it this file.
     · leaderboard/    — directly, as its own <link>. That page
       keeps its page-local leaderboard/styles.css and must NOT
       load home.css: it would restyle the board.

   NOT index.html. Since the 2026-08 Console rebuild the home page
   carries its own chrome in styles/console.css and follows the OS
   colour scheme; this file stays the subpages' fixed desk/paper
   design (design/landing-console-2026-08/DESIGN.md §Follow-ups).

   Because leaderboard/styles.css loads last and declares a bare
   `.nav` rule plus its own `--paper`/`--ink`, the bar is selected
   as `header.nav` and re-pins those two tokens locally, and the
   chrome's containers (`.nav-inner`, `.footer-inner`, `.desk-frame`)
   carry their own width instead of leaning on `.wrap`, which that
   file also redefines.
   ============================================================ */

/* ---------- desk & paper palette ---------- */
:root {
  /* desk */
  --desk: #1A1612;
  --desk-2: #14110D;
  --desk-3: #211B15;
  --desk-line: #2B231B;
  --desk-line-2: #3A2F24;
  --desk-line-3: #544432;
  --desk-fg: #F2E8D4;
  --desk-fg-2: #C4B79F;
  --desk-fg-3: #8F8574;

  /* paper */
  --paper: #F6F0E4;
  --paper-2: #FBF7EE;
  --paper-3: #EFE7D3;
  --paper-4: #E6DCC6;
  --ink: #1A1612;
  --ink-2: #4A4337;
  --ink-3: #6F675A;
  --ink-4: #9C9484;
  --hair: #E0D4B8;
  --hair-soft: #EBE1CC;
  --hair-strong: #C6B68F;

  /* accents */
  --ember: #E5B655;
  --ember-soft: #F2E3B9;
  --ember-text: #8E5F0B;     /* ember legible on paper (≥ 4.5:1) */
  --olive: #6B7A4E;
  --olive-soft: #DDE3CC;
  --olive-text: #4E5C35;
  --danger: #A63F26;
  --danger-soft: #F5D4C2;
  --info: #4A6B8A;

  --shadow-sheet: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 2px 6px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.28);
  --shadow-card: 0 1px 2px rgba(60, 40, 20, 0.06), 0 2px 8px rgba(60, 40, 20, 0.07);
  --radius: 6px;
  --radius-lg: 8px;
  --wrap: 1200px;
  --gutter: 24px;

  /* Copied from styles/tokens.css, which still owns them for how-it-works/. A second copy of
     three semantic accents lives in the `:root:root` block below — that one exists for
     specificity, not convenience; see its comment before touching either.
     leaderboard/ loads this file WITHOUT tokens.css — that file's element defaults (h1-h6, p,
     body font) restyle the board — so the chrome has to carry its own. A test asserts the
     values here stay identical to tokens.css. */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino", Georgia, serif;
  --font-sans: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --dur-fast: 120ms;
  --ease-standard: cubic-bezier(0.32, 0.08, 0.24, 1);
}

/* The landing pages are ONE fixed design — the desk/paper palette does not follow the OS
   colour scheme. But tokens.css's `@media (prefers-color-scheme: dark)` block redefines the
   semantic accents at `:root:not([data-theme="light"])` (specificity 0-2-0), which outranks
   this file's plain `:root` — so on a dark-OS machine --danger silently became #E07050 and
   the warning chip dropped from 4.5:1 to 2.3:1 on paper (design-review FINDING-009).
   `:root:root` matches that specificity and this file loads later, so the pin wins. Same
   pattern as header.nav re-pinning --paper/--ink below. */
:root:root {
  --danger: #A63F26;
  --info: #4A6B8A;
  --focus-ring: #C14A2A;
}

/* ---------- skip link, screen-reader text, focus ring ---------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  padding: 10px 14px; background: var(--ember); color: var(--desk);
  border-radius: var(--radius); font: 600 17px/1.55 var(--font-sans); text-decoration: none;
}
.skip-link:focus { top: 12px; }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--ember); outline-offset: 3px; border-radius: var(--radius);
}

/* ---------- buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; --btn-pad: 20px; padding: 0 var(--btn-pad); border-radius: var(--radius); border: 1px solid transparent;
  font: 600 15px/1 var(--font-sans); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.btn-sm { height: 36px; --btn-pad: 14px; font-size: 14px; }
.btn-ember { background: var(--ember); color: var(--desk); }
.btn-ember:hover { background: #EFC66A; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: #2A241D; }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--hair-strong); }
.btn-outline:hover { border-color: var(--ink); }

/* ---------- nav ----------
   The paper bar: how-it-works/ and leaderboard/ wear it. index.html carries the SAME MARKUP but
   paints it from styles/console.css — tests/landing-subpages.test.js asserts the two stay one
   bar (same mark geometry, same links, same targets).
   leaderboard/ additionally loads its own page-local stylesheet *after* this file, and
   that file declares a bare `.nav` rule and re-tints --paper/--ink. So the bar is selected as
   `header.nav` (element+class beats a bare class) and re-pins those two tokens locally, and
   `.nav-inner` carries its own width instead of leaning on `.wrap` (also redefined there). */
header.nav {
  --paper: #F6F0E4;
  --ink: #1A1612;
  /* Typography is stated, not inherited: leaderboard/ does not load home.css, whose base rule
     sets the 17px page font, and the board's own bare `.nav` rule leaks flex properties here. */
  display: block; font: 400 17px/1.55 var(--font-sans); align-items: normal; gap: normal;
  position: sticky; top: 0; z-index: 50;
  background: var(--paper); color: var(--ink);
  border-bottom: 1px solid var(--desk-line);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
.nav-inner {
  width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 32px; height: 64px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; }
.brand-name {
  font-family: var(--font-display); font-weight: 560; font-size: 26px; letter-spacing: -0.01em;
  font-variation-settings: "opsz" 32;
}
.brand-desk { color: var(--desk-fg); }
.brand-desk .brand-mark { width: 40px; height: 40px; }
.brand-desk .brand-name { font-size: 34px; }
.nav-links { display: flex; gap: 26px; flex: 1; }
.nav-links a { font-size: 15px; font-weight: 500; color: var(--ink-2); text-decoration: none; padding: 6px 0; }
.nav-links a:hover { color: var(--ink); }
/* A page-local stylesheet may restyle or hide its own nav links — leaderboard/styles.css does
   both: `.nav a` makes every anchor a 44px inline-flex box, and under 560px `.nav a:not(.si)`
   hides them outright, brand and Install button included. `header.nav a…` outranks both. */
header.nav a.brand { display: inline-flex; min-height: 0; padding-right: 0; }
header.nav .nav-actions .btn { display: inline-flex; min-height: 0; padding-right: var(--btn-pad); }
header.nav .nav-links a { display: block; min-height: 0; align-items: normal; padding: 6px 0; }
.nav-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.nav-toggle {
  display: none; width: 40px; height: 40px; align-items: center; justify-content: center;
  background: transparent; color: var(--ink); font: inherit;
  border: 1px solid var(--hair-strong); border-radius: var(--radius); cursor: pointer;
}

/* ---------- footer ---------- */
footer.footer {
  padding: 40px 0 48px; border-top: 1px solid var(--desk-line); margin-top: 24px;
  color: var(--desk-fg); font: 400 17px/1.55 var(--font-sans);
}
.footer-inner {
  width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.footer-links a { color: var(--desk-fg-2); text-decoration: none; font-size: 15px; }
.footer-links a:hover { color: var(--desk-fg); }
.footer-note { width: 100%; margin: 0; font-size: 13px; color: var(--desk-fg-3); }

/* ---------- launch toggle (meta name="cadence-launch") ----------
   Private (default, also without JS): GitHub-bound links stay in-page anchors, `.launch-public`
   elements are hidden, `.launch-private` notes show. home.js flips html[data-launch="public"]
   and swaps every [data-public-href] into its href once the meta says "public". */
:root:not([data-launch="public"]) .launch-public { display: none !important; }
:root[data-launch="public"] .launch-private { display: none !important; }
.launch-note { margin: 0; font-family: var(--font-display); font-style: italic; font-size: 17px; line-height: 1.5; color: var(--desk-fg-2); font-variation-settings: "opsz" 18; max-width: 44ch; }
.sheet .launch-note { color: var(--ink-2); }

/* ============================================================
   Subpages — how-it-works/ and leaderboard/
   ------------------------------------------------------------
   Both wear the chrome above and lay their own content out as a
   single paper sheet on the desk, so the site reads as one design.
   ============================================================ */

/* Marks a subpage whose own stylesheet would otherwise paint the page: leaderboard/styles.css
   is page-local, loads last and colours `body` its own cream. Element+class wins that, and the
   class goes on <html> as well so the desk also paints the canvas below a short page. */
html.desk-page, body.desk-page { background: var(--desk); }
/* leaderboard/styles.css pads its body for a page that used to end in content, not in the shared
   desk footer; that left 60px of desk below the footer no other page has. */
body.desk-page { padding-bottom: 0; }

/* Holds a sheet at the desk's gutter. Same geometry as home.css's `.wrap`, under a name no
   page-local stylesheet shadows (leaderboard/styles.css redefines `.wrap`). */
.desk-frame { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* The desk showing above and below a sheet. Shared, because both subpages lay a sheet on it. */
.desk-section { padding: 64px 0; }
.desk-section-tight { padding-top: 8px; }

/* Text on a sheet is ink, whatever the OS colour scheme says. tokens.css gives h1-h6 and p an
   explicit `color: var(--fg-1)`, and its `@media (prefers-color-scheme: dark)` block turns that
   near-white — which on these light sheets is invisible. `:where()` keeps this at the specificity
   of `.sheet-page` alone, so it outranks tokens.css's element rules while any page-local rule of
   equal weight (leaderboard/styles.css's `.sub`, `.claim`, `.wyl h2`) still wins, as it should. */
.sheet-page :where(h1, h2, h3, h4, h5, h6, p, li, dt, dd) { color: var(--ink); }

/* One long sheet holding a whole document or board, instead of the home page's stack of sheets. */
.sheet-page {
  /* The desk is dark and the document says so; the sheet on it is not. Stating this keeps native
     controls inside a sheet (the board's <select>s) on light UA rendering no matter what the
     document or a future rule declares for the page. */
  color-scheme: light;
  background: var(--paper); color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow-sheet);
  padding: clamp(28px, 4vw, 56px) 0 clamp(36px, 5vw, 64px);
}
/* The board's own components are drawn as #FAF6EA cards; its sheet keeps the cream they were
   designed against (leaderboard/styles.css --cream) so that contrast survives. */
.sheet-board { background: #F4EFE1; }


/* ---------- chrome + subpage responsive ---------- */
@media (max-width: 900px) {
  :root { --gutter: 20px; }
  .desk-section { padding: 48px 0; }
  .nav-inner { min-height: 58px; height: auto; gap: 12px 16px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  /* Without JS the links simply wrap under the brand row; with JS they collapse behind the toggle. */
  .nav-links { order: 3; flex: 0 0 100%; width: 100%; flex-wrap: wrap; gap: 4px 18px; }
  .nav-links a { font-size: 15px; }
  .js .nav-links {
    display: none; position: absolute; left: 0; right: 0; top: 100%; order: 0; width: auto; flex: none;
    flex-direction: column; gap: 0; padding: 8px 20px 14px;
    background: var(--paper); border-bottom: 1px solid var(--hair-strong); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  }
  .js .nav-links a { padding: 12px 0; border-bottom: 1px solid var(--hair-soft); font-size: 16px; }
  .js .nav-links a:last-child { border-bottom: 0; }
  .js .nav.is-open .nav-links { display: flex; }
  .js .nav-toggle { display: inline-flex; }
  .js .nav-inner { height: 58px; min-height: 0; flex-wrap: nowrap; padding-top: 0; padding-bottom: 0; }
}

@media (max-width: 520px) {
  .footer-links { gap: 8px 20px; }
}
