/* Shared by the three worked stories. Values: BRAND.md, Visual. Boundary: ADR-0018. */
:root {
  --paper: #FAF7F1; --paper-raised: #FFFDF8; --ink: #1B1712;
  --ink-mid: #4A433A; --ink-muted: #726A5E; --rule: #E2DACB;
  --rule-strong: #C9BFAC; --hair: rgba(27,23,18,.20);
  --wash: rgba(27,23,18,.030); --wash2: rgba(27,23,18,.055);
  --radius: 0; color-scheme: light;
  --spent: repeating-linear-gradient(45deg, var(--hair) 0 1px, transparent 1px 7px);
  --closed: repeating-linear-gradient(135deg, var(--hair) 0 1px, transparent 1px 7px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131110; --paper-raised: #1C1917; --ink: #F3EEE5;
    --ink-mid: #C2B9AC; --ink-muted: #948B7E; --rule: #302B24;
    --rule-strong: #443D34; --hair: rgba(243,238,229,.20);
    --wash: rgba(243,238,229,.035); --wash2: rgba(243,238,229,.075); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131110; --paper-raised: #1C1917; --ink: #F3EEE5;
  --ink-mid: #C2B9AC; --ink-muted: #948B7E; --rule: #302B24;
  --rule-strong: #443D34; --hair: rgba(243,238,229,.20);
  --wash: rgba(243,238,229,.035); --wash2: rgba(243,238,229,.075); color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink-mid); font: 400 15px/1.6 Geist, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-underline-offset: 4px; text-decoration-color: var(--rule-strong); }
a:hover { text-decoration-color: var(--ink); }
button { font: inherit; border-radius: var(--radius); cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.wrap { max-width: 1048px; padding: 0 28px; margin: auto; }
.skip { position: absolute; top: -100px; left: 20px; z-index: 5; padding: 12px; background: var(--paper-raised); }
.skip:focus { top: 12px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 65px; border-bottom: 1px solid var(--rule); }
.site, .pages, .theme { display: flex; align-items: center; }
.site { gap: 22px; }
.brand { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 44px; color: var(--ink); text-decoration: none; }
.pages { gap: 20px; padding-left: 22px; border-left: 1px solid var(--rule-strong); font-size: 13.5px; }
.pages a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-muted); text-decoration: none; }
.pages a:hover { color: var(--ink); text-decoration: underline; }
.pages a[aria-current] { color: var(--ink); }
.theme { gap: 4px; }
.theme button { border: 0; background: none; min-height: 44px; padding: 6px 8px; color: var(--ink-muted); font-size: 12px; }
.theme button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
.hero { padding: 60px 0 36px; max-width: 745px; }
h1 { margin: 0; color: var(--ink); font: 600 clamp(28px, 4.6vw, 42px)/1.08 Geist, sans-serif; letter-spacing: -.04em; text-wrap: balance; }
.dek { margin: 22px 0 16px; font-size: 17px; line-height: 1.65; max-width: 64ch; }
.meta { color: var(--ink-muted); font-size: 13px; margin: 0; }
h2 { margin: 0 0 14px; color: var(--ink); font: 500 24px/1.25 Geist, sans-serif; letter-spacing: -.013em; text-wrap: balance; }
h3 { font-size: 15px; line-height: 1.5; font-weight: 500; color: var(--ink); margin: 0; }
p { margin: 0 0 16px; }
.money { font-family: "Geist Mono", ui-monospace, monospace; font-weight: 500; font-size: .92em; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.standing { margin: 24px 0 0; border-top: 1px solid var(--rule); }
.standing > div { display: grid; grid-template-columns: 100px 1fr; gap: 20px; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 13.5px; }
.standing dt { color: var(--ink); font-weight: 500; }
.standing dd { margin: 0; }

/* One navigation in document order. It moves into the margin only when it fits. */
.guide { position: relative; scroll-margin-top: 24px; }
.guide-body { min-width: 0; }
.chapters { display: grid; grid-template-columns: repeat(var(--chapter-count), minmax(0, 1fr)); border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule); }
.chapters a { display: flex; align-items: center; min-height: 58px; padding: 12px 16px; border-left: 2px solid transparent; color: var(--ink-mid); font-size: 13.5px; line-height: 1.4; text-decoration: none; }
.chapters a:hover { color: var(--ink); background: var(--wash); }
.chapters a:focus-visible { position: relative; z-index: 1; outline-offset: -2px; }
.chapters a[aria-current] { color: var(--ink); font-weight: 500; background: var(--wash2); border-left-color: var(--ink); }
.guide-meta { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 8px 0; }
.guide-meta p { margin: 0; font-size: 12px; color: var(--ink-muted); }
#view-toggle { min-height: 44px; border: 0; padding: 8px 0 8px 16px; background: none; color: var(--ink-mid); font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }
[data-step] { padding: 18px 0 32px; scroll-margin-top: 28px; }
[data-step] + [data-step] { border-top: 1px solid var(--rule); }
.guide.is-guided [data-step] { border-top: 0; }
.step-intro, .block-intro { max-width: 72ch; }
.step-intro { margin-bottom: 25px; }
.step-intro p { margin: 8px 0 0; }
.block-intro > p:last-child { margin-bottom: 0; }
[data-step] h2:focus:not(:focus-visible) { outline: none; }
.guide-controls { display: flex; align-items: center; gap: 22px; padding: 22px 0; border-top: 1px solid var(--rule); }
.guide-controls button { padding: 12px 22px; min-height: 48px; border: 1px solid var(--rule-strong); }
.guide-controls .back { background: none; color: var(--ink); }
.guide-controls .back:disabled { opacity: .4; cursor: default; }
.guide-controls .next { background: var(--ink); color: var(--paper); margin-left: auto; }
.guide-controls p { margin: 0; font-size: 13px; color: var(--ink-muted); }
.switch, .choices { display: inline-flex; border: 1px solid var(--rule-strong); max-width: 100%; }
.switch { margin: 0 0 26px; }
.switch button, .choices button { border: 0; background: transparent; padding: 10px 18px; min-height: 46px; color: var(--ink-mid); font-size: 13.5px; }
.switch button + button, .choices button + button { border-left: 1px solid var(--rule-strong); }
.switch button[aria-pressed="true"], .choices button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.switch button:hover:not([aria-pressed="true"]), .choices button:hover:not([aria-pressed="true"]) { background: var(--wash2); }
.switch button:focus-visible, .choices button:focus-visible { position: relative; z-index: 1; }

/* Payments are a continuous strip, not six unrelated cards. The only texture is the hatch. */
.panel:not([hidden]) ~ .panel:not([hidden]) { margin-top: 30px; }
.panel-label { margin: 0 0 12px; font-size: 13px; font-weight: 500; color: var(--ink); }
.months { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--rule-strong); border-left: 1px solid var(--rule-strong); }
.months li { display: flex; flex-direction: column; justify-content: space-between; gap: 22px; min-height: 160px; padding: 16px; border-right: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong); background: var(--paper-raised); }
.months .when { font-size: 12px; color: var(--ink-mid); }
.months .amount { font: 500 19px/1.2 "Geist Mono", ui-monospace, monospace; color: var(--ink); }
.months .what { min-height: 34px; font-size: 12px; line-height: 1.4; }
.months .paid { background: var(--spent), var(--wash); }
.months .closed { background: var(--closed), var(--wash); }
.months .closed .what { color: var(--ink); font-weight: 500; }
.panel-foot { margin: 20px 0 0; max-width: 70ch; color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 22px 0 0; padding: 0; list-style: none; color: var(--ink-muted); font-size: 12px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.swatch { width: 18px; height: 14px; border: 1px solid var(--rule-strong); background: var(--paper-raised); }
.swatch.paid { background: var(--spent), var(--wash); }
.swatch.closed { background: var(--closed), var(--wash); }
.compare { width: 100%; border-collapse: collapse; margin: 28px 0; font-size: 14px; }
.compare caption { text-align: left; font-size: 13px; color: var(--ink-muted); padding-bottom: 15px; }
.compare th, .compare td { text-align: left; vertical-align: top; padding: 16px; border-bottom: 1px solid var(--rule); }
.compare th:first-child { padding-left: 0; }
.compare thead th { border-bottom-color: var(--rule-strong); color: var(--ink); font-weight: 500; }
.compare tbody th { font-weight: 400; width: 40%; }
.compare td { color: var(--ink); }
.compare td:last-child, .compare thead th:last-child { background: var(--wash); }
.compare td small { display: block; color: var(--ink-muted); font-size: 12px; margin-top: 4px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 32px; }
.pair section { border-top: 2px solid var(--ink); padding-top: 18px; }
.pair ul { list-style: none; margin: 5px 0 0; padding: 0; }
.pair li { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.check { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin: 28px 0 24px; padding: 24px; border: 1px solid var(--rule-strong); background: var(--paper-raised); }
.check div { display: flex; flex-direction: column; gap: 10px; }
.check span { font-size: 13px; color: var(--ink-muted); }
.check strong { font: 500 24px/1.2 "Geist Mono", ui-monospace, monospace; color: var(--ink); }
.check p { grid-column: 1/-1; margin: 0; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 13.5px; }
.changes { list-style: none; margin: 26px 0 20px; padding: 0; border-top: 1px solid var(--rule-strong); }
.changes li { display: grid; grid-template-columns: 1.1fr 1.2fr 170px; align-items: center; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.changes p { margin: 0; font-size: 14px; }
.state { justify-self: start; font-size: 12px; color: var(--ink-muted); }
.state.ending { padding: 8px 10px; background: var(--closed), var(--wash); color: var(--ink); }
.after-note { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--rule); }
.after-note h2 { font-size: 19px; }

/* Refusals keep the question, result and useful next action in one reading surface. */
.refusal { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px 48px; align-items: start; }
.refusal .ask { margin: 0 0 12px; font-size: 12px; color: var(--ink-muted); }
.refusal h2 { margin-bottom: 20px; }
.refusal .reason { margin-bottom: 0; }
.answer-sheet { padding: 24px; border: 1px solid var(--rule-strong); background: var(--paper-raised); min-height: 190px; }
.answer-label { font-size: 12px; color: var(--ink-muted); margin-bottom: 20px; }
.answer-sheet > .frame:has(.word.left) { height: 90px; background: transparent; border: 0; }
.answer-sheet > .frame .word.left { left: 0; right: 0; font-size: 19px; line-height: 1.4; font-weight: 500; }
.still { grid-column: 1/-1; margin: 0; padding: 22px 24px; border-left: 2px solid var(--ink); background: var(--wash); max-width: 80ch; }
.still b { display: block; margin-bottom: 6px; font-weight: 500; color: var(--ink); }
.quotes { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 20px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.quotes div { padding: 14px 0; }
.quotes div + div { padding-left: 20px; border-left: 1px solid var(--rule); }
.quotes dt { color: var(--ink-muted); font-size: 12px; }
.quotes dd { margin: 8px 0 0; font-size: 19px; }
.tolerance { margin-bottom: 24px; }
.tolerance p { margin: 0 0 12px; font-size: 13px; }
.tolerance .compare-instruction { font-size: 12px; color: var(--ink-muted); }
.choices { display: flex; }
.choices button { flex: 1; padding: 9px 10px; font-size: 12px; }
.state-panel:not([hidden]) ~ .state-panel:not([hidden]) { margin-top: 26px; }
.state-name { font-size: 12px; color: var(--ink-muted); margin-bottom: 20px; }
.verdict { margin: 24px 0 0; }
.verdict strong { font-weight: 500; color: var(--ink); }
.key { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin: 30px 0 0; }
.key p { font-size: 13px; margin: 18px 0 0; }
.whole { list-style: none; padding: 0; margin: 24px 0 0; }
.whole li { display: grid; grid-template-columns: 220px 1fr; gap: 28px; padding: 16px 0; border-top: 1px solid var(--rule); }
.whole b { font-weight: 500; color: var(--ink); }

/* Scales keep the original meaning and positions. No hatch on a measured scale. */
.frame { position: relative; height: 64px; border: 1px solid var(--rule-strong); background: var(--paper-raised); }
.frame .word { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; line-height: 1.35; font-weight: 500; color: var(--ink); }
.frame .word.left { left: 16px; right: 16px; }
.frame .word.before, .frame .word.against { right: calc(100% - var(--at) + 10px); left: 8px; text-align: right; }
.frame .word.after { left: calc(var(--at) + 12px); }
.frame .wall { position: absolute; top: -9px; bottom: -9px; left: var(--at); width: 2px; margin-left: -1px; background: var(--ink); }
.frame .tick { position: absolute; inset-block: 0; left: var(--at); width: 1px; background: var(--ink-mid); }
.marks, .scale-marks { position: relative; height: 34px; margin-top: 16px; font: 400 11px/1.4 "Geist Mono", ui-monospace, monospace; color: var(--ink-muted); }
.marks span, .scale-marks span { position: absolute; top: 0; }
.marks .end, .scale-marks .end { right: 0; color: var(--ink); }
.scale-marks .at { left: var(--at); }
.scale-marks .ink { color: var(--ink); }
.above, .scale-top { position: relative; height: 24px; margin-bottom: 8px; font: 400 11px/1.4 "Geist Mono", ui-monospace, monospace; color: var(--ink); }
.above span, .scale-top span { position: absolute; bottom: 0; left: var(--at); white-space: nowrap; }
.above span.back, .scale-top span.back { transform: translateX(-100%); }
.line-figure { margin: 32px 0 24px; }
.line-figure figcaption { margin-top: 6px; font-size: 13.5px; }

/* Terms and consequence: source stays plain, the result has the raised ground. */
.way { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.way:not([hidden]) ~ .way:not([hidden]) { margin-top: 32px; }
.way-name { margin-bottom: 16px; font-size: 13px; font-weight: 500; color: var(--ink); }
.terms { margin: 0; border-top: 2px solid var(--ink); }
.terms > div { display: grid; grid-template-columns: 1fr 1.15fr; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.terms dd { margin: 0; text-align: right; color: var(--ink); }
.way > div:last-child { padding: 24px; border: 1px solid var(--rule-strong); background: var(--paper-raised); }
.scope-note { font-size: 12px; line-height: 1.6; color: var(--ink-muted); padding-top: 18px; border-top: 1px solid var(--rule); margin: 20px 0 0; }
.tests { list-style: none; margin: 24px 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.tests li { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.tests li > span:last-child { font-size: 14px; color: var(--ink-muted); }
.tests .rule { color: var(--ink); }
.tests .rule > span:last-child { color: var(--ink); }

/* Secondary reading is available, but doesn't compete with the example. */
.source-notes { border-top: 1px solid var(--rule-strong); margin-top: 24px; }
.source-notes summary { cursor: pointer; min-height: 66px; padding: 20px 0; color: var(--ink); font-size: 14px; }
.source-notes summary span { float: right; color: var(--ink-muted); font-size: 12px; padding: 2px 0 0 20px; }
.source-content { padding: 6px 0 26px; }
.source-content > ul { padding-left: 20px; max-width: 80ch; margin: 0; font-size: 13.5px; }
.source-content > ul li { padding: 0 0 12px 4px; }
.development { margin-top: 18px; }
.built { margin: 0; }
.built > div { display: grid; grid-template-columns: 100px 1fr; gap: 20px; padding: 12px 0; border-top: 1px solid var(--rule); font-size: 13px; }
.built dt { font-weight: 500; color: var(--ink); }
.built dd { margin: 0; max-width: 78ch; }
.continuation { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin: 36px 0 48px; padding-top: 24px; border-top: 1px solid var(--rule-strong); }
.continuation > a { font-weight: 500; }
.continuation p { margin: 0; color: var(--ink-muted); font-size: 13.5px; }
footer { border-top: 1px solid var(--rule); padding: 20px 0 28px; display: flex; justify-content: space-between; gap: 20px; color: var(--ink-muted); font-size: 12px; }
footer p { margin: 0; }
footer a { color: inherit; }
@media (min-width: 1480px) {
  .guide-navigation { position: absolute; inset: 0 calc(100% + 24px) 0 auto; width: 200px; }
  .chapters { position: sticky; top: 28px; grid-template-columns: 1fr; border: 0; }
  .chapters a { min-height: 56px; border-bottom: 1px solid var(--rule); }
  .guide-meta { border-top: 1px solid var(--rule-strong); }
}
@media (max-width: 760px) {
  .wrap { padding: 0 22px; }
  .top { flex-wrap: wrap; gap: 0 16px; padding: 8px 0; }
  .site { gap: 12px; }
  .pages { gap: 14px; padding-left: 14px; font-size: 12px; }
  .theme { margin-left: auto; }
  .hero { padding-top: 24px; padding-bottom: 28px; }
  .dek { font-size: 16px; }
  h2 { font-size: 21px; }
  .chapters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapters a { min-height: 48px; padding: 12px; font-size: 13px; }
  .chapters a:last-child:nth-child(odd) { grid-column: 1/-1; }
  [data-step] { padding-top: 18px; }
  .guide-controls { flex-wrap: wrap; gap: 12px; }
  .guide-controls p { flex-basis: 100%; order: -1; }
  .months { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .months li { min-height: 134px; padding: 12px; gap: 18px; }
  .months .amount { font-size: 17px; }
  .pair, .refusal, .way, .key { grid-template-columns: 1fr; gap: 24px; }
  .check { padding: 18px 16px; gap: 16px; }
  .check div > span { min-height: 3.2em; }
  .check strong { font-size: 19px; }
  .check span { font-size: 12px; }
  .changes li { grid-template-columns: 1fr; gap: 8px; }
  .whole li, .tests li { grid-template-columns: 1fr; gap: 6px; }
  .answer-sheet, .way > div:last-child { padding: 20px; }
  .answer-sheet { min-height: 0; }
  .still { padding: 18px; }
  .compare th, .compare td { padding: 12px 9px; font-size: 12px; }
  .compare tbody th { width: 36%; }
  .compare .money { font-size: 12px; }
  .continuation { flex-direction: column; gap: 16px; }
  .standing > div, .built > div { grid-template-columns: 80px 1fr; gap: 16px; }
  .source-notes summary span { display: none; }
  footer { flex-direction: column; gap: 10px; }
}
@media (max-width: 380px) {
  .wrap { padding: 0 16px; }
  .pages { gap: 10px; padding-left: 10px; }
  .site { gap: 8px; }
  .check { padding: 16px 12px; gap: 12px; }
  .check strong { font-size: 16px; }
  .switch button { padding-inline: 12px; font-size: 12px; }
  .choices button { padding-inline: 7px; }
  .answer-sheet, .way > div:last-child { padding: 16px; }
  .scale-marks .end { top: 17px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  :root, :root[data-theme] { --paper: #fff; --paper-raised: #fff; --ink: #000; --ink-mid: #222; --ink-muted: #444; --rule: #ccc; --rule-strong: #999; --hair: rgba(0,0,0,.2); --wash: transparent; --wash2: transparent; color-scheme: light; }
  .wrap { max-width: none; padding: 0; }
  .theme, .skip, .pages, .switch, .choices, .guide-controls, .guide-meta, .guide-navigation, .continuation { display: none !important; }
  [data-step][hidden], .panel[hidden], .state-panel[hidden] { display: block !important; }
  .refusal[hidden], .way[hidden] { display: grid !important; }
  .hero { padding-top: 20px; }
  [data-step], .panel, .way { break-inside: avoid; }
  [data-step] + [data-step] { border-top: 1px solid var(--rule); }
  .source-content { display: block !important; }
  .source-notes::details-content { content-visibility: visible; }
}
