/* 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. */

@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-danger: #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:     #3db9cf;
  --accent:         #00a2c7;
  --accent-bright:  #0797b9;
  --accent-text:    #107d98;
  --accent-subtle:  #caf1f6;
  --code-text:      #107d98;
  --amber:          #ffc53d;
  --amber-text:     #ab6400;
  --amber-subtle:   #fff7c2;
  --callout-tip:    #3db87a;
  --callout-danger: #c84b4b;
}

/* ── 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; }
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);
}
/* Continuous rail down the active top-level section's child list.
   Sits at left: 0.875rem — the same offset as nav-link's padding-left —
   so the active pip overlays it cleanly. */
.page-layout .sidebar .nav-list > .nav-item:has(.nav-link.active) > .nav-children {
  position: relative;
}
.page-layout .sidebar .nav-list > .nav-item:has(.nav-link.active) > .nav-children::before {
  content: '';
  position: absolute;
  left: 0.875rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
  pointer-events: none;
}
/* 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; }

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-danger); background: color-mix(in srgb, var(--callout-danger) 10%, transparent); }
.callout[data-type="caution"] .callout-title { color: var(--callout-danger); }

/* 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;
}

/* 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 { 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. */


/*
 * PostgreSQL-inspired theme — minimal
 * #336791 used sparingly: site heading, active nav, emphasis
 * Otherwise whites/off-whites (light) and dark navies (dark)
 */

@import url('https://fonts.googleapis.com/css2?family=Strait&family=Open+Sans:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --font-sans:  'Strait', 'Open Sans', 'IBM Plex Sans', sans-serif;
  --font-serif: 'Open Sans', 'IBM Plex Serif', serif;
}

[data-theme="light"] {
  --bg-base:      #ffffff;
  --bg-surface:   #f8f9fa;
  --bg-elevated:  #f1f3f5;
  --bg-hover:     #e9ecef;

  --border:        #dee2e6;
  --border-strong: #adb5bd;

  --text-primary:   #212529;
  --text-secondary: #495057;
  --text-muted:     #868e96;

  /* Blue used only for interactive/active states */
  --accent:        #336791;
  --accent-bright: #264d6d;
  --accent-text:   #336791;
  --accent-subtle: #e8f0f7;

  --code-text: #495057;

  --amber:        #f59f00;
  --amber-text:   #664d00;
  --amber-subtle: #fff9db;
  --callout-tip:    #0ca678;
  --callout-danger: #e03131;
}

[data-theme="dark"] {
  --bg-base:      #1c1c1c;
  --bg-surface:   #242424;
  --bg-elevated:  #2e2e2e;
  --bg-hover:     #363636;

  --border:        #3a3a3a;
  --border-strong: #555555;

  --text-primary:   #e8e8e8;
  --text-secondary: #aaaaaa;
  --text-muted:     #717171;

  --accent:        #5b9bd5;
  --accent-bright: #7ab3e0;
  --accent-text:   #7ab3e0;
  --accent-subtle: #1e2d3d;

  --code-text: #aaaaaa;

  --amber:        #f59f00;
  --amber-text:   #ffd87a;
  --amber-subtle: #2b2200;
  --callout-tip:    #0ca678;
  --callout-danger: #e03131;
}

/* ── Nav toggle button (injected by script below) ────────────────────────── */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

@media (max-width: 1100px) {
  .nav-toggle { display: flex; }
}

/* Overlay backdrop */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--header-height);
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.nav-overlay.is-visible { display: block; }

/* When aside is hidden (hide_aside or no headings), content spans full width */
.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%);
}

/* ── Responsive layout ───────────────────────────────────────────────────── */

/* Medium — sidebar collapses off-canvas, TOC stays, content expands */
@media (max-width: 1100px) {
  .page-layout {
    grid-template-columns: 1fr var(--toc-width);
  }

  /* Sidebar is fixed/off-canvas, so no-TOC pages just need one column */
  .page-layout:not(:has(.toc)) {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 260px;
    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);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }
}

/* Small — sidebar off-canvas, TOC moves inline above content */
@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;
    /* Render as a horizontal pill-strip of links */
    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;
  }

  /* Indent sub-items slightly */
  .toc-item.toc-level-3 .toc-link { color: var(--text-muted); }

  .page-content {
    grid-column: 1;
    grid-row: 2;
    padding: 1rem 1.25rem;
  }
}

/* ── Footnotes (absent from braised base) ────────────────────────────────── */
.footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.footnotes ol {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
}
.footnotes li { margin-bottom: 0.4rem; }
.footnote-ref { font-size: 0.75em; vertical-align: super; }
.footnote-backref { margin-left: 0.25em; text-decoration: none; }

/* ── List styles (absent from braised base) ──────────────────────────────── */
.page-body ul,
.page-body ol {
  margin: 0.75rem 0 1rem 1.5rem;
  padding: 0;
}
.page-body ul { list-style: disc; }
.page-body ol { list-style: decimal; }
.page-body li { margin-bottom: 0.3rem; }
.page-body li > ul,
.page-body li > ol { margin-top: 0.3rem; margin-bottom: 0; }

/* Site title gets the PG blue treatment */
.site-title {
  font-family: 'Strait', 'Open Sans', sans-serif;
  color: #336791;
}

[data-theme="dark"] .site-title {
  color: #5b9bd5;
}
