/* ============================================================
   SmartKMS Docs — design tokens
   Palette: the SmartKMS app's own default theme (static/css/styles.css):
   warm off-white paper and #121416 grey in dark mode, the app's primary
   blue hsl(210 65% 45%), amber reserved for warning notes.
   Type: DM Sans (headings + wordmark, matching the app) + Inter (UI/body)
   + JetBrains Mono (code/commands/config).

   Theme: defaults to the OS/browser's preference (prefers-color-scheme).
   A manual toggle (see js/site.js) can force light or dark regardless of
   system setting via [data-theme="light"|"dark"] on <html>; removing the
   attribute (the toggle's third state) returns to following the system.
   ============================================================ */
:root {
  --bg:            #FCFAF8;   /* hsl(40 33% 98%) */
  --bg-elevated:   #FFFFFF;   /* hsl(0 0% 100%) */
  --bg-sunken:     #F5F3F0;   /* hsl(40 20% 95%) */
  --sidebar-bg:    #FFFFFF;   /* hsl(0 0% 100%) */
  --nav-active:    #EAECF0;   /* hsl(220 15% 93%) */
  --ink:           #1B212D;   /* hsl(220 25% 14%) */
  --ink-muted:     #454E5E;   /* hsl(220 15% 32%) */
  --ink-faint:     #6A7181;   /* hsl(220 10% 46%) */
  --border:        #E2E4E9;   /* hsl(220 13% 90%) */
  --border-strong: #CBCFD7;   /* hsl(220 13% 82%) */
  --blue:          #2873BD;   /* hsl(210 65% 45%) */
  --blue-dark:     #215E9C;   /* hsl(210 65% 37%) */
  --blue-light:    #4E94DA;   /* hsl(210 65% 58%) */
  --blue-wash:     #EAF2FB;   /* hsl(210 65% 95%) */
  --amber:         #AE5C13;   /* hsl(28 80% 38%) */
  --amber-wash:    #FCF2E8;   /* hsl(28 80% 95%) */
  --red:           #C52020;   /* hsl(0 72% 45%) */
  --red-wash:      #FCEDED;   /* hsl(0 72% 96%) */
  --code-bg:       #121416;   /* hsl(210 10% 8%) */
  --code-ink:      #E8EBEE;   /* hsl(210 15% 92%) */
  --code-accent:   #89B8E6;   /* hsl(210 65% 72%) */

  --radius-sm: 6px;
  --radius-md: 12px;   /* app: --radius 0.75rem */
  --radius-lg: 16px;

  --sidebar-w: 264px;
  --toc-w: 220px;
  --topbar-h: 56px;

  --font-display: 'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;  /* same face as the app's headings and wordmark */
  --font-body: 'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;  /* the app's body face */
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Dark palette — applied when the OS/browser prefers dark AND the person
   hasn't explicitly forced light mode, OR when they've explicitly forced
   dark mode via the toggle regardless of system preference. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #121416;   /* hsl(210 10% 8%) */
    --bg-elevated:   #1A1C1F;   /* hsl(210 9% 11%) */
    --bg-sunken:     #232629;   /* hsl(210 8% 15%) */
    --sidebar-bg:    #0E0F11;   /* hsl(210 10% 6%) */
    --nav-active:    #26292C;   /* hsl(210 8% 16%) */
    --ink:           #E8EBEE;   /* hsl(210 15% 92%) */
    --ink-muted:     #ACB0B9;   /* hsl(220 8% 70%) */
    --ink-faint:     #7B818E;   /* hsl(220 8% 52%) */
    --border:        #2D3034;   /* hsl(210 7% 19%) */
    --border-strong: #3E4247;   /* hsl(210 7% 26%) */
    --blue:          #4E94DA;   /* hsl(210 65% 58%) */
    --blue-dark:     #86B8EA;   /* hsl(210 70% 72%) */
    --blue-light:    #4E94DA;   /* hsl(210 65% 58%) */
    --blue-wash:     #182939;   /* hsl(210 40% 16%) */
    --amber:         #EC9951;   /* hsl(28 80% 62%) */
    --amber-wash:    #322315;   /* hsl(28 40% 14%) */
    --red:           #DA6262;   /* hsl(0 62% 62%) */
    --red-wash:      #321515;   /* hsl(0 40% 14%) */
    --code-bg:       #0E0F11;   /* hsl(210 10% 6%) */
    --code-ink:      #DCE0E5;   /* hsl(210 15% 88%) */
    --code-accent:   #89B8E6;   /* hsl(210 65% 72%) */
  }
}
:root[data-theme="dark"] {
  --bg:            #121416;   /* hsl(210 10% 8%) */
  --bg-elevated:   #1A1C1F;   /* hsl(210 9% 11%) */
  --bg-sunken:     #232629;   /* hsl(210 8% 15%) */
  --sidebar-bg:    #0E0F11;   /* hsl(210 10% 6%) */
  --nav-active:    #26292C;   /* hsl(210 8% 16%) */
  --ink:           #E8EBEE;   /* hsl(210 15% 92%) */
  --ink-muted:     #ACB0B9;   /* hsl(220 8% 70%) */
  --ink-faint:     #7B818E;   /* hsl(220 8% 52%) */
  --border:        #2D3034;   /* hsl(210 7% 19%) */
  --border-strong: #3E4247;   /* hsl(210 7% 26%) */
  --blue:          #4E94DA;   /* hsl(210 65% 58%) */
  --blue-dark:     #86B8EA;   /* hsl(210 70% 72%) */
  --blue-light:    #4E94DA;   /* hsl(210 65% 58%) */
  --blue-wash:     #182939;   /* hsl(210 40% 16%) */
  --amber:         #EC9951;   /* hsl(28 80% 62%) */
  --amber-wash:    #322315;   /* hsl(28 40% 14%) */
  --red:           #DA6262;   /* hsl(0 62% 62%) */
  --red-wash:      #321515;   /* hsl(0 40% 14%) */
  --code-bg:       #0E0F11;   /* hsl(210 10% 6%) */
  --code-ink:      #DCE0E5;   /* hsl(210 15% 88%) */
  --code-accent:   #89B8E6;   /* hsl(210 65% 72%) */
}

* { box-sizing: border-box; }
/* scroll-margin-top on the headings (below) is what actually offsets an
   anchor jump for the sticky top bar. Do NOT also set scroll-padding-top
   here - the two stack (they don't override each other), which double-
   counts the offset and overshoots past the target heading into whatever
   sits above it. */
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout shell ─────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 20px 16px 24px;
}

/* ── OS-alternative command tabs ─────────────────────────────
   Used wherever a command differs by platform (venv activation,
   path separators, package manager, etc). */
.os-tabs { margin: 10px 0 16px; }
.os-tab-btns { display: flex; gap: 4px; margin-bottom: -1px; position: relative; z-index: 1; }
.os-tab-btn {
  padding: 6px 13px;
  font-size: 12.5px; font-weight: 600; font-family: var(--font-body);
  color: var(--ink-faint);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  cursor: pointer;
}
.os-tab-btn.active { color: var(--code-ink); background: var(--code-bg); border-color: var(--code-bg); }
/* Hover only recolours INACTIVE tabs: the active tab sits on the dark code
   background, where the page's ink colour (near-black in light mode) was
   unreadable. */
.os-tab-btn:not(.active):hover { color: var(--ink); background: var(--bg-elevated); }
.os-tab-btn.active:hover { color: var(--code-ink); }
.os-tab-btn:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 1px; }
.os-tabs .code-block { margin-top: 0; border-top-left-radius: 0; }
.os-tab-panel[hidden] { display: none; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--ink-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--blue-dark); border-color: var(--blue-light); }

/* Color-mode menu under the topbar button */
.theme-menu-wrap { position: relative; }
.theme-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 150px;
  padding: 5px; display: flex; flex-direction: column; gap: 1px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(16,19,26,0.16);
}
.theme-menu[hidden] { display: none; }
.theme-option {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px;
  border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--ink-muted); text-align: left;
}
.theme-option:hover, .theme-option:focus-visible { background: var(--bg-sunken); color: var(--ink); outline: none; }
.theme-option.is-current { color: var(--blue-dark); font-weight: 600; }
.theme-option svg { flex-shrink: 0; }
.theme-check { margin-left: auto; }

/* Language button: globe + EN / FIL */
.theme-toggle.lang-toggle { width: auto; gap: 5px; padding: 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.lang-code {
  display: inline-grid; place-items: center; min-width: 26px; height: 18px; padding: 0 3px; flex-shrink: 0;
  border: 1px solid var(--border-strong); border-radius: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
}
.theme-option.is-current .lang-code { border-color: currentColor; }
.nav-lang {
  margin-left: 6px; padding: 0 4px; border: 1px solid var(--border-strong); border-radius: 3px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .04em; color: var(--ink-faint); vertical-align: 1px;
}
.lang-note {
  display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 18px; padding: 5px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-sunken);
  font-size: 13px; color: var(--ink-muted);
}

.nav-group { padding: 6px 8px 2px; }
.nav-group-label {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 6px 8px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.nav-group-label:hover { background: var(--bg-sunken); color: var(--ink-muted); }
.nav-chevron { flex-shrink: 0; transition: transform 0.15s ease; }
.nav-group.is-collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-group-items { display: grid; gap: 1px; padding-top: 2px; }
.nav-group.is-collapsed .nav-group-items { display: none; }

.nav-link {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.8px;
  color: var(--ink-muted);
  margin-bottom: 1px;
}
.nav-link:hover { background: var(--bg-sunken); text-decoration: none; color: var(--ink); }
.nav-link.active { background: var(--nav-active); color: var(--ink); font-weight: 600; }

/* Indent sub-items (dropdown items) with a left padding/tab space */
.nav-link-indented {
  padding-left: 28px !important;
}

.sidebar-footer {
  margin-top: 20px;
  padding: 14px 8px 4px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.version-pill {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ── Topbar (persistent at every screen size) ────────────────
   Brand · search/filter · links ······ theme toggle · GitHub */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-menu-btn {
  display: none; /* shown only at the mobile breakpoint below */
  align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.topbar-brand {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0; color: var(--ink);
}
.topbar-brand:hover { text-decoration: none; color: var(--ink); }
.topbar-brand img { display: block; }
.topbar-name { font-family: 'DM Sans', var(--font-body); font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }  /* same face/weight as the SmartKMS wordmark */
.topbar-name-sub {
  font-family: var(--font-body); font-weight: 500; font-size: 12.5px;
  color: var(--ink-faint); margin-left: 3px;
}

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  width: 280px; min-width: 0;
  padding: 7px 11px;
  margin-left: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--ink-faint);
}
.topbar-search:focus-within { border-color: var(--blue-light); }
.topbar-search svg { flex-shrink: 0; }
.topbar-search input {
  border: none; background: none; outline: none; width: 100%;
  color: var(--ink); font-size: 13.5px; font-family: var(--font-body);
}
.topbar-search input::placeholder { color: var(--ink-faint); }
.topbar-kbd {
  flex-shrink: 0; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-faint); background: var(--bg-elevated);
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 1.5px 6px;
}

/* Section search results, under the search box */
.topbar-search { position: relative; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0;
  width: 440px; max-width: calc(100vw - 24px); max-height: min(70vh, 520px); overflow-y: auto;
  padding: 6px; z-index: 60;
  background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(16,19,26,0.16);
}
.search-results[hidden] { display: none; }
.search-result {
  display: block; padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none;
}
.search-result[aria-selected="true"], .search-result:hover { background: var(--blue-wash); }
.search-result-title { display: block; font-weight: 600; font-size: 14px; }
.search-result-page { display: block; font-size: 12px; color: var(--blue-dark); margin-top: 1px; }
.search-result-text { display: block; font-size: 12.5px; color: var(--ink-muted); margin-top: 3px; line-height: 1.45; }
.search-empty { padding: 12px; font-size: 13px; color: var(--ink-faint); }

.topbar-links { display: flex; align-items: center; gap: 2px; margin-left: 6px; }
.topbar-links a {
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 13.8px; font-weight: 500; color: var(--ink-muted);
}
.topbar-links a:hover { background: var(--bg-sunken); color: var(--ink); text-decoration: none; }
.topbar-links a.active { color: var(--blue-dark); }

.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.topbar-actions .theme-toggle { margin-left: 0; }
.topbar-icon-link {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--ink-muted);
}
.topbar-icon-link:hover { background: var(--bg-sunken); color: var(--ink); text-decoration: none; }

/* ── Main content area ────────────────────────────────────── */
.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: 40px;
  padding: 48px 48px 96px;
  max-width: 1180px;
}

.content { min-width: 0; max-width: 760px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
}

.content h1 {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
  line-height: 1.15;
}
.page-lede {
  font-size: 17px;
  color: var(--ink-muted);
  margin: 0 0 36px;
  max-width: 62ch;
}

.content h2 {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  margin: 48px 0 16px;
  padding-top: 8px;
  letter-spacing: -0.015em;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.content h2:first-of-type { margin-top: 0; }
.content h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 28px 0 10px;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.content h4, .content [id], .release[id] { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.content p { margin: 0 0 14px; color: var(--ink); }
.content ul, .content ol { margin: 0 0 16px; padding-left: 22px; }
.content li { margin-bottom: 6px; }
.content strong { font-weight: 600; }

.content code {
  font-family: var(--font-mono);
  background: var(--bg-sunken);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.87em;
  color: var(--blue-dark);
  overflow-wrap: anywhere;
}
.content pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 16px 18px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 20px;
}
.content pre code { background: none; color: inherit; padding: 0; }

/* ── Code blocks — "terminal window" treatment ────────────────
   Every <pre> in the content area gets progressively enhanced at
   runtime (see wireCodeBlocks() in site.js) with a title bar
   (inferred label + copy button), rather than hand-editing every
   command block in every page. */
.code-block {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 0 0 20px;
  border: 1px solid var(--border-strong);
}
.code-block-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 7px 8px 7px 14px;
  background: var(--code-bg);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.code-block-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--code-ink);
  opacity: 0.55;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-copy-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  color: var(--code-ink); opacity: 0.55;
  background: transparent; border: none; border-radius: 6px;
  cursor: pointer; flex-shrink: 0;
}
.code-copy-btn:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.code-copy-btn.copied { opacity: 1; color: #6EE7B7; }
.code-copy-btn svg { flex-shrink: 0; }
.code-block pre {
  margin: 0;
  border-radius: 0;
  border: none;
}

/* ── Callout boxes ────────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--blue);
  background: var(--blue-wash);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0 0 20px;
  font-size: 14.5px;
}
.callout.warn { border-color: var(--amber); background: var(--amber-wash); }
.callout.danger { border-color: var(--red); background: var(--red-wash); }
/* Only a leading bold phrase is the callout's title; bold words later in
   the text stay inline. */
.callout > strong:first-child { display: block; margin-bottom: 3px; }

/* ── Video ────────────────────────────────────────────────── */
.video { margin: 0 0 28px; }
.video video {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-sunken);
}
.video figcaption { margin-top: 8px; font-size: 13.5px; color: var(--ink-faint); }

/* ── Tables ───────────────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 24px;
}
.table-scroll table { margin: 0 0 0; }
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 24px;
  font-size: 14px;
}
.content th, .content td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: anywhere;
}
.content th {
  font-weight: 600;
  color: var(--ink-muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border-strong);
}
.content tr:last-child td { border-bottom: none; }

/* Three-column tables are too narrow on phones: stack each row into a
   card (layer label, technology, purpose) instead of squeezing columns. */
@media (max-width: 600px) {
  .content .stack-table,
  .content .stack-table tbody,
  .content .stack-table tr,
  .content .stack-table td { display: block; }
  .content .stack-table tr:first-child { display: none; }
  .content .stack-table tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .content .stack-table tr:last-child { border-bottom: none; }
  .content .stack-table td { padding: 0; border-bottom: none; overflow-wrap: normal; }
  .content .stack-table td:nth-child(1) {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .content .stack-table td:nth-child(2) { margin-top: 2px; font-weight: 600; color: var(--ink); }
  .content .stack-table td:nth-child(3) { margin-top: 2px; color: var(--ink-muted); }
}

/* ── Card grid (feature/page listings) ───────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 0 0 28px;
}
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card p { margin: 0; font-size: 13.5px; color: var(--ink-muted); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--ink-muted);
  margin-right: 6px;
}
.badge.teal { background: var(--blue-wash); color: var(--blue-dark); }
.badge.amber { background: var(--amber-wash); color: var(--amber); }

/* ── Table of contents (right rail) ──────────────────────── */
.toc-wrap {
  padding-top: 4px;
}
.toc-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}
#toc { position: sticky; top: 48px; display: flex; flex-direction: column; gap: 2px; border-left: 2px solid var(--border); }
.toc-link {
  font-size: 12.8px;
  color: var(--ink-faint);
  padding: 4px 0 4px 14px;
  border-left: 2px solid transparent;
  margin-left: -2px;
}
.toc-link:hover { color: var(--ink); text-decoration: none; }
.toc-link.active { color: var(--blue-dark); border-left-color: var(--blue); font-weight: 600; }
.toc-link.toc-sub { padding-left: 26px; font-size: 12.2px; }

/* TOC dropdown groups — shared by regular h2/h3 groups and the changelog's
   year/month groups below. Mirrors the sidebar's .nav-group collapse. */
.toc-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.toc-toggle-row {
  width: 100%;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  border-radius: var(--radius-sm);
}
.toc-toggle-row:hover { background: var(--bg-sunken); }
.toc-link.toc-h2 { flex: 1; min-width: 0; }
.toc-chevron-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 4px;
  border: none;
  background: none;
  padding: 0;
  color: var(--ink-faint);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.toc-chevron-btn:hover { color: var(--ink-muted); background: var(--bg-sunken); }
.toc-group-row .nav-chevron { flex-shrink: 0; margin-right: 6px; transition: transform 0.15s ease; }
.toc-group.is-collapsed .toc-group-row .nav-chevron { transform: rotate(-90deg); }
.toc-group .toc-group-items { display: flex; flex-direction: column; gap: 2px; }
.toc-group.is-collapsed .toc-group-items { display: none; }
.toc-month-group { margin-left: 0; }

/* Changelog TOC: Year → Month → release groups */
.toc-year {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  padding: 14px 0 2px 14px;
  margin-left: -2px;
}
#toc > .toc-group.toc-year-group:first-child .toc-year { padding-top: 0; }
.toc-month {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 0 2px 14px;
  margin-left: -2px;
}
.toc-link.toc-release { padding-left: 26px; }
.toc-more { display: flex; flex-direction: column; gap: 2px; }
.toc-more[hidden] { display: none; }
.toc-more-btn {
  align-self: flex-start; margin: 2px 0 4px; padding: 3px 0 3px 26px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 12.2px; font-weight: 500; color: var(--blue-dark);
}
.toc-more-btn:hover { text-decoration: underline; }
.toc-more-btn:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 1px; border-radius: 3px; }

/* ── Changelog timeline (signature element) ──────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border-strong);
}
.release {
  position: relative;
  margin-bottom: 44px;
}
.release::before {
  content: '';
  position: absolute;
  left: -28px; top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--blue);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--blue);
}
.release.breaking::before { background: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.release-version {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
}
.release-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  margin: 2px 0 14px;
  letter-spacing: -0.01em;
}
.release-gh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -6px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
}
.release-gh:hover { text-decoration: underline; }
.release-gh svg { width: 14px; height: 14px; }
.release h4 {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue-dark);
  margin: 18px 0 8px;
}
.release .section-fix h4 { color: var(--red); }
.release .section-clean h4 { color: var(--ink-faint); }
.release ul { margin-bottom: 4px; }
.release li { font-size: 14px; margin-bottom: 8px; color: var(--ink); }
.release li code { font-size: 0.85em; }

/* ── Footer ───────────────────────────────────────────────── */
.page-footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1080px) {
  .main { grid-template-columns: minmax(0, 1fr); }
  .toc-wrap { display: none; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .topbar-menu-btn { display: flex; }
  .topbar-links { display: none; }
  .topbar-kbd { display: none; }
  .topbar-name-sub { display: none; }
  .topbar-search { flex: 1; width: auto; margin-left: 4px; }
  .search-results { position: fixed; top: var(--topbar-h); left: 12px; right: 12px; width: auto; max-width: none; }
  .sidebar {
    position: fixed;
    left: -280px;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    width: 264px;
    z-index: 30;
    transition: left 0.18s ease;
    box-shadow: 2px 0 24px rgba(16,19,26,0.12);
  }
  .sidebar.open { left: 0; }
  .main { padding: 28px 20px 64px; }
  .content h1 { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sidebar { transition: none; }
}
/* ── Download PDF (sidebar) ──────────────────────────────── */
.sidebar-pdf {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 8px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-sunken);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
}
.sidebar-pdf svg { flex-shrink: 0; color: var(--blue); }
.sidebar-pdf span { display: flex; flex-direction: column; }
.sidebar-pdf small { color: var(--ink-faint); font-size: 11.5px; }
.sidebar-pdf:hover { text-decoration: none; border-color: var(--blue-light); background: var(--blue-wash); }

/* ── Last updated (under the page title) ─────────────────── */
.last-updated {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -6px 0 24px;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.last-updated svg { flex-shrink: 0; }

/* ── Site footer ─────────────────────────────────────────── */
.site-footer {
  grid-column: 1 / -1;
  margin-top: 72px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink-muted);
}
.site-footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: 28px;
}
.site-footer-logo { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.site-footer-logo em { font-style: normal; font-weight: 500; color: var(--ink-faint); }
.site-footer-logo:hover { text-decoration: none; }
.site-footer-brand p { margin: 10px 0 0; max-width: 300px; line-height: 1.55; color: var(--ink-faint); font-size: 12.5px; }
.site-footer-col { display: flex; flex-direction: column; gap: 7px; }
.site-footer-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-faint); margin-bottom: 2px; }
.site-footer-col a { color: var(--ink-muted); }
.site-footer-col a:hover { color: var(--blue-dark); }
.site-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-faint);
}
@media (max-width: 860px) {
  .site-footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer-brand { grid-column: 1 / -1; }
}
