/* ============================================================
   Lux Ethos — Litepaper · Daylight design system
   Canonical tokens live in /home/alec/Documents/lux-ethos/BRAND.md
   ============================================================ */

:root {
  /* Daylight palette */
  --bg: #F7F2E4;
  --bg-deep: #F0E8D4;
  --surface: #FFFDF7;
  --surface-2: #F1EBD8;
  --ink: #1C1917;
  --ink-2: #454039;
  --muted: #6E675C;
  --gold: #C9B26A;
  --gold-soft: #E9DFB9;
  --gold-wash: #F3EDD6;
  --gold-deep: #9A8640;
  --gold-ink: #776829;      /* AA link/label text on cream */
  --border: #E5DDC7;
  --border-strong: #CFC4A3;
  --ok: #3D6B4F;
  --warn: #8A6A2F;
  --no: #8B3A3A;

  /* Type */
  --sans: "Instrument Sans", "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --serif: "Newsreader", "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;

  /* Layout */
  --measure: 40rem;    /* ~68ch body column */
  --breakout: 48rem;   /* figures, tables, interludes */
  --toc-w: 200px;
  --radius: 10px;
  --radius-sm: 6px;
}

/* ---------- Base ---------- */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;          /* 18px */
  line-height: 1.7;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--gold-soft); color: var(--ink); }

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

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

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--surface);
  padding: 0.5rem 1rem; font-family: var(--sans); font-size: 0.875rem;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- Shared label voice ---------- */

.kicker {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 242, 228, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-family: var(--sans);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 0.9375rem; letter-spacing: 0.01em;
}
.wordmark svg { display: block; }
.doc-meta {
  font-family: var(--mono);
  font-size: 0.75rem; color: var(--muted);
  display: inline-flex; align-items: center; gap: 0.75rem;
  white-space: nowrap;
}
.badge-draft {
  font-family: var(--sans); font-weight: 600;
  font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gold-ink);
  border: 1px solid var(--gold);
  background: var(--gold-wash);
  padding: 0.15rem 0.5rem; border-radius: 999px;
}
.progress {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 0;
  background: var(--gold-deep);
}

/* ---------- Hero / title page ---------- */

.hero {
  max-width: 1120px; margin: 0 auto;
  padding: 4.5rem 1.5rem 3.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr);
  gap: 3rem 4rem;
  align-items: start;
}
.hero-copy .kicker { display: block; margin-bottom: 1.25rem; }
.hero h1 {
  margin: 0 0 0.75rem;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.035em;
  font-size: clamp(3rem, 7.5vw, 4.75rem);
  line-height: 1.02;
}
.hero .subtitle {
  margin: 0 0 1.5rem;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
  line-height: 1.4;
  font-weight: 500;
  color: var(--ink);
  max-width: 22em;
}
.hero .creed {
  margin: 0 0 2.5rem;
  font-style: italic;
  font-size: 1.125rem;
  color: var(--ink-2);
  max-width: 30em;
}
.hero .creed em { font-style: normal; }

.colophon {
  border-top: 1px solid var(--border-strong);
  font-family: var(--sans);
  font-size: 0.875rem;
  max-width: 30rem;
}
.colophon > div {
  display: grid; grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.colophon dt { margin: 0; color: var(--muted); font-size: 0.8125rem; }
.colophon dd { margin: 0; color: var(--ink); }
.colophon dd .tick { font-family: var(--mono); font-size: 0.8125rem; }

.hero-figure { padding-top: 1.5rem; }
.hero-figure svg { width: 100%; height: auto; display: block; }

/* Animated lumen — canvas dot-grid wave (acejack rolling-pixel technique,
   recolored Daylight). Static SVG is the no-JS and print fallback. */
.lumen {
  position: relative;
  width: 100%;
  aspect-ratio: 340 / 260;
  -webkit-mask-image: radial-gradient(ellipse 92% 92% at 50% 50%, black 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 92% 92% at 50% 50%, black 62%, transparent 100%);
}
.lumen-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: none;
}
.lumen-static { position: absolute; inset: 0; width: 100%; height: 100%; }
.lumen.js .lumen-canvas { display: block; }
.lumen.js .lumen-static { visibility: hidden; }

figcaption, .figcap {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.75rem;
  line-height: 1.5;
}
.figcap .fig-no { font-family: var(--mono); font-size: 0.75rem; color: var(--gold-ink); margin-right: 0.5rem; }

/* ---------- Shell: TOC + paper ---------- */

.shell {
  max-width: 1120px; margin: 0 auto;
  display: grid;
  grid-template-columns: var(--toc-w) minmax(0, 1fr);
  gap: 3.5rem;
  padding: 0 1.5rem 6rem;
}

.toc {
  position: sticky; top: 4.25rem;
  align-self: start;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
  padding: 2rem 0.25rem 2rem 0;
  font-family: var(--sans);
  scrollbar-width: thin;
}
.toc-title {
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc .toc-part {
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gold-ink);
  margin: 1.1rem 0 0.35rem;
}
.toc a {
  display: flex; gap: 0.55rem;
  padding: 0.28rem 0.5rem 0.28rem 0.6rem;
  font-size: 0.8125rem; line-height: 1.35;
  color: var(--ink-2); text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.toc a .n { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); padding-top: 0.1rem; min-width: 1.2rem; }
.toc a:hover { color: var(--ink); background: var(--surface); }
.toc a.active { color: var(--ink); border-left-color: var(--gold-deep); background: var(--surface); }
.toc a.active .n { color: var(--gold-ink); }

/* Mobile contents */
.toc-mobile { display: none; }

/* ---------- Paper column ---------- */

.paper { min-width: 0; padding-top: 2rem; }
.paper > * { max-width: var(--measure); }
.paper > .breakout, .paper > .interlude { max-width: var(--breakout); }

.paper p { margin: 0 0 1.25rem; color: var(--ink); }
.paper p.lede {
  font-size: 1.25rem; line-height: 1.6; color: var(--ink);
}
.paper ul, .paper ol { margin: 0 0 1.25rem; padding-left: 1.35rem; }
.paper li { margin: 0.4rem 0; }
.paper li::marker { color: var(--gold-deep); }
.paper strong { font-weight: 600; }
.paper hr { border: 0; border-top: 1px solid var(--border); margin: 3rem 0; }

.section-head { margin-top: 4.5rem; }
.section-head .secno {
  display: block;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--gold-ink);
  margin-bottom: 0.4rem;
}
.paper h2 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0 0 1.25rem;
  scroll-margin-top: 5.5rem;
}
.paper h3 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 1.1875rem;
  margin: 2.25rem 0 0.75rem;
  scroll-margin-top: 5.5rem;
}
.paper h4 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 1.75rem 0 0.5rem;
  color: var(--ink-2);
}

.paper code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--surface-2);
  border-radius: 4px;
  padding: 0.08em 0.35em;
}

.paper pre {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  margin: 1.25rem 0 1.5rem;
  color: var(--ink-2);
}
.paper pre code { background: none; padding: 0; font-size: inherit; }

/* Pull quotes — ethos lines inside sections */
.pull {
  margin: 2.5rem 0;
  padding: 0 0 0 1.5rem;
  border-left: 2px solid var(--gold);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.375rem;
  line-height: 1.5;
  color: var(--ink);
}
.pull .attr {
  display: block; margin-top: 0.5rem;
  font-style: normal; font-family: var(--sans);
  font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Part interludes ---------- */

.interlude {
  margin: 6rem 0 4.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-strong);
  text-align: left;
}
.interlude .glyph { margin-bottom: 1.25rem; }
.interlude .glyph svg { display: block; }
.interlude .part-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-ink);
  margin-bottom: 0.85rem;
}
.interlude .part-line {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  line-height: 1.35;
  color: var(--ink);
  max-width: 26em;
}

/* ---------- Reader's note / callouts ---------- */

.note {
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-deep);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.25rem 1.5rem;
  margin: 2.5rem 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--ink-2);
}
.note .kicker { display: block; margin-bottom: 0.5rem; }
.note p { margin: 0 0 0.75rem; font-family: var(--sans); color: var(--ink-2); }
.note p:last-child { margin-bottom: 0; }
.note strong { color: var(--ink); }

/* ---------- Figures ---------- */

figure { margin: 2rem 0 2.25rem; }
figure.breakout { margin: 2.5rem 0 2.75rem; }
.diagram-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
}
.diagram-frame svg { width: 100%; height: auto; display: block; }

/* SVG diagram vocabulary */
.dg-box { fill: var(--bg); stroke: var(--border-strong); stroke-width: 1; }
.dg-box-accent { fill: var(--gold-wash); stroke: var(--gold-deep); stroke-width: 1; }
.dg-box-dashed { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 4 3; }
.dg-title { font-family: var(--sans); font-size: 13px; font-weight: 600; fill: var(--ink); }
.dg-sub { font-family: var(--mono); font-size: 10px; fill: var(--muted); }
.dg-ann { font-family: var(--mono); font-size: 10.5px; fill: var(--muted); }
.dg-flow { stroke: var(--ink-2); stroke-width: 1.2; fill: none; }
.dg-dash { stroke: var(--gold-deep); stroke-width: 1.1; fill: none; stroke-dasharray: 4 3; }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; margin: 1.5rem 0 2rem; }
.paper table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.5;
}
.paper th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.5rem 0.85rem 0.5rem 0;
  border-bottom: 1px solid var(--border-strong);
  vertical-align: bottom;
}
.paper td {
  padding: 0.6rem 0.85rem 0.6rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--ink-2);
}
.paper td:first-child, .paper th:first-child { padding-left: 0; }
.paper td strong { color: var(--ink); }
.paper td .tick, .paper .tick { font-family: var(--mono); font-size: 0.8125rem; }

/* verdict chips in tables / PoE */
.chip {
  display: inline-block;
  font-family: var(--sans); font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.14rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted); background: var(--surface);
  white-space: nowrap;
}
.chip.yes { color: #2E523C; border-color: #9DBCA9; background: #EDF3EC; }
.chip.no { color: var(--no); border-color: #D8B2B2; background: #F8EEEA; }
.chip.select { color: var(--ink); border-color: var(--gold-deep); background: var(--gold-soft); }
.chip.defer { color: var(--warn); border-color: var(--gold); background: var(--gold-wash); }

/* ---------- Split bar (92/4/4) ---------- */

.splitbar { margin: 1.75rem 0 2rem; font-family: var(--sans); }
.splitbar .bar {
  display: flex; height: 34px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
}
.splitbar .seg-op { background: var(--gold-soft); flex: 92; }
.splitbar .seg-tr { background: var(--gold); flex: 4; }
.splitbar .seg-ops { background: var(--gold-deep); flex: 4; }
.splitbar .legend {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  margin-top: 0.75rem;
  font-size: 0.8125rem; color: var(--ink-2);
}
.splitbar .legend .key {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; margin-right: 0.45rem;
  border: 1px solid var(--border-strong);
  vertical-align: baseline;
}
.splitbar .legend .k-op { background: var(--gold-soft); }
.splitbar .legend .k-tr { background: var(--gold); }
.splitbar .legend .k-ops { background: var(--gold-deep); }
.splitbar .legend strong { font-weight: 600; color: var(--ink); }

/* ---------- Checklists (build schematic) ---------- */

.check { list-style: none; padding: 0; margin: 1rem 0 1.75rem; }
.check li {
  position: relative;
  padding: 0.45rem 0 0.45rem 2rem;
  margin: 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.check li::before {
  content: "";
  position: absolute; left: 0.15rem; top: 0.78rem;
  width: 0.8rem; height: 0.8rem;
  border: 1.5px solid var(--gold-deep);
  border-radius: 3px;
  background: var(--surface);
}
.check li strong { color: var(--ink); }
.check.later li::before { border-color: var(--border-strong); }

/* ---------- Naming tree ---------- */

.tree { font-family: var(--sans); font-size: 0.9375rem; margin: 1.5rem 0 2rem; }
.tree ul { list-style: none; margin: 0; padding-left: 1.4rem; }
.tree > ul { padding-left: 0; }
.tree > ul > li > .tree-label { font-weight: 600; }
.tree ul ul { border-left: 1px solid var(--border-strong); margin-left: 0.35rem; }
.tree li { margin: 0; padding: 0.3rem 0 0.3rem 0; }
.tree ul ul li { padding-left: 1rem; position: relative; }
.tree ul ul li::before {
  content: ""; position: absolute; left: 0; top: 1.05rem;
  width: 0.7rem; height: 1px; background: var(--border-strong);
}
.tree .tree-label { color: var(--ink); }
.tree .tree-sub { color: var(--muted); font-size: 0.8125rem; margin-left: 0.5rem; }
.tree .tick { font-family: var(--mono); font-size: 0.8125rem; }

/* ---------- Q&A ---------- */

.qa { margin: 2rem 0 1.5rem; border-top: 1px solid var(--border-strong); }
.qa details { border-bottom: 1px solid var(--border); }
.qa summary {
  display: flex; gap: 1rem; align-items: baseline;
  padding: 1.1rem 2.25rem 1.1rem 0;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary .qno {
  font-family: var(--mono); font-size: 0.75rem;
  color: var(--gold-ink);
  min-width: 2rem;
}
.qa summary .q {
  font-family: var(--serif);
  font-size: 1.125rem; font-weight: 500; line-height: 1.45;
  color: var(--ink);
}
.qa summary::after {
  content: "+";
  position: absolute; right: 0.25rem; top: 50%;
  transform: translateY(-50%);
  font-family: var(--sans); font-weight: 400;
  font-size: 1.25rem; color: var(--gold-deep);
}
.qa details[open] summary::after { content: "\2212"; }
.qa summary:hover .q { color: var(--gold-ink); }
.qa .a {
  padding: 0 0 1.5rem 3rem;
  max-width: var(--measure);
  color: var(--ink-2);
  font-size: 1.0625rem;
}
.qa .a p { margin: 0 0 1rem; color: var(--ink-2); }
.qa .a p:last-child { margin-bottom: 0; }
.qa .a ul { margin: 0 0 1rem; }

.qa-tools {
  font-family: var(--sans); font-size: 0.8125rem;
  margin: 0 0 0.5rem;
  display: flex; gap: 1rem;
}
.qa-tools button {
  font: inherit; color: var(--gold-ink);
  background: none; border: none; padding: 0.25rem 0;
  cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.qa-tools button:hover { color: var(--ink); }

/* ---------- Brand PoE ---------- */

.poe { border-top: 1px solid var(--border-strong); margin: 1.5rem 0 2rem; font-family: var(--sans); }
.poe-row {
  display: grid;
  grid-template-columns: 1.6rem minmax(9rem, 0.6fr) 1fr auto;
  gap: 1rem; align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}
.poe-row .l { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); }
.poe-row .name { font-weight: 600; color: var(--ink); }
.poe-row .idea { color: var(--ink-2); font-size: 0.875rem; }

.swatches { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 2rem; }
.swatch {
  width: 88px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.swatch .well { height: 44px; }
.swatch .lab {
  font-family: var(--mono); font-size: 0.625rem; line-height: 1.5;
  color: var(--muted); padding: 0.35rem 0.5rem;
}
.swatch .lab strong { display: block; color: var(--ink-2); font-weight: 500; }

.specimen { margin: 1.5rem 0 2rem; border-top: 1px solid var(--border-strong); }
.specimen > div {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
  display: grid; grid-template-columns: minmax(9rem, 0.45fr) 1fr;
  gap: 1.5rem; align-items: baseline;
}
.specimen .role {
  font-family: var(--sans); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  line-height: 1.6;
}
.specimen .sample-sans { font-family: var(--sans); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.specimen .sample-serif { font-family: var(--serif); font-size: 1.375rem; font-style: italic; }
.specimen .sample-mono { font-family: var(--mono); font-size: 0.9375rem; color: var(--ink-2); }

.logo-demo {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin: 1.5rem 0 1rem;
}
.logo-demo .lockup { display: flex; align-items: center; gap: 0.85rem; font-family: var(--sans); font-weight: 600; font-size: 1.25rem; letter-spacing: 0.01em; }

/* ---------- Glossary ---------- */

.glossary { margin: 1.5rem 0 2rem; border-top: 1px solid var(--border-strong); }
.glossary > div {
  display: grid; grid-template-columns: minmax(9.5rem, 0.4fr) 1fr;
  gap: 1.5rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.glossary dt {
  margin: 0; font-family: var(--sans); font-weight: 600;
  font-size: 0.9375rem; color: var(--ink);
}
.glossary dd {
  margin: 0; font-family: var(--sans);
  font-size: 0.9375rem; color: var(--ink-2); line-height: 1.55;
}

/* ---------- Disclaimer / footer ---------- */

.disclaimer {
  font-size: 1rem; color: var(--ink-2);
}

.site-foot {
  border-top: 1px solid var(--border-strong);
  background: var(--bg-deep);
  padding: 3.5rem 1.5rem 4rem;
}
.site-foot .inner {
  max-width: 1120px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 2rem 4rem; align-items: start;
}
.site-foot .foot-creed {
  font-family: var(--serif); font-style: italic;
  font-size: 1.25rem; line-height: 1.55; color: var(--ink);
  margin: 1rem 0 0;
}
.site-foot .foot-meta {
  font-family: var(--sans); font-size: 0.8125rem; color: var(--muted);
  line-height: 1.7; padding-top: 0.5rem;
}
.site-foot .foot-meta a { color: var(--gold-ink); }

/* ---------- Language toggle (Protocol | Actual English) ---------- */

html[data-lang="protocol"] [data-plain] { display: none !important; }
html[data-lang="plain"] [data-proto] { display: none !important; }

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px;
  background: var(--surface);
  flex-shrink: 0;
}
.lang-toggle button {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.28rem 0.8rem;
  border: none;
  background: none;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.lang-toggle button:hover { color: var(--ink); }
.lang-toggle button.on { background: var(--gold-soft); color: var(--ink); }

/* ---------- Hero bullets ---------- */

.hero-bullets { list-style: none; margin: 0 0 2rem; padding: 0; }
.hero-bullets li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1.6rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.hero-bullets li::before {
  content: "";
  position: absolute; left: 0.15rem; top: 0.92rem;
  width: 0.55rem; height: 0.55rem;
  border-radius: 999px;
  background: var(--gold);
  border: 1px solid var(--gold-deep);
}
.hero-bullets li strong { color: var(--ink); }
.hero-bullets .tick { font-family: var(--mono); font-size: 0.8125rem; }

/* ---------- Numbered steps ---------- */

.steps { list-style: none; counter-reset: step; margin: 1.25rem 0 1.75rem; padding: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.5rem 0 0.5rem 2.6rem;
  margin: 0;
  font-size: 1.0625rem;
  color: var(--ink-2);
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0.55rem;
  width: 1.6rem; height: 1.6rem;
  border-radius: 999px;
  background: var(--gold-wash);
  border: 1px solid var(--gold);
  color: var(--gold-ink);
  font-family: var(--mono);
  font-size: 0.8125rem;
  display: flex; align-items: center; justify-content: center;
}
.steps li strong { color: var(--ink); }

/* ---------- Appendix ---------- */

.appendix { margin-top: 3rem; border-top: 1px solid var(--border-strong); }
.appendix > details { border-bottom: 1px solid var(--border); }
.appendix > details > summary {
  cursor: pointer;
  list-style: none;
  padding: 1.15rem 2rem 1.15rem 0;
  position: relative;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--ink);
}
.appendix > details > summary::-webkit-details-marker { display: none; }
.appendix > details > summary::after {
  content: "+";
  position: absolute; right: 0.25rem; top: 50%;
  transform: translateY(-50%);
  font-weight: 400; font-size: 1.25rem; color: var(--gold-deep);
}
.appendix > details[open] > summary::after { content: "\2212"; }
.appendix > details > summary .app-tag {
  font-family: var(--mono); font-size: 0.75rem; color: var(--gold-ink);
  margin-right: 0.75rem;
}
.appendix .app-body { padding: 0 0 2rem; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .toc-mobile {
    display: block;
    margin: 1.5rem 0 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-family: var(--sans);
  }
  .toc-mobile summary {
    padding: 0.85rem 1.15rem;
    font-size: 0.8125rem; font-weight: 600;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink-2); cursor: pointer; list-style: none;
  }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile ol {
    list-style: none; margin: 0; padding: 0 1.15rem 1rem;
    columns: 2; column-gap: 2rem;
  }
  .toc-mobile a {
    display: block; padding: 0.3rem 0;
    font-size: 0.8125rem; color: var(--ink-2); text-decoration: none;
  }
  .toc-mobile a .n { font-family: var(--mono); font-size: 0.7rem; color: var(--gold-ink); margin-right: 0.5rem; }
  .hero { grid-template-columns: 1fr; padding-top: 3rem; gap: 2rem; }
  .hero-figure { max-width: 22rem; padding-top: 0; }
}

@media (max-width: 640px) {
  body { font-size: 1.0625rem; }
  .doc-meta { display: none; }
  .qa .a { padding-left: 0; }
  .toc-mobile ol { columns: 1; }
  .poe-row { grid-template-columns: 1.6rem 1fr auto; }
  .poe-row .idea { grid-column: 2 / -1; }
  .colophon > div { grid-template-columns: 7rem 1fr; }
  .site-foot .inner { grid-template-columns: 1fr; }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Print ---------- */

@media print {
  :root { --bg: #ffffff; --surface: #ffffff; }
  body { background: #fff; font-size: 10.5pt; }
  .topbar, .toc, .toc-mobile, .qa-tools, .skip-link, .progress { display: none !important; }
  .lumen-canvas { display: none !important; }
  .lumen.js .lumen-static { visibility: visible !important; }
  .lumen { -webkit-mask-image: none; mask-image: none; }
  .shell { display: block; padding: 0; }
  .paper > * { max-width: none; }
  .hero { grid-template-columns: 1fr; padding: 0 0 1.5rem; }
  .hero-figure { max-width: 18rem; }
  figure, .note, .qa details, table { break-inside: avoid; }
  .qa summary::after { display: none; }
  a { color: inherit; text-decoration: none; }
  .section-head { margin-top: 2.5rem; }
  .interlude { margin: 3rem 0 2rem; }
}
