/* ==========================================================================
   workbench documentation
   Design tokens first, then layout, then prose, then components.
   ========================================================================== */


/* Geometry. Matches the portal: this documentation separates with lines, not
   with elevation or roundness, so the shared token file's 6/8/12 radius ramp
   collapses to a single value here and nothing is a capsule. tokens.css is
   left alone — it is shared, and the override belongs to the surface that
   wants it. */
:root {
  --radius-sm: 6px;
  --radius: 6px;
  --radius-lg: 6px;
}

/* Themed scrollbars, matching the portal: the stock browser bar is the one
   element on the page that ignores the palette, and it is most obvious in dark
   mode. Elements that hide their bar entirely (.topnav, .tab-bar) opt out
   below. */
* {
  scrollbar-width: thin;                       /* Firefox */
  scrollbar-color: var(--border) transparent;  /* thumb / track */
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-line); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* --------------------------------------------------------------- reset -- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + var(--topnav-h) + 20px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

button { font: inherit; color: inherit; }

::selection { background: var(--accent-line); color: var(--text); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: 12px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; color: #fff; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

/* -------------------------------------------------------------- topbar -- */

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-12);
  padding: 0 var(--page-pad-x);
  max-width: 1560px; margin: 0 auto;
}

.menu-btn {
  display: none; width: 32px; height: 32px; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; color: var(--text-2);
}
.menu-btn svg { width: 16px; height: 16px; }

.brand { display: flex; align-items: baseline; gap: 8px; color: var(--text); flex-shrink: 0; }
.brand:hover { color: var(--text); }
.brand-mark { display: inline-flex; width: 24px; height: 24px; color: var(--accent); line-height: 0; transform: translateY(2px); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--text-3); font-weight: 500; }

.search-btn {
  margin-left: auto; margin-right: auto;
  display: flex; align-items: center; gap: var(--s-8);
  width: min(440px, 42vw); padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-3); font-size: 14px; cursor: pointer;
  transition: border-color .14s;
}
.search-btn:hover { border-color: var(--border-strong); }
.search-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.search-btn span { flex: 1; text-align: left; }
.search-btn kbd, .search-input-row kbd {
  font-family: var(--sans); font-size: 10px; font-weight: 500; letter-spacing: .06em;
  padding: 2px 4px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-sunk); color: var(--text-4);
}

.topbar-actions { display: flex; align-items: center; gap: var(--s-4); flex-shrink: 0; }
.ghost {
  padding: 8px 12px; border-radius: var(--radius); font-size: 14px; font-weight: 500; color: var(--text-2);
}
.ghost:hover { background: var(--surface-2); color: var(--text); }

.theme-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: var(--radius); cursor: pointer; color: var(--text-3);
}
.theme-btn:hover { background: var(--surface-2); color: var(--text); }
.theme-btn svg { width: 16px; height: 16px; }
.i-moon { display: none; }
:root[data-theme='dark'] .i-sun { display: none; }
:root[data-theme='dark'] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .i-sun { display: none; }
  :root:not([data-theme='light']) .i-moon { display: block; }
}

/* -------------------------------------------------------------- topnav -- */

.topnav {
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav-tab { scroll-snap-align: start; }
.topnav-inner {
  display: flex; gap: var(--s-4); padding: 0 var(--page-pad-x); max-width: 1560px; margin: 0 auto;
  height: var(--topnav-h); align-items: stretch;
}
.topnav-tab {
  display: inline-flex; align-items: center; padding: 0 var(--s-12);
  font-size: 14px; font-weight: 500; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.topnav-tab:hover { color: var(--text); }
.topnav-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

/* --------------------------------------------------------------- shell -- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 0 var(--s-40);
  max-width: 1560px; margin: 0 auto; padding: 0 var(--page-pad-x);
  align-items: start;
}

.sidebar {
  position: sticky; top: calc(var(--topbar-h) + var(--topnav-h));
  height: calc(100vh - var(--topbar-h) - var(--topnav-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: var(--s-24) var(--s-12) var(--s-48) 0;
  scrollbar-width: thin;
}

.nav-group + .nav-group { margin-top: var(--s-24); }
.nav-group-title {
  margin: 0 0 var(--s-4); padding: 0 var(--s-8);
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3);
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: block; padding: var(--s-4) var(--s-8); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-2); line-height: 1.45;
}
.sidebar li a:hover { background: var(--surface-2); color: var(--text); }
.sidebar li a.active {
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
  box-shadow: inset 2px 0 0 var(--accent);
}

.content { min-width: 0; padding: var(--s-32) 0 var(--s-48); }

.toc-col { position: sticky; top: calc(var(--topbar-h) + var(--topnav-h)); padding: var(--s-32) 0 var(--s-40); }
.toc { max-height: calc(100vh - 140px); overflow-y: auto; }
.toc ul { border-left: 2px solid var(--border); }
.toc-title { margin: 0 0 var(--s-8); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li a {
  display: block; padding: var(--s-4) 0 var(--s-4) var(--s-12); margin-left: -2px;
  border-left: 2px solid transparent;
  font-size: 14px; color: var(--text-2); line-height: 1.4;
}
.toc li a:hover { color: var(--text); border-left-color: var(--border-strong); }
.toc li a.active { color: var(--accent); font-weight: 700; border-left-color: var(--accent); }
.toc-h3 a { padding-left: var(--s-24) !important; font-size: 12px; }

/* --------------------------------------------------------------- prose -- */

.prose { max-width: var(--content-max); }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-20);
  margin-bottom: var(--s-12);
}
.page-head h1 { margin-bottom: 0; }

.copy-page {
  display: inline-flex; align-items: center; gap: var(--s-4); flex-shrink: 0;
  margin-top: var(--s-4); padding: var(--s-8) var(--s-12);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: border-color .14s, color .14s;
}
.copy-page:hover { border-color: var(--border-strong); color: var(--text); }
.copy-page.done { color: var(--ok); border-color: var(--ok-line); }
.copy-page svg { width: 14px; height: 14px; }
@media (max-width: 560px) { .copy-page span { display: none; } .copy-page { padding: var(--s-8); } }

.eyebrow {
  margin: 0 0 var(--s-4); font-size: 12px; font-weight: 700; color: var(--accent);
  letter-spacing: 0;
}

.prose h1 {
  margin: 0 0 var(--s-12); text-wrap: balance; font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em;
}
.lede { margin: 0 0 var(--s-24); font-size: 18px; line-height: 1.6; color: var(--text-3); }

.prose h2 {
  overflow-wrap: break-word;
  margin: var(--s-48) 0 var(--s-16); font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em;
  padding-top: var(--s-8); border-top: 1px solid var(--border);
}
.prose h3 { overflow-wrap: break-word; margin: var(--s-32) 0 var(--s-8); font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.prose h4 { margin: var(--s-24) 0 var(--s-8); font-size: 18px; font-weight: 700; color: var(--text-2); }

.anchor {
  margin-left: var(--s-8); color: var(--text-4); opacity: 0; font-weight: 500;
  transition: opacity .12s;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }

.prose p { margin: 0 0 var(--s-16); color: var(--text-2); overflow-wrap: break-word; }
.prose strong { color: var(--text); font-weight: 700; }

.prose ul, .prose ol { margin: 0 0 var(--s-16); padding-left: var(--s-24); color: var(--text-2); }
.prose li { margin: var(--s-4) 0; overflow-wrap: break-word; }
.prose li::marker { color: var(--text-4); }

.prose hr { margin: var(--s-40) 0; border: none; border-top: 1px solid var(--border); }

.prose blockquote {
  margin: 0 0 var(--s-16); padding: var(--s-2) 0 var(--s-2) var(--s-16);
  border-left: 2px solid var(--border-strong); color: var(--text-3);
}

.ext { font-size: .8em; margin-left: 2px; opacity: .6; }

/* inline code — must be breakable: a long token in a paragraph would otherwise
   push the page wider than the viewport and scroll the whole body sideways. */
.prose :not(pre) > code {
  font-family: var(--mono); font-size: .855em;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: .1em .34em; border-radius: var(--radius-sm); color: var(--text);
  overflow-wrap: anywhere;
}
.prose a > code { color: var(--accent); border-color: var(--accent-line); }

/* --------------------------------------------------------------- table -- */

/* A clipped table edge must read as "there is more", not as a layout bug. */
.table-wrap {
  margin: 0 0 var(--s-20); overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface);
  scrollbar-width: thin;
}
.table-wrap.is-scrollable {
  mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
}
.table-wrap.is-scrollable.at-end { mask-image: none; -webkit-mask-image: none; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
thead th {
  text-align: left; padding: var(--s-8) var(--s-16); white-space: nowrap;
  background: var(--surface-2); color: var(--text-3);
  font-weight: 700; font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: var(--s-12) var(--s-16); border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td code, th code { white-space: nowrap; overflow-wrap: normal; }

/* ---------------------------------------------------------------- code -- */

.code {
  margin: 0 0 var(--s-24); border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 0, 0, .08);
  overflow: hidden; background: var(--code-bg);
}
:root[data-theme='dark'] .code { border-color: rgba(255, 255, 255, .07); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .code { border-color: rgba(255, 255, 255, .07); }
}
.code-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-8) var(--s-8) var(--s-8) var(--s-12); background: var(--code-bar);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.code-lang {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: #8e95a3;
}
.copy {
  background: none; border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--radius);
  color: #c6cad0; font-size: 12px; padding: var(--s-4) var(--s-8); cursor: pointer;
  transition: background .12s, color .12s;
}
.copy:hover { background: rgba(255, 255, 255, .08); color: #e5e7eb; }
.copy.done { color: #4fd3a0; border-color: #17513a; }

.code pre { margin: 0; padding: var(--s-16); overflow-x: auto; }
.code code {
  font-family: var(--mono); font-size: 14px; line-height: 1.6;
  color: var(--code-text); background: none; border: none; padding: 0; white-space: pre;
}

/* highlight.js token colors (one dark palette, both themes — code stays dark) */
.hljs-comment, .hljs-quote { color: #6b7280; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type { color: #d68ee4; }
.hljs-string, .hljs-attr, .hljs-addition { color: #4fd3a0; }
.hljs-number, .hljs-symbol, .hljs-meta { color: #f7b75c; }
.hljs-title, .hljs-section, .hljs-name { color: #5ca8f0; }
.hljs-variable, .hljs-template-variable, .hljs-built_in { color: #e5b8ef; }
.hljs-deletion { color: #f2726c; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ---------------------------------------------------------------- tabs -- */

.tabs { margin: 0 0 var(--s-20); }
.tab-bar {
  display: flex; gap: var(--s-2); border-bottom: 1px solid var(--border); margin-bottom: -1px;
  overflow-x: auto; scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: var(--s-8) var(--s-12); font-size: 14px; font-weight: 500; color: var(--text-3); cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.tab-panel { display: none; padding-top: var(--s-12); }
.tab-panel.active { display: block; }
.tab-panel .code { margin-bottom: 0; }

/* ------------------------------------------------------------ callouts -- */

.callout {
  margin: 0 0 var(--s-20); padding: var(--card-pad) var(--s-16); border-radius: var(--radius-lg);
  border: 1px solid var(--info-line); background: var(--info-soft);
}
.callout-head { display: flex; align-items: center; gap: var(--card-gap); margin-bottom: var(--s-4); }
.callout-icon { display: inline-flex; color: var(--info); }
.callout-icon svg { width: 16px; height: 16px; }
.callout-title { font-weight: 700; font-size: 14px; color: var(--text); }
.callout-body > :last-child { margin-bottom: 0; }
.callout-body { overflow-wrap: break-word; }
.callout-body p { font-size: 14px; color: var(--text-2); margin-bottom: var(--s-8); }
.callout-body ul, .callout-body ol { font-size: 14px; margin-bottom: var(--s-8); }

.callout-tip { border-color: var(--ok-line); background: var(--ok-soft); }
.callout-tip .callout-icon { color: var(--ok); }
.callout-warning { border-color: var(--warn-line); background: var(--warn-soft); }
.callout-warning .callout-icon { color: var(--warn); }
.callout-danger { border-color: var(--danger-line); background: var(--danger-soft); }
.callout-danger .callout-icon { color: var(--danger); }

/* --------------------------------------------------------------- cards -- */

.cards { display: grid; gap: var(--section-gap); margin: 0 0 var(--s-24); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards[data-cols='3'] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards[data-cols='1'] { grid-template-columns: 1fr; }
@media (max-width: 720px) { .cards, .cards[data-cols='3'] { grid-template-columns: 1fr; } }

.card {
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--card-pad); border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text);
  transition: border-color .14s;
}
.card:hover {
  border-color: var(--accent-line); color: var(--text);
}
.card-title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.card-desc { font-size: 14px; color: var(--text-3); line-height: 1.5; flex: 1; }
.card-more { display: inline-flex; align-items: center; gap: var(--s-4); font-size: 14px; font-weight: 700; color: var(--accent); margin-top: var(--s-4); }
.card-more svg { width: 13px; height: 13px; }

/* --------------------------------------------------------------- steps -- */

.steps { counter-reset: step; margin: 0 0 var(--s-24); }
.steps > h3 {
  counter-increment: step; position: relative; padding-left: var(--s-40); margin-top: var(--s-24);
}
.steps > h3::before {
  content: counter(step);
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: var(--s-24); height: var(--s-24); border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.steps > *:not(h3) { padding-left: var(--s-40); }
@media (max-width: 560px) { .steps > *:not(h3) { padding-left: 0; } }

/* ------------------------------------------------------------- mermaid -- */

.mermaid-wrap {
  margin: 0 0 var(--s-20); padding: var(--s-20); overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  text-align: center;
}
.mermaid { margin: 0; font-family: var(--sans) !important; }
.mermaid:not([data-processed]) { visibility: hidden; min-height: 60px; }

/* Mermaid ships hairline edges and bare edge labels. Both are the parts a
   reader actually traces, so they get weight and a ground of their own. */
.mermaid .flowchart-link,
.mermaid .messageLine0,
.mermaid .messageLine1,
.mermaid .relationshipLine { stroke-width: 1.7px; }

.mermaid .marker,
.mermaid marker path { fill: var(--text-3); stroke: var(--text-3); }

.mermaid .messageText, .mermaid .loopText, .mermaid .noteText {
  font-size: 12px !important; letter-spacing: 0;
}
/* Mermaid measures label boxes before this stylesheet applies, so never change
   an edge label's font-size, tracking or casing here — it clips. Ground only. */
/* A cylinder is storage, not another step — give it its own fill. */
.mermaid .node path[d*="C"] + path, .mermaid g.node.default > path {
  filter: saturate(.55);
}

/* Nodes read as one family: same corner, same border weight, tabular labels. */
.mermaid .node rect,
.mermaid .node polygon,
.mermaid .node circle,
.mermaid .cluster rect { rx: 6; ry: 6; stroke-width: 1.4px; }

.mermaid .nodeLabel, .mermaid .actor > tspan { font-weight: 500; }
.mermaid .cluster-label .nodeLabel { font-weight: 700; font-size: 12px !important; }

/* Sequence diagrams: the lifeline is scaffolding, not content. */
.mermaid line.actor-line { stroke-dasharray: 3 4; opacity: .55; }

/* ---------------------------------------------------------- prev / next -- */

.prevnext {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--section-gap);
  max-width: var(--content-max); margin: var(--s-48) 0 0;
}
.pn {
  display: flex; flex-direction: column; gap: var(--s-2); padding: var(--card-pad) var(--s-16);
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  transition: border-color .14s;
}
.pn:hover { border-color: var(--accent-line); }
.pn-next { text-align: right; }
.pn-dir { font-size: 12px; color: var(--text-3); }
.pn-label { font-size: 14px; font-weight: 700; color: var(--text); }

.page-foot {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-16); flex-wrap: wrap;
  max-width: var(--content-max); margin-top: var(--s-32); padding-top: var(--s-16);
  border-top: 1px solid var(--border);
  font-size: 14px; color: var(--text-3);
}

/* -------------------------------------------------------------- search -- */

.search-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  display: grid; place-items: start center; padding: 12vh var(--s-16) var(--s-16);
}
.search-overlay[hidden] { display: none; }

.search-modal {
  width: min(620px, 100%); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.search-input-row {
  display: flex; align-items: center; gap: var(--s-8); padding: var(--s-12) var(--s-16);
  border-bottom: 1px solid var(--border);
}
.search-input-row svg { width: 16px; height: 16px; color: var(--text-4); flex-shrink: 0; }
.search-input-row input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--sans); font-size: 16px; color: var(--text);
}
.search-input-row input::placeholder { color: var(--text-4); }

.search-results { max-height: 56vh; overflow-y: auto; padding: var(--s-4); }
.search-empty { padding: var(--s-24) var(--s-16); text-align: center; color: var(--text-3); font-size: 14px; }
.sr {
  display: block; padding: var(--s-8) var(--s-12); border-radius: var(--radius); color: var(--text);
}
.sr:hover, .sr.sel { background: var(--accent-soft); color: var(--text); }
.sr-crumb { font-size: 12px; color: var(--text-3); }
.sr-title { font-size: 14px; font-weight: 700; margin-top: var(--s-2); }
.sr-snip { font-size: 12px; color: var(--text-3); margin-top: var(--s-2); line-height: 1.45; }
.sr mark { background: var(--accent-line); color: var(--text); border-radius: var(--radius-sm); padding: 0 2px; }

/* ------------------------------------------------------------- landing -- */

/* Reference pages are tables first, prose second: give the columns room. */
.is-wide { --content-max: 1000px; }
.is-wide .shell { max-width: 1680px; }

.is-landing .toc-col { display: none; }
.is-landing .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.is-landing .prose { max-width: 880px; }
.is-landing .page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-20);
  margin-bottom: var(--s-12);
}
.page-head h1 { margin-bottom: 0; }

.copy-page {
  display: inline-flex; align-items: center; gap: var(--s-4); flex-shrink: 0;
  margin-top: var(--s-4); padding: var(--s-8) var(--s-12);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: border-color .14s, color .14s;
}
.copy-page:hover { border-color: var(--border-strong); color: var(--text); }
.copy-page.done { color: var(--ok); border-color: var(--ok-line); }
.copy-page svg { width: 14px; height: 14px; }
@media (max-width: 560px) { .copy-page span { display: none; } .copy-page { padding: var(--s-8); } }

.eyebrow { display: none; }
.is-landing .prose h1 { font-size: 40px; margin-bottom: var(--s-16); }
.is-landing .prose > h2:first-of-type { border-top: none; padding-top: 0; }

/* ---------------------------------------------------------- responsive -- */

@media (max-width: 1200px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc-col { display: none; }
}

@media (max-width: 900px) {
  :root { --topbar-h: 48px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .brand-sub { display: none; }
  .search-btn { width: auto; margin-right: 0; }
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { padding: var(--s-8); }
  .topbar-actions .ghost { display: none; }

  .sidebar {
    position: fixed; inset: calc(var(--topbar-h) + var(--topnav-h)) auto 0 0;
    width: 280px; max-width: 84vw; height: auto;
    background: var(--surface); border-right: 1px solid var(--border);
    z-index: 80; padding: var(--s-20) var(--s-12) var(--s-40);
    transform: translateX(-102%); transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  body.nav-open::after {
    content: ''; position: fixed; inset: 0; z-index: 70;
    background: var(--overlay);
  }
  .content { padding-top: var(--s-24); }
  .prose h1 { font-size: 24px; }
  .is-landing .prose h1 { font-size: 24px; }
  .lede { margin-bottom: var(--s-20); }
  .lede { font-size: 16px; }
  .prevnext { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .prose h2 { font-size: 20px; }
  .code code { font-size: 12px; }
}

@media print {
  .topbar, .sidebar, .toc-col, .prevnext, .search-overlay, .page-foot { display: none !important; }
  .shell { grid-template-columns: 1fr; }
}
