/* ==========================================================================
   PRC DOCUMENTATION — Control Deck reading room
   The documentation styled in the PRC.Server / PRC.Verify design language:
   ambient backdrop with amber + blue glows and a masked dot grid, floating
   glass panels, Manrope/Sora/JetBrains Mono, amber accent. Dark is the
   default theme (like the Server); light is the override.
   ========================================================================== */

/* ---------- Fonts (local, offline-safe — same files as PRC.Server) ---------- */
@font-face {
  font-display: swap;
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400;
  src: url('manrope-v20-latin-regular.woff2') format('woff2');
}
@font-face {
  font-display: swap;
  font-family: 'Sora';
  font-style: normal;
  font-weight: 300;
  src: url('sora-v17-latin-300.woff2') format('woff2');
}
@font-face {
  font-display: swap;
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  src: url('jetbrains-mono-regular.woff2') format('woff2');
}

/* ---------- Design tokens (mirroring Server/wwwroot/css/prc.css) ---------- */
:root {
  --font-body: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Sora', 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'SF Mono', Consolas, monospace;

  --acc: #ffa726;
  --acc-strong: #f57c00;
  --acc-soft: rgba(255, 167, 38, 0.14);
  --acc-glow: rgba(255, 167, 38, 0.35);
  --acc-glow-btn: rgba(255, 167, 38, 0.245);
  --grad-acc: linear-gradient(135deg, #ffc06b 0%, #f59838 100%);
  --acc-fill: #ffa726;

  --ok: #3ddc84;
  --warn: #ffb300;
  --err: #ff5252;
  --info: #57b2ff;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1017;
  --bg-glow-1: rgba(255, 145, 30, 0.20);
  --bg-glow-2: rgba(70, 110, 180, 0.24);
  --grid-dot: rgba(255, 255, 255, 0.18);

  --glass: rgba(15, 18, 25, 0.68);
  --glass-strong: rgba(13, 16, 22, 0.86);
  --glass-soft: rgba(255, 255, 255, 0.06);
  --edge: rgba(255, 255, 255, 0.08);
  --edge-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 18px rgba(0, 0, 0, 0.35);

  --text: #e9ecf2;
  --text-dim: #99a1b3;
  --text-faint: #5d6577;

  --field-bg: rgba(255, 255, 255, 0.045);
  --field-edge: rgba(255, 255, 255, 0.11);
  --track: rgba(255, 255, 255, 0.12);
  --row-hover: rgba(255, 255, 255, 0.035);

  --scrim: rgba(0, 0, 0, 0.62);
  /* code tokens (github dark) */
  --tok-kw: #ff7b72; --tok-str: #a5d6ff; --tok-num: #79c0ff; --tok-cm: #8b949e;
  --tok-fn: #d2a8ff; --tok-ty: #ffa657; --tok-var: #c9d1d9;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef0f4;
  --bg-glow-1: rgba(245, 124, 0, 0.07);
  --bg-glow-2: rgba(90, 130, 200, 0.10);
  --grid-dot: rgba(20, 30, 50, 0.09);

  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --glass-soft: rgba(15, 20, 30, 0.035);
  --edge: rgba(15, 20, 30, 0.10);
  --edge-strong: rgba(15, 20, 30, 0.22);
  --shadow: 0 14px 44px rgba(30, 40, 60, 0.16);
  --shadow-sm: 0 4px 18px rgba(30, 40, 60, 0.10);

  --text: #1a1d24;
  --text-dim: #565e6e;
  --text-faint: #9098a8;

  --acc: #e8820c;
  --acc-soft: rgba(232, 130, 12, 0.12);
  --acc-glow: rgba(232, 130, 12, 0.30);
  --acc-glow-btn: rgba(232, 130, 12, 0.21);

  --field-bg: rgba(15, 20, 30, 0.04);
  --field-edge: rgba(15, 20, 30, 0.14);
  --track: rgba(15, 20, 30, 0.14);
  --row-hover: rgba(15, 20, 30, 0.04);

  --scrim: rgba(16, 18, 22, 0.45);
  /* code tokens (github light) */
  --tok-kw: #cf222e; --tok-str: #0a3069; --tok-num: #0550ae; --tok-cm: #6e7781;
  --tok-fn: #8250df; --tok-ty: #953800; --tok-var: #24292f;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  /* Keep the scrollbar gutter permanently: otherwise short and long pages have
     different viewport widths and the centered layout shifts when navigating. */
  overflow-y: scroll;
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient backdrop: glow gradients + masked dot grid, exactly the Server's
   .prc-backdrop recipe, painted as fixed pseudo layers behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(1100px 700px at 95% 110%, var(--bg-glow-2), transparent 60%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.4px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 30%, transparent 100%);
}

::selection { background: var(--acc-soft); color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }
a { color: inherit; }

button { font-family: inherit; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--glass-soft); color: var(--text); }
html:not([data-theme="dark"]) .i-sun { display: none; }
html[data-theme="dark"] .i-moon { display: none; }

.overline-style {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- frame ---------- */
.layout {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 224px;
  gap: 0 22px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 22px 40px;
}
.topbar { display: none; }
.sidebar-scrim { display: none; } /* mobile-only backdrop — must never be a grid item */

/* ---------- sidebar: two floating glass capsules ----------
   The top capsule (logo + search) is sticky and always visible; the nav
   capsule lives in normal flow and simply grows — when it is taller than the
   screen it continues below and scrolls WITH the page, never inside itself. */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.side-panel {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.side-panel-top {
  position: sticky;
  top: 20px;
  z-index: 2;
}
.side-panel-nav { flex: 0 0 auto; }
.side-top { display: flex; align-items: flex-start; gap: 4px; }
.site-home {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  transition: background 0.15s var(--ease), filter 0.15s;
}
.site-home:hover { background: var(--glass-soft); }
/* Official wordmark, one variant per theme (dark text ↔ light text). */
.wordmark { display: block; width: 100%; max-width: 208px; height: auto; }
html[data-theme="dark"] .wm-for-light { display: none; }
html:not([data-theme="dark"]) .wm-for-dark { display: none; }

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-faint);
  background: var(--field-bg);
  border: 1px solid var(--field-edge);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.sidebar-search:hover { border-color: var(--acc); color: var(--text-dim); box-shadow: 0 0 14px var(--acc-glow-btn); }
.sidebar-search span { flex: 1; text-align: left; }
.sidebar-search kbd {
  font: 500 10px/1.6 var(--font-mono);
  color: var(--text-faint);
  border: 1px solid var(--field-edge);
  border-radius: 5px;
  padding: 0 5px;
  background: var(--glass-soft);
}

.nav-tree { font-size: 13.5px; padding-top: 2px; }
.nav-tree a {
  display: block;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  text-decoration: none;
  position: relative;
  transition: background 0.13s var(--ease), color 0.13s var(--ease);
}
.nav-tree a:hover { background: var(--glass-soft); color: var(--text); }
.nav-tree a.active { background: var(--acc-soft); color: var(--acc); font-weight: 600; }

/* top-level entries: Welcome + section heads + top-level pages — Server overlines */
.nav-tree > a,
.nav-tree > .nav-group > summary > a {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  margin-top: 12px;
}
.nav-tree > a:first-child { margin-top: 0; }
.nav-tree > a.active,
.nav-tree > .nav-group > summary > a.active { color: var(--acc); }

.nav-group > summary {
  display: flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary > a { flex: 1; }
.nav-group > summary .chev {
  padding: 2px 7px;
  margin-top: 12px;
  color: var(--text-faint);
  font-size: 9px;
  transition: transform 0.15s var(--ease);
}
.nav-group:not([open]) > summary .chev { transform: rotate(-90deg); }
.nav-children {
  margin: 3px 0 5px 12px;
  padding-left: 9px;
  border-left: 1px solid var(--edge);
}
.nav-children .nav-group > summary > a { font-weight: 600; color: var(--text-dim); }
.nav-children .nav-group > summary > a:hover { color: var(--text); }
.nav-children .nav-group > summary .chev { margin-top: 0; }
.nav-children a.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 5px;
  bottom: 5px;
  width: 2px;
  border-radius: 2px;
  background: var(--acc);
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--edge);
}
.sidebar-foot a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  transition: background 0.13s var(--ease), color 0.13s var(--ease);
}
.sidebar-foot a:hover { background: var(--glass-soft); color: var(--acc); }
.sidebar-foot .ext { color: var(--text-faint); font-size: 11px; }
.sidebar-foot a:hover .ext { color: var(--acc); }

/* ---------- article: near-opaque glass panel ---------- */
.content { min-width: 0; }
article {
  background: var(--glass-strong);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 38px 48px 44px;
  max-width: 840px;
}

.crumbs {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
}
.crumbs a { color: var(--text-faint); text-decoration: none; transition: color 0.13s; }
.crumbs a:hover { color: var(--acc); }
.crumb-sep { margin: 0 7px; opacity: 0.7; }

h1 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin: 0 0 26px;
}
h1::after {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  border-radius: 2px;
  background: var(--grad-acc);
  margin-top: 14px;
}
h1 img.h1-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  margin-right: 12px;
  vertical-align: -5px;
}
h1 .h1-icon-emoji { margin-right: 10px; }
h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; margin: 40px 0 12px; }
h3 { font-size: 17px; font-weight: 700; margin: 30px 0 10px; }
h4 { font-size: 15px; font-weight: 700; margin: 24px 0 8px; }
h2, h3, h4 { scroll-margin-top: 28px; line-height: 1.35; }
.hlink {
  margin-left: 8px;
  color: var(--text-faint);
  text-decoration: none;
  opacity: 0;
  font-weight: 400;
  transition: opacity 0.12s;
}
h2:hover .hlink, h3:hover .hlink, h4:hover .hlink { opacity: 1; }
.hlink:hover { color: var(--acc); }

p { margin: 0 0 12px; }
.blank { height: 10px; }
.indent { margin-left: 22px; }
article a {
  color: var(--acc);
  text-decoration: underline;
  text-decoration-color: var(--acc-glow);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.12s;
}
article a:hover { text-decoration-color: var(--acc); }
ul, ol { margin: 0 0 14px; padding-left: 24px; }
li { margin: 4px 0; }
li::marker { color: var(--text-faint); }
li.todo { list-style: none; margin-left: -20px; }
li.todo input { accent-color: var(--acc); }
hr { border: none; border-top: 1px solid var(--edge); margin: 30px 0; }
blockquote {
  margin: 14px 0;
  padding: 4px 2px 4px 16px;
  border-left: 3px solid var(--acc);
  color: var(--text-dim);
}
code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: var(--field-bg);
  border: 1px solid var(--field-edge);
  border-radius: 5px;
  padding: 1.5px 5.5px;
}
s { color: var(--text-faint); }

/* toggles — Q&A cards (Troubleshooting) */
article details {
  margin: 10px 0;
  border: 1px solid var(--field-edge);
  border-radius: var(--r-md);
  background: var(--field-bg);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
article details:hover { border-color: var(--acc); box-shadow: 0 0 14px var(--acc-glow-btn); }
article details > summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: 14.5px;
  padding: 12px 16px;
}
article details > summary::-webkit-details-marker { display: none; }
article details > summary::before {
  content: "▸";
  color: var(--acc);
  flex-shrink: 0;
  transition: transform 0.15s var(--ease);
}
article details[open] > summary::before { transform: rotate(90deg); }
.toggle-body { padding: 0 16px 12px 34px; }
.toggle-body > :last-child { margin-bottom: 0; }

/* callouts */
.callout {
  display: flex;
  gap: 12px;
  padding: 13px 16px;
  margin: 16px 0;
  border-radius: var(--r-md);
  background: var(--glass-soft);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--text-faint);
  font-size: 14.5px;
}
.callout-icon { font-size: 17px; line-height: 1.5; flex-shrink: 0; }
img.callout-icon { width: 20px; height: 20px; margin-top: 3px; }
.callout-body { min-width: 0; }
.callout-body > p:last-child { margin-bottom: 0; }
.callout-orange, .callout-yellow { background: var(--acc-soft); border-color: var(--acc-glow); border-left-color: var(--acc); }
.callout-red { background: rgba(255, 82, 82, 0.08); border-color: rgba(255, 82, 82, 0.25); border-left-color: var(--err); }
.callout-blue { background: rgba(87, 178, 255, 0.08); border-color: rgba(87, 178, 255, 0.22); border-left-color: var(--info); }
.callout-green, .callout-teal { background: rgba(61, 220, 132, 0.08); border-color: rgba(61, 220, 132, 0.22); border-left-color: var(--ok); }
.callout-gray { border-left-color: var(--text-faint); }

/* code blocks */
.codeblock {
  margin: 16px 0;
  border: 1px solid var(--field-edge);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--field-bg);
}
.codehead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--field-edge);
}
.codehead .copy {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-dim);
  background: var(--glass-soft);
  border: 1px solid var(--field-edge);
  border-radius: 6px;
  padding: 2.5px 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.codeblock:hover .copy, .codehead .copy:focus-visible { opacity: 1; }
.codehead .copy:hover { color: var(--acc); border-color: var(--acc); box-shadow: 0 0 14px var(--acc-glow-btn); }
.codeblock pre {
  margin: 0;
  padding: 13px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: var(--track) transparent;
}
.codeblock pre code { background: none; border: none; color: var(--text); padding: 0; font-size: inherit; }
.codeblock figcaption {
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  border-top: 1px solid var(--field-edge);
}
.equation { font-family: var(--font-mono); background: var(--field-bg); padding: 10px 14px; border-radius: var(--r-sm); }

/* highlight.js tokens */
.hljs-keyword, .hljs-literal, .hljs-deletion { color: var(--tok-kw); }
.hljs-string, .hljs-regexp, .hljs-addition { color: var(--tok-str); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id { color: var(--tok-num); }
.hljs-comment, .hljs-quote { color: var(--tok-cm); font-style: italic; }
.hljs-title, .hljs-section, .hljs-name, .hljs-function .hljs-title { color: var(--tok-fn); }
.hljs-type, .hljs-class .hljs-title, .hljs-built_in, .hljs-attribute, .hljs-attr, .hljs-selector-class, .hljs-selector-tag, .hljs-template-tag { color: var(--tok-ty); }
.hljs-variable, .hljs-params, .hljs-template-variable { color: var(--tok-var); }

/* figures */
.img { margin: 20px 0; text-align: center; }
.img img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--edge-strong);
  box-shadow: var(--shadow-sm);
}
.img figcaption { font-size: 13px; color: var(--text-dim); margin-top: 8px; }
.video {
  margin: 20px 0;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--edge-strong);
  background: #000;
  box-shadow: var(--shadow-sm);
}
.video iframe { width: 100%; height: 100%; border: 0; display: block; }

/* child-page links — plain text with an amber arrow */
.pagelink {
  display: flex;
  align-items: baseline;
  gap: 9px;
  width: fit-content;
  padding: 3px 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none !important;
}
.pagelink img.pl-icon {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: -3px;
}
.pagelink .pl-icon-emoji { margin-right: 7px; }
.pagelink .pl-arrow { color: var(--acc); transition: transform 0.14s var(--ease); }
.pagelink:hover .pl-arrow { transform: translateX(3px); }
.pagelink:hover span:last-child { color: var(--acc); }
.pagelink.sub {
  margin-left: 27px;
  padding: 1px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
}
.pagelink.sub .pl-arrow { color: var(--text-faint); }
.pagelink.sub:hover .pl-arrow { color: var(--acc); transform: none; }

/* bookmark cards */
.bookmark {
  display: block;
  margin: 12px 0;
  padding: 12px 15px;
  border: 1px solid var(--field-edge);
  border-radius: var(--r-md);
  text-decoration: none !important;
  color: var(--text);
  background: var(--field-bg);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.bookmark:hover { border-color: var(--acc); transform: translateY(-1px); box-shadow: 0 0 18px var(--acc-glow-btn); }
.bm-title { display: block; font-weight: 700; font-size: 14px; color: var(--text); }
.bm-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.55;
}
.bm-host {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 7px;
}

/* file downloads */
.file {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 6px 10px 6px 0;
  padding: 8px 15px;
  border: 1px solid var(--field-edge);
  border-radius: var(--r-md);
  text-decoration: none !important;
  color: var(--text);
  background: var(--field-bg);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.file:hover { border-color: var(--acc); box-shadow: 0 0 14px var(--acc-glow-btn); }
.file-icon { color: var(--acc); font-size: 14px; }
.file-name { font-weight: 700; font-size: 13.5px; }
.file-size { color: var(--text-faint); font-size: 11.5px; font-family: var(--font-mono); }

/* external-object chips (GitHub links) */
.extobj {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 8px 4px 0;
  padding: 6px 12px;
  border: 1px solid var(--field-edge);
  border-radius: var(--r-sm);
  text-decoration: none !important;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  background: var(--field-bg);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.extobj:hover { border-color: var(--acc); box-shadow: 0 0 14px var(--acc-glow-btn); }
.extobj-domain {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.extobj.inline { margin: 0 4px 0 0; padding: 2px 9px; }
.mention { font-weight: 600; }
.mention::before { content: "📄 "; font-size: 0.85em; }

/* tables */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--field-edge);
  border-radius: var(--r-md);
  scrollbar-width: thin;
  scrollbar-color: var(--track) transparent;
}
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 8px 14px; text-align: left; vertical-align: top; }
th {
  background: var(--glass-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--field-edge);
}
td { border-top: 1px solid var(--edge); }
tr:first-child td { border-top: none; }
table tr:hover td { background: var(--row-hover); }

/* columns */
.cols { display: flex; gap: 30px; margin: 8px 0; }
.col { min-width: 0; }
@media (max-width: 760px) { .cols { flex-direction: column; gap: 0; } }

/* notion text colors */
.nc-gray { color: var(--text-dim); } .nc-brown { color: #b78168; } .nc-orange { color: var(--acc); }
.nc-yellow { color: var(--warn); } .nc-green, .nc-teal { color: var(--ok); } .nc-blue { color: var(--info); }
.nc-purple { color: #b18aff; } .nc-pink { color: #ff7eb6; } .nc-red { color: var(--err); }
.nc-gray_background { background: var(--glass-soft); border-radius: 3px; padding: 0 3px; }
.nc-orange_background, .nc-yellow_background { background: var(--acc-soft); border-radius: 3px; padding: 0 3px; }
.nc-red_background { background: rgba(255, 82, 82, 0.13); border-radius: 3px; padding: 0 3px; }
.nc-blue_background { background: rgba(87, 178, 255, 0.13); border-radius: 3px; padding: 0 3px; }
.nc-green_background { background: rgba(61, 220, 132, 0.13); border-radius: 3px; padding: 0 3px; }

/* pager + meta — floating below the article panel */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  max-width: 840px;
  margin-top: 22px;
  padding: 0 6px;
}
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  min-width: 0;
}
.pager-link.next { text-align: right; margin-left: auto; }
.pager-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.pager-title { color: var(--acc); font-weight: 700; font-size: 14px; transition: color 0.12s; }
.pager-link:hover .pager-title { text-decoration: underline; text-underline-offset: 3px; }
.page-meta {
  display: flex;
  gap: 18px;
  max-width: 840px;
  margin-top: 16px;
  padding: 0 6px;
  font-size: 12px;
  color: var(--text-faint);
}
.page-meta a { color: var(--text-faint); text-decoration: none; }
.page-meta a:hover { color: var(--acc); }

/* toc — floating text beside the article */
.toc {
  position: sticky;
  top: 20px;
  height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px 4px 24px 2px;
  font-size: 12.5px;
  scrollbar-width: thin;
  scrollbar-color: var(--track) transparent;
}
.toc-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--edge-strong); }
.toc li a {
  display: block;
  padding: 3.5px 0 3.5px 13px;
  color: var(--text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1.5px;
  transition: color 0.12s, border-color 0.12s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc li a:hover { color: var(--acc); }
.toc li.active > a { color: var(--acc); border-left-color: var(--acc); font-weight: 600; }
.toc .toc-l3 a { padding-left: 26px; }
.toc .toc-l4 a { padding-left: 38px; }

/* ---------- search: glass modal ---------- */
.search-overlay[hidden] { display: none; }
.search-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 11vh 16px 16px;
}
.search-box {
  width: min(640px, 100%);
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--edge-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
#searchInput {
  width: 100%;
  padding: 16px 20px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  border-bottom: 1px solid var(--edge);
}
#searchInput::placeholder { color: var(--text-faint); }
.search-results { max-height: 55vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--track) transparent; }
.search-results .hit {
  display: block;
  padding: 11px 20px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--edge);
}
.search-results .hit:last-child { border-bottom: none; }
.search-results .hit:hover, .search-results .hit.sel { background: var(--acc-soft); }
.hit-title { font-weight: 700; font-size: 14px; }
.hit-crumb { font-size: 11.5px; color: var(--text-faint); margin-left: 8px; }
.hit-snip { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; line-height: 1.55; }
.hit-snip mark { background: none; color: var(--acc); font-weight: 700; }
.search-empty { padding: 20px; color: var(--text-faint); font-size: 13.5px; }

/* ---------- back to top ----------
   Two placements for one control: a chip in the right rail under the
   "On this page" list (wide screens), and a floating corner button where
   that rail does not exist (narrow screens). Both fade in after scrolling. */
.to-top {
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease),
              border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { border-color: var(--acc); color: var(--acc); box-shadow: 0 0 14px var(--acc-glow-btn); }

.to-top-rail {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 5px 11px;
  background: var(--field-bg);
  border: 1px solid var(--field-edge);
  border-radius: var(--r-sm);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: translateY(4px);
}
.to-top-rail.show { transform: none; }
@media (min-width: 1181px) { .to-top-rail { display: inline-flex; } }

.to-top-float {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--edge-strong);
  color: var(--text-dim);
  box-shadow: var(--shadow-sm);
  transform: translateY(6px);
}
.to-top-float.show { transform: none; }
@media (min-width: 1181px) { .to-top-float { display: none; } }

/* ---------- scrollbars (webkit) ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--track); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 272px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 32px; }
  .topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--edge);
    padding: 9px 12px;
    margin: -12px -12px 12px;
  }
  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    border-radius: var(--r-sm);
    color: var(--text);
    cursor: pointer;
  }
  .menu-btn:hover { background: var(--glass-soft); }
  .topbar-title {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    overflow: hidden;
  }
  .topbar-title .wordmark { width: auto; height: 32px; }
  .topbar .icon-btn { width: 34px; height: 34px; color: var(--text); }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(320px, 86vw);
    z-index: 60;
    gap: 0;
    /* Opaque: the scrim sits BEHIND the drawer, and translucent light glass
       would let it bleed through and grey the whole drawer out. */
    background: var(--bg);
    border-right: 1px solid var(--edge-strong);
    border-radius: 0 var(--r-lg) var(--r-lg) 0;
    box-shadow: var(--shadow);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--track) transparent;
    transform: translateX(-103%);
    transition: transform 0.2s ease-out;
  }
  /* Inside the drawer the capsules dissolve into one column; the header part
     stays pinned while the nav scrolls beneath it. */
  .side-panel {
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .side-panel-top {
    top: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--edge);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--scrim);
    z-index: 50;
  }
  article { padding: 24px 20px 32px; border-radius: var(--r-md); }
  h1 { font-size: 25px; }
  h2 { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
