/* =========================================================================
   THE WATCH CODEX — style.css
   thecodex.expert/watches/
   v0.2 — 26 September 2026

   WHAT CHANGED IN v0.2
   · One layout system. Every page uses the same container, the same gutter and
     the same left edge, so nothing shifts from page to page.
   · A real colour system. Six tinted section surfaces with rails strong enough
     to read, instead of one ivory-and-parchment wash.
   · Reading levels are a sticky left rail with one continuous flow of text —
     no tabs, nothing hidden.

   RULES THIS FILE ENFORCES
   · Light only. No dark background anywhere, including the footer.
   · Body 18px / 1.7. Nothing below 14px.
   · Tap targets 44px minimum. Visible 3px focus ring on everything focusable.
   · Colour never carries meaning alone — always paired with a word or a mark.
   · Every colour comes from a token. No literal hex outside :root.
   · prefers-reduced-motion respected. Every grid collapses.

   FONTS: Fraunces (display) and DM Sans (text) are named first in each stack
   so adding the self-hosted WOFF2 subsets needs no other change.
   ========================================================================= */

:root {
  /* ---------- Layout: the single source of alignment ---------- */
  --page-max: 1200px;
  --gutter: clamp(20px, 4.5vw, 56px);
  --measure: 68ch;          /* reading width for body text */
  --rail-w: 252px;          /* sticky navigation rail */
  --nav-h: 64px;

  /* ---------- Neutrals: warm, biased toward the brass accent ---------- */
  --bg:        #FFFDF9;     /* ivory page */
  --card:      #FFFFFF;
  --ink:       #231F1A;     /* headings — 16.1:1 on ivory */
  --ink2:      #46403A;     /* body — 10.1:1 */
  --ink3:      #645C52;     /* meta — 6.5:1 */
  --rule:      rgba(35, 31, 26, .14);
  --rule-firm: rgba(35, 31, 26, .26);

  /* ---------- Accent: Champagne Brass ---------- */
  --brass:      #856526;    /* text and links — AA on every surface below */
  --brass-deep: #6E5323;
  --brass-mid:  #C9A66B;    /* decorative only — never text */
  --brass-rail: #A88844;

  /* ---------- Section surfaces ----------
     Each family is surface / rail / ink. The rail is strong enough to read
     against both its own surface and the ivory page; the ink is AA on both. */
  --parchment:      #F5EFE2;  --parchment-rail: #A88844;  --parchment-ink: #5E4A20;
  --sky:            #E2EDF5;  --sky-rail:       #4E86AE;  --sky-ink:       #123F5C;
  --sage:           #E3F0E5;  --sage-rail:      #4A8D5D;  --sage-ink:      #155030;
  --blush:          #F9E8EA;  --blush-rail:     #B15E6E;  --blush-ink:     #6C2230;
  --plum:           #EEE9F4;  --plum-rail:      #7C63A3;  --plum-ink:      #46295F;
  --clay:           #F7E8DA;  --clay-rail:      #B4783D;  --clay-ink:      #6A3C15;

  /* ---------- Semantic (separate from the accent) ---------- */
  --ok-bg:   #E3F0E5;  --ok-ink:   #155030;  --ok-rail:   #4A8D5D;
  --warn-bg: #F9E8EA;  --warn-ink: #6C2230;  --warn-rail: #B15E6E;

  --focus: #2F6F8F;

  /* ---------- Incidental surfaces (kept as tokens so no literal hex
     appears anywhere below the :root block) ---------- */
  --row-alt:      #FDFBF6;   /* zebra striping in tables */
  --planned-tile: #EFEAE0;   /* monogram on a planned card */
  --stripe:       #E7E0D2;   /* 'not tested' hatching */
  --on-accent:    #FFFDF9;   /* text on a brass fill */
  --print-rule:   #BBBBBB;   /* borders when printed */

  /* ---------- Type ---------- */
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino,
           "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans:  "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto,
           "Helvetica Neue", Arial, sans-serif;

  --step: 1;
  --t-body:  calc(18px * var(--step));
  --t-small: calc(15.5px * var(--step));
  --t-micro: calc(14px * var(--step));   /* floor */

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(35,31,26,.05), 0 10px 26px rgba(35,31,26,.07);
  --shadow-lift: 0 2px 5px rgba(35,31,26,.06), 0 18px 40px rgba(35,31,26,.11);
}

html[data-textsize="medium"] { --step: 1.125; }
html[data-textsize="large"]  { --step: 1.28; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
/* One rule sets the clearance under the sticky nav for every anchor target.
   Using scroll-padding on <html> as well would stack with this and drop the
   heading twice as far down the screen. */
[id] { scroll-margin-top: calc(var(--nav-h) + 20px); }

body {
  background: var(--bg);
  color: var(--ink2);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.7;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brass-deep); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--card); color: var(--ink);
  padding: 14px 20px; border: 2px solid var(--focus);
  border-radius: 0 0 var(--radius-sm) 0; font-weight: 500;
}
.skip-link:focus { left: 0; }

/* =========================================================================
   TYPE SCALE
   ========================================================================= */
h1, h2, h3, h4 {
  font-family: var(--serif); color: var(--ink);
  line-height: 1.18; font-weight: 600; letter-spacing: -.015em;
  text-wrap: balance;
}
h1 { font-size: calc(clamp(36px, 5.2vw, 58px) * var(--step)); line-height: 1.06; }
h2 { font-size: calc(clamp(26px, 3vw, 34px) * var(--step)); }
h3 { font-size: calc(21px * var(--step)); }
h4 { font-size: calc(18px * var(--step)); }

p { max-width: var(--measure); }
p + p { margin-top: 1.05em; }

/* =========================================================================
   THE ONE CONTAINER — every page aligns to this and nothing else
   ========================================================================= */
.shell { max-width: var(--page-max); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(44px, 6vw, 76px); }
.section-tight { padding-block: clamp(28px, 4vw, 44px); }

.band { border-block: 1px solid var(--rule); }
.band-parchment { background: var(--parchment); }
.band-sky       { background: var(--sky); }
.band-sage      { background: var(--sage); }
.band-plum      { background: var(--plum); }

/* =========================================================================
   NAVIGATION
   ========================================================================= */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 253, 249, .95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-firm);
  min-height: var(--nav-h);
}
/* The nav content sits on exactly the same left edge as .shell, so the logo
   lines up with every h1, breadcrumb, rail and footer column on the site. */
.nav-inner {
  max-width: var(--page-max); margin-inline: auto; width: 100%;
  padding-inline: var(--gutter);
  display: flex; align-items: center; gap: 10px; min-height: var(--nav-h);
}
.nav-logo {
  font-family: var(--serif); font-size: calc(20px * var(--step));
  font-weight: 600; color: var(--ink); text-decoration: none;
  letter-spacing: -.02em; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 9px; min-height: 44px;
}
.nav-logo em { font-style: italic; font-weight: 400; color: var(--brass); }
.nav-links { display: flex; gap: 2px; margin-left: auto; align-items: center; }
.nav-link {
  font-size: var(--t-small); color: var(--ink2); text-decoration: none;
  padding: 10px 9px; border-radius: 8px; min-height: 44px;
  display: inline-flex; align-items: center; transition: background .15s, color .15s;
  /* Session 10: a two-word label ("How it works") wrapped onto three lines once the
     nav reached seven items, breaking the bar's alignment. Nav labels never wrap;
     below 1180px the drawer takes over and this rule stops applying. */
  white-space: nowrap;
}
.nav-link:hover { background: var(--parchment); color: var(--ink); }
.nav-link[aria-current="page"] {
  color: var(--brass-deep); font-weight: 600; background: var(--parchment);
  box-shadow: inset 0 -2px 0 var(--brass);
}
.nav-tools { display: flex; align-items: center; gap: 8px; margin-left: 10px; }

.textsize {
  display: flex; align-items: center; gap: 3px;
  border: 1px solid var(--rule-firm); border-radius: 999px;
  padding: 3px; background: var(--card);
}
.textsize-label { font-size: var(--t-micro); color: var(--ink3); padding-inline: 7px; }
.ts-btn {
  font-family: var(--serif); background: none; border: none; cursor: pointer;
  color: var(--ink2); border-radius: 999px;
  /* Session 12 QC gate 6: this was 38px, below the site's own 44px tap-target
     floor that every other control meets. */
  min-width: 44px; min-height: 44px; font-size: var(--t-micro);
}
.ts-btn:hover { background: var(--parchment); }
.ts-btn[aria-pressed="true"] { background: var(--brass); color: var(--on-accent); font-weight: 600; }

.hamburger {
  display: none; background: none; border: 1px solid var(--rule-firm);
  border-radius: 10px; cursor: pointer; min-width: 46px; min-height: 44px;
  margin-left: auto; align-items: center; justify-content: center;
  gap: 4px; flex-direction: column;
}
.hamburger span { display: block; width: 20px; height: 2px; background: var(--ink2); border-radius: 2px; }

.mobile-drawer {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: var(--bg); padding: 82px var(--gutter) 28px;
  flex-direction: column; overflow-y: auto;
}
.mobile-drawer.open { display: flex; }
.mobile-drawer a {
  font-size: calc(17px * var(--step)); color: var(--ink); text-decoration: none;
  padding: 15px 4px; border-bottom: 1px solid var(--rule); min-height: 44px;
}


/* =========================================================================
   SEARCH
   The input is plain HTML and renders instantly; the index is fetched only
   when someone first focuses it, so a reader who never searches pays nothing.
   ========================================================================= */
/* Session 11: this was `min-width: 0`, so when the nav bar filled up the search
   field shrank to zero width — but its icon and its "/" hint are absolutely
   positioned and kept drawing, directly over the last nav link. A search box that
   cannot be seen is not a search box; it now refuses to shrink below a usable size
   and the bar's other elements give way instead. */
.search { position: relative; flex: 0 1 260px; min-width: 168px; }
.search-input {
  width: 100%; font-family: var(--sans); font-size: var(--t-small);
  color: var(--ink); background: var(--card);
  border: 1px solid var(--rule-firm); border-radius: 999px;
  padding: 10px 16px 10px 38px; min-height: 44px;
}
.search-input::placeholder { color: var(--ink3); }
.search-input:hover { border-color: var(--brass-mid); }
.search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--ink3);
}
.search-key {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: var(--t-micro); color: var(--ink3); pointer-events: none;
  border: 1px solid var(--rule-firm); border-radius: 5px; padding: 1px 6px;
  background: var(--parchment); line-height: 1.5;
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 120;
  background: var(--card); border: 1px solid var(--rule-firm);
  border-top: 4px solid var(--brass-rail); border-radius: var(--radius);
  box-shadow: var(--shadow-lift); overflow: hidden auto; max-height: 70vh;
}
.search-hit {
  display: block; padding: 12px 16px; text-decoration: none; color: var(--ink2);
  border-bottom: 1px solid var(--rule);
}
.search-hit:last-child { border-bottom: none; }
.search-hit.is-active, .search-hit:hover { background: var(--parchment); }
.search-hit-cat {
  display: block; font-size: var(--t-micro); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--brass-deep);
  margin-bottom: 3px;
}
.search-hit-title {
  display: block; font-family: var(--serif); font-size: calc(17px * var(--step));
  font-weight: 600; color: var(--ink); line-height: 1.25; margin-bottom: 3px;
}
.search-hit-excerpt { display: block; font-size: var(--t-micro); color: var(--ink3); line-height: 1.5; }
.search-hit mark { background: var(--brass-tint, var(--clay)); color: var(--ink); padding: 0 2px; border-radius: 3px; }
.search-empty { padding: 16px; font-size: var(--t-small); color: var(--ink3); max-width: none; }

/* The prominent one on the hub */
.search-hero { flex: 1 1 auto; max-width: 620px; margin-top: 26px; }
.search-hero .search-input { font-size: calc(17px * var(--step)); padding: 14px 18px 14px 44px; min-height: 54px; }
.search-hero .search-icon { left: 16px; }
.search-note { font-size: var(--t-micro); color: var(--ink3); margin-top: 10px; }

/* In the mobile drawer */
.mobile-drawer .search { flex: 1 1 auto; width: 100%; margin-bottom: 18px; }
.mobile-drawer .search-key { display: none; }

/* With JavaScript off a search box that does nothing is worse than none. */
.no-js-search { font-size: var(--t-small); color: var(--ink3); }

/* =========================================================================
   BREADCRUMB
   ========================================================================= */
.breadcrumb { padding-top: 20px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; font-size: var(--t-small); }
.breadcrumb li { color: var(--ink3); }
.breadcrumb li + li::before { content: "/"; margin-right: 8px; color: var(--ink3); }
.breadcrumb a { color: var(--ink2); }

/* =========================================================================
   HERO — left aligned, on the same edge as everything else
   ========================================================================= */
.hero { padding-block: clamp(40px, 6vw, 76px) clamp(28px, 4vw, 44px); }
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center; }
.hero-eyebrow {
  font-size: var(--t-micro); letter-spacing: .16em; text-transform: uppercase;
  color: var(--brass-deep); margin-bottom: 18px; font-weight: 600;
}
.hero h1 { margin-bottom: 20px; max-width: 16ch; }
.hero h1 em { font-style: italic; font-weight: 400; color: var(--brass); }
.hero-sub { font-size: calc(20px * var(--step)); color: var(--ink2); max-width: 54ch; }
.hero-note {
  font-family: var(--serif); font-style: italic;
  font-size: calc(17px * var(--step)); color: var(--ink3);
  margin-top: 18px; max-width: 54ch;
  border-left: 3px solid var(--brass-mid); padding-left: 18px;
}
.dial-mark { flex-shrink: 0; }

/* =========================================================================
   SECTION HEADS — a coloured rail marks the family, the label names it
   ========================================================================= */
.section-head { margin-bottom: 28px; }
.section-head::before {
  content: ""; display: block; width: 52px; height: 4px; border-radius: 2px;
  background: var(--rail, var(--brass-rail)); margin-bottom: 16px;
}
.section-label {
  font-family: var(--sans); font-size: var(--t-micro); font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--rail-ink, var(--brass-deep));
  margin: 0 0 8px; line-height: 1.4;
}
.section-note { font-size: var(--t-small); color: var(--ink3); max-width: var(--measure); }

.fam-sky       { --rail: var(--sky-rail);       --rail-ink: var(--sky-ink); }
.fam-sage      { --rail: var(--sage-rail);      --rail-ink: var(--sage-ink); }
.fam-blush     { --rail: var(--blush-rail);     --rail-ink: var(--blush-ink); }
.fam-plum      { --rail: var(--plum-rail);      --rail-ink: var(--plum-ink); }
.fam-clay      { --rail: var(--clay-rail);      --rail-ink: var(--clay-ink); }
.fam-parchment { --rail: var(--parchment-rail); --rail-ink: var(--parchment-ink); }

/* =========================================================================
   LENS CARDS
   ========================================================================= */
.lens-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.lens-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 18px; }
.lens-card {
  min-width: 0;
  display: block; text-decoration: none; border-radius: var(--radius);
  padding: 28px 26px 24px; border: 1px solid var(--rule-firm);
  border-top: 5px solid var(--rail);
  background: var(--surface);
  transition: transform .18s, box-shadow .18s;
}
.lens-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.lens-country { --surface: var(--sky);   --rail: var(--sky-rail);   --lens-ink: var(--sky-ink); }
.lens-brand   { --surface: var(--clay);  --rail: var(--clay-rail);  --lens-ink: var(--clay-ink); }
.lens-budget  { --surface: var(--sage);  --rail: var(--sage-rail);  --lens-ink: var(--sage-ink); }
.lens-legacy  { --surface: var(--plum);  --rail: var(--plum-rail);  --lens-ink: var(--plum-ink); }
.lens-academy { --surface: var(--blush); --rail: var(--blush-rail); --lens-ink: var(--blush-ink); }

.lens-icon { display: block; margin-bottom: 14px; }
.lens-kicker {
  display: block; font-size: var(--t-micro); font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--lens-ink); margin-bottom: 8px;
}
.lens-title {
  display: block; font-family: var(--serif); font-size: calc(29px * var(--step));
  font-weight: 600; letter-spacing: -.02em; line-height: 1.14;
  color: var(--lens-ink); margin-bottom: 9px;
}
.lens-tag { display: block; font-size: var(--t-small); color: var(--lens-ink); margin-bottom: 18px; max-width: 46ch; }
.lens-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-micro); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--lens-ink);
  border-bottom: 2px solid var(--rail); padding-bottom: 3px;
}
.lens-card:hover .lens-cta { gap: 10px; }

/* =========================================================================
   CARDS
   ========================================================================= */
/* min() is load-bearing: a bare minmax(330px, 1fr) cannot shrink below 330px,
   so on a 320px phone the card overflows its container. */
.card-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(262px, 100%), 1fr)); gap: 18px; }
.card-grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 18px; }

.card {
  min-width: 0;
  background: var(--card); border: 1px solid var(--rule-firm);
  border-top: 4px solid var(--rail, var(--brass-rail));
  border-radius: var(--radius); padding: 22px;
  text-decoration: none; display: block; color: var(--ink2);
  transition: transform .18s, box-shadow .18s;
}
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-cat { font-size: var(--t-micro); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--rail-ink, var(--ink3)); }
.card-title { font-family: var(--serif); font-size: calc(22px * var(--step)); font-weight: 600; letter-spacing: -.02em; margin-bottom: 5px; line-height: 1.2; }
.card-sub { font-size: var(--t-micro); color: var(--ink3); margin-bottom: 10px; }
.card-desc { font-size: var(--t-small); color: var(--ink2); margin-bottom: 14px; max-width: none; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: var(--t-micro); color: var(--ink3); }

.card-planned { background: var(--parchment); border-style: dashed; border-top-style: solid; border-top-color: var(--rule-firm); }
.card-planned .card-title, .card-planned .card-desc { color: var(--ink3); }

/* The typographic monogram — the default identity mark, because no brand logo
   appears without a cleared Image Ledger row. */
.monogram {
  background: var(--parchment); border: 1px solid var(--brass-mid);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; color: var(--brass-deep);
  letter-spacing: .05em; text-align: center; padding: 14px 10px;
  min-height: 74px; margin-bottom: 14px; font-size: calc(21px * var(--step)); line-height: 1.15;
}
.monogram-lg { min-height: 112px; font-size: calc(32px * var(--step)); max-width: 300px; }
.monogram-note { font-size: var(--t-micro); color: var(--ink3); margin-bottom: 18px; max-width: var(--measure); }
.card-planned .monogram { background: var(--planned-tile); border-color: var(--rule-firm); color: var(--ink3); }

/* =========================================================================
   BADGES, TIERS, CHIPS — colour always paired with a word
   ========================================================================= */
.badge {
  font-size: var(--t-micro); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: 4px 10px; border-radius: 999px;
  border: 1px solid;
  /* No nowrap: a status badge can be a short sentence, and truncating a label
     whose job is to be unambiguous is worse than letting it take two lines. */
}
.badge-live    { background: var(--ok-bg);    color: var(--ok-ink);    border-color: var(--ok-rail); }
.badge-build   { background: var(--clay);     color: var(--clay-ink);  border-color: var(--clay-rail); }
.badge-planned { background: var(--parchment); color: var(--ink3);     border-color: var(--rule-firm); }

.tier {
  font-size: var(--t-micro); font-weight: 700; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 6px;
  background: var(--clay); color: var(--clay-ink);
  border: 1px solid var(--clay-rail); white-space: nowrap;
}
.chip {
  display: inline-block; font-size: var(--t-micro);
  padding: 5px 11px; border-radius: 999px;
  background: var(--card); color: var(--ink2); border: 1px solid var(--rule-firm);
}
.verified { font-size: var(--t-micro); color: var(--ink3); display: inline-flex; align-items: center; gap: 6px; }
.verified::before { content: "✓"; color: var(--ok-rail); font-weight: 700; }
.muted { color: var(--ink3); }

/* =========================================================================
   PAGE HEADER
   ========================================================================= */
.page-header { padding-block: 26px 10px; }
.page-header h1 { margin: 14px 0 14px; }
.page-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.page-lede { font-size: calc(21px * var(--step)); color: var(--ink2); max-width: 58ch; }

.identity-statement {
  background: var(--parchment); border: 1px solid var(--rule-firm);
  border-left: 5px solid var(--brass-rail); border-radius: var(--radius-sm);
  padding: 20px 24px; margin-block: 26px; font-size: var(--t-small);
  color: var(--ink2); max-width: none;
}

/* =========================================================================
   DOCUMENT LAYOUT — sticky left rail, one continuous column of text
   ========================================================================= */
.doc {
  display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px); align-items: start;
  padding-bottom: clamp(48px, 6vw, 80px);
}
.doc-main { min-width: 0; }

.rail { position: sticky; top: calc(var(--nav-h) + 20px); align-self: start; }
.rail-title {
  font-family: var(--sans); font-size: var(--t-micro); font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink3);
  margin-bottom: 14px;
}
.rail-nav, .rail-nav ul { list-style: none; }
.rail-nav { border-left: 2px solid var(--rule-firm); }
.rail-nav li { margin: 0; }
.rail-nav a {
  display: block; padding: 9px 14px; margin-left: -2px;
  border-left: 3px solid transparent;
  font-size: var(--t-small); color: var(--ink2); text-decoration: none;
  line-height: 1.35; min-height: 44px;
}
.rail-nav a:hover { background: var(--parchment); color: var(--ink); }
.rail-nav a[aria-current="true"] {
  border-left-color: var(--rail, var(--brass)); color: var(--ink);
  font-weight: 600; background: var(--parchment);
}
.rail-nav .rail-level > a {
  font-family: var(--serif); font-size: calc(17px * var(--step)); font-weight: 600;
  color: var(--ink); margin-top: 10px;
}
.rail-nav .rail-sub a { padding-left: 26px; font-size: var(--t-micro); color: var(--ink3); }
.rail-nav .rail-sub a:hover, .rail-nav .rail-sub a[aria-current="true"] { color: var(--ink2); }
.rail-level-sky   { --rail: var(--sky-rail); }
.rail-level-sage  { --rail: var(--sage-rail); }
.rail-level-plum  { --rail: var(--plum-rail); }

.rail-aside {
  min-width: 0; overflow-wrap: anywhere;
  margin-top: 26px; background: var(--card); border: 1px solid var(--rule-firm);
  border-top: 4px solid var(--brass-rail); border-radius: var(--radius); padding: 18px 20px;
}
.rail-aside h2 { font-family: var(--sans); font-size: var(--t-micro); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink3); margin-bottom: 12px; }
.rail-aside dl { display: grid; gap: 10px; font-size: var(--t-micro); }
.rail-aside dt { color: var(--ink3); }
.rail-aside dd { color: var(--ink); font-weight: 500; }
.rail-aside ul { list-style: none; display: grid; gap: 9px; font-size: var(--t-micro); }

/* =========================================================================
   READING LEVELS — continuous flow, each with its own colour identity
   ========================================================================= */
.level {
  border-top: 1px solid var(--rule);
  padding-top: clamp(30px, 4vw, 46px);
  margin-top: clamp(30px, 4vw, 46px);
}
.level:first-of-type { border-top: none; margin-top: 8px; padding-top: 0; }
.level-head { margin-bottom: 22px; }
.level-badge {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--sans); font-size: var(--t-micro); font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  background: var(--lv-bg); color: var(--lv-ink);
  border: 1px solid var(--lv-rail); border-radius: 999px;
  padding: 6px 15px; margin-bottom: 14px;
}
.level-badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--lv-rail); }
.level-blurb { font-size: var(--t-small); color: var(--ink3); max-width: var(--measure); }
.level-curious   { --lv-bg: var(--sky);  --lv-ink: var(--sky-ink);  --lv-rail: var(--sky-rail); }
.level-exploring { --lv-bg: var(--sage); --lv-ink: var(--sage-ink); --lv-rail: var(--sage-rail); }
.level-deep      { --lv-bg: var(--plum); --lv-ink: var(--plum-ink); --lv-rail: var(--plum-rail); }

.level h3 { margin-top: 1.7em; padding-left: 14px; border-left: 3px solid var(--lv-rail); }
.level h3:first-of-type { margin-top: 1.2em; }
.level p, .level ul, .level ol { margin-top: .95em; }
.level ul, .level ol { padding-left: 1.35em; max-width: var(--measure); }
.level li { margin-top: .45em; }

/* =========================================================================
   CALLOUTS — each family visibly different
   ========================================================================= */
.callout {
  border-radius: var(--radius-sm); padding: 20px 24px; margin-block: 26px;
  border: 1px solid var(--co-rail); border-left: 5px solid var(--co-rail);
  background: var(--co-bg); font-size: var(--t-small); color: var(--ink2);
}
.callout h3 {
  font-family: var(--sans); font-size: var(--t-small); font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--co-ink);
  margin: 0 0 10px; line-height: 1.4; padding: 0; border: none;
}
.callout p { max-width: none; }
.callout-source  { --co-bg: var(--parchment); --co-rail: var(--parchment-rail); --co-ink: var(--parchment-ink); }
.callout-caution { --co-bg: var(--blush);     --co-rail: var(--blush-rail);     --co-ink: var(--blush-ink); }
.callout-note    { --co-bg: var(--sky);       --co-rail: var(--sky-rail);       --co-ink: var(--sky-ink); }
.callout-contest { --co-bg: var(--plum);      --co-rail: var(--plum-rail);      --co-ink: var(--plum-ink); }

.disclaimer-box {
  background: var(--card); border: 1px solid var(--rule-firm);
  border-left: 5px solid var(--blush-rail); border-radius: var(--radius-sm);
  padding: 20px 24px; margin-block: 24px; font-size: var(--t-small); color: var(--ink2);
}
.disclaimer-box strong { color: var(--ink); }
.disclaimer-box p { max-width: none; }
.disclaimer-inline {
  font-size: var(--t-micro); color: var(--ink3);
  border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 18px; max-width: none;
}

/* =========================================================================
   TABLES
   ========================================================================= */
.table-wrap { overflow-x: auto; margin-block: 24px; border: 1px solid var(--rule-firm); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: var(--t-small); background: var(--card); }
caption { text-align: left; font-size: var(--t-micro); color: var(--ink3); padding: 13px 18px; background: var(--parchment); border-bottom: 1px solid var(--rule-firm); }
th, td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-weight: 700; color: var(--ink); background: var(--parchment); border-bottom: 2px solid var(--brass-rail); }
tbody th { font-weight: 600; color: var(--ink); }
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: none; }
td a { overflow-wrap: anywhere; }

.kv { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0 24px; margin-block: 24px; font-size: var(--t-small); }
.kv dt { color: var(--ink3); padding: 12px 0; border-bottom: 1px solid var(--rule); }
.kv dd { color: var(--ink2); padding: 12px 0; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }

/* Session 14 — three small patterns the Standards page introduced.
   A short aside under a block of prose (a scoped negative, a caveat about how a
   quotation was obtained) needs to read as quieter than body text without
   pretending to be a disclaimer, which is what .disclaimer-inline signals.
   .faq-list is the questions-this-page-answers block: a definition list rather
   than headings, so the same markup feeds FAQPage data and a reader scanning. */
.note-inline {
  font-size: var(--t-small); color: var(--ink3);
  border-left: 3px solid var(--rule-firm); padding-left: 16px;
  margin-block: 22px; max-width: var(--measure);
}
.source-note { font-size: var(--t-micro); color: var(--ink3); max-width: none; margin-top: 10px; }
.faq-list { margin-block: 26px; max-width: var(--measure); }
.faq-list dt {
  font-family: var(--sans); font-weight: 700; color: var(--ink);
  font-size: calc(17px * var(--step)); line-height: 1.45;
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--rule);
}
.faq-list dt:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.faq-list dd { margin: 10px 0 0; color: var(--ink2); font-size: var(--t-small); }

/* =========================================================================
   GLOSSARY
   ========================================================================= */
.gloss-aliases { font-size: var(--t-small); color: var(--ink3); margin-top: 12px; }
.gloss-body { max-width: var(--measure); }
.gloss-body p { font-size: calc(18px * var(--step)); }
.gloss-cols {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(24px, 3vw, 40px); align-items: start; margin-top: 36px;
}
.gloss-cols .sources { margin-top: 0; }
.gloss-cols .rail-aside { margin-top: 0; }
.tier-chip {
  display: inline-block; font-size: var(--t-micro); font-weight: 700;
  padding: 2px 8px; border-radius: 5px; margin-right: 6px;
  background: var(--clay); color: var(--clay-ink); border: 1px solid var(--clay-rail);
}
/* First use of a defined term on any page links to its entry. Underlined with
   a dot so it reads as a definition link, not an ordinary outbound link. */
.gloss-link {
  color: inherit; text-decoration: underline dotted var(--brass-mid);
  text-underline-offset: 4px; text-decoration-thickness: 1.5px;
}
.gloss-link:hover { color: var(--brass-deep); text-decoration-style: solid; }

/* Part 26.3 — the newspaper pattern. A small superscript chip immediately
   after a claim, naming the issuing authority (never a bare number) and
   linking to the matching numbered entry in that page's own Sources list.
   Visually distinct by claim type: an independent third-party authority
   (WIPO, the Smithsonian, ISO...) reads sage-green; a company's own claim
   about itself reads clay-tan, matching the Brand lens and the Tier badge
   so a reader learns the colour means "self-reported" wherever they see it
   again. A reserved third variant is here for a future Tier 2 source. */
.cite {
  font-size: var(--t-micro); font-weight: 700;
  vertical-align: super; line-height: 0;
}
.cite a { color: var(--sage-ink); text-decoration: none; }
.cite a:hover, .cite a:focus { text-decoration: underline; }
.cite-own a { color: var(--clay-ink); }
/* A third variant (e.g. .cite-tier2, sky-toned) is owed the day a Tier 2
   source first earns a chip — not added ahead of that need, per the
   no-orphaned-CSS rule this validator enforces. */

/* The glossary hub lists every entry that could not be closed from a citable
   source. At 20 terms that was four cards; at 80 it is 33, and as a card grid it
   buried the domain sections above it. A dense column list keeps every one of
   them visible — hiding any would defeat the point of the section — while
   letting the domains stay the page's centre of gravity. [Session 09] */
.gloss-open {
  columns: 2; column-gap: 40px; margin-block: 16px 8px;
  font-size: var(--t-small); list-style: none; padding: 0;
}
.gloss-open li {
  break-inside: avoid; padding: 9px 0; border-bottom: 1px solid var(--rule);
}
.gloss-open a { color: var(--ink2); text-decoration-color: var(--brass-mid); }
.gloss-open a:hover, .gloss-open a:focus { color: var(--brass-deep); }

@media (max-width: 900px) { .gloss-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .gloss-open { columns: 1; } }

/* =========================================================================
   SOURCES
   ========================================================================= */
.sources { background: var(--parchment); border: 1px solid var(--rule-firm); border-top: 4px solid var(--brass-rail); border-radius: var(--radius); padding: 26px 28px; margin-top: 36px; }
.sources h2 { margin-bottom: 10px; }
.sources ol { padding-left: 1.4em; font-size: var(--t-small); margin-top: 16px; }
.sources li { margin-top: .85em; color: var(--ink2); }
.sources cite { font-style: normal; color: var(--ink); }
.sources a { overflow-wrap: anywhere; }
.source-date { color: var(--ink3); font-size: var(--t-micro); }

/* =========================================================================
   ACADEMY — quiz
   ========================================================================= */
.quiz { max-width: 780px; }
/* The engine replaces the loading card with the first question once the bank
   loads. Without a reserved height that swap shifts everything below it, which
   the Construction Manual's CLS target of zero does not allow. */
#quiz-root { min-height: 640px; }
@media (max-width: 560px) { #quiz-root { min-height: 760px; } }
.quiz-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.quiz-count { font-size: var(--t-small); color: var(--ink2); font-weight: 600; white-space: nowrap; }
.quiz-bar { flex: 1 1 140px; height: 10px; background: var(--parchment); border: 1px solid var(--rule-firm); border-radius: 999px; overflow: hidden; }
.quiz-bar-fill { height: 100%; background: var(--brass-mid); width: 0%; transition: width .3s; }

.quiz-card { background: var(--card); border: 1px solid var(--rule-firm); border-top: 5px solid var(--blush-rail); border-radius: var(--radius); padding: clamp(22px, 4vw, 34px); box-shadow: var(--shadow); }
.quiz-domain { font-size: var(--t-micro); letter-spacing: .1em; text-transform: uppercase; color: var(--blush-ink); font-weight: 700; margin-bottom: 12px; }
.quiz-stem { font-family: var(--serif); font-size: calc(25px * var(--step)); font-weight: 600; line-height: 1.28; margin-bottom: 22px; letter-spacing: -.01em; color: var(--ink); }

.quiz-options { list-style: none; display: grid; gap: 10px; }
.quiz-option { display: block; }
.quiz-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.quiz-option-label {
  display: flex; align-items: flex-start; gap: 13px;
  border: 1px solid var(--rule-firm); border-radius: var(--radius-sm);
  padding: 15px 18px; cursor: pointer; background: var(--bg);
  font-size: var(--t-small); min-height: 44px; transition: background .15s, border-color .15s;
}
.quiz-option-label:hover { background: var(--parchment); border-color: var(--brass-mid); }
.quiz-option input:focus-visible + .quiz-option-label { outline: 3px solid var(--focus); outline-offset: 2px; }
.quiz-option input:checked + .quiz-option-label { border-color: var(--brass); background: var(--parchment); }
.quiz-key { flex-shrink: 0; font-family: var(--serif); font-weight: 600; width: 28px; height: 28px; border-radius: 50%; background: var(--card); border: 1px solid var(--rule-firm); display: flex; align-items: center; justify-content: center; font-size: var(--t-micro); color: var(--ink2); }
.quiz-option input:checked + .quiz-option-label .quiz-key { background: var(--brass); color: var(--on-accent); border-color: var(--brass); }

.quiz-option-label.is-correct { border-color: var(--ok-rail); background: var(--ok-bg); }
.quiz-option-label.is-wrong   { border-color: var(--warn-rail); background: var(--warn-bg); }
.quiz-option-label.is-correct .quiz-key { background: var(--ok-rail); color: var(--card); border-color: var(--ok-rail); }
.quiz-option-label.is-wrong   .quiz-key { background: var(--warn-rail); color: var(--card); border-color: var(--warn-rail); }
.quiz-mark { margin-left: auto; font-size: var(--t-micro); font-weight: 700; white-space: nowrap; padding-left: 10px; }
.quiz-option-label.is-correct .quiz-mark { color: var(--ok-ink); }
.quiz-option-label.is-wrong .quiz-mark { color: var(--warn-ink); }

.quiz-feedback { margin-top: 22px; border-top: 1px solid var(--rule); padding-top: 20px; }
.quiz-verdict { font-family: var(--serif); font-size: calc(21px * var(--step)); font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.quiz-verdict-right { color: var(--ok-ink); }
.quiz-verdict-wrong { color: var(--warn-ink); }
.quiz-explain { font-size: var(--t-small); color: var(--ink2); max-width: none; }
.quiz-cite { overflow-wrap: anywhere; margin-top: 14px; font-size: var(--t-micro); color: var(--ink3); background: var(--parchment); border: 1px solid var(--rule-firm); border-left: 4px solid var(--brass-rail); border-radius: var(--radius-sm); padding: 13px 16px; }
.quiz-cite strong { color: var(--ink2); }
.quiz-cite a { overflow-wrap: anywhere; }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; align-items: center; }
.quiz-hint { font-size: var(--t-micro); color: var(--ink3); }

.btn {
  font-family: var(--sans); font-size: var(--t-small); font-weight: 600;
  border-radius: 999px; cursor: pointer; padding: 13px 26px; min-height: 48px;
  border: 1px solid var(--brass); background: var(--brass); color: var(--on-accent);
  text-decoration: none; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; transition: background .15s;
}
.btn:hover { background: var(--brass-deep); border-color: var(--brass-deep); color: var(--on-accent); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-quiet { background: var(--card); color: var(--ink2); border-color: var(--rule-firm); }
.btn-quiet:hover { background: var(--parchment); color: var(--ink); border-color: var(--brass-mid); }

.result-head { margin-bottom: 28px; }
.result-label { font-family: var(--serif); font-size: calc(clamp(30px, 5vw, 46px) * var(--step)); font-weight: 600; color: var(--brass-deep); margin-bottom: 8px; letter-spacing: -.02em; }
.result-score { font-size: calc(19px * var(--step)); color: var(--ink2); }
.result-blurb { font-size: var(--t-small); color: var(--ink3); max-width: 54ch; margin-top: 12px; }

.profile { display: grid; gap: 14px; margin-block: 26px; }
.profile-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) 82px; gap: 14px; align-items: center; }
.profile-name { font-size: var(--t-small); color: var(--ink2); }
.profile-track { height: 16px; background: var(--parchment); border: 1px solid var(--rule-firm); border-radius: 999px; overflow: hidden; }
.profile-fill { height: 100%; background: var(--brass-mid); }
.profile-fill-none { background: repeating-linear-gradient(135deg, var(--stripe) 0 6px, var(--parchment) 6px 12px); width: 100%; }
.profile-val { font-size: var(--t-micro); color: var(--ink3); text-align: right; white-space: nowrap; }
.readnext { display: grid; gap: 10px; margin-top: 10px; }
.readnext li { font-size: var(--t-small); }

/* =========================================================================
   FOOTER — parchment, never dark
   ========================================================================= */
.site-footer { background: var(--parchment); border-top: 3px solid var(--brass-rail); padding-block: clamp(38px, 5vw, 58px) 26px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 36px; margin-bottom: 34px; }
.footer-brand { font-family: var(--serif); font-size: calc(20px * var(--step)); font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.footer-desc { font-size: var(--t-small); color: var(--ink2); max-width: 32ch; }
.footer-col h2 { font-family: var(--sans); font-size: var(--t-micro); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink3); margin-bottom: 14px; }
.footer-col ul { list-style: none; display: grid; gap: 10px; }
.footer-col li { font-size: var(--t-small); }
.footer-col a { color: var(--ink2); text-decoration: none; }
.footer-col a:hover { color: var(--brass-deep); text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--rule-firm); padding-top: 20px; display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.footer-disclaimer { font-size: var(--t-micro); color: var(--ink3); max-width: 78ch; }
.footer-copy { font-size: var(--t-micro); color: var(--ink3); white-space: nowrap; }

/* =========================================================================
   UTILITIES
   ========================================================================= */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.is-hidden { display: none; }
.stack-sm > * + * { margin-top: 12px; }
.mt-lg { margin-top: 34px; }
.flow > * + * { margin-top: 1em; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1040px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  /* The rail becomes a collapsible block at the top — still every link, never hidden */
  .rail { position: static; }
  .rail-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); border-left: none; border-top: 2px solid var(--rule-firm); }
  .rail-nav a { border-left: none; border-top: 3px solid transparent; margin-left: 0; }
  .rail-nav a[aria-current="true"] { border-left-color: transparent; border-top-color: var(--rail, var(--brass)); }
  .rail-nav .rail-sub a { padding-left: 14px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .dial-mark { order: -1; }
}
@media (max-width: 1340px) {
  .site-nav .nav-links { display: none; }
}
@media (max-width: 900px) {
  .lens-grid, .lens-grid-2 { grid-template-columns: 1fr; }
  .site-nav .search, .nav-tools { display: none; }
  .hamburger { display: flex; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dt { border-bottom: none; padding-bottom: 0; }
}
@media (max-width: 560px) {
  .card-grid, .card-grid-2 { grid-template-columns: 1fr; }
  /* A status badge can be a short sentence ("No authority defines this"), and
     nowrap makes it wider than a phone. Let it wrap rather than truncating a
     label whose whole job is to be unambiguous. */
  .tier, .chip { white-space: normal; }
  .card-top { flex-wrap: wrap; }
  .page-meta { gap: 8px; }
  .footer-grid { grid-template-columns: 1fr; }
  .profile-row { grid-template-columns: minmax(0, 1fr) 76px; }
  .profile-name { grid-column: 1 / -1; }
  .quiz-actions .btn { width: 100%; }
  .footer-copy { white-space: normal; }
  .rail-nav { grid-template-columns: 1fr; }
}

/* =========================================================================
   PRINT
   ========================================================================= */
@media print {
  .site-nav, .mobile-drawer, .skip-link, .quiz-actions, .rail { display: none !important; }
  body { background: var(--card); font-size: 12pt; }
  .doc { grid-template-columns: 1fr; }
  .quiz-card, .card, .rail-aside { box-shadow: none; border-color: var(--print-rule); }
  a { text-decoration: underline; }
}

/* Session 11: the nav bar is at capacity. Eight links, a logo, a search field and
   the text-size control do not fit inside the 1200px shell the bar shares with the
   page content, and the shared left edge is deliberate (see the note above
   .nav-inner), so the bar cannot simply be widened. The drawer therefore takes over
   below 1340px — measured, not guessed: at 1280px the full bar still forced the page
   wider than the viewport. Below 1400px the text-size control drops its word label
   and keeps its three buttons. If another top-level
   page is ever added, this flat list has to become a grouped one — shaving pixels
   again will not work a third time. */
@media (max-width: 1400px) {
  .textsize-label { display: none; }
}
