/* ═══════════════════════════════════════════════════════════════════════
   REGISTER A — the dashboard's print register, shared across the
   hand-authored content pages under public/learn/ (#26, #27, #28).

   Nothing here is a new design decision. Tokens, type pairing, rules and
   grain are lifted verbatim from src/lpa/public_page.py's `_CSS` (the
   live, currently-shipping dashboard stylesheet) and from the prose-layout
   classes proven out in docs/design/register-a-print.html on branch
   25-register-prototype (issue #25's worked sample of Register A as running
   text, not just charts). This file exists so a third and fourth copy of
   the same tokens doesn't get pasted into #27's and #28's pages — link to
   this file; don't re-embed a <style> block of tokens.

   What lives here: the palette/type tokens, the paper grain, and the base
   register elements every content page needs (masthead, theme toggle,
   table of contents, the italic one-line gloss under a heading, running
   prose, colophon). What does NOT live here: layout specific to one
   page's content (e.g. glossary.html's term-entry structure) — that stays
   in the page's own <style> block, built on these tokens.

   The theme toggle's behaviour (not just its look) lives in register-a.js,
   for the same reason — link it, don't paste the pre-paint read and the
   click handler into a fourth page.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* paper + ink — a green-grey stock, not cream */
  --ground:      #E9EAE4;
  --surface:     #F2F3EE;
  --ink:         #17191A;
  --ink-soft:    #55584F;
  /* #8A8D83 in the mockup is 2.79:1 on --ground and carries every eyebrow,
     label and key. The handoff's suggested #6C6F66 measures 4.23:1 — still
     short. This is 4.62:1. */
  --ink-faint:   #666960;
  --rule:        #C8CAC0;
  --rule-hair:   #D8DAD1;

  /* coalitions — printed inks, not screen neons */
  --ph:  #B23A2E;
  --bn:  #1D4E89;
  --pn:  #2B7A78;
  --gps: #8A6D1F;
  --grs: #6A4A7C;

  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(20px, 5vw, 72px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground:    #15161A;
    --surface:   #1C1E23;
    --ink:       #E7E8E2;
    --ink-soft:  #A6A9A0;
    --ink-faint: #8B8E85;
    --rule:      #33363C;
    --rule-hair: #26292E;
    --ph:  #E0705F;
    --bn:  #5D93D8;
    --pn:  #4FB3AF;
    --gps: #C9A542;
    --grs: #A886C2;
  }
}

:root[data-theme="dark"] {
  --ground:    #15161A;
  --surface:   #1C1E23;
  --ink:       #E7E8E2;
  --ink-soft:  #A6A9A0;
  --ink-faint: #8B8E85;
  --rule:      #33363C;
  --rule-hair: #26292E;
  --ph:  #E0705F;
  --bn:  #5D93D8;
  --pn:  #4FB3AF;
  --gps: #C9A542;
  --grs: #A886C2;
}

:root[data-theme="light"] {
  --ground:    #E9EAE4;
  --surface:   #F2F3EE;
  --ink:       #17191A;
  --ink-soft:  #55584F;
  --ink-faint: #666960;
  --rule:      #C8CAC0;
  --rule-hair: #D8DAD1;
  --ph:  #B23A2E;
  --bn:  #1D4E89;
  --pn:  #2B7A78;
  --gps: #8A6D1F;
  --grs: #6A4A7C;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* faint press grain — sits above ground, below everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.sheet {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter) 96px;
}

/* ── masthead ─────────────────────────────────────────── */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 32px;
  padding: 22px 0 14px;
  border-bottom: 2px solid var(--ink);
}
.wordmark { font-family: var(--serif); font-size: 15px; letter-spacing: .02em; }
.wordmark a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule); }
.wordmark a:hover { border-bottom-color: var(--ink-faint); }
.wordmark a:focus-visible { outline: 2px solid var(--pn); outline-offset: 2px; }
.wordmark em { font-style: normal; color: var(--ink-faint); }
.stamp {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}
.theme-btn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--rule);
  padding: 4px 9px;
  cursor: pointer;
}
.theme-btn:hover { color: var(--ink); border-color: var(--ink-faint); }
.theme-btn:focus-visible { outline: 2px solid var(--pn); outline-offset: 2px; }

/* ── table of contents — a row of chips linking to the page's sections ── */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: clamp(22px, 4vw, 34px) 0 0;
  padding: 0;
  list-style: none;
}
.toc li { margin: 0; }
.toc a {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--ink-soft);
  text-decoration: none;
  border: 1px solid var(--rule);
  padding: 5px 11px;
}
.toc a:hover { color: var(--ink); border-color: var(--ink-faint); }
.toc a:focus-visible { outline: 2px solid var(--pn); outline-offset: 2px; }

:target { scroll-margin-top: 24px; }

/* ── opening — eyebrow + a large lede, for a page's own standfirst ── */
.opening {
  padding: clamp(30px, 5vw, 52px) 0 clamp(24px, 4vw, 36px);
  border-bottom: 1px solid var(--rule);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  line-height: 1.4;
}
.opening h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 5.5vw, 56px);
  letter-spacing: -.02em;
  margin: 10px 0 18px;
}
.lede {
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.5;
  letter-spacing: -.008em;
  max-width: 62ch;
  margin: 0;
  color: var(--ink-soft);
}
.lede b { font-weight: inherit; color: var(--ink); }

/* ── gloss — the italic one-line summary under a section heading; e.g.
   glossary.html's term-gloss, coalitions.html's coalition-gloss, and
   ge16-process.html's step-gloss are all this same rule, three names for
   one idiom. Use this class directly rather than re-declaring it. ── */
.gloss {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 15px;
  margin: 0 0 16px;
}

/* ── running prose ────────────────────────────────────── */
.prose { padding: clamp(34px, 5vw, 56px) 0 0; }
.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 28px;
  margin-bottom: clamp(14px, 3vw, 24px);
}
.prose p {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.62;
  max-width: 66ch;
  margin: 0 0 1.05em;
  color: var(--ink);
}
.prose p:last-child { margin-bottom: 0; }
.prose p a { color: inherit; border-bottom: 1px solid var(--rule); text-decoration: none; }
.prose p a:hover { border-bottom-color: var(--ink-faint); }
.prose p a:focus-visible { outline: 2px solid var(--pn); outline-offset: 2px; }

/* ── colophon ─────────────────────────────────────────── */
.colophon {
  margin-top: clamp(48px, 7vw, 80px);
  padding-top: 22px;
  border-top: 2px solid var(--ink);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 26px 44px;
}
.colophon h3 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
  margin: 0 0 10px;
}
.colophon p {
  font-family: var(--serif);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}
.colophon a { color: inherit; }
.colophon a:focus-visible { outline: 2px solid var(--pn); outline-offset: 2px; }
.caveat { border-left: 2px solid var(--ph); padding-left: 14px; }
.caveat p { color: var(--ink); }

@media (max-width: 720px) {
  .lede { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
