/* Pyrosphere Manual — docs layout.
   Top bar, left page tree, reading column, "On this page" rail.
   Graphite + ember like the plugin; dark first, light on request or by system. */

:root {
  --bg: #121315;
  --panel: #18191c;
  --raised: #1f2124;
  --sunken: #0d0e10;
  --ink: #ece9e4;
  --ink-soft: #c9c5be;
  --muted: #9a968f;
  --line: #2b2d31;
  --line-soft: #222428;
  --ember: #ff8a3d;
  --ember-strong: #ff7a1a;
  --ember-soft: rgba(255, 138, 61, 0.12);
  --ember-glow: rgba(255, 122, 26, 0.35);
  --green: #7fd18b;
  --green-soft: rgba(127, 209, 139, 0.1);
  --amber: #f2c14e;
  --amber-soft: rgba(242, 193, 78, 0.1);
  --red: #ff7b72;
  --red-soft: rgba(255, 123, 114, 0.1);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-legend: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --top: 60px;
  --side: 284px;
  --toc: 228px;
  --radius: 10px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f6f5;
    --panel: #ffffff;
    --raised: #ffffff;
    --sunken: #eceded;
    --ink: #1c1d20;
    --ink-soft: #3b3d42;
    --muted: #64676d;
    --line: #dcdddf;
    --line-soft: #e8e9ea;
    --ember: #b8410e;
    --ember-strong: #d9530f;
    --ember-soft: rgba(217, 83, 15, 0.08);
    --ember-glow: rgba(217, 83, 15, 0.18);
    --green: #2f6b3a;
    --green-soft: rgba(47, 107, 58, 0.08);
    --amber: #8a5a00;
    --amber-soft: rgba(196, 140, 0, 0.1);
    --red: #a3201c;
    --red-soft: rgba(163, 32, 28, 0.07);
    --shadow: 0 18px 50px rgba(20, 20, 20, 0.15);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f6f6f5;
  --panel: #ffffff;
  --raised: #ffffff;
  --sunken: #eceded;
  --ink: #1c1d20;
  --ink-soft: #3b3d42;
  --muted: #64676d;
  --line: #dcdddf;
  --line-soft: #e8e9ea;
  --ember: #b8410e;
  --ember-strong: #d9530f;
  --ember-soft: rgba(217, 83, 15, 0.08);
  --ember-glow: rgba(217, 83, 15, 0.18);
  --green: #2f6b3a;
  --green-soft: rgba(47, 107, 58, 0.08);
  --amber: #8a5a00;
  --amber-soft: rgba(196, 140, 0, 0.1);
  --red: #a3201c;
  --red-soft: rgba(163, 32, 28, 0.07);
  --shadow: 0 18px 50px rgba(20, 20, 20, 0.15);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 20px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--ember); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; border-radius: 4px; }

/* ---------------- top bar ---------------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: calc(var(--top) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.brand .maker {
  font-family: var(--font-legend);
  font-weight: 700;
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  color: var(--ember);
  text-transform: uppercase;
  line-height: 1.1;
}
.brand .product { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; line-height: 1.1; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
}
.iconbtn:hover { color: var(--ink); border-color: var(--muted); }
.iconbtn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
.searchbtn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: 38px;
  min-width: 0;
  width: min(300px, 40vw);
  padding: 0 0.7rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.searchbtn:hover { border-color: var(--muted); color: var(--ink-soft); }
.searchbtn svg { width: 16px; height: 16px; flex: none; }
.searchbtn span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.searchbtn kbd { flex: none; }
.site-link {
  font-family: var(--font-legend);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.85rem;
  border-radius: 9px;
  background: var(--ember-strong);
  color: #1a0d04;
  text-decoration: none;
  white-space: nowrap;
}
.site-link:hover { filter: brightness(1.08); }

/* ---------------- frame ---------------- */
.frame {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr) var(--toc);
  max-width: 1440px;
  margin: 0 auto;
  padding-top: calc(var(--top) + env(safe-area-inset-top, 0px));
}

/* ---------------- sidebar ---------------- */
.sidebar {
  position: sticky;
  top: calc(var(--top) + env(safe-area-inset-top, 0px));
  height: calc(100vh - var(--top) - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  padding: 1.5rem 1rem 3rem max(16px, env(safe-area-inset-left, 0px));
  border-right: 1px solid var(--line-soft);
  font-size: 0.94rem;
}
.version-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  font-weight: 700;
}
.version-chip span { font-family: var(--font-legend); font-size: 0.68rem; font-weight: 600; color: var(--ember); letter-spacing: 0.06em; }
.navgroup { margin-bottom: 1.1rem; }
.navgroup h4 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.3rem;
  padding: 0 0.6rem;
  font-family: var(--font-legend);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.navgroup h4 svg { width: 15px; height: 15px; color: var(--ember); flex: none; }
.navgroup ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.navgroup a {
  display: block;
  padding: 0.36rem 0.6rem 0.36rem 2.05rem;
  border-radius: 7px;
  color: var(--ink-soft);
  text-decoration: none;
  line-height: 1.35;
}
.navgroup a:hover { background: var(--raised); color: var(--ink); }
.navgroup a[aria-current="page"] {
  background: var(--ember-soft);
  color: var(--ember);
  font-weight: 700;
}

/* ---------------- main ---------------- */
.main {
  min-width: 0;
  padding: 2.25rem clamp(1.25rem, 4vw, 3.5rem) 4rem;
}
.doc { max-width: 760px; margin: 0 auto; }
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
.crumbs a { color: var(--ember); text-decoration: none; }
.crumbs .sep { opacity: 0.6; }
.doc h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4.5vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}
.doc .lede { font-size: 1.2rem; line-height: 1.55; color: var(--ink-soft); margin: 0 0 2rem; }
.doc h2, .doc h3 {
  font-family: var(--font-display);
  text-wrap: balance;
  position: relative;
}
.doc h2 { font-size: 1.55rem; font-weight: 700; margin: 2.8rem 0 0.6rem; line-height: 1.2; }
.doc h3 { font-size: 1.18rem; font-weight: 700; margin: 2rem 0 0.4rem; }
.doc h2 .anchor, .doc h3 .anchor {
  position: absolute;
  left: -1.3em;
  padding-right: 0.4em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
  font-weight: 400;
}
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc .anchor:focus-visible { opacity: 1; }
.doc p { margin: 0 0 1rem; }
.doc ul, .doc ol { padding-left: 1.4rem; margin: 0 0 1.1rem; }
.doc li { margin: 0.3rem 0; }
.doc li::marker { color: var(--muted); }
.doc strong { color: var(--ink); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

/* control names in the plugin's legend style */
.ctl {
  font-family: var(--font-legend);
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ember);
  white-space: nowrap;
  text-shadow: 0 0 14px var(--ember-glow);
}
.val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
kbd {
  font-family: var(--font-code);
  font-size: 0.74em;
  background: var(--raised);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.08rem 0.4rem;
  white-space: nowrap;
  color: var(--ink-soft);
}
code {
  font-family: var(--font-code);
  font-size: 0.82em;
  background: var(--raised);
  border: 1px solid var(--line-soft);
  padding: 0.08rem 0.38rem;
  border-radius: 5px;
  overflow-wrap: anywhere;
}

/* range / default chips under a control heading */
.meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.7rem; }
.meta span {
  font-size: 0.8rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.meta b { font-family: var(--font-legend); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-right: 0.35rem; }
.summary { font-weight: 700; color: var(--ink); }

/* numbered steps */
ol.steps { counter-reset: s; list-style: none; padding-left: 0; }
ol.steps > li {
  counter-increment: s;
  position: relative;
  padding-left: 2.6rem;
  margin: 0.85rem 0;
}
ol.steps > li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ember-soft);
  border: 1px solid var(--ember);
  color: var(--ember);
  font-family: var(--font-legend);
  font-weight: 700;
  font-size: 0.78rem;
}

/* callouts */
.callout {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.9rem 1.05rem;
  border-radius: var(--radius);
  margin: 1.3rem 0;
  background: var(--raised);
  border: 1px solid var(--line);
}
.callout svg { width: 20px; height: 20px; margin-top: 0.15rem; }
.callout > div > :last-child { margin-bottom: 0; }
.callout.tip { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.callout.tip svg { color: var(--green); }
.callout.note svg { color: var(--muted); }
.callout.important { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.callout.important svg { color: var(--amber); }
.callout.warning { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.callout.warning svg { color: var(--red); }

/* tables */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.6rem; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--line-soft); }
tr:last-child td { border-bottom: 0; }
th {
  font-family: var(--font-legend);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel);
}
td:first-child { font-weight: 700; }
table.plain td:first-child { font-weight: 400; }
td.num, th.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* figures */
figure { margin: 1.6rem 0 2rem; }
figure.shot img, figure.panel img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #0d0e10;
}
figure.panel { max-width: 460px; margin-left: auto; margin-right: auto; }
figure.panel.wide { max-width: 640px; }
figure.small { max-width: 220px; }
figcaption { font-size: 0.86rem; color: var(--muted); margin-top: 0.7rem; text-align: center; }
.pair-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; max-width: 320px; margin: 1.4rem auto; }
.pair-figs figure { margin: 0; }
.pinwrap { position: relative; }
.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(18px, 2.4vw, 26px);
  height: clamp(18px, 2.4vw, 26px);
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--ember-strong);
  color: #1a0d04;
  font-family: var(--font-legend);
  font-weight: 700;
  font-size: clamp(0.55rem, 1.1vw, 0.7rem);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px #0d0e10, 0 0 14px rgba(255, 122, 26, 0.75);
  cursor: help;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pin:hover, .pin:focus-visible, .pin.on {
  transform: translate(-50%, -50%) scale(1.28);
  box-shadow: 0 0 0 2px #0d0e10, 0 0 0 4px #ffb27a, 0 0 22px rgba(255, 122, 26, 0.95);
  outline: none;
  z-index: 3;
}
.pin-hint { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--muted); margin: -0.4rem 0 0.8rem; }
.pin-hint i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ember-strong); color: #1a0d04; font-style: normal; font-family: var(--font-legend); font-weight: 700; font-size: 0.6rem; }
.legend { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.15rem 1rem; font-size: 0.94rem; }
.legend li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 0.5rem; padding: 0.3rem 0.45rem; margin: 0 !important; border-radius: 8px; transition: background 0.15s ease; }
.legend li.on { background: var(--ember-soft); }
.legend .k { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--ember-soft); border: 1px solid var(--ember); color: var(--ember); font-family: var(--font-legend); font-weight: 700; font-size: 0.64rem; display: grid; place-items: center; margin-top: 0.12rem; }

.tipbox {
  position: fixed;
  z-index: 60;
  max-width: min(300px, calc(100vw - 32px));
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: #16171a;
  color: #ece9e4;
  font-size: 0.9rem;
  line-height: 1.45;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 138, 61, 0.5);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.tipbox.show { opacity: 1; transform: none; }
.tipbox .tn { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; margin-right: 0.4rem; border-radius: 50%; background: #ff7a1a; color: #1a0d04; font-family: var(--font-legend); font-weight: 700; font-size: 0.62rem; vertical-align: 0.1em; }
.tipbox .ctl { color: #ff9a52; }
.tipbox a { color: #ffb27a; }

/* signal flow */
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem 0.4rem; padding: 1.1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin: 1rem 0; }
.flow .node { font-family: var(--font-legend); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.42rem 0.85rem; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
.flow .node.hot { background: var(--ember-soft); color: var(--ember); border-color: color-mix(in srgb, var(--ember) 55%, transparent); box-shadow: 0 0 18px var(--ember-glow); }
.flow .node.end { background: var(--ember-strong); color: #1a0d04; border-color: var(--ember-strong); }
.flow .arrow { color: var(--ember); opacity: 0.6; font-size: 0.85rem; }

/* time diagram */
.timediagram { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; overflow-x: auto; }
.timediagram svg { display: block; width: 100%; min-width: 520px; height: auto; }
.td-label { font-family: var(--font-legend); font-size: 11px; letter-spacing: 0.1em; fill: var(--muted); }
.td-label.hot { fill: var(--ember); }
.td-axis { stroke: var(--line); stroke-width: 1; fill: none; }
.td-hit { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; fill: none; }
.td-wave { stroke: var(--ink); stroke-width: 1.6; fill: none; }
.td-wave.hot { stroke: var(--ember); }

/* two-up cards */
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 1.3rem 0; }
.pair > div { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.pair h4 { font-family: var(--font-display); font-size: 1.05rem; margin: 0 0 0.4rem; }
.pair > div > :last-child { margin-bottom: 0; }

/* landing cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.85rem; margin: 1.4rem 0 2rem; }
.card {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--ember); transform: translateY(-1px); text-decoration: none; }
.card b { display: block; font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 0.2rem; }
.card span { color: var(--muted); font-size: 0.92rem; line-height: 1.45; display: block; }

/* recipes */
.recipe { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem 0.4rem; margin: 1.2rem 0; background: var(--panel); }
.recipe h2, .recipe h3 { margin-top: 0.2rem !important; }
.recipe .for { font-family: var(--font-legend); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ember); }

/* faq */
details.faq { border-bottom: 1px solid var(--line); padding: 0.85rem 0; }
details.faq summary { cursor: pointer; font-weight: 700; font-family: var(--font-display); font-size: 1.08rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--ember); font-weight: 400; font-size: 1.3rem; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq p { margin: 0.6rem 0 0; color: var(--ink-soft); }

dl.gloss { margin: 0; }
dl.gloss > div { padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); }
dl.gloss dt { font-weight: 700; font-family: var(--font-display); }
dl.gloss dd { margin: 0.15rem 0 0; color: var(--ink-soft); }

/* pager + page footer */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; margin-top: 3.5rem; }
.pager a { display: block; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--panel); }
.pager a:hover { border-color: var(--ember); }
.pager small { display: block; color: var(--muted); font-size: 0.78rem; }
.pager b { font-family: var(--font-display); }
.pager .next { text-align: right; grid-column: 2; }
.docfoot { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 0.84rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; }

/* ---------------- on this page ---------------- */
.toc {
  position: sticky;
  top: calc(var(--top) + env(safe-area-inset-top, 0px));
  height: calc(100vh - var(--top) - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  padding: 2.4rem max(16px, env(safe-area-inset-right, 0px)) 2rem 0.5rem;
  font-size: 0.86rem;
}
.toc h5 { display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0.6rem; font-family: var(--font-legend); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.toc h5 svg { width: 14px; height: 14px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 0.28rem 0 0.28rem 0.85rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a.sub { padding-left: 1.6rem; font-size: 0.82rem; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ember); border-left-color: var(--ember); }

/* ---------------- search ---------------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(5, 5, 6, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: calc(10vh + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
}
.search-overlay[hidden], [hidden] { display: none !important; }
.search-box { width: min(640px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.search-box .field { display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); }
.search-box .field svg { width: 18px; height: 18px; color: var(--muted); }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1.05rem; outline: none; }
.search-results { list-style: none; margin: 0; padding: 0.4rem; max-height: min(60vh, 520px); overflow-y: auto; }
.search-results li a { display: block; padding: 0.6rem 0.75rem; border-radius: 9px; color: var(--ink); text-decoration: none; }
.search-results li a small { display: block; color: var(--muted); font-size: 0.78rem; margin-bottom: 0.1rem; }
.search-results li a b { font-family: var(--font-display); font-weight: 700; }
.search-results li a span { display: block; color: var(--ink-soft); font-size: 0.86rem; line-height: 1.4; margin-top: 0.15rem; }
.search-results li a mark { background: var(--ember-soft); color: var(--ember); border-radius: 3px; padding: 0 2px; }
.search-results li.sel a, .search-results li a:hover { background: var(--raised); }
.search-empty { padding: 1.2rem; color: var(--muted); text-align: center; }

/* ---------------- responsive ---------------- */
.scrim { display: none; }
@media (max-width: 1240px) {
  .frame { grid-template-columns: var(--side) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .frame { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .sidebar {
    position: fixed;
    top: calc(var(--top) + env(safe-area-inset-top, 0px));
    left: 0;
    bottom: 0;
    height: auto;
    width: min(320px, 86vw);
    background: var(--bg);
    z-index: 40;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    border-right: 1px solid var(--line);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, 0.45); }
  .main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .doc h2 .anchor, .doc h3 .anchor { display: none; }
}
@media (max-width: 900px) {
  .searchbtn { width: 38px; padding: 0; justify-content: center; }
  .searchbtn span, .searchbtn kbd { display: none; }
}
@media (max-width: 640px) {
  .brand .maker { display: none; }
  .site-link { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .pin, .tipbox, .legend li, .card, .sidebar { transition: none; }
}

/* inside an iframe on goldendsp.com the store button is redundant */
html.embedded .site-link { display: none; }

@media print {
  .topbar, .sidebar, .toc, .pager, .scrim { display: none !important; }
  .frame { display: block; padding: 0; }
  .main { padding: 0; }
}
