/* dotHuman — app styles.
   Brand tokens live in :root; everything else references them.
   Shared by the homepage (body.home) and all rendered pages. External + cached —
   edit here, not inline. Bump the ?v= query in the <link> tags when this changes. */

/* ===================== Design tokens (brand) — dark default + light theme ===================== */
/* All colour flows through these, so theming is a token swap (no markup changes).
   Dark is the default. Light applies when the OS asks (prefers-color-scheme) UNLESS the visitor
   explicitly chose dark, OR when [data-theme="light"] is set. data-theme is written before first
   paint by the inline <head> script (no flash). See .human/Goals/2026-06-11_adaResearch/. */
:root {
  color-scheme: dark;
  /* surfaces */
  --bg: #0d1f2d;
  --bg-glow: #15273a;
  --surface-2: #1c2f43;
  --surface-2-hover: #243a52;
  /* text */
  --ink: #f0f0ec;
  --ink-soft: #b5b8b5;
  --muted: #a8aba7;
  /* accent */
  --accent: #3ED9C4; /* bright brand teal — the dark-theme accent */
  --accent-hover: #2fc3af;
  --on-accent: #0a1620; /* text/icon ON an accent-filled surface — dark on the bright teal; flips to light below */
  --depth-advanced: #F5A623; /* warm amber — marks Advanced-depth content (distinct from the teal accent) */
  --toggle-off: #44566b; /* "off" switch track (cookie modal) — token-driven so it flips in light */
  /* lines / effects */
  --rule: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --inset-bg: rgba(255, 255, 255, 0.04);
  --hover-bg: rgba(255, 255, 255, 0.06);
  --overlay: rgba(6, 16, 26, 0.6);
  --shadow: rgba(0, 0, 0, 0.5);
  --text-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
  --home-bg: linear-gradient(160deg, #1c3a52 0%, #0d1f2d 45%, #0e2a35 100%);
  --logo-img: url("/logo.svg"); /* theme-swapped in-page logo (follows OS pref + the toggle) */
  /* type / layout */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 760px;
  --radius: 6px;
}

/* Light palette. INTENTIONALLY duplicated under two selectors below — the @media auto path AND the
   explicit [data-theme="light"] toggle. Pure CSS can't share one token block across a media-query
   boundary, and resolving "auto" in JS instead would regress no-JS graceful degradation. So: keep the
   two blocks in sync (see weeklyReview F9). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f8fa;
    --bg-glow: #ffffff;
    --surface-2: #eef2f6;
    --surface-2-hover: #e2e9f0;
    --ink: #0d1f2d;
    --ink-soft: #33485c;
    --muted: #586a78;
    --accent: #0b7568; /* darkened teal — the bright teal fails AA on a light background */
    --accent-hover: #095e54;
    --on-accent: #ffffff; /* white passes AA on the darkened teal button */
    --depth-advanced: #c2410c; /* burnt orange — darker so light text passes contrast on a light bg */
    --toggle-off: #c8d2db;
    --rule: rgba(13, 31, 45, 0.12);
    --glass-bg: rgba(13, 31, 45, 0.035);
    --inset-bg: rgba(13, 31, 45, 0.04);
    --hover-bg: rgba(13, 31, 45, 0.05);
    --overlay: rgba(13, 31, 45, 0.4);
    --shadow: rgba(13, 31, 45, 0.18);
    --text-shadow: none;
    --home-bg: linear-gradient(160deg, #e8f1f3 0%, #f6f8fa 45%, #edf4f2 100%);
    --logo-img: url("/logo-light.svg");
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fa;
  --bg-glow: #ffffff;
  --surface-2: #eef2f6;
  --surface-2-hover: #e2e9f0;
  --ink: #0d1f2d;
  --ink-soft: #33485c;
  --muted: #586a78;
  --accent: #0b7568;
  --accent-hover: #095e54;
  --on-accent: #ffffff;
  --depth-advanced: #c2410c;
  --toggle-off: #c8d2db;
  --rule: rgba(13, 31, 45, 0.12);
  --glass-bg: rgba(13, 31, 45, 0.035);
  --inset-bg: rgba(13, 31, 45, 0.04);
  --hover-bg: rgba(13, 31, 45, 0.05);
  --overlay: rgba(13, 31, 45, 0.4);
  --shadow: rgba(13, 31, 45, 0.18);
  --text-shadow: none;
  --home-bg: linear-gradient(160deg, #e8f1f3 0%, #f6f8fa 45%, #edf4f2 100%);
  --logo-img: url("/logo-light.svg");
}

/* ===================== Reset / base ===================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-sans); line-height: 1.6; overflow-x: clip; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===================== Accessibility ===================== */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--accent); color: var(--bg); padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0; font-weight: 600; text-decoration: none; }
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ===================== Site header — shared sticky nav (every page) ===================== */
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.site-header .nav-in { max-width: 80rem; margin: 0 auto; padding: 0 1.5rem; min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-header .brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; text-decoration: none; }
.site-header .brand:hover { text-decoration: none; }
.site-header .brand .brand-logo { width: 28px; height: 28px; display: block; background: var(--logo-img) center / contain no-repeat; }
.site-header .brand .hl { color: var(--accent); }
.site-header .nav-links { display: flex; align-items: center; gap: 1.6rem; }
.site-header .nav-links a { font-size: .9rem; color: var(--ink-soft); text-decoration: none; transition: color .15s ease; }
.site-header .nav-links a:hover { color: var(--ink); }
.site-header .nav-links .nav-beta { font-weight: 600; color: var(--on-accent); background: var(--accent); padding: .5rem .9rem; border-radius: 8px; transition: filter .15s ease; }
.site-header .nav-links .nav-beta:hover { color: #0a1620; filter: brightness(1.07); }
.site-header .nav-toggle { display: none; flex: 0 0 auto; width: 40px; height: 40px; padding: 0; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--rule); border-radius: 8px; color: var(--ink); cursor: pointer; }
.site-header .nav-toggle svg { width: 20px; height: 20px; }
@media (max-width: 720px) {
  .site-header .nav-toggle { display: inline-flex; }
  .site-header .nav-links { display: none; }
  .site-header[data-nav-open="true"] .nav-links { display: flex; flex-direction: column; align-items: stretch; gap: 0; position: absolute; top: 100%; left: 0; right: 0; background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--rule); padding: .25rem 1.5rem 1.1rem; box-shadow: 0 20px 40px -22px rgba(0,0,0,.75); }
  .site-header[data-nav-open="true"] .nav-links a { font-size: 1rem; padding: .85rem .25rem; border-top: 1px solid var(--rule); }
  .site-header[data-nav-open="true"] .nav-links .nav-beta { margin-top: .7rem; border-top: 0; text-align: center; padding: .7rem; color: var(--on-accent); }
}

/* ===================== Content pages (legal, sitemap) ===================== */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 2.5rem 1.25rem 2rem; }
.legal h1 { font-size: 2rem; margin: 0 0 .25rem; }
.legal .updated { color: var(--muted); font-size: .9rem; margin: 0 0 2rem; }
.legal h2 { font-size: 1.15rem; margin: 2rem 0 .5rem; color: var(--ink); }
.legal p, .legal li { color: var(--ink-soft); }
.legal p a, .legal li a { text-decoration: underline; }  /* in-text links must not rely on color alone */
.legal .review { background: var(--bg-glow); border-left: 3px solid var(--accent); padding: .75rem 1rem; border-radius: var(--radius); font-size: .9rem; margin: 0 0 2rem; }
.home-link { display: inline-block; margin-top: 1.5rem; color: var(--accent); }

/* Cookie policy table (rendered from the cookies registry) */
.cookie-table { margin: .5rem 0 1.75rem; }
.cookie-row { background: var(--bg-glow); border: 1px solid var(--rule); border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: .6rem; }
.cookie-row .ck-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; color: var(--ink); font-size: .95rem; margin: 0 0 .35rem; }
.cookie-row .ck-meta { color: var(--ink-soft); font-size: .9rem; line-height: 1.5; margin: .1rem 0; }
.cookie-row .ck-label { display: inline-block; min-width: 5.5rem; color: var(--muted); }

/* CookieConsent v3 — brand theme (tracks the :root tokens, so it adapts to light/dark) */
#cc-main {
  --cc-font-family: var(--font-sans);
  --cc-bg: var(--bg-glow);
  --cc-primary-color: var(--ink);
  --cc-secondary-color: var(--ink-soft);
  --cc-link-color: var(--accent);
  --cc-btn-primary-bg: var(--accent);
  --cc-btn-primary-color: var(--bg);
  --cc-btn-primary-border-color: var(--accent);
  --cc-btn-primary-hover-bg: var(--accent-hover);
  --cc-btn-primary-hover-border-color: var(--accent-hover);
  --cc-btn-primary-hover-color: var(--bg);
  --cc-btn-secondary-bg: var(--surface-2);
  --cc-btn-secondary-color: var(--ink);
  --cc-btn-secondary-border-color: var(--rule);
  --cc-btn-secondary-hover-bg: var(--surface-2-hover);
  --cc-btn-secondary-hover-border-color: var(--ink-soft);
  --cc-toggle-on-bg: var(--accent);
  --cc-toggle-off-bg: var(--toggle-off);
  --cc-cookie-category-block-bg: var(--bg);
  --cc-cookie-category-block-border: var(--rule);
  --cc-cookie-category-block-hover-bg: var(--surface-2);
  --cc-separator-border-color: var(--rule);
  --cc-modal-border-radius: 12px;
  --cc-btn-border-radius: 999px;
  --cc-overlay-bg: var(--overlay);
}

/* Persistent "manage cookies" controls */
.cc-float { position: fixed; left: .85rem; bottom: .85rem; z-index: 40; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg-glow); color: var(--accent); border: 1px solid var(--rule); cursor: pointer; box-shadow: 0 4px 16px var(--shadow); transition: color .2s, background .2s, border-color .2s; }
.cc-float:hover { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.cc-float[hidden] { display: none; }
.btn-manage { display: inline-block; margin: .25rem 0; padding: .5rem 1.1rem; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font: inherit; font-size: .9rem; cursor: pointer; }
.btn-manage:hover { background: var(--accent); color: var(--bg); }

/* CookieConsent reuses --cc-btn-border-radius (our pill value) for category blocks too;
   its CSS is injected after app.css, so override with !important → clean 10px rects
   (keeps the pill buttons + the library's expanded-state squared corners). */
#cc-main .pm__section,
#cc-main .pm__section--toggle,
#cc-main .pm__section-title { border-radius: 10px !important; }
#cc-main .pm__section--toggle .pm__section-desc-wrapper { border-radius: 0 0 10px 10px !important; }
#cc-main .pm__section--toggle.is-expanded .pm__section-title { border-bottom-left-radius: 0 !important; border-bottom-right-radius: 0 !important; }

/* ===================== Site footer (content pages) ===================== */
.site-footer { border-top: 1px solid var(--rule); background: var(--bg-glow); margin-top: 3rem; }
.ft-cols { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.25rem 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; }
.ft-col h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); margin: 0 0 .75rem; }
.ft-col a { display: block; color: var(--ink-soft); padding: .4rem 0; }
.ft-col a:hover { color: var(--accent); }
.ft-col p { color: var(--ink-soft); margin: .15rem 0; }
.ft-muted { color: var(--muted); font-size: .85rem; }
.ft-social a { display: inline-block; margin-right: .75rem; }
.ft-bar { border-top: 1px solid var(--rule); max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; color: var(--muted); font-size: .8rem; }
.ft-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.ft-link:hover { text-decoration: underline; }

/* ===================== Homepage (coming-soon) — body.home ===================== */
body.home {
  background-image: var(--home-bg);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4rem 1.5rem;
}
.home main { max-width: 640px; width: 100%; }
.home .home-logo { width: 164px; height: 164px; display: block; margin: 0 auto 2rem; background: var(--logo-img) center / contain no-repeat; filter: drop-shadow(0 8px 26px var(--shadow)); }
.home .tagline { font-size: clamp(2.25rem, 7vw, 4.25rem); line-height: 1.15; font-weight: 700; letter-spacing: -.025em; margin-bottom: 2rem; text-align: center; text-shadow: var(--text-shadow); }
.home .tagline .wordmark { font-weight: 800; letter-spacing: -.04em; }
.home .tagline .human { color: var(--accent); }
.home .positioning { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 3rem; text-align: center; }
.home .intro { font-size: .95rem; color: var(--ink-soft); line-height: 1.7; margin-bottom: 3.5rem; }
.home .preview-glass { background: var(--glass-bg); padding: 1.75rem 1.75rem 1.5rem; border-radius: 14px; border: 1px solid var(--rule); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); margin-bottom: 4.5rem; }
.home .preview-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .18em; color: var(--muted); margin-bottom: 1.25rem; }
.home ul.preview { list-style: none; }
.home ul.preview li { padding: .75rem 0 .75rem 1.5rem; border-bottom: 1px solid var(--rule); font-size: .95rem; color: var(--ink); position: relative; }
.home ul.preview li:last-child { border-bottom: none; }
.home ul.preview li::before { content: "·"; color: var(--accent); font-weight: 800; position: absolute; left: 0; font-size: 1.5rem; line-height: .6; top: 1.1rem; }
.home footer { font-size: .85rem; color: var(--muted); text-align: center; }
.home footer .launch { color: var(--ink); font-weight: 600; margin-bottom: .5rem; }
.home footer .meta { margin-bottom: 1rem; }
.home footer a { color: var(--muted); text-decoration: none; transition: color .2s; }
.home footer a:hover { color: var(--accent); }
.home .social { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--rule); border-radius: 50%; color: var(--muted); transition: color .2s, border-color .2s; }
.home .social:hover { color: var(--accent); border-color: var(--accent); }
.home .social svg { width: 18px; height: 18px; display: block; }
.home footer .legal-links { margin-top: 1.25rem; font-size: .8rem; line-height: 1.9; }
@media (max-width: 480px) { body.home { padding: 3rem 1.25rem; } }

/* ===================== External-link bumper ===================== */
/* Screen-reader-only text (e.g. "opens in a new tab") */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* The ↗ external-link affordance, appended to outbound links */
.ext-icon { display: inline-block; width: .7em; height: .7em; margin-left: .15em; vertical-align: .18em; opacity: .7; flex: none; }
a:hover .ext-icon { opacity: 1; }

/* "You're leaving …" interstitial dialog (reuses the consent modal's visual language) */
#lb-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: var(--overlay); }
#lb-overlay[hidden] { display: none; }
#lb-modal { background: var(--bg-glow); color: var(--ink); border: 1px solid var(--rule); border-radius: 12px; max-width: 30rem; width: 100%; padding: 1.5rem 1.5rem 1.25rem; box-shadow: 0 18px 48px var(--shadow); }
#lb-modal h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
#lb-modal #lb-desc { color: var(--ink-soft); font-size: .95rem; margin: 0 0 .5rem; }
#lb-modal #lb-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; color: var(--accent); word-break: break-all; background: var(--inset-bg); border: 1px solid var(--rule); border-radius: var(--radius); padding: .5rem .65rem; margin: 0 0 1.25rem; }
#lb-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.lb-btn { font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; padding: .55rem 1.2rem; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: var(--bg); }
.lb-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.lb-btn-secondary { background: transparent; color: var(--ink); border-color: var(--rule); }
.lb-btn-secondary:hover { background: var(--hover-bg); border-color: var(--ink-soft); }

/* ===================== User OS preferences — Layer 2 ===================== */
/* High contrast — the OS request (unless the panel turned it off) or the panel's toggle on.
   Collapses softer text to full contrast, makes hairlines solid, thickens focus. Works in both themes. */
@media (prefers-contrast: more) {
  :root:not([data-contrast="off"]) { --ink-soft: var(--ink); --muted: var(--ink); --rule: var(--ink-soft); }
  :root:not([data-contrast="off"]) :focus-visible { outline-width: 3px; }
}
:root[data-contrast="more"] { --ink-soft: var(--ink); --muted: var(--ink); --rule: var(--ink-soft); }
:root[data-contrast="more"] :focus-visible { outline-width: 3px; }

/* Reduced transparency — turn the frosted-glass panel solid. */
@media (prefers-reduced-transparency: reduce) {
  .home .preview-glass { background: var(--bg-glow); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Forced colours (Windows High Contrast Mode) — keep interactive surfaces outlined + focus visible
   when the OS overrides our palette with its own. */
@media (forced-colors: active) {
  .lb-btn, .lb-btn-secondary, .btn-manage, .cc-float, .home .preview-glass, .cookie-row,
  #lb-modal, .site-header, .site-footer, .a11y-fab, #a11y-panel { border: 1px solid; }
  :focus-visible { outline: 2px solid; }
}

/* ===================== Display & accessibility panel (first-party) ===================== */
.a11y-fab { position: fixed; right: .85rem; bottom: .85rem; z-index: 55; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg-glow); color: var(--accent); border: 1px solid var(--rule); cursor: pointer; box-shadow: 0 4px 16px var(--shadow); transition: color .2s, background .2s, border-color .2s; }
.a11y-fab:hover { color: var(--bg); background: var(--accent); border-color: var(--accent); }
#a11y-overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: var(--overlay); }
#a11y-overlay[hidden] { display: none; }
#a11y-panel { background: var(--bg-glow); color: var(--ink); border: 1px solid var(--rule); border-radius: 12px; max-width: 24rem; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: 0 18px 48px var(--shadow); }
.a11y-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem .65rem; }
.a11y-head h2 { font-size: 1.1rem; margin: 0; }
.a11y-x { background: none; border: 0; color: var(--ink-soft); font-size: 1rem; line-height: 1; cursor: pointer; padding: .3rem; }
.a11y-x:hover { color: var(--ink); }
.a11y-body { padding: 0 1.25rem; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-top: 1px solid var(--rule); }
.a11y-row:first-child { border-top: 0; }
.a11y-label { font-size: .95rem; color: var(--ink); }
.a11y-seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; flex: none; }
.a11y-opt { background: transparent; border: 0; color: var(--ink-soft); font: inherit; font-size: .85rem; padding: .35rem .75rem; cursor: pointer; }
.a11y-opt:hover { color: var(--ink); }
.a11y-opt.is-on { background: var(--accent); color: var(--bg); font-weight: 600; }
.a11y-switch { position: relative; width: 44px; height: 24px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface-2); cursor: pointer; padding: 0; flex: none; }
.a11y-switch .a11y-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink-soft); transition: left .15s, background .15s; }
.a11y-switch.is-on { background: var(--accent); border-color: var(--accent); }
.a11y-switch.is-on .a11y-knob { left: 22px; background: var(--bg); }
.a11y-foot { padding: .65rem 1.25rem 1.1rem; }
.a11y-reset { background: transparent; border: 1px solid var(--rule); color: var(--ink-soft); font: inherit; font-size: .85rem; padding: .4rem .9rem; border-radius: 999px; cursor: pointer; }
.a11y-reset:hover { color: var(--ink); border-color: var(--ink-soft); }

/* Effects the panel toggles drive (same paths the OS media queries use). */
:root[data-text-scale="115"] { font-size: 115%; }
:root[data-text-scale="130"] { font-size: 130%; }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
:root[data-underline] a { text-decoration: underline; }
:root[data-font="legible"] { --font-sans: Verdana, "Trebuchet MS", system-ui, sans-serif; }

/* ---- Handbook docs (Goals/2026-06-18_docsExperience) — sidebar IA reference layout ---- */
.handbook { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 2.5rem; max-width: 80rem; margin: 0 auto; padding: 2.75rem 1.25rem 3rem; }
.handbook-sidebar { font-size: .92rem; align-self: start; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
.handbook-sidebar ul { list-style: none; margin: 0; padding: 0; }
.hs-group-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.1rem 0 .35rem; }
.handbook-sidebar a { display: block; padding: .25rem .6rem; color: var(--ink-soft); text-decoration: none; border-radius: var(--radius); border-left: 2px solid transparent; }
.handbook-sidebar a:hover { color: var(--ink); background: var(--hover-bg); }
.handbook-sidebar a[aria-current="page"] { color: var(--accent); font-weight: 600; border-left-color: var(--accent); }
/* nested item — _contextreset.md lives inside Comprehension, so indent it under its parent */
.handbook-sidebar a[href$="/context-reset-doc"] { padding-left: 1.7rem; position: relative; }
.handbook-sidebar a[href$="/context-reset-doc"]::before { content: "\21B3"; position: absolute; left: .72rem; color: var(--muted); opacity: .7; }

.handbook-main { min-width: 0; }
.handbook-main .breadcrumb { font-size: .85rem; color: var(--muted); margin: 0 0 1.25rem; }
.handbook-main .breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.handbook-main .breadcrumb a:hover { color: var(--accent); }
.handbook-main h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; margin: 0 0 .5rem; }
.hb-lede { color: var(--ink-soft); font-size: 1.1rem; margin: 0 0 1.25rem; max-width: 42rem; }
.hb-count { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 1.25rem; }

.doc-body { line-height: 1.7; }
.doc-body p { margin: 0 0 1rem; }
.doc-body h2 { font-size: 1.3rem; margin: 1.75rem 0 .6rem; }
.doc-body h3 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
.doc-body .placeholder { color: var(--muted); font-style: italic; }

.hb-seq { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font-size: .95rem; }
.hb-seq a { color: var(--ink-soft); text-decoration: none; max-width: 48%; }
.hb-seq a:hover { color: var(--accent); }
.hb-next { margin-left: auto; text-align: right; }

.hb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; margin: 1.25rem 0; list-style: none; padding: 0; }
.hb-card { display: block; height: 100%; padding: 1.1rem 1.2rem; background: var(--glass-bg); border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; color: inherit; transition: border-color .15s ease, background .15s ease; }
.hb-card:hover { border-color: var(--accent); background: var(--surface-2); }
.hb-card-title { font-weight: 600; color: var(--ink); margin: 0 0 .4rem; }
.hb-card-desc { color: var(--ink-soft); font-size: .88rem; line-height: 1.5; margin: 0 0 .6rem; }
.hb-card-meta { color: var(--accent); font-size: .78rem; }

/* ---- Restructured handbook landing (Goals/2026-06-22_canonicalAudit) ---- */
.hb-landing .hb-kicker { color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 .4rem; }
.hb-bar { display: flex; align-items: center; gap: .7rem; background: var(--glass-bg); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: .8rem 1rem; margin: .25rem 0 2rem; font-size: .95rem; }
.hb-bar .hb-bar-i { color: var(--accent); font-size: 1.15rem; flex: 0 0 auto; line-height: 1; }
.hb-bar p { margin: 0; color: var(--ink-soft); }
.hb-bar a { color: var(--accent); font-weight: 600; text-decoration: none; }
.hb-bar a:hover { text-decoration: underline; }

.hb-get { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: center; background: var(--glass-bg); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.8rem 2rem; margin: .5rem 0 3.75rem; }
.hb-get-main > .hb-seclabel { margin: 0 0 .5rem; }
.hb-get-h { font-size: 1.4rem; margin: 0 0 .5rem; line-height: 1.2; }
.hb-get-p { color: var(--ink-soft); margin: 0 0 1.1rem; }
.hb-steps { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.hb-steps li { display: flex; gap: .6rem; align-items: center; font-size: .9rem; margin: 0 0 .55rem; color: var(--ink); }
.hb-steps li b { flex: 0 0 auto; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--inset-bg); border: 1px solid var(--rule); color: var(--ink); font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.hb-steps li a { color: var(--accent); font-weight: 600; text-decoration: none; }
.hb-steps li a:hover { text-decoration: underline; }
.hb-steps li em { color: var(--muted); font-style: italic; }
.hb-cta { display: inline-block; background: var(--accent); color: var(--bg); font-weight: 700; border-radius: var(--radius); padding: .55rem 1.2rem; text-decoration: none; }
.hb-cta:hover { background: var(--accent-hover); }
.hb-tree { background: var(--inset-bg); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.1rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; line-height: 1.75; color: var(--ink-soft); margin: 0; overflow-x: auto; }
.hb-tree span { color: var(--muted); }

.hb-sec { margin: 0 0 3.75rem; }
.hb-sec.hb-band { background: var(--inset-bg); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.6rem 1.6rem 1.7rem; }
.hb-sechead { display: flex; align-items: baseline; gap: .9rem; flex-wrap: wrap; margin: 0 0 1.35rem; padding: 0 0 .7rem; border-bottom: 1px solid var(--rule); }
.hb-seclabel { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0; font-weight: 700; }
.hb-secdesc { color: var(--muted); font-size: .85rem; }
.hb-sec .hb-cards { margin: 0; gap: 1.15rem; }
.hb-landing .hb-card { padding: 1.25rem 1.35rem; }
.hb-card.go .hb-card-title { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.hb-card.go .arr { color: var(--accent); font-weight: 700; flex: 0 0 auto; }
@media (max-width: 600px) { .hb-get { grid-template-columns: 1fr; } }

/* Icon strip (Before You Begin etc.) — visual summary of a few items */
.hb-iconrow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1.1rem .75rem; margin: 1.75rem 0 2.75rem; }
.hb-iconcard { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.hb-iconcard-art { width: 100%; max-width: 7rem; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; background: var(--glass-bg); border: 1px solid var(--rule); border-color: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 1.1rem; color: var(--accent); }
.hb-iconcard-art svg { width: 56%; height: 56%; }
.hb-iconcard-t { margin: .8rem 0 .2rem; font-size: .9rem; font-weight: 700; color: var(--ink); }
.hb-iconcard-s { margin: 0; font-size: .76rem; line-height: 1.4; color: var(--muted); min-height: 2.8em; }
@media (max-width: 640px) { .hb-iconrow { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 400px) { .hb-iconrow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* small section-heading icon (matches the strip; ties summary → detail) */
.hb-sec-ic { display: inline-flex; align-items: center; justify-content: center; width: 1.15em; height: 1.15em; margin-right: .5em; vertical-align: -0.16em; color: var(--accent); }
.hb-sec-ic svg { width: 100%; height: 100%; }
/* icon-tagged sections + numbered steps: underline the heading (visual breather) + keep the list indent, drop the bullets */
.doc-body h3:has(.hb-sec-ic), .doc-body h3:has(.hb-step-n) { margin-top: 2rem; padding-bottom: .45rem; border-bottom: 1px solid var(--rule); }
.hb-step-n { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 1.7em; height: 1.7em; margin-right: .3em; border-radius: 50%; background: var(--accent); color: var(--bg); font-size: .72em; font-weight: 700; vertical-align: .15em; }
.doc-body h3:has(.hb-sec-ic) + ul { list-style: none; padding-left: 1.6rem; }
.doc-body h3:has(.hb-sec-ic) + ul li { margin: 0 0 .5rem; }
.hb-step-body { padding-left: 1.6rem; }
.hb-step-body > :first-child { margin-top: 0; }

/* pillar "you are here" locator — mini-map of the five pillars */
.hb-pmap { margin: 1.25rem 0 1.5rem; padding: .85rem 1rem 1rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--inset-bg); text-align: left; }
.hb-pmap figcaption { font-size: .64rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: .7rem; }
.hb-pmap figcaption span { color: var(--accent); }
.hb-pmap-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.hb-pmap-item { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; padding: .6rem .65rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface-2); color: var(--muted); opacity: .5; }
.hb-pmap-item svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hb-pmap-item b { font-size: .8rem; font-weight: 700; color: currentColor; line-height: 1.15; }
.hb-pmap-sub { font-family: ui-monospace, monospace; font-style: normal; font-size: .66rem; opacity: .85; }
.hb-pmap-spine { flex-direction: row; align-items: center; gap: .55rem; margin-top: .5rem; }
.hb-pmap-spine b { font-family: ui-monospace, monospace; font-size: .82rem; }
.hb-pmap-spine i { font-style: normal; font-size: .76rem; opacity: .9; }
.hb-pmap-item.is-here { opacity: 1; color: var(--ink); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, var(--surface-2)); }
.hb-pmap-item.is-here svg { stroke: var(--accent); }
@media (max-width: 560px) { .hb-pmap-row { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 48rem) {
  .handbook { grid-template-columns: 1fr; gap: 1.5rem; }
  .handbook-sidebar { position: static; max-height: none; overflow: visible; }
}

/* ---- Handbook reading-depth pref (phase 3): simple (default) hides .depth-advanced; advanced reveals ---- */
:root:not([data-depth="advanced"]) .depth-advanced { display: none; }
:root[data-depth="advanced"] .depth-simple { display: none; }   /* simple-only: the complement of .depth-advanced */
.depth-advanced { border-left: 3px solid var(--depth-advanced); padding-left: .9rem; margin: 1rem 0; }
/* figures swapped by depth are standalone — don't give them the prose-aside border/indent */
figure.depth-advanced, figure.depth-simple { border-left: 0; padding-left: 0; margin: 1.5rem 0; }
.hb-depth { display: inline-flex; align-items: center; gap: .3rem; margin: 1rem 0 2.25rem; padding: .3rem .4rem; background: var(--inset-bg); border: 1px solid var(--rule); border-radius: var(--radius); }
.hb-depth-label { color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: .72rem; padding: 0 .4rem; }
.hb-depth-btn { background: transparent; border: 0; color: var(--ink-soft); padding: .25rem .75rem; border-radius: var(--radius); cursor: pointer; font: inherit; font-size: .85rem; }
.hb-depth-btn:hover { color: var(--ink); }
.hb-depth-btn[aria-pressed="true"] { background: var(--accent); color: var(--bg); font-weight: 600; }
.hb-depth-btn[data-depth-set="advanced"][aria-pressed="true"] { background: var(--depth-advanced); } /* orange = advanced, matching the section borders */

/* ---- Search (shared: /docs/search + the handbook landing box) ---- */
.search-form { margin: 1.25rem 0; }
.search-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--ink-soft); }
.search-form input { width: 100%; max-width: 34rem; padding: .5rem .6rem; background: var(--surface-2); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius); font: inherit; }
.search-count { color: var(--muted); font-size: .9rem; min-height: 1.2em; margin: .5rem 0 1rem; }
.docs-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 1rem; }
.doc-card { padding: 1.1rem 1.25rem; background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius); }
.doc-card h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.doc-card h2 a { color: var(--ink); text-decoration: none; }
.doc-card h2 a:hover { color: var(--accent); }
.doc-card p { margin: 0; color: var(--ink-soft); line-height: 1.6; }
.doc-card mark { background: var(--bg-glow); color: var(--ink); padding: 0 .15em; border-radius: 2px; }
.doc-meta { margin: .5rem 0 0 !important; color: var(--muted); font-size: .85rem; }
.search-empty { color: var(--muted); padding: 1rem 0; list-style: none; }

/* handbook landing search box (the PNG's "Search the docs… ⌘K") */
.hb-search { position: relative; max-width: 34rem; margin: 0 0 1.5rem; }
.hb-search input { width: 100%; padding: .6rem 3rem .6rem .8rem; background: var(--surface-2); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius); font: inherit; }
.hb-search .hb-kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .72rem; border: 1px solid var(--rule); border-radius: 4px; padding: .1rem .35rem; pointer-events: none; }

/* ---- Handbook demo islands (phase 4): compact, inline interactive aids on demoTier=interactive terms ---- */
.hb-demo { margin: 2rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.hb-demo > h2 { font-size: 1.05rem; margin: 0 0 .75rem; color: var(--ink-soft); }
.hb-demo-mount { background: var(--glass-bg); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
/* stepper (lifecycle, captain's log) */
.hb-steps { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0 0 1rem; padding: 0; }
.hb-step { background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink-soft); border-radius: var(--radius); padding: .4rem .7rem; cursor: pointer; font: inherit; font-size: .9rem; }
.hb-step:hover { color: var(--ink); }
.hb-step[aria-current="true"] { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.hb-step-sep { color: var(--muted); align-self: center; }
.hb-panel { color: var(--ink-soft); line-height: 1.6; min-height: 3.5em; }
.hb-panel strong { color: var(--ink); }
/* toggle (seed & steward) */
.hb-toggle { display: inline-flex; gap: .25rem; margin: 0 0 1rem; padding: .25rem; background: var(--inset-bg); border: 1px solid var(--rule); border-radius: var(--radius); }
.hb-toggle button { background: transparent; border: 0; color: var(--ink-soft); padding: .3rem .8rem; border-radius: var(--radius); cursor: pointer; font: inherit; font-size: .85rem; }
.hb-toggle button[aria-pressed="true"] { background: var(--accent); color: var(--bg); font-weight: 600; }
.hb-tree { font-family: var(--font-mono, ui-monospace, monospace); font-size: .85rem; line-height: 1.7; margin: 0; white-space: pre; color: var(--ink-soft); }
.hb-flag-stale { color: #e0b341; }
.hb-flag-ok { color: var(--accent); }
/* card (pseudoskill) + controls */
.hb-card-demo { }
.hb-log { list-style: none; margin: .5rem 0 1rem; padding: 0; display: grid; gap: .3rem; font-size: .9rem; }
.hb-log li { color: var(--ink-soft); }
.hb-log .hb-date { color: var(--muted); }
.hb-controls { display: flex; flex-wrap: wrap; gap: .5rem; }
.hb-btn { background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink); border-radius: var(--radius); padding: .4rem .9rem; cursor: pointer; font: inherit; font-size: .88rem; }
.hb-btn:hover { border-color: var(--accent); color: var(--accent); }
.hb-btn:disabled { opacity: .45; cursor: default; }
.hb-btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.hb-btn-primary:hover { color: var(--bg); background: var(--accent-hover); }
.hb-badge { display: inline-block; background: var(--accent); color: var(--bg); border-radius: 4px; padding: .05rem .4rem; font-size: .72rem; font-weight: 600; margin-left: .4rem; }

/* ---- Handbook GitBook-parity (phase 7): 3-col layout, page-head, on-this-page rail, copy, freshness ---- */
.handbook.has-aside { grid-template-columns: minmax(0, 14rem) minmax(0, 1fr) minmax(0, 12.5rem); max-width: 80rem; gap: 3.5rem; }

/* page-head row: (mobile hamburger) breadcrumb · version + copy */
.hb-pagehead { display: flex; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; margin: 0 0 1rem; }
.hb-pagehead .breadcrumb { margin: 0; }
.hb-pagehead-actions { margin-left: auto; display: inline-flex; align-items: center; gap: .6rem; }
.hb-version { color: var(--muted); font-size: .75rem; border: 1px solid var(--rule); border-radius: 999px; padding: .1rem .6rem; white-space: nowrap; text-decoration: none; transition: color .15s, border-color .15s; }
a.hb-version:hover { color: var(--accent); border-color: var(--accent); }
.hb-copy { display: inline-flex; align-items: center; gap: .35rem; background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink-soft); border-radius: var(--radius); padding: .3rem .7rem; cursor: pointer; font: inherit; font-size: .82rem; }
.hb-copy:hover { color: var(--ink); border-color: var(--accent); }
.hb-copy.is-copied { color: var(--accent); border-color: var(--accent); }
.hb-menu-btn { display: none; align-items: center; gap: .35rem; background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink); border-radius: var(--radius); padding: .3rem .7rem; cursor: pointer; font: inherit; font-size: .85rem; }

/* right-rail "on this page" (desktop) — shared .doc-toc styles also used by /docs/search-adjacent pages */
.hb-aside { align-self: start; position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto; padding-left: 1.5rem; border-left: 1px solid var(--rule); }
.doc-toc { font-size: .85rem; }
.doc-toc-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .5rem; }
.doc-toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.doc-toc a { display: block; color: var(--ink-soft); text-decoration: none; padding: .15rem .6rem; border-left: 2px solid transparent; }
.doc-toc a:hover { color: var(--ink); }
.doc-toc a[aria-current="true"] { color: var(--accent); border-left-color: var(--accent); }
.doc-toc .toc-sub { padding-left: .9rem; font-size: .95em; }

/* freshness line */
.hb-updated { color: var(--muted); font-size: .8rem; margin: 1.75rem 0 0; }

/* images + figures in content */
.doc-body img { display: block; max-width: 100%; height: auto; margin: 1.25rem auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface-2); }
.doc-body figure { margin: 1.5rem 0; }
/* click-to-enlarge: figures open in a modal lightbox (docs-figure-zoom.js) */
.doc-body figure img.is-zoomable { cursor: zoom-in; }
.fig-modal { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem; padding: 2vmin; background: #0b141e; overflow-y: auto; }
.fig-modal[hidden] { display: none; }
.fig-modal-fig { margin: auto; display: flex; flex-direction: column; align-items: center; max-width: 97vw; }
/* explicit height makes the SVG scale UP to fill the screen (max-* alone only shrinks) */
.fig-modal-fig img { height: 84vh; width: auto; max-width: 97vw; object-fit: contain; }
.fig-modal-fig figcaption { color: #d2d6d2; font-size: .9rem; line-height: 1.55; text-align: center; margin-top: .9rem; max-width: 760px; }
.fig-modal-fig figcaption code { font-family: ui-monospace, Menlo, Consolas, monospace; }
.fig-modal-close { position: absolute; top: 2vmin; right: 2.4vmin; width: 40px; height: 40px; font-size: 26px; line-height: 1; color: #f0f0ec; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); border-radius: 8px; cursor: pointer; }
.fig-modal-close:hover { background: rgba(255, 255, 255, .16); }
.doc-body p:has(> img:only-child) { text-align: center; margin-bottom: .4rem; }
/* captions: explicit <figcaption>, or (convention) an emphasized-only line right under an image or table */
.doc-body figcaption,
.doc-body p:has(> img:only-child) + p:has(> em:only-child),
.doc-body table + p:has(> em:only-child) { color: var(--muted); font-size: .85rem; font-style: italic; text-align: center; line-height: 1.5; margin: .3rem 0 1.5rem; }

/* tables */
.doc-body table { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: .92rem; }
.doc-body th, .doc-body td { border: 1px solid var(--rule); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.doc-body thead th { background: var(--inset-bg); color: var(--ink); font-weight: 600; }
.doc-body tbody tr { background: var(--glass-bg); }
.doc-body table caption { caption-side: bottom; color: var(--muted); font-size: .85rem; font-style: italic; margin-top: .4rem; }

/* lists — restore the indentation the global `* { padding: 0 }` reset strips */
.doc-body ul, .doc-body ol { margin: 0 0 1rem; padding-left: 1.6rem; }
.doc-body li { margin: .3rem 0; }
.doc-body li::marker { color: var(--muted); }
.doc-body li > ul, .doc-body li > ol { margin: .3rem 0; }

/* mobile on-this-page disclosure + drawer bits — hidden on desktop */
.hb-toc-mobile { display: none; }
.hb-toc-toggle { display: inline-flex; align-items: center; gap: .35rem; background: var(--inset-bg); border: 1px solid var(--rule); color: var(--ink-soft); border-radius: var(--radius); padding: .4rem .8rem; cursor: pointer; font: inherit; font-size: .85rem; width: 100%; justify-content: space-between; }
.hb-toc-toggle::after { content: "\25BE"; color: var(--muted); }
.hb-toc-toggle[aria-expanded="true"]::after { content: "\25B4"; }
.hb-toc-mobile-panel { border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: .6rem .8rem; }
.hb-scrim { display: none; }

@media (max-width: 64rem) {
  .handbook, .handbook.has-aside { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.25rem 1.25rem 3rem; }
  .hb-menu-btn { display: inline-flex; }
  .hb-aside { display: none; }
  /* more breathing room on the stacked layout */
  .hb-pagehead { margin-bottom: 1.5rem; }
  .handbook-main h1 { margin-top: .25rem; }
  .hb-depth { margin-bottom: 1.5rem; }
  .hb-toc-mobile { display: block; margin: 0 0 1.75rem; }
  .doc-body { margin-top: .5rem; }
  .hb-seq { margin-top: 2rem; }
  .handbook-sidebar { position: fixed; inset: 0 auto 0 0; width: 16rem; max-width: 82vw; z-index: 50; background: var(--bg); border-right: 1px solid var(--rule); padding: 1.25rem 1rem; transform: translateX(-100%); transition: transform .2s ease; overflow-y: auto; max-height: none; }
  .handbook.nav-open .handbook-sidebar { transform: translateX(0); }
  .handbook.nav-open .hb-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
  body.hb-nav-locked { overflow: hidden; }
}

/* ---- Inline code + code blocks in rendered content (.doc-body: handbook + /docs) ---- */
.doc-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--inset-bg); border: 1px solid var(--rule); border-radius: 5px; padding: .1em .4em; color: var(--ink); }
.doc-body a code { color: inherit; }
.doc-body pre { background: var(--inset-bg); border: 1px solid var(--rule); border-radius: var(--radius); padding: .9rem 1.1rem; overflow-x: auto; margin: 1.25rem 0; }
.doc-body pre code { background: none; border: 0; padding: 0; font-size: .85rem; white-space: pre; }
