/* ==========================================================================
   xsibility — site stylesheet
   Design goals: WCAG 2.2 AA (aiming AAA for body text contrast), readable
   measure, generous spacing, no motion dependency, light + dark themes.
   Fonts are self-hosted (no third-party font requests — GDPR friendly).
   ========================================================================== */

@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-next.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-next-italic.woff2") format("woff2");
  font-weight: 200 800; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 100 900; font-style: italic; font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;
  --paper: #FBF8F4;
  --paper-2: #F3EDE5;
  --card: #FFFFFF;
  --ink: #17141B;          /* 17.6:1 on paper */
  --ink-2: #3D3843;        /* 10.9:1 */
  --ink-3: #5A5462;        /* 7.0:1  */
  --line: #E2DACF;         /* decorative only */
  --line-strong: #827A8A;  /* UI component borders, ≥3:1 */
  --brand: #B0121E;        /* 6.6:1 on paper */
  --brand-hover: #870D17;
  --brand-tint: #FBEBEC;
  --on-brand: #FFFFFF;
  --ok: #17663A;
  --ok-tint: #E7F4EC;
  --warn: #7A4F00;
  --warn-tint: #FFF4DC;
  --info: #1D4E89;
  --info-tint: #E8F0FA;
  --focus: #B0121E;
  --focus-halo: #FFFFFF;
  --shadow: 0 1px 2px rgba(23,20,27,.06), 0 8px 24px rgba(23,20,27,.06);

  --font-body: "Atkinson Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: clamp(.9rem, .88rem + .1vw, .95rem);
  --step-0: clamp(1.0625rem, 1.03rem + .2vw, 1.1875rem);
  --step-1: clamp(1.25rem, 1.18rem + .35vw, 1.45rem);
  --step-2: clamp(1.5rem, 1.35rem + .7vw, 1.95rem);
  --step-3: clamp(1.85rem, 1.55rem + 1.4vw, 2.7rem);
  --step-4: clamp(2.3rem, 1.8rem + 2.6vw, 3.9rem);

  --radius: 10px;
  --radius-sm: 6px;
  --wrap: 72rem;
  --measure: 68ch;
  --gutter: clamp(1rem, 4vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131116; --paper-2: #1A171E; --card: #1E1B23;
    --ink: #F3EFF6; --ink-2: #D3CCDA; --ink-3: #B2AABB;
    --line: #36313D; --line-strong: #8D8598;
    --brand: #FF8089; --brand-hover: #FFB1B7; --brand-tint: #2C1418; --on-brand: #1A0306;
    --ok: #7FD8A2; --ok-tint: #12251A; --warn: #F2C46B; --warn-tint: #2A2110;
    --info: #9CC3F5; --info-tint: #142133;
    --focus: #FF8089; --focus-halo: #131116;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --paper: #131116; --paper-2: #1A171E; --card: #1E1B23;
  --ink: #F3EFF6; --ink-2: #D3CCDA; --ink-3: #B2AABB;
  --line: #36313D; --line-strong: #8D8598;
  --brand: #FF8089; --brand-hover: #FFB1B7; --brand-tint: #2C1418; --on-brand: #1A0306;
  --ok: #7FD8A2; --ok-tint: #12251A; --warn: #F2C46B; --warn-tint: #2A2110;
  --info: #9CC3F5; --info-tint: #142133;
  --focus: #FF8089; --focus-halo: #131116;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 620;
  line-height: 1.15;
  letter-spacing: -.012em;
  color: var(--ink);
  margin: 0 0 .6em;
  font-optical-sizing: auto;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: var(--step-3); margin-top: 1.6em; }
h3 { font-size: var(--step-2); margin-top: 1.4em; }
h4 { font-size: var(--step-1); margin-top: 1.2em; font-family: var(--font-body); font-weight: 700; letter-spacing: 0; }
p, ul, ol, dl, table, blockquote, figure, details { margin: 0 0 1.15em; }
p { text-wrap: pretty; }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: .45em; }
li::marker { color: var(--brand); }
strong, b { font-weight: 700; color: var(--ink); }
small { font-size: var(--step--1); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
code, kbd {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 4px; padding: .08em .35em;
}
kbd { border-bottom-width: 2px; }
abbr[title] { text-decoration: underline dotted; cursor: help; }

a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}
a:hover { color: var(--brand-hover); text-decoration-thickness: .14em; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--focus-halo);
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--brand); color: var(--on-brand); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Skip link */
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 1000;
  background: var(--ink); color: var(--paper);
  padding: .8rem 1.1rem; border-radius: var(--radius-sm);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 1rem; color: var(--paper); }

/* ---------- Layout ---------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.narrow { max-width: var(--measure); }
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section--alt { background: var(--paper-2); }
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.section h2:first-child, .section .eyebrow + h2 { margin-top: 0; }
.stack > * + * { margin-top: 1rem; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: .75rem;
}
.lead { font-size: var(--step-1); line-height: 1.55; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--ink-3); }

/* ---------- Notice bar (static, in flow — never overlaps) ---------- */
.notice-bar {
  background: var(--ink);
  color: var(--paper);
  font-size: var(--step--1);
  line-height: 1.45;
}
.notice-bar .wrap { padding-block: .6rem; text-align: center; }
.notice-bar strong { color: var(--paper); }
.notice-bar a { color: var(--paper); font-weight: 700; }
.notice-bar a:hover { color: var(--paper); }
:root[data-theme="dark"] .notice-bar,
:root:not([data-theme="light"]) .notice-bar { }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .notice-bar { background: var(--brand-tint); color: var(--ink); }
  :root:not([data-theme="light"]) .notice-bar strong,
  :root:not([data-theme="light"]) .notice-bar a { color: var(--ink); }
}
:root[data-theme="dark"] .notice-bar { background: var(--brand-tint); color: var(--ink); }
:root[data-theme="dark"] .notice-bar strong, :root[data-theme="dark"] .notice-bar a { color: var(--ink); }

/* ---------- Header (not sticky: avoids obscuring focus, WCAG 2.4.11) ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 50;
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; min-height: 4.75rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  text-decoration: none; color: var(--ink);
  font-family: var(--font-display); font-weight: 650; font-size: 1.6rem;
  letter-spacing: -.02em; line-height: 1;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 2.25rem; height: 2.25rem; flex: none;
  border-radius: 8px; background: var(--brand); color: var(--on-brand);
  display: grid; place-items: center;
  font-family: var(--font-display); font-style: italic; font-size: 1.05rem; font-weight: 700;
}
.brand-xs { color: var(--brand); }

.primary-nav { display: flex; align-items: center; gap: .25rem; }
.nav-list { display: flex; align-items: center; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.nav-list > li { position: relative; margin: 0; }
.nav-link, .nav-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  min-height: 2.75rem; padding: .5rem .8rem;
  font: inherit; font-size: 1rem; font-weight: 600;
  color: var(--ink); background: transparent; border: 0; border-radius: var(--radius-sm);
  text-decoration: none; cursor: pointer;
}
.nav-link:hover, .nav-toggle:hover { background: var(--paper-2); color: var(--ink); }
.nav-link[aria-current="page"], .nav-toggle.is-current { color: var(--brand); }
.nav-toggle svg { width: .8em; height: .8em; transition: transform .2s; }
.nav-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav-panel {
  position: absolute; top: calc(100% + .4rem); left: 0;
  min-width: 19rem; padding: .6rem;
  background: var(--card); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  list-style: none; margin: 0;
}
.nav-panel[hidden] { display: none; }
.nav-panel li { margin: 0; }
.nav-panel a {
  display: block; padding: .6rem .75rem; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.35;
}
.nav-panel a span { display: block; font-weight: 400; font-size: var(--step--1); color: var(--ink-3); margin-top: .15rem; }
.nav-panel a:hover { background: var(--paper-2); color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3rem; padding: .7rem 1.35rem;
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.2;
  border-radius: var(--radius-sm); border: 2px solid transparent;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn--primary { background: var(--brand); color: var(--on-brand); }
.btn--primary:hover { background: var(--brand-hover); color: var(--on-brand); }
.btn--secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--secondary:hover { background: var(--ink); color: var(--paper); }
.btn--ghost { background: transparent; color: var(--brand); padding-inline: .2rem; min-height: 2.75rem; }
.btn--small { min-height: 2.75rem; padding: .5rem 1rem; }
.btn svg { width: 1.1em; height: 1.1em; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; }

.menu-toggle { display: none; }

@media (max-width: 64rem) {
  .menu-toggle {
    display: inline-flex; align-items: center; gap: .5rem;
    min-height: 2.75rem; padding: .5rem .9rem;
    font: inherit; font-weight: 700; color: var(--ink);
    background: transparent; border: 2px solid var(--ink); border-radius: var(--radius-sm); cursor: pointer;
  }
  .primary-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch;
    background: var(--card); border-bottom: 1px solid var(--line-strong);
    padding: .75rem var(--gutter) 1.25rem; box-shadow: var(--shadow);
  }
  .primary-nav.is-open { display: flex; }
  .nav-list { flex-direction: column; align-items: stretch; }
  .nav-link, .nav-toggle { width: 100%; justify-content: space-between; font-size: 1.05rem; }
  .nav-panel { position: static; box-shadow: none; border: 0; border-left: 3px solid var(--line); border-radius: 0; margin: .25rem 0 .5rem .75rem; min-width: 0; padding: .25rem 0 .25rem .5rem; }
  .primary-nav .btn { margin-top: .75rem; width: 100%; }
}
@media (max-width: 26rem) { .brand { font-size: 1.35rem; } .brand-mark { width: 2rem; height: 2rem; } }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3rem, 7vw, 6rem) clamp(3rem, 6vw, 5rem); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.hero h1 { max-width: 16ch; }
.hero h1 em { font-style: italic; color: var(--brand); font-weight: 560; }
.hero .lead { margin-bottom: 2rem; }
.hero-proof { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; list-style: none; padding: 0; color: var(--ink-3); font-size: var(--step--1); }
.hero-proof li { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.hero-proof svg { width: 1.1em; height: 1.1em; color: var(--ok); flex: none; }
@media (max-width: 56rem) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }

/* Deadline ledger */
.ledger {
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 1.5rem 1.5rem .75rem; box-shadow: var(--shadow);
}
.ledger h2 { font-size: var(--step-1); margin: 0 0 .25rem; font-family: var(--font-body); font-weight: 700; letter-spacing: 0; }
.ledger > p { color: var(--ink-3); font-size: var(--step--1); margin-bottom: 1rem; }
.ledger ol { list-style: none; padding: 0; margin: 0; }
.ledger li { display: grid; grid-template-columns: 6.6rem 1fr; gap: 1rem; padding: .85rem 0; border-top: 1px solid var(--line); margin: 0; }
.ledger time { font-weight: 700; color: var(--brand); font-size: var(--step--1); line-height: 1.4; }
.ledger .who { font-weight: 700; display: block; line-height: 1.35; }
.ledger .what { color: var(--ink-3); font-size: var(--step--1); line-height: 1.45; display: block; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-block: 1px solid var(--line); margin: 0; }
.stat { padding: 1.75rem 1.25rem 1.5rem; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat dt { order: 2; color: var(--ink-2); font-size: var(--step--1); line-height: 1.45; }
.stat dd { margin: 0 0 .35rem; font-family: var(--font-display); font-size: var(--step-3); font-weight: 600; line-height: 1; color: var(--ink); }
.stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.stat .src { display: block; margin-top: .4rem; font-size: .82rem; color: var(--ink-3); }
@media (max-width: 52rem) { .stats { grid-template-columns: repeat(2, minmax(0,1fr)); } .stat:nth-child(3) { border-left: 0; padding-left: 0; } .stat:nth-child(n+3) { border-top: 1px solid var(--line); } }
@media (max-width: 26rem) { .stats { grid-template-columns: minmax(0, 1fr); } .stat { border-left: 0; padding-left: 0; } .stat + .stat { border-top: 1px solid var(--line); } }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr)); }
.card {
  position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.35rem;
  display: flex; flex-direction: column;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.card h3 { font-size: var(--step-1); margin: 0 0 .5rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card h3 a:hover { color: var(--brand); text-decoration: underline; }
.card h3 a:focus-visible { outline: none; box-shadow: none; }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.card p { color: var(--ink-2); margin-bottom: .75rem; }
.card .card-meta { margin-top: auto; font-size: var(--step--1); color: var(--ink-3); font-weight: 600; }
.card-icon { width: 2.6rem; height: 2.6rem; border-radius: 8px; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; margin-bottom: 1rem; }
.card-icon svg { width: 1.35rem; height: 1.35rem; }
.tag { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); margin-bottom: .5rem; }

/* Process steps */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 1.5rem; }
.steps li { counter-increment: step; margin: 0; padding-top: 1rem; border-top: 3px solid var(--ink); }
.steps li::before { content: "0" counter(step); display: block; font-family: var(--font-display); font-size: var(--step-2); font-weight: 600; color: var(--brand); margin-bottom: .35rem; }
.steps h3 { font-size: var(--step-1); margin: 0 0 .4rem; }
.steps p { color: var(--ink-2); margin: 0; }

/* Split section */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 52rem) { .split { grid-template-columns: minmax(0, 1fr); } }

/* Quote / case */
.case-quote { border-left: 4px solid var(--brand); padding: .25rem 0 .25rem 1.25rem; margin: 0 0 1.5rem; }
.case-quote p { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.4; color: var(--ink); margin-bottom: .5rem; }
.case-quote footer { color: var(--ink-3); font-size: var(--step--1); }

/* ---------- Page header & breadcrumbs ---------- */
.page-head { padding-block: clamp(2.5rem, 5vw, 4rem) clamp(2rem, 4vw, 3rem); border-bottom: 1px solid var(--line); background: var(--paper); }
.page-head h1 { max-width: 22ch; font-size: clamp(2.1rem, 1.7rem + 2vw, 3.3rem); }
.page-head .lead { margin-bottom: 0; }
.crumbs { margin-bottom: 1.5rem; font-size: var(--step--1); }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem .5rem; }
.crumbs li { margin: 0; display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-3); }
.crumbs li + li::before { content: "/"; color: var(--line-strong); }
.crumbs a { color: var(--ink-2); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.article-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin-top: 1.25rem; color: var(--ink-3); font-size: var(--step--1); }
.article-meta span { display: inline-flex; gap: .35rem; align-items: center; }

/* ---------- Article layout ---------- */
.doc { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: clamp(2rem, 5vw, 4.5rem); align-items: start; padding-block: clamp(2.5rem, 5vw, 4rem); }
.doc--single { grid-template-columns: minmax(0, 1fr); }
.doc-aside { position: sticky; top: 1.5rem; order: 2; }
@media (max-width: 64rem) { .doc { grid-template-columns: minmax(0, 1fr); } .doc-aside { position: static; order: 0; } }
.toc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 1rem 1.15rem; font-size: var(--step--1); }
.toc summary { font-weight: 700; cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; list-style-position: inside; }
.toc ol { list-style: none; padding: 0; margin: .5rem 0 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: .4rem 0 .4rem .7rem; border-left: 2px solid var(--line); color: var(--ink-2); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--brand); border-left-color: var(--brand); text-decoration: underline; }
.aside-cta { margin-top: 1.25rem; padding: 1.15rem; border-radius: var(--radius); background: var(--ink); color: var(--paper); font-size: var(--step--1); }
.aside-cta strong { color: var(--paper); display: block; font-size: 1.05rem; margin-bottom: .35rem; }
.aside-cta p { margin: 0 0 .85rem; }
.aside-cta a { color: var(--paper); font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .aside-cta { background: var(--card); border: 1px solid var(--line-strong); color: var(--ink); } :root:not([data-theme="light"]) .aside-cta strong, :root:not([data-theme="light"]) .aside-cta a { color: var(--ink); } }
:root[data-theme="dark"] .aside-cta { background: var(--card); border: 1px solid var(--line-strong); color: var(--ink); }
:root[data-theme="dark"] .aside-cta strong, :root[data-theme="dark"] .aside-cta a { color: var(--ink); }

.prose { max-width: var(--measure); }
.prose > h2 { scroll-margin-top: 1.5rem; padding-top: .25rem; }
.prose > h2:first-child { margin-top: 0; }
.prose img { border-radius: var(--radius); }
.prose ul ul, .prose ol ol { margin-top: .45em; }
.prose blockquote { border-left: 4px solid var(--brand); margin-left: 0; padding: .25rem 0 .25rem 1.25rem; color: var(--ink-2); font-style: italic; }

/* Callouts */
.callout { border-radius: var(--radius); padding: 1.15rem 1.25rem; margin: 1.5rem 0; border: 1px solid var(--line); border-left-width: 5px; background: var(--card); }
.callout > :last-child { margin-bottom: 0; }
.callout > :first-child { margin-top: 0; }
.callout-title { display: block; font-weight: 700; margin-bottom: .35rem; color: var(--ink); }
.callout--key { border-left-color: var(--brand); background: var(--brand-tint); }
.callout--tip { border-left-color: var(--ok); background: var(--ok-tint); }
.callout--warn { border-left-color: var(--warn); background: var(--warn-tint); }
.callout--info { border-left-color: var(--info); background: var(--info-tint); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.table-wrap:focus-visible { outline-offset: 2px; }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); margin: 0; }
caption { text-align: left; font-weight: 700; padding: .9rem 1rem .25rem; color: var(--ink); }
th, td { text-align: left; vertical-align: top; padding: .75rem 1rem; border-bottom: 1px solid var(--line); line-height: 1.5; }
thead th { background: var(--paper-2); color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--line-strong); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 700; }

/* Checklist */
.checklist { list-style: none; padding: 0; }
.checklist li { position: relative; padding-left: 2rem; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .3em; width: 1.15rem; height: 1.15rem; border: 2px solid var(--brand); border-radius: 4px; }

/* Case file */
.case-file { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); padding: 1.25rem 1.35rem; margin: 1.5rem 0 2rem; }
.case-file h3 { margin-top: 0; font-size: var(--step-1); }
.case-file dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: var(--step--1); margin: 0 0 1rem; }
.case-file dt { font-weight: 700; color: var(--ink-3); }
.case-file dd { margin: 0; color: var(--ink); }
.case-file > :last-child { margin-bottom: 0; }
@media (max-width: 30rem) { .case-file dl { grid-template-columns: 1fr; } .case-file dd { margin-bottom: .4rem; } }

/* FAQ */
.faq { border-top: 1px solid var(--line); max-width: var(--measure); }
.faq details { border-bottom: 1px solid var(--line); margin: 0; }
.faq summary {
  cursor: pointer; list-style: none; position: relative;
  padding: 1.15rem 2.5rem 1.15rem 0; min-height: 2.75rem;
  font-weight: 700; font-size: var(--step-0); color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: .35rem; top: 1.45rem;
  width: .65rem; height: .65rem; border-right: 2.5px solid var(--brand); border-bottom: 2.5px solid var(--brand);
  transform: rotate(45deg); transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg); top: 1.75rem; }
.faq summary:hover { color: var(--brand); }
.faq .faq-a { padding: 0 0 1.25rem; color: var(--ink-2); }
.faq .faq-a > :last-child { margin-bottom: 0; }

/* Related */
.related { border-top: 1px solid var(--line); }

/* CTA band */
.cta-band { background: var(--ink); color: var(--paper); }
.cta-band .wrap { display: grid; grid-template-columns: minmax(0, 1.5fr) auto; gap: 2rem; align-items: center; padding-block: clamp(3rem, 6vw, 4.5rem); }
.cta-band h2 { color: var(--paper); margin: 0 0 .5rem; font-size: var(--step-3); }
.cta-band p { color: var(--paper); opacity: .92; margin: 0; max-width: 56ch; }
.cta-band .btn--primary { background: var(--paper); color: var(--ink); }
.cta-band .btn--primary:hover { background: var(--brand-tint); color: var(--ink); }
.cta-band .btn--secondary { color: var(--paper); border-color: var(--paper); }
.cta-band .btn--secondary:hover { background: var(--paper); color: var(--ink); }
.cta-band :focus-visible { outline-color: var(--paper); box-shadow: 0 0 0 6px var(--ink); }
@media (max-width: 52rem) { .cta-band .wrap { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cta-band { background: var(--brand-tint); } :root:not([data-theme="light"]) .cta-band h2, :root:not([data-theme="light"]) .cta-band p { color: var(--ink); } :root:not([data-theme="light"]) .cta-band .btn--primary { background: var(--brand); color: var(--on-brand); } :root:not([data-theme="light"]) .cta-band .btn--secondary { color: var(--ink); border-color: var(--ink); } :root:not([data-theme="light"]) .cta-band :focus-visible { outline-color: var(--focus); box-shadow: none; } }
:root[data-theme="dark"] .cta-band { background: var(--brand-tint); }
:root[data-theme="dark"] .cta-band h2, :root[data-theme="dark"] .cta-band p { color: var(--ink); }
:root[data-theme="dark"] .cta-band .btn--primary { background: var(--brand); color: var(--on-brand); }
:root[data-theme="dark"] .cta-band .btn--secondary { color: var(--ink); border-color: var(--ink); }
:root[data-theme="dark"] .cta-band :focus-visible { outline-color: var(--focus); box-shadow: none; }

/* ---------- Forms ---------- */
.form { max-width: 44rem; }
.field { margin-bottom: 1.35rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
@media (max-width: 36rem) { .field-row { grid-template-columns: minmax(0, 1fr); } }
label, .label { display: block; font-weight: 700; margin-bottom: .4rem; color: var(--ink); }
.req { color: var(--brand); font-weight: 700; }
.hint { display: block; font-size: var(--step--1); color: var(--ink-3); margin: -.15rem 0 .45rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%; min-height: 3rem; padding: .7rem .85rem;
  font: inherit; font-size: 1.0625rem; color: var(--ink);
  background: var(--card); border: 2px solid var(--line-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 9rem; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--focus); }
[aria-invalid="true"] { border-color: var(--brand) !important; border-width: 3px; }
.field-error { display: flex; gap: .4rem; align-items: flex-start; color: var(--brand); font-weight: 700; font-size: var(--step--1); margin-top: .4rem; }
.field-error[hidden] { display: none; }
.check { display: flex; gap: .7rem; align-items: flex-start; font-weight: 400; }
.check input { width: 1.4rem; height: 1.4rem; margin-top: .2rem; accent-color: var(--brand); flex: none; }
.error-summary { border: 3px solid var(--brand); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; background: var(--brand-tint); }
.error-summary h2 { font-size: var(--step-1); margin: 0 0 .5rem; font-family: var(--font-body); }
.error-summary ul { margin: 0; }
.form-status { margin-top: 1rem; font-weight: 700; }
.form-status.is-ok { color: var(--ok); }
.form-status.is-err { color: var(--brand); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Contact layout */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 56rem) { .contact-grid { grid-template-columns: minmax(0, 1fr); } }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { padding: 1rem 0; border-top: 1px solid var(--line); margin: 0; }
.contact-list .k { display: block; font-size: var(--step--1); color: var(--ink-3); font-weight: 700; }

/* ---------- Footer ---------- */
.site-footer { background: var(--paper-2); border-top: 1px solid var(--line); padding-block: clamp(3rem, 6vw, 4.5rem) 2rem; font-size: var(--step--1); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 2rem; }
@media (max-width: 60rem) { .footer-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 30rem) { .footer-grid { grid-template-columns: minmax(0, 1fr); } }
.site-footer h2 { font-family: var(--font-body); font-size: 1rem; font-weight: 700; letter-spacing: 0; margin: 0 0 .75rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 0 0 .15rem; }
.site-footer a { color: var(--ink-2); text-decoration: none; display: inline-block; padding: .3rem 0; }
.site-footer a:hover { color: var(--brand); text-decoration: underline; }
.footer-brand p { color: var(--ink-2); max-width: 34ch; }
.footer-brand address { font-style: normal; color: var(--ink-2); }
.footer-base { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; justify-content: space-between; color: var(--ink-3); }
.footer-base ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.linklike { font: inherit; color: var(--ink-2); background: none; border: 0; padding: .3rem 0; cursor: pointer; text-decoration: none; }
.linklike:hover { color: var(--brand); text-decoration: underline; }
.theme-switch { display: inline-flex; align-items: center; gap: .5rem; }
.theme-switch select { width: auto; min-height: 2.5rem; padding: .3rem 2rem .3rem .6rem; font-size: var(--step--1); }

/* ---------- Consent banner (in page flow: never covers content or focus) ---------- */
.consent { background: var(--paper-2); border-bottom: 2px solid var(--ink); font-size: var(--step--1); }
.consent[hidden] { display: none; }
.consent-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem 2rem; align-items: center; padding-block: 1rem; }
.consent h2 { font-family: var(--font-body); font-size: 1.05rem; margin: 0 0 .25rem; letter-spacing: 0; }
.consent p { margin: 0; color: var(--ink-2); max-width: 70ch; }
.consent fieldset { grid-column: 1 / -1; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); margin: 0; padding: .75rem 1rem 1rem; display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; }
.consent fieldset[hidden] { display: none; }
.consent legend { font-weight: 700; padding: 0 .25rem; }
.consent .check { margin: 0; }
@media (max-width: 52rem) { .consent-inner { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Utilities ---------- */
.center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.pill-list { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; }
.pill-list li { margin: 0; }
.pill-list a, .pill-list span { display: inline-block; padding: .45rem .85rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); text-decoration: none; font-size: var(--step--1); font-weight: 600; min-height: 2.5rem; }
.pill-list a:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- Motion & preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (prefers-contrast: more) {
  :root { --line: #6E6676; --ink-2: #17141B; --ink-3: #2E2934; }
  .card, .toc, .faq details, .table-wrap { border-width: 2px; }
  a { text-decoration-thickness: .14em; }
}
@media (forced-colors: active) {
  .btn, .nav-toggle, .menu-toggle, .card, .consent, .ledger, .callout { border: 2px solid CanvasText; }
  .brand-mark { forced-color-adjust: none; }
  .steps li::before, .eyebrow { color: LinkText; }
}

/* ---------- Print ---------- */
@media print {
  .notice-bar, .site-header, .site-footer, .cta-band, .consent, .doc-aside, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .doc { display: block; padding: 0; }
  a { color: #000; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; word-break: break-all; }
  h2, h3 { break-after: avoid; }
  .case-file, .callout, table { break-inside: avoid; }
}

/* Additions */
.prose--wide { max-width: none; }
.prose--wide > p, .prose--wide > ul, .prose--wide > ol, .prose--wide > h2, .prose--wide > h3 { max-width: var(--measure); }
.hub-body > section { margin-bottom: 2.5rem; }
.hub-body > section h2 { margin-top: 0; }
pre {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 1rem 1.15rem; overflow-x: auto; font-size: .9rem; line-height: 1.55; margin: 0 0 1.25em;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose dl:not(.case-file dl) dt { font-weight: 700; margin-top: .75rem; }
.prose dl:not(.case-file dl) dd { margin-left: 0; color: var(--ink-2); }
.glossary dt { font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; margin-top: 1.75rem; scroll-margin-top: 1rem; }
.glossary dd { margin: .35rem 0 0; color: var(--ink-2); max-width: var(--measure); }
.az { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 0 0 2rem; }
.az li { margin: 0; }
.az a { display: inline-grid; place-items: center; min-width: 2.75rem; min-height: 2.75rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); text-decoration: none; font-weight: 700; }
.az a:hover { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.notfound { padding-block: clamp(4rem, 10vw, 7rem); }

.prose, .hub-body, .doc > *, .grid > * { min-width: 0; }
.prose a, .contact-list a { overflow-wrap: anywhere; }
.btn--ghost { white-space: normal; text-align: left; }
@media (max-width: 26rem) { .btn { white-space: normal; text-align: center; } }
