/* ============================================================
   site.css — layout and components for the Quickstart guide.
   Reads ONLY custom properties from tokens.css: no color or font
   literals live in this file.
   Sections: base · topbar · layout + sidebar · drawer · page header ·
   hero · buttons · prose · Say this · commands · placeholders · steps ·
   tabs · callouts · fold-outs · ui/kbd · checklist · cards · tables ·
   diagrams · personalize · progress · done/jump/pagenav · toc ·
   footer · modals · search · toast · no-js · motion · print
   ============================================================ */

/* ---------------- base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 18px);
  scrollbar-gutter: stable;
  background: var(--bg);
}
body {
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.65;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a {
  color: var(--link);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }
h1, h2, h3, h4 {
  font-family: var(--font-display); font-weight: 700;
  line-height: 1.2; letter-spacing: -0.015em; color: var(--text);
  text-wrap: balance;
}
h1 { font-size: clamp(1.85rem, 4.2vw, 2.55rem); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.38rem, 3vw, 1.7rem); }
h3 { font-size: 1.16rem; }
h4 { font-size: 1rem; }
strong, b { font-weight: 700; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--mark-bg); }
code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--code-bg); color: var(--text);
  border-radius: 5px; padding: 0.12em 0.38em;
  overflow-wrap: anywhere;
}
kbd {
  font-family: var(--font-mono); font-size: 0.8em; font-weight: 600;
  background: var(--kbd-bg); color: var(--text-muted);
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 0.05em 0.42em; white-space: nowrap;
}
.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;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--accent-contrast);
  padding: 10px 18px; border-radius: 0 0 var(--radius-md) 0; font-weight: 700; text-decoration: none;
}
.skip-link:focus { left: 0; color: var(--accent-contrast); }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 4px;
  height: var(--topbar-h); padding: 0 12px 0 10px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
@supports ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
  .topbar {
    background: var(--topbar-bg);
    -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  }
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 40px; height: 40px; padding: 0 10px; flex: none;
  border-radius: var(--radius-md); color: var(--text-muted); text-decoration: none;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0; margin-left: 2px;
  color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--hero-bg); box-shadow: inset 0 0 0 1px var(--hero-line);
}
.brand-mark svg { width: 22px; height: 22px; }
.bm-chevron { fill: none; stroke: var(--hero-text); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.bm-spark { fill: var(--say-bar); }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.08rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand-name .thin { color: var(--text-faint); font-weight: 600; }
.brand-tag {
  font-size: 0.84rem; color: var(--text-faint);
  padding-left: 12px; margin-left: 2px; border-left: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.topbar-spacer { flex: 1; }
.searchbtn {
  display: flex; align-items: center; gap: 8px;
  height: 38px; min-width: 240px; padding: 0 8px 0 12px; margin-right: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text-faint); font-size: 0.88rem;
  transition: border-color var(--speed) var(--ease), color var(--speed) var(--ease);
}
.searchbtn:hover { border-color: var(--border-strong); color: var(--text-muted); }
.searchbtn svg { width: 16px; height: 16px; }
.searchbtn kbd { margin-left: auto; font-size: 0.7rem; }
.pz-open { position: relative; font-size: 0.88rem; font-weight: 600; }
.pz-dot {
  position: absolute; top: 7px; left: 23px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--bg); display: none;
}
.pz-open.has-details .pz-dot { display: block; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.nav-toggle { padding: 0; }
.hb { position: relative; width: 18px; height: 14px; display: block; }
.hb span {
  position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform 260ms var(--ease), opacity 180ms var(--ease);
}
.hb span:nth-child(1) { top: 0; }
.hb span:nth-child(2) { top: 6px; }
.hb span:nth-child(3) { bottom: 0; }
body.nav-open .hb span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .hb span:nth-child(2) { opacity: 0; transform: translateX(-6px); }
body.nav-open .hb span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (min-width: 1024px) { .nav-toggle { display: none; } }
@media (max-width: 1100px) { .brand-tag { display: none; } }
@media (max-width: 1023px) {
  .searchbtn { min-width: 0; width: 40px; height: 40px; padding: 0; margin: 0; justify-content: center; border: 0; background: none; color: var(--text-muted); }
  .searchbtn svg { width: 19px; height: 19px; }
  .searchbtn-label, .searchbtn kbd { display: none; }
  .pz-open { padding: 0; }
  .pz-open-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 560px) {
  .topbar { gap: 0; padding: 0 6px; }
  .gh-link { display: none; }
  .icon-btn { min-width: 38px; }
}

/* ---------------- layout + sidebar ---------------- */
.layout { flex: 1 0 auto; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
@media (min-width: 1024px) {
  .layout {
    background: linear-gradient(to right, var(--sidebar-bg) calc(var(--sidebar-w) - 1px), var(--border) calc(var(--sidebar-w) - 1px) var(--sidebar-w), transparent var(--sidebar-w));
  }
}
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: 16px 12px 40px; background: var(--sidebar-bg);
}
.sb-progress {
  margin: 0 4px 6px; padding: 11px 12px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.sb-progress-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sb-progress-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint); }
.sb-progress-count { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sb-progress-count span { font-weight: 700; color: var(--text); }
.bar { height: 6px; margin-top: 8px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; }
.bar > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 420ms var(--ease); }
.sb-group { margin-top: 4px; }
.sb-title {
  font-size: 0.69rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-faint); padding: 14px 10px 6px;
}
.sb-group ul { list-style: none; padding: 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.9rem; line-height: 1.35; text-decoration: none;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.nav-link:hover { background: var(--surface-alt); color: var(--text); }
.nav-ic { display: grid; place-items: center; width: 18px; height: 18px; flex: none; color: var(--text-faint); }
.nav-ic svg { width: 17px; height: 17px; }
.nav-t { flex: 1; min-width: 0; }
.nav-link[aria-current="page"] { background: var(--accent-tint); color: var(--accent-strong); font-weight: 600; }
.nav-link[aria-current="page"] .nav-ic { color: var(--accent); }
.nav-done {
  display: none; place-items: center; width: 18px; height: 18px; flex: none;
  border-radius: 50%; background: var(--success-tint); color: var(--success);
}
.nav-done svg { width: 12px; height: 12px; stroke-width: 3; }
.nav-link.is-done .nav-done { display: grid; }
.nav-done-sr { display: none; }
.nav-link.is-done .nav-done-sr { display: inline; }

/* ---------------- mobile drawer ---------------- */
.scrim {
  position: fixed; inset: 0; z-index: 69; background: var(--scrim);
  opacity: 0; pointer-events: none; transition: opacity 240ms var(--ease);
}
@media (min-width: 1024px) { .scrim { display: none; } }
@media (max-width: 1023px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); z-index: 70;
    width: min(320px, 86vw);
    border-right: 1px solid var(--border); box-shadow: var(--shadow-3);
    transform: translateX(-102%); visibility: hidden;
    transition: transform 260ms var(--ease), visibility 0s linear 260ms;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform 260ms var(--ease); }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { position: fixed; left: 0; right: 0; overflow: hidden; }
  body.nav-open .topbar { position: fixed; top: 0; left: 0; right: 0; }
}

/* ---------------- main column + page header ---------------- */
.content { min-width: 0; padding: 28px clamp(16px, 4vw, 56px) 72px; }
.content:focus { outline: none; }
.page-grid { display: grid; grid-template-columns: minmax(0, var(--column)); gap: 48px; }
@media (min-width: 1280px) { .page-grid.has-toc { grid-template-columns: minmax(0, var(--column)) 208px; } }
.page { min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-faint); margin-bottom: 18px; }
.crumbs a { color: var(--text-faint); text-decoration: none; }
.crumbs a:hover { color: var(--link); text-decoration: underline; }
.crumbs .sep { opacity: 0.55; }
.crumbs [aria-current] { color: var(--text-muted); }
.page-head { margin-bottom: 30px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.page-head .lede { margin-top: 12px; max-width: 62ch; font-size: 1.12rem; line-height: 1.6; color: var(--text-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px 3px 9px; border-radius: var(--radius-pill);
  font-size: 0.8rem; font-weight: 600; line-height: 1.5;
  background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border);
}
.chip svg { width: 14px; height: 14px; }
.chip-track.track-app { background: var(--accent-tint); color: var(--accent-strong); border-color: transparent; }
.chip-track.track-vscode { background: var(--info-tint); color: var(--info); border-color: transparent; }

/* ---------------- hero (home) ---------------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: center;
  padding: clamp(26px, 5vw, 52px);
  margin-bottom: 36px;
  background: var(--hero-bg); color: var(--hero-text);
  border-radius: var(--radius-lg);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(540px 280px at 95% -10%, var(--hero-glow-a), transparent 65%),
    radial-gradient(460px 260px at -5% 115%, var(--hero-glow-b), transparent 65%);
}
.hero-kicker {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: var(--radius-pill);
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--hero-muted); background: var(--hero-glass); border: 1px solid var(--hero-line);
}
.hero h1 { margin-top: 16px; max-width: 18ch; color: var(--hero-text); font-size: clamp(2rem, 5vw, 3.1rem); }
.hero-lede { margin-top: 14px; max-width: 52ch; color: var(--hero-muted); font-size: clamp(1.02rem, 2vw, 1.16rem); line-height: 1.6; }
.hero .cta-row { margin-top: 26px; }
.hero .chips { margin-top: 20px; }
.hero .chip { background: var(--hero-glass); border-color: var(--hero-line); color: var(--hero-muted); }
.hero-art { display: none; }
.hero-svg { width: 100%; max-width: 380px; height: auto; margin-left: auto; overflow: visible; }
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.75fr); }
  .hero-art { display: block; }
}
.ha-window { fill: var(--surface); stroke: var(--hero-line); stroke-width: 1.5; }
.ha-bar { fill: var(--surface-alt); }
.ha-dot { fill: var(--border-strong); }
.ha-url { fill: var(--surface-sunken); }
.ha-ink { fill: var(--text); }
.ha-line { fill: var(--border); }
.ha-card-a { fill: var(--accent-tint); stroke: var(--accent); stroke-width: 1.2; }
.ha-card-b { fill: var(--surface-alt); }
.ha-badge { fill: var(--dg-accent-fill); stroke: var(--surface); stroke-width: 3; }
.ha-badge-ink { fill: none; stroke: var(--dg-on); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ha-arrow { fill: none; stroke: var(--hero-muted); stroke-width: 2; stroke-dasharray: 5 6; stroke-linecap: round; }
.ha-arrowhead { fill: var(--hero-muted); }
.ha-say { fill: var(--say-bg); stroke: var(--say-border); stroke-width: 1.5; }
.ha-say-bar { fill: var(--say-bar); }
.ha-say-label { fill: var(--say-ink); font-family: var(--font-body); font-weight: 800; font-size: 11px; letter-spacing: 0.12em; }
.ha-say-line { fill: var(--say-border); }
.ha-var { fill: var(--var-bg); stroke: var(--var-border); stroke-dasharray: 3 2; }
@media (prefers-reduced-motion: no-preference) {
  .ha-say-g { animation: qs-float 6s ease-in-out infinite; }
  .ha-site { animation: qs-float 7s ease-in-out -2.5s infinite; }
}
@keyframes qs-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------------- buttons ---------------- */
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--radius-md);
  font-weight: 700; font-size: 0.95rem; line-height: 1.2; text-decoration: none;
  border: 1px solid transparent;
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease), background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: var(--accent-strong); color: var(--accent-contrast); box-shadow: var(--shadow-2); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--text-faint); color: var(--text); }
.btn-glass { background: var(--hero-glass); color: var(--hero-text); border-color: var(--hero-line); }
.btn-glass:hover { background: var(--hero-glass-strong); color: var(--hero-text); }
@media (max-width: 520px) { .hero .cta-row .btn { flex: 1 1 100%; } }

/* ---------------- prose ---------------- */
.prose { overflow-wrap: break-word; } /* long URLs wrap instead of widening the page */
.prose > * { max-width: var(--measure); }
.prose > :is(.table-wrap, .cards) { max-width: none; }
.prose > * + * { margin-top: 16px; }
.prose h2 { margin-top: 52px; }
.prose h3 { margin-top: 32px; }
.prose > :first-child { margin-top: 0; }
.prose :is(h2, h3) + * { margin-top: 12px; }
.prose ul:not([class]), .prose ol:not([class]) { padding-left: 1.4em; }
.prose li + li { margin-top: 6px; }
.prose li > :is(ul, ol) { margin-top: 6px; }
.prose li > p + p { margin-top: 8px; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
.prose blockquote {
  border-left: 3px solid var(--accent); padding: 14px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--surface-alt); color: var(--text); font-style: italic;
}
.prose blockquote > * + * { margin-top: 10px; }
.prose dl dt { font-weight: 700; margin-top: 14px; }
.prose dl dd { margin-top: 2px; color: var(--text-muted); }
.prose > p:first-child { font-size: 1.04rem; }
.h-anchor {
  display: inline-flex; vertical-align: middle; margin-left: 8px;
  color: var(--text-faint); opacity: 0; text-decoration: none;
  transition: opacity var(--speed) var(--ease);
}
.h-anchor svg { width: 0.72em; height: 0.72em; }
:is(h2, h3):hover > .h-anchor, .h-anchor:focus-visible { opacity: 1; }
.h-anchor:hover { color: var(--accent); }
@media (hover: none) { .h-anchor { display: none; } }

/* ---------------- Say this (the most important box on a page) ---------------- */
.say-box {
  position: relative; overflow: hidden;
  background: var(--say-bg);
  border: 1.5px solid var(--say-border); border-left: 5px solid var(--say-bar);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-say);
}
.prose .say-box { margin-top: 20px; }
.say-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px 7px 14px;
  background: var(--say-head-bg); border-bottom: 1px solid var(--say-border);
}
.say-ic { display: grid; color: var(--say-ink); }
.say-ic svg { width: 18px; height: 18px; }
.say-label {
  flex: 1; min-width: 0;
  font-size: 0.76rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--say-ink);
}
pre.say {
  margin: 0; padding: 14px 18px 16px;
  font-family: var(--font-body); font-size: 1.07rem; line-height: 1.62; font-weight: 500;
  color: var(--text); background: none;
  white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2;
}
.say-foot { padding: 0 18px 13px; margin-top: -4px; }
.say-fill {
  display: inline-flex; align-items: flex-start; gap: 6px; text-align: left;
  font-size: 0.84rem; font-weight: 600; color: var(--say-ink);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--say-border);
}
.say-fill svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.say-fill:hover { text-decoration-color: currentColor; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 32px; padding: 0 12px 0 10px; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 700;
  background: var(--say-btn-bg); color: var(--say-ink); border: 1px solid var(--say-border);
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.copy-btn:hover { border-color: var(--say-bar); }
.copy-ic { display: grid; }
.copy-ic svg { grid-area: 1 / 1; width: 15px; height: 15px; }
.copy-ic svg + svg { display: none; }
.copy-btn.is-copied .copy-ic svg:first-child { display: none; }
.copy-btn.is-copied .copy-ic svg + svg { display: block; }

/* ---------------- terminal commands ---------------- */
.cmd-box { background: var(--cmd-bg); border: 1px solid var(--cmd-border); border-radius: var(--radius-md); overflow: hidden; }
.prose .cmd-box { margin-top: 16px; }
.cmd-head { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; background: var(--cmd-head-bg); color: var(--cmd-muted); }
.cmd-ic { display: grid; }
.cmd-ic svg { width: 16px; height: 16px; }
.cmd-label { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 0.76rem; font-weight: 600; letter-spacing: 0.02em; }
.cmd-box .copy-btn { background: var(--cmd-bg); color: var(--cmd-muted); border-color: color-mix(in srgb, var(--cmd-muted) 35%, transparent); height: 30px; }
.cmd-box .copy-btn:hover { color: var(--cmd-text); border-color: var(--cmd-muted); }
pre.cmd {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.6;
  color: var(--cmd-text); background: none; tab-size: 2;
}
pre.cmd code { background: none; padding: 0; color: inherit; font-size: inherit; border-radius: 0; overflow-wrap: normal; }
/* phones: wrap long commands instead of hiding their end off to the side (Copy still copies one line) */
@media (max-width: 560px) {
  pre.cmd { white-space: pre-wrap; overflow-wrap: anywhere; }
  pre.cmd code { overflow-wrap: anywhere; }
}
/* plain <pre> (e.g. an error message the reader will see) wraps, so nothing hides off to the side */
.prose pre:not(.say):not(.cmd) {
  font-family: var(--font-mono); font-size: 0.86rem; line-height: 1.6;
  background: var(--code-bg); border-radius: var(--radius-md); padding: 14px 16px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
pre code { background: none; padding: 0; font-size: inherit; }

/* ---------------- placeholders ---------------- */
var {
  font-style: normal; font-weight: 600; font-family: inherit;
  color: var(--var-text); background: var(--var-bg);
  border: 1px dashed var(--var-border); border-radius: 5px;
  padding: 0 0.3em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
var.is-filled { background: var(--var-filled-bg); color: var(--var-filled-text); border-style: solid; border-color: var(--var-filled-border); }
.cmd-box var { background: var(--cmd-var-bg); color: var(--cmd-var-text); border-color: var(--var-border); }
.cmd-box var.is-filled { background: none; color: var(--cmd-text); border-color: var(--var-filled-border); }

/* ---------------- numbered steps ---------------- */
ol.steps { list-style: none; padding: 0; counter-reset: step; }
.prose ol.steps { margin-top: 24px; }
ol.steps > li { position: relative; counter-increment: step; min-height: 40px; padding: 0 0 30px 58px; }
ol.steps > li + li { margin-top: 0; }
ol.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--step-bg); color: var(--step-text);
  font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; line-height: 1;
  box-shadow: 0 0 0 4px var(--bg);
}
ol.steps > li::after {
  content: ""; position: absolute; left: 19px; top: 44px; bottom: 6px;
  width: 2px; border-radius: 2px; background: var(--step-rail);
}
ol.steps > li:last-child { padding-bottom: 4px; }
ol.steps > li:last-child::after { display: none; }
ol.steps > li > h3 { margin-top: 0; padding-top: 6px; font-size: 1.18rem; }
ol.steps > li > * + * { margin-top: 10px; }
ol.steps > li > :is(ul, ol):not([class]) { padding-left: 1.3em; }

/* ---------------- tabs ---------------- */
.tabs { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.prose .tabs { margin-top: 20px; }
.tab-list {
  display: flex; gap: 4px; padding: 6px; overflow-x: auto; scrollbar-width: none;
  background: var(--surface-alt); border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.tab-btn {
  flex: 0 0 auto; padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; color: var(--text-muted); white-space: nowrap;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.tab-btn:hover { color: var(--text); background: var(--surface); }
.tab-btn[aria-selected="true"] { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-1), inset 0 -2px 0 var(--accent); }
.tab-panel { padding: 16px 18px 20px; }
.tab-panel > * + * { margin-top: 14px; }
.tab-panel > .tab-title + * { margin-top: 10px; }
.tab-panel .say-box, .tab-panel .cmd-box { margin-top: 14px; }
.tab-title { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; color: var(--text); }
.js .tab-title { display: none; }
/* Until site.js runs, show only the remembered tab (the head script sets data-tab-*). */
.js .tabs:not(.is-ready) > .tab-panel { display: none; }
.js .tabs:not([data-group]):not(.is-ready) > .tab-panel:first-of-type,
:root[data-tab-os="mac"] .tabs[data-group="os"]:not(.is-ready) > .tab-panel[data-tab="mac"],
:root[data-tab-os="windows"] .tabs[data-group="os"]:not(.is-ready) > .tab-panel[data-tab="windows"],
:root[data-tab-agent="claude"] .tabs[data-group="agent"]:not(.is-ready) > .tab-panel[data-tab="claude"],
:root[data-tab-agent="codex"] .tabs[data-group="agent"]:not(.is-ready) > .tab-panel[data-tab="codex"],
:root[data-tab-where="app"] .tabs[data-group="where"]:not(.is-ready) > .tab-panel[data-tab="app"],
:root[data-tab-where="vscode"] .tabs[data-group="where"]:not(.is-ready) > .tab-panel[data-tab="vscode"] { display: block; }
:root[data-tab-os="mac"] .tabs[data-group="os"]:not(.is-ready) > .tab-list > [data-tab="mac"],
:root[data-tab-os="windows"] .tabs[data-group="os"]:not(.is-ready) > .tab-list > [data-tab="windows"],
:root[data-tab-agent="claude"] .tabs[data-group="agent"]:not(.is-ready) > .tab-list > [data-tab="claude"],
:root[data-tab-agent="codex"] .tabs[data-group="agent"]:not(.is-ready) > .tab-list > [data-tab="codex"],
:root[data-tab-where="app"] .tabs[data-group="where"]:not(.is-ready) > .tab-list > [data-tab="app"],
:root[data-tab-where="vscode"] .tabs[data-group="where"]:not(.is-ready) > .tab-list > [data-tab="vscode"] {
  background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-1), inset 0 -2px 0 var(--accent);
}

/* ---------------- callouts ---------------- */
.callout {
  --c: var(--info); --ct: var(--info-tint);
  background: var(--ct);
  border: 1px solid color-mix(in srgb, var(--c) 24%, transparent); border-left: 4px solid var(--c);
  border-radius: var(--radius-md);
  padding: 12px 16px 14px;
}
.prose .callout { margin-top: 20px; }
.callout.tip { --c: var(--accent); --ct: var(--accent-tint); }
.callout.note { --c: var(--info); --ct: var(--info-tint); }
.callout.warn { --c: var(--warn); --ct: var(--warn-tint); }
.callout.manual { --c: var(--manual); --ct: var(--manual-tint); }
.callout.check { --c: var(--success); --ct: var(--success-tint); }
.callout-head { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; font-weight: 700; color: var(--c); }
.callout-ic { display: grid; }
.callout-ic svg { width: 18px; height: 18px; }
.callout-body { margin-top: 6px; color: var(--text); }
.callout-body > * + * { margin-top: 10px; }
.callout-body ul:not([class]), .callout-body ol:not([class]) { padding-left: 1.3em; }

/* ---------------- fold-outs ---------------- */
.prose details { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.prose details + details { margin-top: 8px; }
details > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; cursor: pointer; list-style: none;
  font-weight: 600; border-radius: inherit;
  transition: background var(--speed) var(--ease);
}
details > summary::-webkit-details-marker { display: none; }
details > summary:hover { background: var(--surface-alt); }
details[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.sum-ic { display: grid; color: var(--text-faint); }
.sum-ic svg { width: 17px; height: 17px; }
.sum-t { flex: 1; min-width: 0; }
.sum-chev { display: grid; color: var(--text-faint); transition: transform var(--speed) var(--ease); }
.sum-chev svg { width: 16px; height: 16px; }
details[open] > summary .sum-chev { transform: rotate(90deg); }
details > :not(summary) { margin: 12px 16px 0; }
details > :last-child:not(summary) { margin-bottom: 16px; }
details.more > summary { font-size: 0.93rem; color: var(--text-muted); }
details.more[open] > summary { color: var(--text); }
details.fix { border-left: 3px solid var(--warn); }
details.fix > summary .sum-ic { color: var(--warn); }

/* ---------------- UI labels + keys ---------------- */
.ui {
  font-weight: 600; font-size: 0.9em; line-height: 1.4;
  padding: 0.04em 0.45em; border: 1px solid var(--border-strong); border-radius: 5px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 0 var(--border);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---------------- checklist ---------------- */
ul.checklist { list-style: none; padding: 0; display: grid; gap: 8px; }
ul.checklist > li { position: relative; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); transition: background var(--speed) var(--ease); }
ul.checklist > li + li { margin-top: 0; }
.ck-input { position: absolute; left: 14px; top: 15px; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ck-label { display: block; padding: 12px 14px 12px 46px; cursor: pointer; }
ul.checklist > li:has(.ck-input:checked) { background: var(--success-tint); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.ck-input:checked + .ck-label { color: var(--text-muted); }

/* ---------------- cards ---------------- */
/* auto-fit: two cards share the row instead of leaving an empty third track; four go 2 × 2 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(236px, 100%), 1fr)); gap: 14px; }
.cards:has(> :nth-child(4):last-child) { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.prose .cards { margin-top: 20px; }
a.card {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 44px 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  color: var(--text); text-decoration: none;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease), transform var(--speed) var(--ease);
}
a.card:hover { border-color: var(--accent); box-shadow: var(--shadow-2); transform: translateY(-2px); color: var(--text); }
.card-kicker { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent); }
a.card strong { font-family: var(--font-display); font-size: 1.06rem; font-weight: 700; line-height: 1.3; }
a.card > span:not([class]) { font-size: 0.9rem; line-height: 1.5; color: var(--text-muted); }
.card-go { position: absolute; right: 14px; top: 16px; color: var(--text-faint); transition: transform var(--speed) var(--ease), color var(--speed) var(--ease); }
.card-go svg { width: 18px; height: 18px; }
a.card:hover .card-go { color: var(--accent); transform: translateX(3px); }

/* ---------------- tables ---------------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.prose .table-wrap { margin-top: 20px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.93rem; line-height: 1.5; }
.prose :is(th, td) { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose thead th { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-faint); background: var(--surface-alt); white-space: nowrap; }
.prose tbody th { font-weight: 700; }
.prose tbody tr:last-child > * { border-bottom: 0; }
.prose caption { caption-side: top; text-align: left; padding: 10px 14px; font-weight: 700; color: var(--text-muted); }
/* phones: tighter cells and wrapping headers, so a 3-column table fits without a hidden last column */
@media (max-width: 560px) {
  .prose :is(th, td) { padding: 9px 10px; }
  .prose thead th { white-space: normal; }
  .prose td code { overflow-wrap: anywhere; }
}

/* ---------------- diagrams (inline SVG, themed by class) ---------------- */
figure.diagram {
  padding: 22px 16px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.prose figure.diagram { margin-top: 24px; }
/* phones: let diagrams use the full screen width so their text stays legible */
@media (max-width: 560px) {
  .prose figure.diagram {
    margin-inline: calc(-1 * clamp(16px, 4vw, 56px));
    padding: 16px 6px 12px;
    border-radius: 0; border-left: 0; border-right: 0;
  }
  .prose figure.diagram figcaption { padding-inline: 10px; }
}
figure.diagram figcaption { max-width: 60ch; margin: 12px auto 0; text-align: center; font-size: 0.86rem; line-height: 1.5; color: var(--text-muted); }
/* build.mjs sets --dg-w to 1.25 × the viewBox width, so small diagrams are not blown up */
svg.dg { display: block; width: 100%; max-width: min(560px, var(--dg-w, 560px)); height: auto; margin: 0 auto; overflow: visible; font-family: var(--font-body); font-size: 15px; }
.dg-box { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; }
.dg-box-primary { fill: var(--primary); stroke: var(--primary); stroke-width: 1.5; }
.dg-box-accent { fill: var(--accent-tint); stroke: var(--accent); stroke-width: 1.75; }
.dg-box-soft { fill: var(--surface-alt); stroke: var(--border); stroke-width: 1.25; }
.dg-box-dashed { fill: none; stroke: var(--text-faint); stroke-width: 1.5; stroke-dasharray: 6 5; }
.dg-line { fill: none; stroke: var(--text-faint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dg-line-accent { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.dg-line-dashed { fill: none; stroke: var(--text-faint); stroke-width: 2; stroke-dasharray: 5 5; stroke-linecap: round; }
.dg-arrowhead { fill: var(--text-faint); stroke: none; }
.dg-arrowhead-accent { fill: var(--accent); stroke: none; }
.dg-text { fill: var(--text); font-size: 15px; }
.dg-text-sm { fill: var(--text-muted); font-size: 13px; }
.dg-text-strong { fill: var(--text); font-size: 15px; font-weight: 700; }
.dg-label { fill: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.dg-text-on { fill: var(--dg-on); }
.dg-fill-primary { fill: var(--primary); }
.dg-fill-accent { fill: var(--dg-accent-fill); }
.dg-fill-soft { fill: var(--surface-alt); }
.dg :is(.dg-text, .dg-text-sm, .dg-text-strong, .dg-label, .dg-text-on) { stroke: none; }

/* ---------------- personalize ---------------- */
[data-personalize] { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 18px 20px; }
.prose [data-personalize] { margin-top: 20px; }
.pz-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .pz-grid { grid-template-columns: 1fr 1fr; } }
.pz-field label { display: block; margin-bottom: 5px; font-size: 0.88rem; font-weight: 700; }
.pz-field input {
  width: 100%; height: 42px; padding: 0 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
.pz-field input::placeholder { color: var(--text-faint); opacity: 1; }
.pz-field input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.pz-hint { margin-top: 5px; font-size: 0.8rem; line-height: 1.45; color: var(--text-faint); }
.pz-warn { margin-top: 12px; font-size: 0.84rem; color: var(--warn); }
.pz-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.pz-actions .btn { min-height: 40px; padding: 8px 16px; }
.pz-status { font-size: 0.82rem; color: var(--text-faint); }
.pz-status.is-saved { color: var(--success); font-weight: 700; }

/* ---------------- progress summary ---------------- */
.progress-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px 16px; }
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pc-count { color: var(--text-muted); }
.pc-count strong { font-family: var(--font-display); font-size: 1.55rem; font-weight: 800; color: var(--text); margin-right: 2px; }
.pc-reset {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: var(--radius-sm);
  font-size: 0.82rem; color: var(--text-faint);
}
.pc-reset svg { width: 14px; height: 14px; }
.pc-reset:hover { color: var(--warn); background: var(--surface-alt); }
.progress-card .bar { height: 8px; margin-top: 10px; }
.pc-next { margin-top: 12px; font-weight: 700; }
.pc-note { margin-top: 6px; font-size: 0.8rem; color: var(--text-faint); }

/* ---------------- done toggle · jump card · prev/next ---------------- */
.done-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin-top: 52px; padding-top: 26px; border-top: 1px solid var(--border);
}
.done-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 9px 20px 9px 14px; border-radius: var(--radius-pill);
  background: var(--surface); color: var(--text); font-weight: 700;
  border: 1.5px solid var(--border-strong);
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.done-toggle:hover { border-color: var(--success); color: var(--success); }
.done-ic { display: grid; }
.done-ic svg { grid-area: 1 / 1; width: 22px; height: 22px; }
.done-ic .i-on { display: none; }
.done-toggle[aria-pressed="true"] { background: var(--success-tint); border-color: var(--success); color: var(--success); }
.done-toggle[aria-pressed="true"] .i-on { display: block; }
.done-toggle[aria-pressed="true"] .i-off { display: none; }
.done-hint { font-size: 0.82rem; color: var(--text-faint); }
.jump-card {
  display: flex; align-items: center; gap: 14px; margin-top: 22px;
  padding: 13px 16px; border-radius: var(--radius-md);
  background: var(--accent-tint); border: 1px dashed var(--accent);
  color: var(--text); text-decoration: none;
}
.jump-card:hover { border-style: solid; color: var(--text); }
.jump-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--surface); color: var(--accent); }
.jump-ic svg { width: 18px; height: 18px; }
.jump-t { flex: 1; min-width: 0; font-weight: 700; line-height: 1.4; }
.jump-go { color: var(--accent); }
.jump-go svg { width: 18px; height: 18px; }
.pagenav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.pagenav a {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 16px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); text-decoration: none;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.pagenav a:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.pagenav .dir { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.pagenav .dir svg { width: 14px; height: 14px; }
.pagenav .t { font-family: var(--font-display); font-size: 1.04rem; font-weight: 700; color: var(--link); }
.pagenav .next { grid-column: 2; align-items: flex-end; text-align: right; }
@media (max-width: 560px) {
  .pagenav { grid-template-columns: 1fr; }
  .pagenav > span { display: none; }
  .pagenav .next { grid-column: auto; }
}

/* ---------------- on-this-page rail ---------------- */
.toc { display: none; }
@media (min-width: 1280px) {
  .toc {
    display: block; position: sticky; top: calc(var(--topbar-h) + 28px); align-self: start;
    max-height: calc(100vh - var(--topbar-h) - 56px); overflow-y: auto; scrollbar-width: thin;
    font-size: 0.84rem;
  }
  .toc-title { font-size: 0.69rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
  .toc ul { list-style: none; padding: 0; border-left: 2px solid var(--border); }
  .toc a { display: block; margin-left: -2px; padding: 5px 0 5px 12px; border-left: 2px solid transparent; color: var(--text-muted); line-height: 1.35; text-decoration: none; }
  .toc a:hover { color: var(--text); }
  .toc a.active { color: var(--accent-strong); border-left-color: var(--accent); font-weight: 600; }
  .toc .toc-sub a { padding-left: 24px; font-size: 0.8rem; }
}
/* the same list, collapsed at the top of long pages, where the rail doesn't fit */
.toc-mobile { margin: -8px 0 28px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.toc-mobile > summary { font-size: 0.93rem; color: var(--text-muted); }
.toc-mobile[open] > summary { color: var(--text); }
.toc-mobile > ul { list-style: none; padding: 0; border-left: 2px solid var(--border); font-size: 0.93rem; }
.toc-mobile li + li { margin-top: 0; }
.toc-mobile a { display: block; margin-left: -2px; padding: 6px 0 6px 12px; border-left: 2px solid transparent; color: var(--text-muted); line-height: 1.4; text-decoration: none; }
.toc-mobile a:hover { color: var(--text); border-left-color: var(--accent); }
.toc-mobile .toc-sub a { padding-left: 24px; }
@media (min-width: 1280px) { .toc-mobile { display: none; } }

/* ---------------- footer ---------------- */
.footer { border-top: 1px solid var(--border); background: var(--sidebar-bg); }
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 22px;
  padding: 18px clamp(16px, 4vw, 56px); font-size: 0.82rem; color: var(--text-faint);
}
@media (min-width: 1024px) { .footer-inner { padding-left: calc(var(--sidebar-w) + clamp(16px, 4vw, 56px)); } }
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--link); }
.footer-by a { font-weight: 700; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.footer-links a { display: inline-flex; align-items: center; gap: 6px; }
.footer-links svg { width: 15px; height: 15px; }

/* ---------------- modals ---------------- */
.modal { position: fixed; inset: 0; z-index: 100; }
.modal-backdrop { position: absolute; inset: 0; background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; display: flex; flex-direction: column;
  width: min(620px, calc(100vw - 24px)); margin: min(11vh, 100px) auto 0;
  max-height: calc(100vh - 2 * min(11vh, 100px)); max-height: calc(100dvh - 2 * min(11vh, 100px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  animation: qs-pop 180ms var(--ease);
}
@keyframes qs-pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
html.modal-open { overflow: hidden; }
.pz-panel { width: min(580px, calc(100vw - 24px)); padding: 18px 20px 20px; overflow-y: auto; }
.pz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pz-head h2 { display: flex; align-items: center; gap: 10px; font-size: 1.28rem; }
.pz-head h2 svg { width: 22px; height: 22px; color: var(--accent); }
.pz-intro { margin-top: 6px; font-size: 0.93rem; color: var(--text-muted); }
.pz-panel .pz-form { margin-top: 18px; }
@media (max-width: 560px) {
  .modal-panel { margin-top: 10px; max-height: calc(100dvh - 20px); }
}

/* ---------------- search ---------------- */
.search-panel { max-height: min(72vh, 620px); overflow: hidden; }
.search-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); }
.search-head > svg { width: 18px; height: 18px; color: var(--text-faint); }
.search-head input { flex: 1; min-width: 0; height: 42px; border: 0; background: none; font-size: 1.05rem; color: var(--text); outline: none; }
.search-head input::-webkit-search-cancel-button { -webkit-appearance: none; }
.results { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px; }
.hit { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); color: var(--text); text-decoration: none; }
.hit:hover, .hit.sel { background: var(--surface-alt); color: var(--text); }
.hit.sel { box-shadow: inset 3px 0 0 var(--accent); }
.hit-ic { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 8px; background: var(--surface-alt); color: var(--text-faint); }
.hit:hover .hit-ic, .hit.sel .hit-ic { background: var(--accent-tint); color: var(--accent); }
.hit-ic svg { width: 16px; height: 16px; }
.hit-body { flex: 1; min-width: 0; }
.hit-title { display: block; font-weight: 700; font-size: 0.95rem; line-height: 1.35; }
.hit-sec { font-weight: 500; color: var(--text-muted); }
.hit-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; font-size: 0.82rem; line-height: 1.45; color: var(--text-faint); }
.results mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 1px; }
.results .none { padding: 28px 16px; text-align: center; color: var(--text-faint); font-size: 0.92rem; }
.results .r-label { padding: 8px 12px 4px; font-size: 0.69rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint); }
.search-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 0.74rem; color: var(--text-faint); }
.search-foot kbd { margin-right: 3px; }
@media (hover: none), (max-width: 560px) { .search-foot { display: none; } }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 120;
  max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: var(--radius-pill);
  background: var(--toast-bg); color: var(--toast-text);
  font-size: 0.9rem; font-weight: 700; box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none; transform: translate(-50%, 16px);
  transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- JavaScript off ---------------- */
.no-js :is(.copy-btn, .say-foot, .searchbtn, .pz-open, .theme-toggle, .nav-toggle, .sb-progress, .done-row, .tab-list, [data-personalize], [data-progress]) { display: none !important; }
.no-js .tab-panel + .tab-panel { border-top: 1px solid var(--border); }
@media (max-width: 1023px) {
  /* no drawer without JavaScript: the navigation follows the article instead of pushing it down */
  .no-js .layout { display: flex; flex-direction: column; }
  .no-js .layout > .sidebar { order: 2; position: static; width: auto; height: auto; transform: none; visibility: visible; box-shadow: none; border-right: 0; border-top: 1px solid var(--border); }
}

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

/* ---------------- print ---------------- */
@media print {
  .topbar, .sidebar, .toc, .toc-mobile, .scrim, .modal, .toast, .done-row, .jump-card, .pagenav, .copy-btn, .say-foot, .h-anchor, .skip-link, .tab-list, .footer { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  .tabs > .tab-panel { display: block !important; }
  .tab-title { display: block !important; }
  .say-box, .cmd-box, .callout, figure.diagram { break-inside: avoid; box-shadow: none; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: var(--text-muted); }
  .prose a[href^="http"] .ext-ic { display: none; }
}

/* ---------------- small inline bits ---------------- */
.ext-nw { white-space: nowrap; }
.ext-ic { display: inline-block; vertical-align: -0.08em; margin-left: 0.18em; }
.ext-ic svg { width: 0.8em; height: 0.8em; display: inline-block; }
