/* braised:theme/base */
/* braised:theme/base — built-in layout, typography, and block styles.
   Design system: Radix cyanDark/cyanLight palette (12-step scale, inverts between themes).
   Typography: IBM Plex Sans / Serif / Mono.
   Mirrors the structure of Hugo's base styles + Sphinx admonition pattern.

   Agent reading this file: comments survive Tailwind compilation unchanged.
   - CSS customization model:  https://braised.dev/theming/css/
   - Block authoring contract: https://braised.dev/theming/blocks/
   - Built-in block reference: https://braised.dev/content/blocks/

   Block CSS conventions used throughout this file:
   - Each block section names the :::directive that produces it.
   - Built-in blocks expose --blockname-* custom properties as theming handles.
     Override them after @import "braised:theme/base" — no template copy needed.
   - Blocks do not set max-width. The content column (article { max-width: var(--content-max) })
     owns layout constraints; blocks expand or contract within it via margin-inline. */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;1,400&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Serif:ital,wght@0,400;0,600;1,400&display=swap");

/* ── Dark theme ────────────────────────────────────────────────────────────
   Source: Radix cyanDark scale.
   cyanDark: 1:#0b161a 2:#101b20 3:#082c36 4:#003848
             5:#004558 6:#045468 7:#12677e 8:#11809c
             9:#00a2c7 10:#23afd0 11:#4ccce6 12:#b6ecf7
──────────────────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-base:        #0b161a;
  --bg-surface:     #101b20;
  --bg-elevated:    #082c36;
  --bg-hover:       #003848;
  --border:         #004558;
  --border-strong:  #045468;
  --text-primary:   #e8eced;
  --text-secondary: #7aafbe;
  --text-muted:     #5a8fa0;
  --accent:         #00a2c7;
  --accent-bright:  #23afd0;
  --accent-text:    #4ccce6;
  --accent-subtle:  #003848;
  --code-text:      #b6ecf7;
  --amber:          #ffc53d;
  --amber-text:     #ffca16;
  --amber-subtle:   #3f2700;
  --callout-tip:    #3db87a;
  --callout-caution: #c84b4b;
}

/* ── Light theme ───────────────────────────────────────────────────────────
   Same cyan family, scale inverted.
   cyanLight12 (#0d3c48) — mirrors dark bg gunmetal — becomes primary text.
   cyanLight: 1:#fafdfe 2:#f2fafb 3:#def7f9 4:#caf1f6
              5:#b5e9f0 6:#9ddde7 7:#7dcedc 8:#3db9cf
              9:#00a2c7 10:#0797b9 11:#107d98 12:#0d3c48
──────────────────────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-base:        #fafdfe;
  --bg-surface:     #f2fafb;
  --bg-elevated:    #def7f9;
  --bg-hover:       #caf1f6;
  --border:         #b5e9f0;
  --border-strong:  #9ddde7;
  --text-primary:   #0d3c48;
  --text-secondary: #107d98;
  --text-muted:     #2d7080;
  --accent:         #00a2c7;
  --accent-bright:  #0797b9;
  --accent-text:    #107d98;
  --accent-subtle:  #caf1f6;
  --code-text:      #107d98;
  --amber:          #ffc53d;
  --amber-text:     #8d5200;
  --amber-subtle:   #fff7c2;
  --callout-tip:    #1a7a4a;
  --callout-caution: #a03030;
}

/* ── Typography + layout constants (theme-independent) ─────────────────── */
:root {
  --font-sans:      'IBM Plex Sans', sans-serif;
  --font-serif:     'IBM Plex Serif', Georgia, serif;
  --font-mono:      'IBM Plex Mono', 'Courier New', monospace;
  --sidebar-width:  260px;
  --toc-width:      220px;
  --content-max:    680px;
  --header-height:  52px;
  --shell-max:      1280px;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scrollbar-gutter: stable; }

/* ── Focus — WCAG 2.4.11/2.4.12 ─────────────────────────────────────────── */
/* Custom focus ring using --text-primary: ≥11:1 on both themes (AAA).
   :focus-visible limits the ring to keyboard navigation; pointer users are unaffected. */
:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── Reduced motion — WCAG 2.3.3 ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
body {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
  z-index: 100;
}
.site-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

/* ── Version nav ─────────────────────────────────────────────────────────── */
/* Renders inline in the site header between the title and theme toggle. */
.version-nav ul {
  display: flex;
  list-style: none;
  gap: 0.125rem;
}
.version-nav a {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
}
.version-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ── Theme toggle button ─────────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  margin-left: auto;
}
.theme-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── Page shell ──────────────────────────────────────────────────────────── */
/* .page-layout matches the template's wrapper div */
.page-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--toc-width);
  padding-top: var(--header-height);
  min-height: 100vh;
}

/* When TOC is absent (hide_aside: true or page has no headings), collapse the
   third grid column so content + sidebar fill the full width. The article
   max-width cap prevents lines from stretching too wide on large monitors. */
.page-layout:not(:has(.toc)) {
  grid-template-columns: var(--sidebar-width) 1fr;
}
.page-layout:not(:has(.toc)) .page-content {
  max-width: 100%;
}
.page-layout:not(:has(.toc)) article {
  max-width: min(960px, 100%);
}

/* ── Wide layout (blank template: no sidebar or TOC) ────────────────────── */
.page-layout--wide {
  padding-top: var(--header-height);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
/* Scoped to .page-layout so custom layouts that happen to use a .sidebar
   class are not pulled into the docs grid off-canvas behaviour.
   Custom 2-column layouts should use their own sidebar selector and
   collapse breakpoint — 768px is the standard tablet/desktop divide. */
.page-layout .sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  align-self: start; /* required for sticky in CSS Grid — without this the item stretches to row height */
  overflow-y: auto;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
}
.nav-list { list-style: none; }
/* 1.5rem gap between top-level section groups only; .nav-children resets this */
.nav-list > .nav-item { margin-bottom: 1.5rem; }
.nav-children .nav-item { margin-bottom: 0; }

/* nav-section-row: flex wrapper for label + chevron in group/section nodes */
.nav-section-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-left: 0.875rem;
}

/* nav-section: non-clickable group label */
.nav-section {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0 0.4rem 0;
  flex: 1;
}

/* nav-section-link: clickable section label (kind: section) */
.nav-section-link {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0 0 0.4rem 0;
  flex: 1;
  transition: color 0.1s;
}
.nav-section-link:hover { color: var(--text-primary); }
.nav-section-link.active { color: var(--accent-text); }

/* nav-chevron: expand/collapse indicator */
.nav-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: auto;
  margin-right: 0.5rem;
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
  user-select: none;
}
.nav-section-row:hover .nav-chevron {
  color: var(--text-secondary);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}
/* Expanded: show − */
.nav-chevron::before { content: "−"; }
/* Collapsed: show + */
.nav-item:has(> .nav-children.nav-collapsed) > .nav-section-row .nav-chevron::before {
  content: "+";
}

/* Collapsed nav children: hidden until toggled open */
.nav-children.nav-collapsed { display: none; }

/* nav-heading: visual landmark label, no interaction (kind: heading) */
.nav-heading {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.6;
  padding: 0.75rem 1rem 0.25rem 0.875rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* .nav-children matches <ul class="nav-list nav-children"> in navTree template */
.nav-children {
  border-left: 1px solid var(--border);
  margin-left: 1.5rem;
}
.nav-link {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.275rem 1rem 0.275rem 0.875rem;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color 0.1s, background 0.1s;
}
.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.nav-link.active {
  color: var(--accent-text);
  border-left-color: var(--accent);
  background: var(--accent-subtle);
}
/* L3: nested .nav-children inside .nav-children */
.nav-children .nav-children .nav-link {
  font-size: 0.8rem;
  padding-left: 1.625rem;
  color: var(--text-muted);
}
.nav-children .nav-children .nav-link:hover { color: var(--text-secondary); }

/* ── Main content ────────────────────────────────────────────────────────── */
.page-content {
  padding: 1.5rem 2.5rem;
  max-width: calc(var(--content-max) + 8rem);
}
article { max-width: var(--content-max); }

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  scroll-margin-top: calc(var(--header-height) + 0.75rem);
}
.page-title { font-size: 2rem; margin-bottom: 0.75rem; }
h2 { font-size: 1.375rem; margin-top: 2.5rem; margin-bottom: 0.5rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.0625rem; margin-top: 1.75rem; margin-bottom: 0.4rem; }

.page-body p { margin-bottom: 1rem; }
.page-body ul,
.page-body ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.page-body ul { list-style: disc; }
.page-body ol { list-style: decimal; }
.page-body li { margin-bottom: 0.25rem; }
.page-body li > ul,
.page-body li > ol { margin-bottom: 0; margin-top: 0.25rem; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-bright); text-decoration: underline; }
/* Body-prose links: text inherits body color (AAA), teal moves to the underline.
   Authors who prefer teal link text can override with color: var(--accent-text). */
.page-body a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent-text);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-thickness 0.1s;
  border-radius: 2px;
}
.page-body a:hover {
  text-decoration-thickness: 2px;
  background: color-mix(in srgb, var(--accent-subtle) 30%, transparent);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--code-text);
  background: var(--bg-elevated);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.125rem 1.25rem;
  overflow-x: auto;
  margin: 1.25rem 0;
}
pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.65;
}

/* Footnotes — rendered by goldmark's Footnote extension */
.page-body .footnotes {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.page-body .footnotes ol { padding-left: 1.25rem; }
.page-body .footnotes li { margin-bottom: 0.5rem; }
.page-body .footnote-ref { font-size: 0.75em; vertical-align: super; }
.page-body .footnote-backref { margin-left: 0.25rem; text-decoration: none; }

/* ── Blocks ──────────────────────────────────────────────────────────────── */
/* Callouts — rendered by the :::callout directive */
.callout {
  border-left: 5px solid var(--border-strong);
  background: var(--bg-elevated);
  border-radius: 0 6px 6px 0;
  padding: 0.875rem 1.125rem;
  margin: 1.25rem 0;
  font-size: 0.9375rem;
}
.callout-title {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.3rem;
}
.callout[data-type="note"]    { border-left-color: var(--accent-text); background: var(--accent-subtle); }
.callout[data-type="note"] .callout-title { color: var(--accent-text); }
.callout[data-type="tip"]     { border-left-color: var(--callout-tip); background: color-mix(in srgb, var(--callout-tip) 10%, transparent); }
.callout[data-type="tip"] .callout-title  { color: var(--callout-tip); }
.callout[data-type="warning"] { border-left-color: var(--amber); background: var(--amber-subtle); }
.callout[data-type="warning"] .callout-title { color: var(--amber-text); }
.callout[data-type="caution"] { border-left-color: var(--callout-caution); background: color-mix(in srgb, var(--callout-caution) 10%, transparent); }
.callout[data-type="caution"] .callout-title { color: var(--callout-caution); }

/* Details/accordion block */
.details {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 1.25rem 0;
  overflow: hidden;
}
.details summary {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}
.details summary::before {
  content: '▶';
  font-size: 0.6rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.details[open] summary::before { transform: rotate(90deg); }
.details-body {
  padding: 0 1rem 0.875rem;
  border-top: 1px solid var(--border);
}

/* Definition list block (:::dl / :::item) */
.dl {
  margin: 1.25rem 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.375rem 1.5rem;
  align-items: baseline;
}
.dl-term {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  padding-top: 0.125rem;
  white-space: nowrap;
}
.dl-desc {
  color: var(--text-secondary);
  margin: 0;
}
.dl-desc p { margin: 0; }
.dl-desc p + p { margin-top: 0.5rem; }

/* Synopsis block (:::synopsis) — command/BNF grammar display */
.synopsis {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  overflow-x: auto;
}
.synopsis pre {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-primary);
  white-space: pre-wrap;
}
.synopsis pre code {
  background: transparent;
  padding: 0;
  border: none;
  color: inherit;
}
/* Italic inside synopsis = replaceable parameter (mirrors DocBook <replaceable>) */
.synopsis em {
  font-style: italic;
  color: var(--text-secondary);
}

/* Reference layout — man-page-style pages */
.reference-page h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.375rem;
  margin-top: 2rem;
}
.reference-page h2:first-of-type { margin-top: 1rem; }
.reference-page .synopsis { font-size: 0.875rem; }

/* Tabs block and code-group block (:::tabs / :::code-group) */
/* code-group reuses tab-list/tab-btn/tab-panel and needs the same outer margin. */
.tabs,
.code-group { margin: 1.25rem 0; }
.tab-list {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.5rem 1rem;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-text); border-bottom-color: var(--accent); }
/* x-show handles panel visibility; x-cloak prevents flash before Alpine init */
[x-cloak] { display: none !important; }
.tab-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 1rem 1.125rem;
  font-size: 0.9375rem;
}

/* Pillstrip block — page-level content filter */
.pillstrip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.pill.active {
  color: var(--accent-text);
  background: var(--accent-subtle);
  border-color: var(--accent);
  font-weight: 600;
}

/* ── Pull-quote block (:::pull-quote) ────────────────────────────────────────
   Typographic emphasis for a text excerpt. Excluded from the RAG manifest by
   default; set rag="include" on the block to index it. Docs:
   https://braised.dev/content/blocks/#pull-quote
   Custom properties (override after @import "braised:theme/base"):
     --pull-quote-size    font size               (default: 1.25rem)
     --pull-quote-gap     vertical padding         (default: 1.5rem)
     --pull-quote-border  decorative rule color    (default: var(--accent))      */
.pull-quote {
  --pull-quote-size:   1.25rem;
  --pull-quote-gap:    1.5rem;
  --pull-quote-border: var(--accent);
  margin: calc(var(--pull-quote-gap) * 1.5) 0;
  padding: var(--pull-quote-gap) 0;
  border-top: 1px solid var(--pull-quote-border);
  border-bottom: 1px solid var(--pull-quote-border);
  text-align: center;
}
.pull-quote blockquote {
  font-family: var(--font-serif);
  font-size: var(--pull-quote-size);
  font-style: italic;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
}
.pull-quote figcaption {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
}

/* ── Spotlight block (:::spotlight) ─────────────────────────────────────────
   Breakout container that visually elevates any content — prose, images,
   callouts, or a nested pull-quote — beyond the normal column padding. The
   column (article { max-width: var(--content-max) }) caps width on ultrawide
   screens; spotlight only controls expansion within it. Docs:
   https://braised.dev/content/blocks/#spotlight
   Custom properties (override after @import "braised:theme/base"):
     --spotlight-bleed   inline expansion beyond column padding, per level      */
.spotlight {
  --spotlight-bleed: 2rem;
  margin-inline: calc(-1 * var(--spotlight-bleed));
  padding-inline: var(--spotlight-bleed);
  margin-block: 1.5rem;
  border-radius: 8px;
}
.spotlight[data-level="1"] {
  --spotlight-bleed: 1rem;
}
.spotlight[data-level="2"] {
  --spotlight-bleed: 2rem;
  background: var(--bg-surface);
  padding-block: 1.5rem;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.08);
}
.spotlight[data-level="3"] {
  --spotlight-bleed: 3rem;
  background: var(--bg-elevated);
  padding-block: 2rem;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.12);
}

/* Table block (:::table / :::row / :::cell) — multiline-cell aware */
.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
}
.table-block {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9375rem;
  font-family: var(--font-sans);
}
.table-block caption {
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  caption-side: top;
}
.table-block th,
.table-block td {
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}
.table-block thead th {
  background: var(--bg-elevated);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  border-bottom: 2px solid var(--border-strong);
}
.table-block tbody tr:nth-child(even) { background: var(--bg-surface); }
.table-block td p,
.table-block th p { margin: 0; }
.table-block td p + p,
.table-block th p + p { margin-top: 0.5rem; }
.table-block td code,
.table-block th code { font-size: 0.8125rem; }

/* ── Markdown tables (GFM :::table syntax renders .table-block; plain Markdown
   pipe tables render as bare <table> inside .page-body. Apply the same visual
   treatment so both sources look consistent.) ─────────────────────────────── */
.page-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  overflow-x: auto;
  display: block;
}
.page-body table th,
.page-body table td {
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}
.page-body table thead th {
  background: var(--bg-elevated);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  border-bottom: 2px solid var(--border-strong);
}
.page-body table tbody tr:nth-child(even) { background: var(--bg-surface); }
.page-body table td code,
.page-body table th code { font-size: 0.8125rem; }

/* ── TOC ─────────────────────────────────────────────────────────────────── */
.toc {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  align-self: start; /* required for sticky in CSS Grid — mirrors sidebar */
  overflow-y: auto;
  /* min-width: 0 prevents the grid column from blowing past --toc-width */
  min-width: 0;
  padding: 1.5rem 1.25rem 2rem 1.5rem;
  border-left: 1px solid var(--border);
}
.toc-title {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-top: 0;
  padding-bottom: 0;
  border-bottom: none;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.toc-list { list-style: none; }
.toc-link {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.2rem 0 0.2rem 0.625rem;
  /* Always-present transparent border reserves pip space — no layout shift on active */
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color 0.1s, border-color 0.15s;
  overflow-wrap: break-word;
  word-break: break-word;
}
.toc-link:hover { color: var(--text-primary); }
.toc-link.active { color: var(--accent-text); font-weight: 500; border-left-color: var(--accent); }
.toc-item.toc-level-3 a { padding-left: 1.5rem; display: block; }

/* ── Heading anchor links ────────────────────────────────────────────────── */
/* Injected by blocks.js into each h2/h3/h4 that has an id. Visible on hover. */
.heading-anchor {
  opacity: 0;
  font-size: 0.75em;
  font-weight: 400;
  margin-left: 0.4em;
  color: var(--text-muted);
  text-decoration: none !important;
  transition: opacity 0.15s, color 0.15s;
  vertical-align: middle;
  user-select: none;
}
h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor { opacity: 1; }
.heading-anchor:hover { color: var(--accent-text) !important; }

/* ── Code copy button ────────────────────────────────────────────────────── */
/* JS wraps each <pre> in a .code-wrap div and injects a .code-copy-btn. */
.code-wrap {
  position: relative;
  margin: 1.25rem 0;
}
.code-wrap > pre { margin: 0; } /* outer .code-wrap owns the margin */
.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.2rem 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.1s, border-color 0.1s;
  line-height: 1.5;
}
.code-wrap:hover .code-copy-btn,
.code-wrap:focus-within .code-copy-btn { opacity: 1; }
.code-copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.code-copy-btn.copied {
  color: var(--callout-tip);
  border-color: var(--callout-tip);
  opacity: 1;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb ol {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.breadcrumb li + li::before { content: '/'; margin-right: 0.5rem; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ── Mobile nav toggle ───────────────────────────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-right: 0.5rem;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
}
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--header-height); /* start below the fixed header, not behind it */
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}
.nav-overlay.is-visible { display: block; }

/* Medium — sidebar collapses off-canvas, TOC stays visible alongside content */
@media (max-width: 1100px) {
  .nav-toggle { display: flex; }
  .page-layout {
    grid-template-columns: 1fr var(--toc-width);
  }
  .page-layout:not(:has(.toc)) {
    grid-template-columns: 1fr;
  }
  .page-layout .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }
  .page-layout .sidebar.is-open { transform: translateX(0); }
}

/* Small — TOC moves inline above content as a horizontal pill-strip */
@media (max-width: 768px) {
  .page-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
  .toc {
    position: static;
    width: auto;
    height: auto;
    grid-column: 1;
    grid-row: 1;
    border-left: none;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
  }
  .toc-title {
    font-size: 0.75rem;
    margin: 0;
    margin-right: 0.5rem;
    white-space: nowrap;
  }
  .toc-list { display: contents; }
  .toc-item { display: inline; }
  .toc-link {
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .toc-item.toc-level-3 .toc-link { color: var(--text-muted); }
  .page-content {
    grid-column: 1;
    grid-row: 2;
    padding: 1rem 1.25rem;
  }
}

/* ── Wide-screen shell constraint ────────────────────────────────────────── */
/* Prevents the page grid from expanding indefinitely on ultra-wide viewports.
   The header background stays full-width; padding-inline aligns its content
   with the constrained shell. */
@media (min-width: 1281px) {
  .site-header {
    padding-inline: calc((100% - var(--shell-max)) / 2);
  }
  .page-layout {
    max-width: var(--shell-max);
    margin-inline: auto;
  }
}

/* braised:theme/syntax */
/* braised:theme/syntax — built-in syntax highlighting styles.
   Placeholder: theme content will be added in a later stage. */


/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;1,400&family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Serif:ital,wght@0,400;0,600;1,400&display=swap');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Layout tokens — match refined.html dimensions ── */
:root {
  --sidebar-w:  300px;
  --topnav-h:   44px;
  --shell-max:  1100px;
  --font-sans:  'IBM Plex Sans', sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, serif;
  --font-mono:  'IBM Plex Mono', monospace;
}

/* ── Light theme (default) ── */
:root,
[data-theme="light"] {
  --bg:          #f7f1e6;
  --bg-subtle:   #f0e8d8;
  --bg-hover:    #e7dcc8;
  --bg-card:     #faf6ee;
  --border:      rgba(0,0,0,0.08);
  --border-mid:  rgba(0,0,0,0.12);
  --border-str:  rgba(0,0,0,0.18);
  --text:        #1c1a17;
  --text-mid:    #5a5248;
  --text-muted:  #9b9088;
  --accent:      #b85c38;
  --accent-sub:  rgba(184,92,56,0.07);
  --accent-brd:  rgba(184,92,56,0.22);
  --accent-txt:  #8c3f22;
  --topnav-bg:   rgba(247,241,230,0.93);
}

/* ── Neutral theme ── */
[data-theme="neutral"] {
  --bg:          #e8e4dd;
  --bg-subtle:   #e0dbd3;
  --bg-hover:    #d5cfc6;
  --bg-card:     #edeae3;
  --border:      rgba(0,0,0,0.10);
  --border-mid:  rgba(0,0,0,0.15);
  --border-str:  rgba(0,0,0,0.22);
  --text:        #1a1814;
  --text-mid:    #524e47;
  --text-muted:  #8c887e;
  --accent:      #4e6670;
  --accent-sub:  rgba(78,102,112,0.09);
  --accent-brd:  rgba(78,102,112,0.28);
  --accent-txt:  #3b5560;
  --topnav-bg:   rgba(232,228,221,0.93);
}

/* ── Dark theme ── */
[data-theme="dark"] {
  --bg:          #1e1b16;
  --bg-subtle:   #252018;
  --bg-hover:    #2e271e;
  --bg-card:     #231f19;
  --border:      rgba(255,255,255,0.07);
  --border-mid:  rgba(255,255,255,0.11);
  --border-str:  rgba(255,255,255,0.18);
  --text:        #f0e8d5;
  --text-mid:    #c0a882;
  --text-muted:  #907a64;
  --accent:      #c87848;
  --accent-sub:  rgba(200,120,72,0.12);
  --accent-brd:  rgba(200,120,72,0.30);
  --accent-txt:  #d4845a;
  --topnav-bg:   rgba(30,27,22,0.93);
}

/* ═══════════════════════════════════════════════════════
   BASE
═══════════════════════════════════════════════════════ */
html { font-size: 16px; }
body {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════
   TOP NAV
═══════════════════════════════════════════════════════ */
.topnav {
  position: sticky;
  top: 0;
  height: var(--topnav-h);
  background: var(--topnav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-mid);
  display: flex;
  align-items: center;
  padding: 0 1.5rem 0 0;
  z-index: 200;
}

.topnav-identity {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 0 1.25rem;
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
}
.topnav-name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

.topnav-links {
  display: flex;
  align-items: stretch;
  height: 100%;
  list-style: none;
  margin-left: 0.5rem;
}
.topnav-links > li {
  display: flex;
  align-items: stretch;
  position: relative;
}
.topnav-links > li > a,
.topnav-links > li > button {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-mid);
  text-decoration: none;
  padding: 0 0.875rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  height: 100%;
  border-right: 1px solid var(--border);
}
.topnav-links > li > a:hover,
.topnav-links > li > button:hover {
  color: var(--text);
  background: var(--bg-subtle);
}
.topnav-links > li > a.active,
.topnav-links > li > button.active {
  color: var(--accent-txt);
  background: var(--accent-sub);
}

.chevron {
  font-size: 0.6rem;
  opacity: 0.5;
  margin-top: 1px;
}

/* dropdown */
.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: 0 0 5px 5px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  z-index: 300;
  padding: 0.375rem 0;
}
.topnav-links > li:hover .dropdown,
.topnav-links > li .dropdown.open { display: block; }
.dropdown-item {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-mid);
  text-decoration: none;
  padding: 0.4375rem 1rem;
  transition: color 0.1s, background 0.1s;
  white-space: nowrap;
}
.dropdown-item:hover { color: var(--text); background: var(--bg-hover); }
.dropdown-item-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 1rem 0.25rem;
}
.topnav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.topnav-cta {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent-txt);
  text-decoration: none;
  padding: 0.3125rem 0.875rem;
  border: 1px solid var(--accent-brd);
  border-radius: 3px;
  background: var(--accent-sub);
  transition: background 0.15s, border-color 0.15s;
}
.topnav-cta:hover { filter: brightness(1.08); }

/* ═══════════════════════════════════════════════════════
   PAGE SHELL — sidebar + main
═══════════════════════════════════════════════════════ */
.page-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topnav-h));
  max-width: var(--shell-max);
  margin-inline: auto;
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════ */
.sidebar {
  position: sticky;
  top: var(--topnav-h);
  height: calc(100vh - var(--topnav-h));
  overflow-y: auto;
  border-right: 1px solid var(--border-mid);
  background: var(--bg);
  padding: 1.5rem 0 2rem;
}

.sb-group-label,
.sb-group-toggle {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem 0.3rem;
  margin-top: 0.5rem;
}
.sb-group-label:first-child,
.sb-group-toggle:first-child { margin-top: 0; }

/* Toggle button resets + caret */
.sb-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  margin-top: 0;
}
.sb-caret {
  font-size: 0.65rem;
  opacity: 0.7;
  transition: transform 0.15s;
  flex-shrink: 0;
}
.sb-group-toggle[aria-expanded="false"] .sb-caret { transform: rotate(-90deg); }
.sb-group-toggle[aria-expanded="false"] + ul { display: none; }

/* nav-item ul reset for sidebar */
.sidebar ul,
.sidebar li { list-style: none; padding: 0; margin: 0; }

/* Group separator — inset line above each section heading (not the first) */
.sidebar > ul > li + li:has(> .sb-group-label),
.sidebar > ul > li + li:has(> .sb-group-toggle) {
  margin-top: 0.5rem;
  padding-top: 0.25rem;
}
.sidebar > ul > li + li:has(> .sb-group-label)::before,
.sidebar > ul > li + li:has(> .sb-group-toggle)::before {
  content: '';
  display: block;
  height: 1px;
  background: var(--border);
  margin: 0 1.25rem;
}

/* L2 — items directly under a heading group (Blog, Essays, Braised…) */
.sidebar ul ul .sb-link {
  padding-left: 2rem;
  font-size: 0.78125rem;
}

/* L3 — group labels/toggles nested inside a section (e.g. "2026" inside Blog) */
.sidebar ul ul ul .sb-group-label,
.sidebar ul ul ul .sb-group-toggle {
  padding-left: 3.25rem;
}

/* L4 — page links nested inside a year/group inside a section */
.sidebar ul ul ul ul .sb-link {
  padding-left: 3rem;
  font-size: 0.75rem;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-mid);
  text-decoration: none;
  padding: 0.35rem 1.25rem;
  border-left: 3px solid transparent;
  transition: color 0.1s, background 0.1s;
}
.sb-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}
/* Active page pip */
.sb-link.active {
  color: var(--accent-txt);
  border-left-color: var(--accent);
  background: var(--accent-sub);
  font-weight: 500;
}
/* Ancestor section links (has active descendants): soften so they don't compete */
li:has(> ul):has(ul .sb-link.active) > .sb-link.active {
  color: var(--text-mid);
  border-left-color: transparent;
  background: transparent;
  font-weight: 400;
}
/* Single continuous rail down the top-level section's child list.
   Uses ::before so the rail sits at left: 0 of the ul — exactly where
   the sb-link border-left starts — letting the active pip overlay it cleanly. */
.sidebar > ul > li:has(.sb-link.active) > ul {
  margin-left: 1.75rem;
  position: relative;
}
.sidebar > ul > li:has(.sb-link.active) > ul::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-str);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════════ */
.main-content {
  min-width: 0;        /* prevent grid 1fr column from expanding to content min-width */
  overflow-x: clip;
}

/* ── Hero zone ── */
.hero-zone {
  padding: 2.5rem 3rem 0;
  border-bottom: 1px solid var(--border-mid);
}
.hero-intro {
  width: 100%;
  margin-bottom: 2rem;
}
.hero-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 1.25rem;
  height: 1px;
  background: var(--accent);
}

/* h1 inside hero-intro becomes the hero headline */
.hero-intro h1 {
  max-width: 560px;
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 1.25rem;
}
.hero-intro h1 em {
  font-style: italic;
  color: var(--accent-txt);
}

/* ── Kicker cards ── */
.kcard-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid var(--border-mid);
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  margin-top: 2.25rem;
}
.kcard:first-child { border-radius: 5px 5px 0 0; }

.kcard {
  display: grid;
  grid-template-columns: 3px 1fr auto;
  gap: 0 1.25rem;
  align-items: center;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-mid);
  text-decoration: none;
  padding: 0.875rem 1.25rem 0.875rem 0;
  transition: background 0.15s, box-shadow 0.15s;
  position: relative;
  z-index: 0;
}
.kcard:hover {
  background: var(--bg-subtle);
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  z-index: 1;
}

.kcard-line {
  align-self: stretch;
  background: var(--border-str);
  border-radius: 1px;
  transition: background 0.15s;
  width: 3px;
}
.kcard:hover .kcard-line { background: var(--accent); }
.kcard--active .kcard-line { background: var(--accent); }

.kcard-body { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; overflow: hidden; }

.kcard-kicker {
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.15s;
}
.kcard:hover .kcard-kicker,
.kcard--active .kcard-kicker { color: var(--accent); }

.kcard-desc {
  font-family: var(--font-serif);
  font-size: 0.8125rem;
  color: var(--text-mid);
  line-height: 1.55;
  margin-top: 0.2rem;
}
.kcard-desc p { margin: 0; padding: 0; }

.kcard-arrow {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.15s, transform 0.15s;
}
.kcard:hover .kcard-arrow { color: var(--accent-txt); transform: translateX(2px); }

/* Override braised base .page-body a decoration — cards are already full-link UI */
.page-body .kcard,
.page-body .kcard:hover { text-decoration: none; background: none; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border-mid);
  padding: 1.375rem 1.5rem 1.375rem 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
}
.footer-copy {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
}
.footer-links a {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text-mid); }

/* ── Blog post header ── */
.blog-post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-mid);
}
.blog-post-header .hero-eyebrow {
  margin-bottom: 0.75rem;
}
.blog-post-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  letter-spacing: 0.02em;
}

/* ── Standard page prose layout ── */
.hero-zone + .page-body {
  padding-top: 1.75rem;
}
.page-body {
  padding: 2.5rem 3rem;
  max-width: 900px;
  margin-inline: auto;
  min-height: 60vh;
}
.page-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 1.75rem;
}
.page-prose {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text);
  line-height: 1.75;
}
.page-prose p { margin-bottom: 1.25rem; }
.page-prose h2 {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 0.75rem;
}
.page-prose h3 {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 0.5rem;
}
.page-prose ul, .page-prose ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}
.page-prose li { margin-bottom: 0.4rem; }
.page-prose a { color: var(--accent-txt); text-decoration: underline; text-underline-offset: 2px; }
.page-prose dl { margin-bottom: 1.25rem; }
.page-prose dt {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text);
  margin-top: 0.75rem;
}
.page-prose dt:first-child { margin-top: 0; }
.page-prose dd {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0;
}
.page-prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}
/* ── Blockquote — isolated so essay/page contexts can diverge if needed ── */
.page-prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1rem;
  margin: 1.25rem 0;
  color: var(--text-mid);
  font-style: italic;
  font-size: 0.9375rem;
  line-height: 1.65;
}
.page-prose blockquote p { margin-bottom: 0; }

/* .pull-quote lives inside .page-prose but is a distinct block — restore its own styles */
.page-prose .pull-quote blockquote {
  border-left: none;
  padding: 0;
  margin: 0;
  font-size: var(--pull-quote-size);
  line-height: 1.5;
  color: var(--text-primary);
}

/* Tighten pull-quote spacing — base gap (1.5rem) is too generous with attribution */
.pull-quote {
  --pull-quote-gap: 0.75rem;
  border-left: 4px solid var(--pull-quote-border);
}
.pull-quote figcaption {
  margin-top: 0.375rem;
}

/* ── Essay layout ── */
.essay-body {
  max-width: 72ch;
}
.essay-body .page-prose {
  font-size: 1.0625rem;
  line-height: 1.85;
}
.essay-body .page-prose p {
  margin-bottom: 1.5rem;
}
.essay-body .page-prose > p:first-of-type {
  font-size: 1.125rem;
  color: var(--text-mid);
}

/* ── Theme switcher ── */
.theme-switcher {
  position: relative;
  margin-left: 1rem;
  flex-shrink: 0;
}
.theme-btn {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-str);
  border-radius: 3px;
  padding: 0.25rem 0.625rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.theme-btn:hover { color: var(--text); background: var(--bg-hover); }
.theme-btn .tb-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  transition: background 0.2s;
}
.theme-btn .tb-chevron { font-size: 0.55rem; opacity: 0.6; }

.theme-menu {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  min-width: 168px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: 5px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
  z-index: 500;
  padding: 0.3rem 0;
  overflow: hidden;
}
.theme-menu.open { display: block; }

.theme-menu-label {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.875rem 0.25rem;
}
.theme-opt {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-mid);
  background: none;
  border: none;
  padding: 0.4375rem 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: color 0.1s, background 0.1s;
  text-transform: capitalize;
}
.theme-opt:hover { color: var(--text); background: var(--bg-hover); }
.theme-opt.active { color: var(--accent-txt); font-weight: 500; }
.theme-opt-swatch {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
  flex-shrink: 0;
}
.theme-opt[data-theme="light"]   .theme-opt-swatch { background: #f7f1e6; }
.theme-opt[data-theme="neutral"] .theme-opt-swatch { background: #c8c2ba; }
.theme-opt[data-theme="dark"]    .theme-opt-swatch { background: #1e1b16; }

/* In dark mode all swatches get the white-alpha border treatment for consistency */
[data-theme="dark"] .theme-opt-swatch {
  border-color: rgba(255,255,255,0.2);
  box-shadow: none;
}

/* ── Sidebar hamburger toggle ── */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-right: 0.625rem;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-mid);
  border-radius: 2px;
}

/* ── Nav overlay (behind off-canvas sidebar) ── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--topnav-h);
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.nav-overlay.is-visible { display: block; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   The braised base collapses .sidebar at ≤1100px for its 3-column docs layout.
   Our .page-shell is a 2-column layout — keep sidebar sticky down to 768px.
═══════════════════════════════════════════════════════ */

/* Neutralise the braised base 1100px off-canvas rule for our layout */
@media (max-width: 1100px) {
  .page-shell .sidebar {
    position: sticky;
    top: var(--topnav-h);
    height: calc(100vh - var(--topnav-h));
    transform: none;
    width: var(--sidebar-w);
    box-shadow: none;
  }
}

/* Below 768px: hamburger visible, sidebar off-canvas, single column */
@media (max-width: 767px) {
  .nav-toggle { display: flex; }

  .topnav-identity {
    width: auto;
    flex: 1;
    border-right: none;
  }

  /* Nav links and CTA hidden on mobile — sidebar covers navigation */
  .topnav-links { display: none; }
  .topnav-cta   { display: none; }

  .page-shell {
    grid-template-columns: 1fr;
  }

  /* Off-canvas sidebar — overrides the sticky rule above */
  .page-shell .sidebar {
    position: fixed;
    top: var(--topnav-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--topnav-h));
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 100;
    box-shadow: 2px 0 16px rgba(0,0,0,0.15);
  }
  .page-shell .sidebar.is-open { transform: translateX(0); }

  .hero-zone {
    padding: 1.75rem 1.5rem 0;
  }

  .hero-intro h1 {
    font-size: 1.75rem;
  }

  .page-body {
    padding: 1.5rem 1.25rem;
  }

  .site-footer {
    padding: 1.25rem 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.875rem;
  }
}

/* 960px+: tighten side padding — let max-width + centering do the work */
@media (min-width: 960px) {
  .page-body  { padding-inline: 2rem; }
  .hero-zone  { padding-left: 2rem; }
}

/* ── Gutters: viewport wider than shell-max — decorative frame + topnav alignment ── */
@media (min-width: 1100px) {
  /* Topnav background stays full-width; inner content aligns with the shell */
  .topnav {
    padding-left:  calc((100% - var(--shell-max)) / 2);
    padding-right: calc((100% - var(--shell-max)) / 2 + 1.5rem);
  }

  /* Darker body creates visible gutters; shell floats on top */
  body {
    background: var(--bg-subtle);
  }

  .page-shell {
    margin-top: 0.75rem;
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--border-mid);
  }
}

/* ── Proportional sidebar + wider shell at very wide screens ── */
@media (min-width: 1440px) {
  :root {
    --sidebar-w: 340px;
    --shell-max: 1360px;
  }
}
