/* ============================================================================
   Production RAG · reference guide · oriolrius.me identity
   Tokens measured from oriolrius.me (same values as slidev-theme-oriolrius):
   orange #FF6600 is a NON-TEXT accent; orange text uses the AA inks below.
   ========================================================================== */

/* ── fonts (bundled, offline-safe) ─────────────────────────────────────────── */
@font-face { font-family: 'Ubuntu'; src: url('../fonts/ubuntu-latin-300-normal.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Ubuntu'; src: url('../fonts/ubuntu-latin-300-italic.woff2') format('woff2'); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: 'Ubuntu'; src: url('../fonts/ubuntu-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Ubuntu'; src: url('../fonts/ubuntu-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Ubuntu'; src: url('../fonts/ubuntu-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Ubuntu'; src: url('../fonts/ubuntu-latin-500-italic.woff2') format('woff2'); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: 'Ubuntu'; src: url('../fonts/ubuntu-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Ubuntu'; src: url('../fonts/ubuntu-latin-700-italic.woff2') format('woff2'); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Ubuntu Sans Mono'; src: url('../fonts/ubuntu-sans-mono-latin-wght-normal.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Ubuntu Sans Mono'; src: url('../fonts/ubuntu-sans-mono-latin-wght-italic.woff2') format('woff2'); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Yanone Kaffeesatz'; src: url('../fonts/yanone-kaffeesatz-latin-wght-normal.woff2') format('woff2'); font-weight: 200 700; font-display: swap; }
/* arrows / checks the brand fonts lack (DejaVu subsets) */
@font-face { font-family: 'Or Symbols'; src: url('../fonts/or-symbols-400.woff2') format('woff2'); font-weight: 100 599; unicode-range: U+2190-2199, U+21A9-21AA, U+21D0-21D5, U+2713-2718, U+25A0-25A1, U+25B2-25BC; }
@font-face { font-family: 'Or Symbols'; src: url('../fonts/or-symbols-700.woff2') format('woff2'); font-weight: 600 900; unicode-range: U+2190-2199, U+21A9-21AA, U+21D0-21D5, U+2713-2718, U+25A0-25A1, U+25B2-25BC; }
@font-face { font-family: 'Or Symbols Mono'; src: url('../fonts/or-symbols-mono-400.woff2') format('woff2'); font-weight: 100 599; size-adjust: 93%; unicode-range: U+2190-2199, U+21A9-21AA, U+21D0-21D5, U+2713-2718, U+25A0-25A1, U+25B2-25BC, U+2500-257F; }
/* Font Awesome webfonts live in ../webfonts (fontawesome.min.css resolves them) */

:root {
  --or-orange: #FF6600;
  --or-orange-brand: #F46524;
  --or-orange-ink: #C95000;
  --or-orange-ink-deep: #A84300;
  --or-orange-ink-large: #E85A12;
  --or-orange-bright: #FF8533;
  --or-orange-050: #FFF3EB;
  --or-slate: #54595F;
  --or-gray-text: #575757;
  --or-gray-muted: #7A7A7A;
  --or-gray-100: #F4F4F4;
  --or-hairline: #D5D6D7;
  --or-navy: #151652;
  --or-navy-900: #0E0F3A;
  --or-navy-700: #23246B;
  --or-navy-500: #3D3F99;
  --or-navy-300: #8C8FBF;
  --or-navy-100: #E8E8F4;
  --or-green-ink: #0C8760;
  --or-red-ink: #B42318;

  --font-sans: 'Ubuntu', 'Or Symbols', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Ubuntu Sans Mono', 'Or Symbols Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-display: 'Yanone Kaffeesatz', 'Or Symbols', 'Ubuntu Condensed', sans-serif;

  --topbar-h: 68px;
  --side-w: 288px;
  --toc-w: 248px;
  --measure: 46rem;
  --ease: cubic-bezier(.25, .1, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 20px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: .2px;
  color: var(--or-gray-text);
  background: #fff;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--or-orange-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--or-orange-ink-deep); }
img, svg { max-width: 100%; }
kbd {
  font-family: var(--font-mono); font-size: .72rem; line-height: 1; padding: .2rem .4rem;
  border: 1px solid var(--or-hairline); border-bottom-width: 2px; border-radius: 4px; color: var(--or-slate); background: #fff;
}
::selection { background: var(--or-orange-050); color: var(--or-navy); }
:focus-visible { outline: 2px solid var(--or-orange); outline-offset: 2px; }

/* ── reading progress hairline (theme: 3px orange) ────────────────────────── */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--or-orange); transition: width .1s linear; }

/* ── top bar: white, framed logo, grey nav (as on oriolrius.me) ───────────── */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--or-hairline);
}
.topbar-inner { height: 100%; max-width: 1560px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; flex: none; }
.brand img { height: 34px; width: auto; display: block; }
.brand-sep { width: 1px; height: 30px; background: var(--or-hairline); }
.brand-title { display: flex; flex-direction: column; line-height: 1.1; font-weight: 700; color: var(--or-slate); font-size: 1.05rem; letter-spacing: .3px; }
.brand-title small { font-weight: 400; font-size: .74rem; color: var(--or-gray-muted); letter-spacing: 1.2px; text-transform: uppercase; margin-top: 3px; }
.topnav { margin-left: auto; display: flex; gap: 26px; align-items: center; }
.topnav a { color: var(--or-gray-muted); text-decoration: none; font-size: .98rem; letter-spacing: .5px; transition: color .2s var(--ease); white-space: nowrap; }
.topnav a:hover { color: var(--or-orange); }
.topnav a.ext i { font-size: .7em; margin-left: 3px; }
.search-open {
  margin-left: 18px; display: flex; align-items: center; gap: 10px; min-width: 260px;
  padding: 8px 10px 8px 14px; border: 1px solid var(--or-hairline); background: var(--or-gray-100);
  color: var(--or-gray-muted); font: inherit; font-size: .9rem; cursor: pointer; border-radius: 0;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.search-open:hover { border-color: var(--or-orange); background: #fff; }
.search-open span { flex: 1; text-align: left; }
.lang-switch { display: flex; flex: none; border: 1px solid var(--or-hairline); margin-left: 4px; }
.lang-switch a { font: 500 .78rem var(--font-sans); letter-spacing: 1px; padding: 6px 9px; color: var(--or-gray-muted); text-decoration: none; transition: all .2s var(--ease); }
.lang-switch a + a { border-left: 1px solid var(--or-hairline); }
.lang-switch a:hover { color: var(--or-orange-ink); background: var(--or-orange-050); }
.lang-switch a.current { background: var(--or-slate); color: #fff; cursor: default; }
.prose h2 .alias { position: absolute; top: 0; }
.nav-toggle { display: none; border: 0; background: none; font-size: 1.3rem; color: var(--or-slate); cursor: pointer; padding: 6px; }

/* ── shell: sidebar · content · toc ───────────────────────────────────────── */
.shell { max-width: 1560px; margin: 0 auto; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w); }
.layout-wide .shell { display: block; max-width: none; }

.sidebar { border-right: 1px solid var(--or-hairline); background: #fff; }
.sidebar-inner { position: sticky; top: var(--topbar-h); max-height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 26px 18px 40px 26px; scrollbar-width: thin; }
.side-home { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: var(--or-slate); text-decoration: none; font-weight: 500; font-size: .95rem; }
.side-home i { color: var(--or-orange); width: 18px; text-align: center; }
.side-home:hover, .side-home.active { background: var(--or-orange-050); color: var(--or-navy); }
.side-track { margin-top: 20px; }
.side-track-name { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; font-size: 1.05rem; color: var(--or-orange-ink-large); padding: 0 10px 6px; }
.side-track ol { list-style: none; margin: 0; padding: 0; }
.side-track > ol > li > a { display: grid; grid-template-columns: 26px 1fr; gap: 6px; padding: 6px 10px; text-decoration: none; color: var(--or-gray-text); font-size: .9rem; line-height: 1.35; border-left: 3px solid transparent; }
.side-track > ol > li > a .num { font-family: var(--font-mono); font-size: .8rem; color: var(--or-gray-muted); padding-top: 1px; }
.side-track > ol > li > a:hover { color: var(--or-navy); background: var(--or-gray-100); }
.side-track > ol > li.active > a { border-left-color: var(--or-orange); background: var(--or-orange-050); color: var(--or-navy); font-weight: 500; }
.side-track > ol > li.active > a .num { color: var(--or-orange-ink); }
.side-sections { list-style: none; margin: 4px 0 10px; padding: 0 0 0 39px; border-left: 0; display: none; }
@media (max-width: 1280px) { .side-sections { display: block; } }
.side-sections a { display: block; padding: 3px 8px; font-size: .8rem; line-height: 1.35; color: var(--or-gray-muted); text-decoration: none; border-left: 1px solid var(--or-hairline); }
.side-sections a:hover { color: var(--or-orange-ink); }
.side-sections a.current { color: var(--or-navy); border-left: 2px solid var(--or-orange); font-weight: 500; }
.sidebar .side-home:last-child { margin-top: 22px; }

.content { min-width: 0; padding: 48px 56px 80px; }
.doc { max-width: var(--measure); margin: 0 auto; }

.toc { border-left: 1px solid transparent; }
.toc-inner { position: sticky; top: var(--topbar-h); max-height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 48px 24px 40px 8px; scrollbar-width: thin; }
.toc-title { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; font-size: 1.05rem; color: var(--or-slate); margin-bottom: 10px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--or-hairline); }
.toc li a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; font-size: .8rem; line-height: 1.4; color: var(--or-gray-muted); text-decoration: none; transition: color .15s var(--ease); }
.toc li a:hover { color: var(--or-orange-ink); }
.toc li a.current { color: var(--or-navy); border-left-color: var(--or-orange); font-weight: 500; }
.toc-top { display: inline-block; margin-top: 18px; font-size: .8rem; color: var(--or-gray-muted); text-decoration: none; }
.toc-top:hover { color: var(--or-orange-ink); }

/* ── document header ──────────────────────────────────────────────────────── */
.kicker { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; font-size: 1.3rem; color: var(--or-orange-ink-large); display: flex; gap: 8px; align-items: baseline; }
.kicker .dot { color: var(--or-hairline); }
.doc-head h1 {
  margin: 6px 0 0; font-size: clamp(2rem, 1.3rem + 2.2vw, 2.85rem); line-height: 1.15; font-weight: 700; color: var(--or-slate); letter-spacing: -.2px; text-wrap: balance;
}
.doc-head h1::after { content: ''; display: block; width: 110px; height: 4px; background: var(--or-orange); margin-top: 22px; }
.doc-blurb { font-size: 1.22rem; font-weight: 300; font-style: italic; color: var(--or-slate); line-height: 1.5; margin: 22px 0 14px; text-wrap: pretty; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: .85rem; color: var(--or-gray-muted); margin-bottom: 26px; }
.doc-meta i { color: var(--or-orange); margin-right: 5px; }

/* ── audio card ───────────────────────────────────────────────────────────── */
.audio-card { display: grid; grid-template-columns: 56px 1fr; gap: 16px; align-items: center; padding: 16px 18px; margin: 4px 0 34px; background: var(--or-navy); color: #F4F4F4; border-left: 4px solid var(--or-orange); }
.audio-icon { width: 56px; height: 56px; display: grid; place-items: center; border: 2px solid var(--or-orange); color: var(--or-orange-bright); font-size: 1.4rem; }
.audio-kicker { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 1.3px; font-size: 1rem; font-weight: 600; color: var(--or-orange-bright); }
.audio-title { font-weight: 500; color: #fff; margin: 0 0 8px; line-height: 1.3; }
.audio-card audio { width: 100%; height: 36px; display: block; }

/* ── prose ────────────────────────────────────────────────────────────────── */
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.05em; text-wrap: pretty; }
.prose strong { color: var(--or-slate); font-weight: 700; }
.prose em { font-style: italic; }
.prose h2 {
  position: relative; margin: 2.6em 0 .8em; padding-top: 18px; font-size: 1.62rem; line-height: 1.25; font-weight: 500; color: var(--or-slate); text-wrap: balance;
}
.prose h2::before { content: ''; position: absolute; top: 0; left: 0; width: 44px; height: 3px; background: var(--or-orange); }
.prose h2 .anchor { position: absolute; left: -1.6em; top: 20px; font-size: .55em; padding: .5em; color: var(--or-hairline); opacity: 0; transition: opacity .2s var(--ease); text-decoration: none; }
.prose h2:hover .anchor { opacity: 1; }
.prose h2 .anchor:hover { color: var(--or-orange); }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.6em; }
.prose li { margin: .32em 0; padding-left: .2em; }
.prose li > ul, .prose li > ol { margin: .3em 0 .4em; }
.prose ul { list-style: none; padding-left: 1.4em; }
.prose ul > li { position: relative; }
.prose ul > li::before { content: '\f105'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; left: -1.15em; top: 0; color: var(--or-orange); font-size: .9em; }
.prose ul ul > li::before { content: ''; width: 6px; height: 6px; background: var(--or-orange); top: .72em; left: -1em; }
.prose ol > li::marker { color: var(--or-orange-ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.prose .indent { padding-left: 1.4em; border-left: 2px solid var(--or-gray-100); margin-bottom: 1em; }
.prose hr.divider { border: 0; height: 1px; background: var(--or-hairline); margin: 2.2em 0; }

.prose code, .callout code, .toggle summary code, table code {
  font-family: var(--font-mono); font-size: .88em; background: var(--or-gray-100); color: var(--or-navy);
  padding: .1em .38em; border-radius: 3px; overflow-wrap: anywhere;
}
.prose blockquote {
  margin: 1.5em 0; padding: .3em 0 .3em 1.3em; border-left: 6px solid var(--or-orange);
  font-style: italic; color: var(--or-slate); font-size: 1.06rem;
}
.prose blockquote p { margin: 0 0 .5em; }
.prose blockquote p:last-child { margin-bottom: 0; }

/* timestamps → YouTube chip (theme's <Ts>) */
a.ts {
  display: inline-flex; align-items: center; gap: .3em; font-family: var(--font-mono); font-style: normal; font-size: .76em; font-weight: 500;
  padding: .05em .45em; border: 1px solid #F3C7A9; background: var(--or-orange-050); color: var(--or-orange-ink-deep);
  text-decoration: none; border-radius: 3px; white-space: nowrap; vertical-align: .08em; line-height: 1.5;
}
a.ts i { font-size: .95em; color: #E62117; }
a.ts:hover { border-color: var(--or-orange); color: var(--or-navy); }

/* ── callouts (semantic kind from the Notion colour) ──────────────────────── */
.callout {
  --c: var(--or-slate); --tint: color-mix(in srgb, var(--c) 7%, #fff);
  display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 0 .9rem; align-items: start;
  margin: 1.5em 0; padding: 1rem 1.25rem 1rem 1.1rem; background: var(--tint); border-left: 4px solid var(--c);
  color: #3F4348; font-size: .96rem; line-height: 1.62;
}
.callout-icon { color: var(--c); font-size: 1.12rem; line-height: 1.6; text-align: center; padding-top: .05rem; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-body p { margin: 0 0 .7em; }
.callout a:not(.ts) { color: var(--or-orange-ink-deep); }
.callout.danger { --c: #B42318; }
.callout.warning { --c: var(--or-orange-ink); }
.callout.caution { --c: #9A6700; }
.callout.info { --c: var(--or-navy-500); }
.callout.tip { --c: var(--or-green-ink); }
.callout.note { --c: var(--or-slate); --tint: var(--or-gray-100); }
.callout.insight { --c: var(--or-navy); --tint: var(--or-navy-100); }
.callout code { background: rgba(255, 255, 255, .75); }

/* ── toggles ──────────────────────────────────────────────────────────────── */
.toggle { margin: 1.4em 0; border: 1px solid var(--or-hairline); background: #fff; }
.toggle > summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 1.2rem 1fr; gap: .7rem; align-items: start;
  padding: .85rem 1.1rem; font-weight: 500; color: var(--or-slate); background: var(--or-gray-100); line-height: 1.45;
}
.toggle > summary::-webkit-details-marker { display: none; }
.toggle > summary i { color: var(--or-orange); font-size: .8rem; padding-top: .35rem; transition: transform .2s var(--ease); }
.toggle[open] > summary i { transform: rotate(90deg); }
.toggle > summary:hover { color: var(--or-navy); }
.toggle-body { padding: 1.1rem 1.25rem .4rem; border-top: 1px solid var(--or-hairline); }
.toggle-body > :first-child { margin-top: 0; }

/* ── code blocks: navy surface, orange bar, brand syntax colours ──────────── */
figure.code { position: relative; margin: 1.5em 0; background: var(--or-navy); border-left: 4px solid var(--or-orange); }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 0 16px; }
.code-head .lang { font-family: var(--font-mono); font-size: .72rem; letter-spacing: 1px; text-transform: uppercase; color: var(--or-navy-300); }
.copy { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--or-navy-500); background: transparent; color: var(--or-navy-300); font: 500 .72rem var(--font-sans); padding: 4px 9px; cursor: pointer; letter-spacing: .4px; transition: all .2s var(--ease); }
.copy:hover { color: #fff; border-color: var(--or-orange-bright); }
.copy.done { color: #3CCB98; border-color: #3CCB98; }
figure.code pre { margin: 0; padding: 10px 18px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: .84rem; line-height: 1.6; color: #F4F4F4; tab-size: 4; scrollbar-color: var(--or-navy-500) transparent; }
figure.code pre code { font: inherit; background: none; padding: 0; color: inherit; overflow-wrap: normal; }
figure.code.long:not(.open) pre { max-height: 31rem; overflow-y: hidden; mask-image: linear-gradient(#000 82%, transparent); -webkit-mask-image: linear-gradient(#000 82%, transparent); }
.expand { display: flex; width: 100%; justify-content: center; align-items: center; gap: 8px; border: 0; border-top: 1px solid var(--or-navy-700); background: var(--or-navy-900); color: var(--or-orange-bright); font: 500 .8rem var(--font-sans); padding: 9px; cursor: pointer; letter-spacing: .4px; }
.expand:hover { color: #fff; }
figure.code.open .expand i { transform: rotate(180deg); }
figure.code figcaption, figure figcaption { font-size: .82rem; color: var(--or-gray-muted); }
figure.code figcaption { background: #fff; padding: 8px 0 0; }
/* pygments tokens · oriolrius-navy palette (every token ≥ 6.28:1 on #151652) */
.c, .ch, .cm, .c1, .cs, .cp, .cpf { color: #9A9CC8; font-style: italic; }
.k, .kc, .kd, .kn, .kp, .kr, .kt, .ow, .nt { color: #FF8533; }
.s, .sa, .sb, .sc, .dl, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss { color: #D2B922; }
.m, .mb, .mf, .mh, .mi, .il, .mo, .kc { color: #FFB380; }
.nf, .fm, .nb, .bp, .vm { color: #4FB3E8; }
.nc, .nn, .ne, .nd { color: #3CCB98; }
.o, .p { color: #C9CAE6; }
.na, .nv, .vi, .vg, .vc { color: #F4F4F4; }
.gp { color: var(--or-orange-bright); }
.err { color: inherit; background: none; }

/* ── tables: slate header row, hairline rows ──────────────────────────────── */
.table-wrap { margin: 1.5em 0; overflow-x: auto; border: 1px solid var(--or-hairline); scrollbar-width: thin; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .88rem; line-height: 1.5; }
.table-wrap thead th { background: var(--or-slate); color: #fff; font-weight: 500; text-align: left; padding: .65rem .9rem; letter-spacing: .3px; vertical-align: bottom; }
.table-wrap thead th code { background: rgba(255, 255, 255, .15); color: #fff; }
.table-wrap td, .table-wrap tbody th { padding: .6rem .9rem; border-top: 1px solid var(--or-hairline); vertical-align: top; text-align: left; }
.table-wrap tbody tr:nth-child(even) { background: #FAFAFA; }
.table-wrap td:first-child, .table-wrap tbody th { color: var(--or-slate); font-weight: 500; }
.table-wrap td code { white-space: nowrap; }
.table-wrap td code:only-child { white-space: normal; }

/* ── figures: images and diagrams ─────────────────────────────────────────── */
figure.image, figure.diagram { margin: 2em 0; }
figure.image img { display: block; width: 100%; height: auto; border: 1px solid var(--or-hairline); cursor: zoom-in; }
figure.image figcaption, figure.diagram figcaption { margin-top: .7em; font-size: .85rem; color: var(--or-gray-muted); line-height: 1.45; }
.fig-n { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600; font-size: 1.05rem; color: var(--or-orange-ink-large); margin-right: .6em; }
.diagram-frame { position: relative; padding: 20px 14px; background: #fff; border: 1px solid var(--or-hairline); display: flex; justify-content: center; overflow-x: auto; }
.diagram-frame::before { content: ''; position: absolute; left: -1px; top: -1px; width: 22px; height: 22px; border-left: 3px solid var(--or-orange); border-top: 3px solid var(--or-orange); }
.diagram-frame svg { width: 100%; height: auto; display: block; }
.zoom { position: absolute; right: 8px; top: 8px; width: 34px; height: 34px; border: 1px solid var(--or-hairline); background: #fff; color: var(--or-slate); cursor: zoom-in; opacity: 0; transition: opacity .2s var(--ease); }
.diagram-frame:hover .zoom, .zoom:focus-visible { opacity: 1; }
.zoom:hover { color: var(--or-orange); border-color: var(--or-orange); }
details.ascii { margin-top: .4em; }
details.ascii summary { cursor: pointer; font-size: .78rem; color: var(--or-gray-muted); letter-spacing: .3px; display: inline-block; }
details.ascii summary:hover { color: var(--or-orange-ink); }
details.ascii pre { font-family: var(--font-mono); font-size: .76rem; line-height: 1.35; background: var(--or-gray-100); padding: 14px 16px; overflow-x: auto; color: var(--or-navy); margin: .5em 0 0; }

figure.video { margin: 2em 0; }
.video-facade { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; background: var(--or-navy); cursor: pointer; overflow: hidden; }
.video-facade img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .2s var(--ease); }
.video-facade:hover img { opacity: 1; }
.video-facade .play { position: absolute; inset: 0; margin: auto; width: 84px; height: 84px; display: grid; place-items: center; background: var(--or-orange); color: #fff; font-size: 1.8rem; border: 4px solid #fff; }
figure.video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }
figure.video figcaption { margin-top: .6em; }
p.file { display: flex; gap: .6em; align-items: baseline; }
p.file i { color: var(--or-orange); }
.muted { color: var(--or-gray-muted); font-size: .9em; }

/* ── pager ────────────────────────────────────────────────────────────────── */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 70px; padding-top: 30px; border-top: 1px solid var(--or-hairline); }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border: 1px solid var(--or-hairline); text-decoration: none; transition: border-color .2s var(--ease), background .2s var(--ease); }
.pager a:hover { border-color: var(--or-orange); background: var(--or-orange-050); }
.pager .next { text-align: right; }
.pager .dir { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 1.3px; font-size: 1rem; font-weight: 600; color: var(--or-orange-ink-large); }
.pager .pt { color: var(--or-slate); font-weight: 500; line-height: 1.35; }

/* ── landing ──────────────────────────────────────────────────────────────── */
.landing { padding: 0; }
.hero { background: var(--or-navy); color: #F4F4F4; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -160px; top: -200px; width: 480px; height: 480px; border: 6px solid var(--or-orange); }
.hero-inner { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 96px 40px 84px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 60px; align-items: end; }
.hero .kicker { color: var(--or-orange-bright); font-size: 1.45rem; }
.hero h1 { margin: 8px 0 0; font-size: clamp(2.8rem, 1.6rem + 4.5vw, 5rem); line-height: 1.02; font-weight: 700; color: #fff; letter-spacing: -.5px; }
.hero h1::after { content: ''; display: block; width: 140px; height: 4px; background: var(--or-orange); margin-top: 28px; }
.hero-lead { font-size: 1.28rem; font-weight: 300; font-style: italic; line-height: 1.55; color: #E3E4F2; max-width: 40rem; margin: 26px 0 34px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; font-weight: 500; text-decoration: none; letter-spacing: .4px; border: 2px solid var(--or-orange); transition: all .2s var(--ease); }
.btn.primary { background: var(--or-orange); color: #fff; }
.btn.primary:hover { background: var(--or-orange-brand); color: #fff; }
.btn.ghost { color: #fff; }
.btn.ghost:hover { background: rgba(255, 102, 0, .15); color: #fff; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0; border: 1px solid var(--or-navy-500); background: var(--or-navy-900); position: relative; z-index: 2; box-shadow: 0 0 0 10px var(--or-navy); }
.hero-stats > div { padding: 22px 24px; border-right: 1px solid var(--or-navy-500); border-bottom: 1px solid var(--or-navy-500); }
.hero-stats > div:nth-child(2n) { border-right: 0; }
.hero-stats > div:nth-last-child(-n+2) { border-bottom: 0; }
.hero-stats dt { font-family: var(--font-display); font-size: 3.6rem; font-weight: 600; line-height: 1; color: var(--or-orange-bright); }
.hero-stats dd { margin: 6px 0 0; text-transform: uppercase; letter-spacing: 1.5px; font-size: .8rem; color: var(--or-navy-300); }

.landing .intro { max-width: 52rem; margin: 0 auto; padding: 64px 40px 10px; }
.section-head { max-width: 52rem; margin: 0 auto 30px; text-align: left; }
.track-kicker { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 1.5px; font-size: 1.2rem; font-weight: 600; color: var(--or-orange-ink-large); }
.section-head h2 { margin: 4px 0 0; font-size: 2.1rem; line-height: 1.2; color: var(--or-slate); font-weight: 700; }
.section-head h2::after { content: ''; display: block; width: 90px; height: 4px; background: var(--or-orange); margin-top: 16px; }
.section-head p { font-size: 1.08rem; font-weight: 300; font-style: italic; color: var(--or-slate); margin: 16px 0 0; }
.map { padding: 60px 40px 40px; max-width: 1240px; margin: 0 auto; }
.map .section-head { max-width: none; }
.hero-diagram .diagram-frame { padding: 34px 28px; }
.hero-diagram figcaption { text-align: center; }

.parts { background: var(--or-gray-100); padding: 70px 40px 80px; margin-top: 40px; }
.parts > .section-head { max-width: 1320px; }
.track { max-width: 1320px; margin: 46px auto 0; }
.track-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; border-bottom: 1px solid var(--or-hairline); padding-bottom: 12px; margin-bottom: 20px; }
.track-head .track-kicker { font-size: 1.1rem; }
.track-head h2 { margin: 0; font-size: 1.45rem; color: var(--or-slate); font-weight: 700; }
.track-head p { margin: 0; color: var(--or-gray-muted); font-style: italic; font-weight: 300; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
@media (min-width: 1280px) { .cards { grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); } }
.part-card { position: relative; display: flex; flex-direction: column; padding: 22px 22px 18px; background: #fff; text-decoration: none; color: var(--or-gray-text); border: 1px solid var(--or-hairline); border-top: 4px solid var(--or-slate); transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease); }
.part-card:hover { transform: translateY(-3px); border-top-color: var(--or-orange); box-shadow: 0 10px 30px rgba(21, 22, 82, .08); color: var(--or-gray-text); }
.pc-top { display: flex; justify-content: space-between; align-items: flex-start; }
.pc-num { font-family: var(--font-display); font-size: 3rem; font-weight: 600; line-height: .9; color: var(--or-orange-ink-large); }
.pc-icon { font-size: 1.3rem; color: var(--or-slate); opacity: .65; }
.part-card:hover .pc-icon { color: var(--or-orange); opacity: 1; }
.part-card h3 { margin: 14px 0 8px; font-size: 1.08rem; line-height: 1.3; color: var(--or-slate); font-weight: 700; }
.part-card p { margin: 0 0 16px; font-size: .9rem; line-height: 1.55; flex: 1; }
.pc-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .76rem; color: var(--or-gray-muted); text-transform: uppercase; letter-spacing: .8px; }
.badge { color: var(--or-orange-ink); font-weight: 500; }

.listen { padding: 70px 40px 90px; }
.listen .section-head { max-width: 1000px; }
.playlist { list-style: none; margin: 0 auto; padding: 0; max-width: 1000px; border-top: 1px solid var(--or-hairline); }
.playlist li { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--or-hairline); }
.playlist a { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: baseline; text-decoration: none; color: var(--or-slate); font-weight: 500; }
.playlist a:hover { color: var(--or-orange-ink); }
.playlist .num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; color: var(--or-orange-ink-large); }
.playlist .d { font-size: .8rem; color: var(--or-gray-muted); font-weight: 400; font-family: var(--font-mono); }
.playlist audio { width: 100%; height: 36px; }

/* ── footer ───────────────────────────────────────────────────────────────── */
.site-footer { background: var(--or-navy); color: var(--or-navy-300); border-top: 4px solid var(--or-orange); }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 36px 40px; display: flex; gap: 36px; align-items: center; }
.footer-inner img { height: 38px; width: auto; flex: none; }
.footer-inner p { margin: 0; font-size: .85rem; line-height: 1.6; max-width: 60rem; }
.footer-inner a { color: var(--or-orange-bright); }

/* ── search modal ─────────────────────────────────────────────────────────── */
.search-modal { position: fixed; inset: 0; z-index: 100; background: rgba(14, 15, 58, .55); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.search-modal[hidden] { display: none; }
.search-box { width: min(720px, 100%); background: #fff; border-top: 4px solid var(--or-orange); box-shadow: 0 30px 80px rgba(14, 15, 58, .35); display: flex; flex-direction: column; max-height: 76vh; }
.search-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--or-hairline); }
.search-input i { color: var(--or-orange); }
.search-input input { flex: 1; border: 0; outline: 0; font: 400 1.08rem var(--font-sans); color: var(--or-navy); background: none; }
.search-results { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; }
.search-results li a { display: block; padding: 10px 18px; text-decoration: none; color: var(--or-gray-text); border-left: 3px solid transparent; }
.search-results li.sel a, .search-results li a:hover { background: var(--or-orange-050); border-left-color: var(--or-orange); }
.search-results .r-part { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--or-gray-muted); }
.search-results .r-title { display: block; font-weight: 500; color: var(--or-slate); }
.search-results .r-snip { display: block; font-size: .82rem; color: var(--or-gray-muted); line-height: 1.45; margin-top: 2px; }
.search-results mark { background: none; color: var(--or-orange-ink); font-weight: 700; }
.search-results .empty { padding: 26px 18px; color: var(--or-gray-muted); text-align: center; }
.search-foot { display: flex; gap: 18px; padding: 9px 18px; border-top: 1px solid var(--or-hairline); font-size: .75rem; color: var(--or-gray-muted); }
.search-foot kbd { margin-right: 3px; }

/* ── lightbox ─────────────────────────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 110; background: rgba(255, 255, 255, .97); display: flex; align-items: center; justify-content: center; padding: 40px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: auto; }
.lightbox-stage img, .lightbox-stage svg { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.lightbox-stage svg { width: 100%; max-width: none !important; }
.lightbox-close { position: fixed; top: 18px; right: 22px; width: 44px; height: 44px; border: 2px solid var(--or-orange); background: #fff; color: var(--or-orange-ink); font-size: 1.2rem; cursor: pointer; }

@media (min-width: 1281px) { .prose figure.diagram { margin-left: -2.5rem; margin-right: -2.5rem; } }

/* ── responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .shell { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .toc { display: none; }
  .search-open { min-width: 0; }
  .search-open span, .search-open kbd { display: none; }
}
@media (max-width: 980px) {
  .nav-toggle { display: block; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 70; top: var(--topbar-h); bottom: 0; left: 0; width: min(330px, 88vw); transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: 10px 0 40px rgba(14, 15, 58, .15); }
  .sidebar.open { transform: none; }
  .sidebar-inner { position: static; max-height: 100%; height: 100%; }
  .topnav a:not(.ext) { display: none; }
  .content { padding: 34px 22px 60px; }
  .hero-inner { grid-template-columns: 1fr; padding: 64px 24px 56px; gap: 40px; }
  .content.landing { padding: 0; }
  .layout-wide .nav-toggle { display: none; }
  .hero::after { width: 220px; height: 220px; right: -110px; top: -110px; border-width: 4px; }
  .prose h2 .anchor { display: none; }
  .playlist li { grid-template-columns: 1fr; gap: 8px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .brand-sep, .brand-title small { display: none; }
  .topbar-inner { padding: 0 14px; gap: 12px; }
  .brand { gap: 10px; }
  .brand-title { font-size: .95rem; }
  .brand img { height: 28px; }
  .topnav { display: none; }
  .search-open { margin-left: auto; }
  .lang-switch a { padding: 5px 7px; }
  .pager { grid-template-columns: 1fr; }
  .landing .intro, .map, .parts, .listen { padding-left: 18px; padding-right: 18px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media print {
  .topbar, .sidebar, .toc, .progress, .pager, .site-footer, .zoom, .copy, .expand, details.ascii { display: none !important; }
  .shell { display: block; }
  figure.code.long pre { max-height: none !important; mask-image: none !important; -webkit-mask-image: none !important; }
  .toggle-body { display: block !important; }
}
