/* Continuum /doc canonical paper v1.
   Editorial document first: readable prose, restrained diagrams, explicit truth. */

:root {
  color-scheme: light;
  --page-bg:#f6f8fb;
  --paper:#ffffff;
  --paper-raised:#ffffff;
  --paper-soft:#f8fafc;
  --ink:#243044;
  --ink-strong:#111827;
  --muted:#59677b;
  --muted-strong:#40506a;
  --line:#e4e9f0;
  --line-strong:#cfd7e3;
  --blue:#245fca;
  --blue-strong:#174da9;
  --blue-soft:#edf4ff;
  --violet:#7255c7;
  --green:#167a5b;
  --green-soft:#edf9f4;
  --amber:#9a5b10;
  --amber-soft:#fff7e8;
  --red:#b63b47;
  --red-soft:#fff0f1;
  --code-bg:#f5f7fa;
  --shadow:0 20px 56px rgba(29,43,64,.08);
  --doc-width:860px;
  --rail-width:218px;
  --toolbar-height:60px;
}

html[data-theme="dark"] {
  color-scheme:dark;
  --page-bg:#09111d;
  --paper:#0f1927;
  --paper-raised:#111d2c;
  --paper-soft:#0c1623;
  --ink:#cbd7e6;
  --ink-strong:#f3f7fb;
  --muted:#a6b5c8;
  --muted-strong:#c2cede;
  --line:#223247;
  --line-strong:#33465f;
  --blue:#86b5ff;
  --blue-strong:#a9c9ff;
  --blue-soft:#132641;
  --violet:#b5a2ff;
  --green:#7dd9b5;
  --green-soft:#102a24;
  --amber:#efba71;
  --amber-soft:#302515;
  --red:#f1959d;
  --red-soft:#30181d;
  --code-bg:#0a1420;
  --shadow:0 22px 64px rgba(0,0,0,.26);
}

* { box-sizing:border-box; }
html { scroll-behavior:smooth; scroll-padding-top:calc(var(--toolbar-height) + 28px); }
body {
  margin:0;
  background:var(--page-bg);
  color:var(--ink);
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size:16px;
  line-height:1.7;
  text-rendering:optimizeLegibility;
}
a { color:var(--blue); text-underline-offset:3px; }
a:hover { color:var(--blue-strong); }
code,pre { font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace; }
code { padding:.08em .34em; border:1px solid var(--line); border-radius:5px; background:var(--code-bg); color:var(--ink-strong); font-size:.9em; }

.reading-progress { position:fixed; z-index:1400; inset:0 0 auto; height:2px; background:transparent; }
.reading-progress span { display:block; width:0; height:100%; background:var(--blue); }

.document-toolbar {
  position:sticky;
  z-index:1200;
  top:0;
  min-height:var(--toolbar-height);
  border-bottom:1px solid color-mix(in srgb,var(--line) 88%,transparent);
  background:color-mix(in srgb,var(--paper) 92%,transparent);
  -webkit-backdrop-filter:blur(18px) saturate(135%);
  backdrop-filter:blur(18px) saturate(135%);
}
.document-toolbar-inner {
  width:min(1240px,calc(100% - 48px));
  min-height:var(--toolbar-height);
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:24px;
  margin:0 auto;
}
.document-brand { display:inline-flex; align-items:center; gap:10px; color:var(--ink-strong); text-decoration:none; }
.document-brand-mark { width:32px; height:32px; display:grid; place-items:center; border:1px solid var(--line-strong); border-radius:9px; background:var(--paper-soft); color:var(--blue); font-weight:850; }
.document-brand-copy { display:grid; line-height:1.05; }
.document-brand-copy strong { font-size:.84rem; letter-spacing:-.01em; }
.document-brand-copy small { margin-top:4px; color:var(--muted); font-size:.62rem; }
.toolbar-links { display:flex; justify-content:center; gap:22px; }
.toolbar-links a { color:var(--muted-strong); font-size:.72rem; font-weight:720; text-decoration:none; }
.toolbar-links a:hover { color:var(--ink-strong); }
.document-actions { display:flex; align-items:center; gap:7px; }
.document-action,.theme-toggle,.print-button {
  min-height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:0 11px;
  border:1px solid var(--line);
  border-radius:9px;
  background:var(--paper);
  color:var(--muted-strong);
  font:700 .68rem/1 Inter,ui-sans-serif,sans-serif;
  text-decoration:none;
  cursor:pointer;
}
.document-action:hover,.theme-toggle:hover,.print-button:hover { border-color:var(--line-strong); background:var(--paper-soft); color:var(--ink-strong); }
.theme-toggle-icon { width:15px; height:15px; position:relative; display:block; }
.theme-toggle-sun,.theme-toggle-moon { position:absolute; inset:2px; border:1.5px solid currentColor; border-radius:50%; }
.theme-toggle-moon { display:none; }
html[data-theme="dark"] .theme-toggle-sun { display:none; }
html[data-theme="dark"] .theme-toggle-moon { display:block; border-radius:50%; border-top-color:transparent; transform:rotate(-25deg); }

.document-shell {
  width:min(1240px,calc(100% - 48px));
  display:grid;
  grid-template-columns:var(--rail-width) minmax(0,1fr);
  gap:48px;
  align-items:start;
  margin:0 auto;
  padding:38px 0 96px;
}
.document-rail { min-width:0; }
.rail-sticky { position:sticky; top:calc(var(--toolbar-height) + 28px); }
.rail-eyebrow { margin:0 0 8px; color:var(--blue); font-size:.64rem; font-weight:850; letter-spacing:.15em; }
.rail-title { display:block; max-width:182px; color:var(--ink-strong); font-size:.94rem; line-height:1.38; letter-spacing:-.014em; }
.document-toc { display:grid; gap:1px; margin-top:24px; }
.document-toc a {
  position:relative;
  display:block;
  min-height:34px;
  padding:8px 9px 8px 13px;
  border-left:2px solid transparent;
  color:var(--muted);
  font-size:.69rem;
  line-height:1.35;
  text-decoration:none;
}
.document-toc a:hover { color:var(--ink-strong); }
.document-toc a[aria-current="location"] { border-left-color:var(--blue); color:var(--ink-strong); background:linear-gradient(90deg,var(--blue-soft),transparent); font-weight:760; }
.rail-status { display:grid; grid-template-columns:8px minmax(0,1fr); gap:10px; margin-top:24px; padding-top:17px; border-top:1px solid var(--line); }
.status-dot { width:7px; height:7px; margin-top:6px; border-radius:50%; background:var(--green); box-shadow:0 0 0 4px color-mix(in srgb,var(--green) 10%,transparent); }
.rail-status strong { display:block; color:var(--ink-strong); font-size:.68rem; }
.rail-status p { margin:4px 0 0; color:var(--muted); font-size:.63rem; line-height:1.48; }

.document-content { min-width:0; }
.document-paper {
  width:min(var(--doc-width),100%);
  margin:0;
  overflow:visible;
  min-width:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
}
.document-section {
  position:relative;
  margin:0;
  padding:76px 0 0;
  border:0;
  background:transparent;
}
.document-section:first-child { padding-top:18px; }
.document-section + .document-section::before {
  content:"";
  position:absolute;
  top:34px;
  right:0;
  left:0;
  height:1px;
  background:var(--line);
}
.section-kicker,.hero-kicker { margin:0 0 13px; color:var(--blue); font-size:.7rem; font-weight:850; letter-spacing:.14em; }
.document-section h1,.document-section h2,.document-section h3 { color:var(--ink-strong); }
.document-section h1 {
  max-width:780px;
  margin:0;
  font-size:clamp(2.8rem,4.8vw,4.45rem);
  line-height:1;
  letter-spacing:-.055em;
  text-wrap:balance;
}
.document-section h2 {
  max-width:740px;
  margin:0;
  font-size:clamp(1.9rem,3.35vw,2.75rem);
  line-height:1.08;
  letter-spacing:-.045em;
  text-wrap:balance;
}
.document-section h3 { margin:34px 0 8px; font-size:1.08rem; line-height:1.35; letter-spacing:-.018em; }
.document-section p { max-width:720px; margin:14px 0 0; }
.section-intro { max-width:740px!important; margin-top:16px!important; color:var(--muted-strong); font-size:1.02rem; line-height:1.72; }

.continuum-hero .hero-lead {
  max-width:760px;
  margin-top:26px;
  color:var(--ink-strong);
  font-size:clamp(1.16rem,1.72vw,1.38rem);
  line-height:1.58;
  letter-spacing:-.016em;
}
.hero-support { max-width:740px!important; margin-top:18px!important; color:var(--muted-strong); font-size:1rem; }
.hero-thesis { max-width:740px!important; margin-top:24px!important; color:var(--muted-strong); font-size:1.03rem; }
.hero-thesis strong { color:var(--ink-strong); }

.doc-figure {
  max-width:840px;
  margin:32px 0 0;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--paper-soft);
}
.doc-figure figcaption {
  padding:10px 14px;
  border-bottom:1px solid var(--line);
  color:var(--muted);
  font-size:.64rem;
  font-weight:820;
  letter-spacing:.1em;
  text-transform:uppercase;
}
.doc-figure pre {
  margin:0;
  padding:22px 24px;
  overflow:auto;
  background:transparent;
  color:var(--ink-strong);
  font-size:.78rem;
  line-height:1.75;
  white-space:pre;
  scrollbar-width:thin;
}
.architecture-line { margin-top:36px; border-color:color-mix(in srgb,var(--blue) 28%,var(--line)); background:linear-gradient(180deg,color-mix(in srgb,var(--blue-soft) 58%,var(--paper-soft)),var(--paper-soft)); }
.architecture-line pre { color:var(--blue-strong); font-weight:650; }

.principle-callout,.boundary-note {
  max-width:780px;
  margin-top:24px;
  padding:17px 19px;
  border-left:3px solid var(--blue);
  background:var(--paper-soft);
}
.principle-callout strong,.boundary-note strong { color:var(--ink-strong); font-size:.9rem; }
.principle-callout p,.boundary-note p { margin:5px 0 0; color:var(--muted); font-size:.84rem; line-height:1.55; }
.principle-callout.compact { margin-top:26px; }
.opening-summary { max-width:820px; margin-top:30px; padding-top:20px; border-top:1px solid var(--line); }
.opening-summary p { margin:10px 0 0; color:var(--muted-strong); }
.opening-summary strong { color:var(--ink-strong); }

.layer-list { max-width:850px; margin-top:30px; border-top:1px solid var(--line); }
.layer-row { display:grid; grid-template-columns:46px minmax(0,1fr); gap:16px; padding:18px 0; border-bottom:1px solid var(--line); }
.layer-row>span { padding-top:2px; color:var(--blue); font:800 .72rem/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; }
.layer-row strong { color:var(--ink-strong); font-size:.98rem; }
.layer-row p { margin:4px 0 0; color:var(--muted); font-size:.88rem; line-height:1.6; }

.doctrine-quote,.closing-thesis {
  max-width:780px;
  margin:30px 0 0;
  padding:24px 0 24px 24px;
  border-left:3px solid var(--ink-strong);
}
.doctrine-quote p,.closing-thesis p { margin:0; color:var(--ink-strong); font-size:1.14rem; line-height:1.55; }
.doctrine-quote p+p,.closing-thesis p+p { margin-top:7px; }
.state-proof { max-width:820px; margin-top:30px; padding-top:20px; border-top:1px solid var(--line); }
.state-proof h3 { margin:0 0 7px; }
.state-proof p { margin-top:9px; }

.plain-example { max-width:790px; margin-top:26px; padding:16px 18px; border:1px solid var(--line); border-radius:10px; background:var(--paper-soft); }
.plain-example span { color:var(--blue); font-size:.62rem; font-weight:850; letter-spacing:.13em; }
.plain-example p { margin:7px 0 0; color:var(--ink-strong); font-size:.96rem; }

.authority-levels { max-width:830px; margin-top:27px; border-top:1px solid var(--line); }
.authority-levels div { display:grid; grid-template-columns:140px minmax(0,1fr); gap:18px; padding:12px 0; border-bottom:1px solid var(--line); }
.authority-levels strong { color:var(--ink-strong); font-size:.76rem; letter-spacing:.04em; }
.authority-levels span { color:var(--muted); font-size:.86rem; }

.maturity { display:inline-flex; align-items:center; min-height:21px; padding:2px 7px; border:1px solid currentColor; border-radius:999px; font-size:.61rem; font-weight:850; line-height:1; letter-spacing:.04em; vertical-align:middle; white-space:nowrap; }
.maturity-live { color:var(--green); background:var(--green-soft); }
.maturity-building { color:var(--blue); background:var(--blue-soft); }
.maturity-planned { color:var(--amber); background:var(--amber-soft); }
.maturity-future { color:var(--violet); background:color-mix(in srgb,var(--violet) 9%,var(--paper)); }

.continuity-sequence { max-width:850px; margin-top:28px; border-top:1px solid var(--line); }
.continuity-sequence>div { display:grid; grid-template-columns:42px minmax(0,1fr) auto; gap:14px; align-items:start; padding:16px 0; border-bottom:1px solid var(--line); }
.continuity-sequence>div>span { color:var(--blue); font:800 .7rem/1.7 ui-monospace,SFMono-Regular,Menlo,monospace; }
.continuity-sequence p { margin:0; color:var(--muted); font-size:.88rem; }
.continuity-sequence p strong { color:var(--ink-strong); }
.continuity-sequence em { padding-top:2px; color:var(--muted); font-size:.6rem; font-style:normal; font-weight:820; letter-spacing:.05em; white-space:nowrap; }

.maturity-legend { max-width:850px; margin-top:27px; padding:15px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.maturity-legend p { display:grid; grid-template-columns:150px minmax(0,1fr); gap:14px; align-items:center; margin:8px 0; color:var(--muted); font-size:.82rem; }
.maturity-legend .maturity { justify-self:start; }
.table-scroll { max-width:900px; margin-top:24px; overflow-x:auto; border:1px solid var(--line); border-radius:10px; background:var(--paper); scrollbar-width:thin; }
.table-scroll:focus-visible { outline:3px solid color-mix(in srgb,var(--blue) 28%,transparent); outline-offset:3px; }
.maturity-table { width:100%; min-width:760px; border-collapse:collapse; table-layout:fixed; }
.maturity-table th,.maturity-table td { padding:13px 14px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
.maturity-table th { background:var(--paper-soft); color:var(--muted); font-size:.68rem; font-weight:850; letter-spacing:.06em; text-transform:uppercase; }
.maturity-table th:nth-child(1) { width:28%; }
.maturity-table th:nth-child(2) { width:18%; }
.maturity-table td { color:var(--muted-strong); font-size:.79rem; line-height:1.52; }
.maturity-table td:first-child { color:var(--ink-strong); font-weight:720; }
.maturity-table tr:last-child td { border-bottom:0; }

.engineering-principles { max-width:840px; margin-top:28px; border-top:1px solid var(--line); }
.engineering-principles p { margin:0; padding:13px 0; border-bottom:1px solid var(--line); color:var(--muted); font-size:.87rem; }
.engineering-principles strong { color:var(--ink-strong); }
.closing-thesis { margin-top:36px; border-left-color:var(--blue); }
.closing-thesis p:first-child { color:var(--muted-strong); }

.footer-actions.continuum-product-actions { max-width:850px; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1px; margin-top:34px; overflow:hidden; border:1px solid var(--line); border-radius:10px; background:var(--line); }
.continuum-route-link { min-width:0; display:grid; gap:4px; padding:15px; background:var(--paper); color:var(--ink); text-decoration:none; }
.footer-actions.continuum-product-actions .continuum-route-link { border:0; border-radius:0; box-shadow:none; }
.continuum-route-link:hover { background:var(--paper-soft); color:var(--ink-strong); }
.footer-actions.continuum-product-actions .continuum-route-link:hover,
.footer-actions.continuum-product-actions .continuum-route-link:focus-visible { border-color:transparent; }
.continuum-route-link span { color:var(--green); font-size:.58rem; font-weight:850; letter-spacing:.09em; }
.continuum-route-link strong { color:var(--ink-strong); font-size:.82rem; }
.continuum-route-link small { color:var(--muted); font-size:.68rem; line-height:1.4; }

.document-section :focus-visible,.document-toolbar :focus-visible { outline:3px solid color-mix(in srgb,var(--blue) 32%,transparent); outline-offset:3px; }

@media (max-width:1320px) {
  .document-toolbar-inner,.document-shell { width:min(1180px,calc(100% - 36px)); }
  .document-shell { gap:42px; }
}

@media (max-width:1160px) {
  :root { --rail-width:220px; }
  .document-shell { gap:34px; }
  .toolbar-links { gap:16px; }
}

@media (max-width:1040px) {
  .toolbar-links { display:none; }
  .document-toolbar-inner { grid-template-columns:auto 1fr auto; }
  .document-actions { grid-column:3; }
}

@media (max-width:980px) {
  .document-toolbar-inner,.document-shell { width:min(900px,calc(100% - 28px)); }
  .document-shell { display:block; padding-top:26px; }
  .document-rail { display:none; }
  .document-paper { width:100%; }
  .document-section:first-child { padding-top:14px; }
}

@media (max-width:680px) {
  :root { --toolbar-height:60px; }
  .document-toolbar-inner { width:calc(100% - 22px); gap:10px; }
  .document-brand-copy small,.document-action span:last-child,.theme-toggle-label,.print-button span:last-child { display:none; }
  .document-action,.theme-toggle,.print-button { width:38px; padding:0; }
  .document-actions { gap:5px; }
  .document-shell { width:calc(100% - 32px); padding-bottom:74px; }
  .document-section { padding-top:66px; }
  .document-section + .document-section::before { top:30px; }
  .document-section h1 { font-size:clamp(2.35rem,9.8vw,3.1rem); line-height:1.02; letter-spacing:-.05em; }
  .document-section h2 { font-size:clamp(1.85rem,9vw,2.5rem); }
  .continuum-hero .hero-lead { font-size:1.12rem; }
  .hero-support,.section-intro { font-size:.97rem!important; }
  .doc-figure { border-radius:9px; }
  .doc-figure pre { padding:17px; font-size:.68rem; line-height:1.65; }
  .layer-row { grid-template-columns:36px minmax(0,1fr); gap:10px; }
  .authority-levels div { grid-template-columns:116px minmax(0,1fr); gap:10px; }
  .continuity-sequence>div { grid-template-columns:32px minmax(0,1fr); gap:10px; }
  .continuity-sequence em { grid-column:2; }
  .maturity-legend p { grid-template-columns:1fr; gap:5px; }
  .footer-actions.continuum-product-actions { grid-template-columns:1fr; }
}

@media (max-width:430px) {
  .document-shell { width:calc(100% - 32px); }
  .document-section h1 { font-size:clamp(2.2rem,10.8vw,2.75rem); line-height:1.03; }
  .document-section h2 { font-size:1.8rem; }
  .doc-figure pre { font-size:.64rem; }
  .authority-levels div { grid-template-columns:1fr; gap:2px; }
  .doctrine-quote,.closing-thesis { padding-left:16px; }
}

@media (max-width:360px) {
  .document-toolbar-inner { width:calc(100% - 16px); }
  .document-brand-copy { display:none; }
  .document-shell { width:calc(100% - 28px); }
  .doc-figure pre { padding:14px; font-size:.6rem; }
}

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

@media print {
  :root { --page-bg:#fff; --paper:#fff; --paper-raised:#fff; --paper-soft:#fff; --ink:#222; --ink-strong:#000; --muted:#555; --muted-strong:#333; --line:#d9d9d9; --line-strong:#c9c9c9; --blue:#204f9b; --blue-strong:#173d78; --code-bg:#f4f4f4; }
  body { background:#fff; color:#222; font-size:10.5pt; }
  .reading-progress,.document-toolbar,.document-rail,.mobile-contents-trigger,.mobile-contents-backdrop,.mobile-contents-drawer,.footer-actions { display:none!important; }
  .document-shell { width:100%; display:block; margin:0; padding:0; }
  .document-paper { width:100%; max-width:none; }
  .document-section { padding:28pt 0 0; break-inside:auto; }
  .document-section:first-child { padding-top:0; }
  .document-section + .document-section::before { top:14pt; }
  .document-section h1 { font-size:36pt; }
  .document-section h2 { font-size:23pt; }
  .doc-figure,.plain-example,.principle-callout,.boundary-note,.table-scroll { break-inside:avoid; box-shadow:none; }
  .table-scroll { overflow:visible; }
  .maturity-table { min-width:0; font-size:8.5pt; }
  a { color:inherit; text-decoration:none; }
}
