/* ==========================================================================
   rustango docs — stylesheet
   Layout: full-width 2-column (wide article LEFT, 300px nav sidebar RIGHT).
   Tokens live in :root (light) and html[data-mode="dark"].
   ========================================================================== */

:root {
  /* Surfaces */
  --bg: #ffffff;
  --bg-subtle: #f7f9fb;       /* sidebar / inset surfaces */
  --bg-elevated: #ffffff;     /* cards */
  --code-bg: #f4f6f8;
  --code-border: #e4e9ef;

  /* Text */
  --fg: #1a1f26;
  --fg-soft: #3c4651;         /* secondary body text */
  --muted: #5a6573;           /* meta / captions */
  --faint: #8a939f;           /* very low-emphasis */

  /* Lines */
  --border: #e5e9ef;
  --border-strong: #d4dae2;

  /* Brand / interactive */
  --link: #2563b6;
  --link-hover: #174a8f;
  --accent: #c0492a;          /* rust — section labels, kbd, brand */
  --accent-soft: rgba(192, 73, 42, .10);

  /* Semantic (callouts) */
  --note: #2563b6;    --note-bg: rgba(37, 99, 182, .07);
  --tip: #1f7a4d;     --tip-bg: rgba(31, 122, 77, .08);
  --warning: #9a6a00; --warning-bg: rgba(184, 134, 11, .10);
  --danger: #c0392b;  --danger-bg: rgba(192, 57, 43, .08);

  /* Focus ring */
  --ring: #2563b6;

  /* Metrics */
  --maxw: 1320px;
  --measure: 74ch;            /* readable prose line length */
  --radius: 10px;
  --radius-sm: 7px;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .04);

  color-scheme: light;
}

html[data-mode="dark"] {
  --bg: #0d1117;
  --bg-subtle: #11161d;
  --bg-elevated: #161b22;
  --code-bg: #161b22;
  --code-border: #2a313b;

  --fg: #e6edf3;
  --fg-soft: #c2cbd4;
  --muted: #9aa6b2;
  --faint: #6e7b88;

  --border: #232b35;
  --border-strong: #313b46;

  --link: #6cb0ff;
  --link-hover: #93c5ff;
  --accent: #ec7f5f;
  --accent-soft: rgba(236, 127, 95, .14);

  --note: #6cb0ff;    --note-bg: rgba(108, 176, 255, .10);
  --tip: #5dd49a;     --tip-bg: rgba(93, 212, 154, .10);
  --warning: #e3b341; --warning-bg: rgba(227, 179, 65, .12);
  --danger: #f08379;  --danger-bg: rgba(240, 131, 121, .12);

  --ring: #6cb0ff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .45);

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 2px; }

/* In-text links in body content must be distinguishable without relying on
   color (WCAG 1.4.1 / axe `link-in-text-block`) — a dark-mode link can sit
   below 3:1 against the surrounding text. Mirror the faint underline the
   article prose (`.doc-content a`) already uses, for the landing/version
   content + the version banner. Block card links and the nav rails are
   excluded — they aren't in a text block. */
.content p a:not(.card),
.content li a:not(.card),
.version-banner a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
  text-underline-offset: 2px;
}
.content p a:not(.card):hover,
.content li a:not(.card):hover,
.version-banner a:hover { text-decoration-color: currentColor; }

/* Screen-reader-only: removed from view but kept in the accessibility tree
   (clip technique, not display:none) so section headings restore a valid
   heading order (axe `heading-order`) without changing the visual design. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

img { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

::selection { background: var(--accent-soft); }

/* Accessible focus for keyboard users only */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  height: 60px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  z-index: 30;
}
.brand {
  font-weight: 700;
  font-size: 1.075rem;
  letter-spacing: -.01em;
  color: var(--fg);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.brand:hover { text-decoration: none; }
.brand .material { color: var(--accent); font-size: 1.15em; }
.brand-sub { color: var(--muted); font-weight: 500; }

.search { flex: 1; max-width: 460px; }
.search input {
  width: 100%;
  padding: 8px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--fg);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.search input::placeholder { color: var(--faint); }
.search input:hover { border-color: var(--muted); }
.search input:focus {
  outline: none;
  border-color: var(--ring);
  background: var(--bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent);
}

.topnav { display: flex; align-items: center; gap: .85rem; margin-left: auto; }
.topnav select {
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
}
.topnav select:hover { border-color: var(--muted); }

.langs { display: inline-flex; align-items: center; gap: .15rem; }
.langs a {
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
}
.langs a:hover { color: var(--fg); background: var(--accent-soft); text-decoration: none; }
.langs a.active { color: var(--fg); font-weight: 700; }

.mode-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--fg);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 32px;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: background .12s ease, border-color .12s ease;
}
.mode-toggle:hover { background: var(--bg-subtle); border-color: var(--muted); }

/* --------------------------------------------------------------------------
   Version banner
   -------------------------------------------------------------------------- */
.version-banner {
  background: var(--warning-bg);
  border-bottom: 1px solid var(--border);
  padding: 9px 1.5rem;
  font-size: .88rem;
  color: var(--fg);
  text-align: center;
}
.version-banner a { color: var(--link); font-weight: 600; }

/* --------------------------------------------------------------------------
   2-column layout — content LEFT, nav sidebar RIGHT (300px)
   -------------------------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0;
  max-width: var(--maxw);
  margin: 0 auto;
}
.content {
  padding: 2.75rem 3.5rem 4rem;
  min-width: 0;
}
.sidebar {
  border-left: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 2rem 1.1rem 3rem;
  height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* In the CMS preview (docs page inside the editor iframe, flagged by
   docs-anchors.js) the sticky, independently-scrolling sidebar traps
   touchpad scroll. Drop it into normal flow there so the whole preview
   scrolls as one surface. Live docs keep the sticky sidebar. */
html.in-preview .sidebar {
  position: static;
  height: auto;
  overflow: visible;
  overscroll-behavior: auto;
}
/* Slim scrollbar for the sidebar */
.sidebar { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .content { padding: 2rem 1.5rem 3rem; }
  .sidebar {
    position: static;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--border);
    order: 2;
    padding: 1.5rem 1.25rem 2rem;
  }
}

/* Topbar collapses gracefully on phones: search wraps to its own row,
   nav controls stay on the brand row. Prevents horizontal overflow. */
@media (max-width: 640px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: .6rem 1rem;
    gap: .6rem;
    row-gap: .55rem;
  }
  .brand { font-size: 1rem; }
  .search { order: 3; flex: 1 0 100%; max-width: none; }
  .topnav { gap: .5rem; }
  .topnav select { max-width: 8.5rem; }
  .langs a { padding: 3px 4px; font-size: .78rem; }
  .content { padding: 1.5rem 1.15rem 2.5rem; }
  .doc-content pre { border-radius: 8px; }
}

@media (max-width: 420px) {
  /* The version select is reachable via in-page links; drop it from the
     cramped top row so EN/FR/… and the mode toggle stay tappable. */
  .topnav select { display: none; }
}

/* --------------------------------------------------------------------------
   Sidebar nav — three levels: section › page › heading
   -------------------------------------------------------------------------- */
.sidebar nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar nav a {
  display: block;
  padding: 6px 11px;
  border-radius: 7px;
  color: var(--fg-soft);
  line-height: 1.4;
  transition: background .1s ease, color .1s ease;
}
.sidebar nav a:hover { background: var(--accent-soft); color: var(--fg); text-decoration: none; }

/* Level 1 — SECTION: uppercase accent label */
.sidebar nav > ul > li { margin-bottom: 1.75rem; }
.sidebar nav > ul > li:last-child { margin-bottom: 0; }
.sidebar nav > ul > li > a.section {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .7rem;
  font-weight: 700;
  color: var(--accent);
  padding: 4px 11px;
  margin-bottom: .4rem;
}
.sidebar nav > ul > li > a.section:hover { background: transparent; color: var(--accent); }

/* Level 2 — page links */
.sidebar nav > ul > li > ul > li { margin: 1px 0; }
.sidebar nav > ul > li > ul > li > a {
  color: var(--fg-soft);
  font-size: .9rem;
  font-weight: 500;
}
.sidebar nav > ul > li > ul > li > a.active {
  color: var(--link);
  font-weight: 600;
  background: color-mix(in srgb, var(--link) 10%, transparent);
}

/* Level 3 — in-page subheadings (scroll-spy) */
.sidebar nav .subnav {
  margin: .3rem 0 .5rem .85rem;
  border-left: 1.5px solid var(--border);
  padding-left: .35rem;
}
.sidebar nav .subnav li { margin: 0; }
.sidebar nav .subnav a {
  color: var(--muted);
  font-size: .82rem;
  padding: 4px 9px;
  line-height: 1.35;
}
.sidebar nav .subnav a:hover { color: var(--fg); background: var(--accent-soft); }
.sidebar nav .subnav li.h3 a { padding-left: 1.45rem; font-size: .8rem; }
.sidebar nav .subnav a.current {
  color: var(--link);
  font-weight: 600;
  background: color-mix(in srgb, var(--link) 9%, transparent);
  box-shadow: inset 2px 0 0 var(--link);
  margin-left: -1.5px;
}

/* --------------------------------------------------------------------------
   Article typography & vertical rhythm
   Prose is capped to a comfortable measure; code/tables span full width.
   -------------------------------------------------------------------------- */
.content > h1,
.breadcrumbs,
.lead,
.doc-content > p,
.doc-content > ul,
.doc-content > ol,
.doc-content > blockquote,
.doc-content > h2,
.doc-content > h3,
.doc-content > h4,
.doc-content > .callout,
.doc-content > .versionmod,
.doc-content > details,
.doc-content > .xref {
  max-width: var(--measure);
}

.content h1 {
  font-size: 2.15rem;
  line-height: 1.15;
  letter-spacing: -.02em;
  font-weight: 750;
  margin: 0 0 .6rem;
}
.lead {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 2rem;
}
.lead p { margin: 0 0 .6rem; }
.lead p:last-child { margin-bottom: 0; }

.doc-content { font-size: 1rem; color: var(--fg); }
.doc-content > :first-child { margin-top: 0; }

.doc-content h2 {
  font-size: 1.55rem;
  line-height: 1.25;
  letter-spacing: -.01em;
  font-weight: 700;
  margin: 3rem 0 1rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.doc-content h3 {
  font-size: 1.2rem;
  line-height: 1.3;
  font-weight: 650;
  margin: 2.25rem 0 .75rem;
}
.doc-content h4 {
  font-size: 1.02rem;
  font-weight: 650;
  margin: 1.75rem 0 .5rem;
}

.doc-heading { scroll-margin-top: 80px; position: relative; }
.doc-heading .headerlink {
  opacity: 0;
  margin-left: .4rem;
  color: var(--faint);
  font-weight: 400;
  text-decoration: none;
  transition: opacity .12s ease, color .12s ease;
}
.doc-heading:hover .headerlink,
.doc-heading .headerlink:focus-visible { opacity: 1; }
.doc-heading .headerlink:hover { color: var(--link); }

.doc-content p { margin: 0 0 1.15rem; }
.doc-content ul, .doc-content ol { margin: 0 0 1.15rem; padding-left: 1.4rem; }
.doc-content li { margin: .3rem 0; }
.doc-content li > ul, .doc-content li > ol { margin: .3rem 0; }
.doc-content li::marker { color: var(--faint); }
.doc-content strong { font-weight: 650; color: var(--fg); }

.doc-content a { font-weight: 500; }
.doc-content a:not(.headerlink) { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent); text-underline-offset: 2px; }
.doc-content a:not(.headerlink):hover { text-decoration-color: currentColor; }

/* --------------------------------------------------------------------------
   Code — blocks & inline. The hljs token theme is toggled in _base.html
   by data-mode (see <link> media swap). We only style the container here.
   -------------------------------------------------------------------------- */
.doc-content pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 1.25rem;
  overflow-x: auto;
  font-size: .875rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
  tab-size: 4;
}
.doc-content pre code {
  background: transparent;
  padding: 0;
  border: 0;
  font-size: inherit;
  font-family: var(--font-mono);
  color: var(--fg);
}
.doc-content code {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: .1em .4em;
  border-radius: 5px;
  font-size: .875em;
  font-family: var(--font-mono);
  color: var(--fg);
  word-break: break-word;
}
.doc-content a code { color: inherit; }
.doc-content h2 code, .doc-content h3 code, .doc-content h4 code { font-size: .9em; }

/* Slim scrollbar inside code blocks */
.doc-content pre::-webkit-scrollbar { height: 9px; }
.doc-content pre::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
.doc-content pre::-webkit-scrollbar-track { background: transparent; }

/* WCAG AA syntax colors — light highlight.js theme.
   github.min.css ships four token groups below 4.5:1 against our
   --code-bg (#f4f6f8): keyword #d73a49 (4.22), built_in/symbol #e36209
   (3.04), comment #6a737d (4.46), name/selector-tag #22863a (4.30).
   Darken each to an AA-compliant Primer hue. Scoped to light mode and
   specificity-bumped (`html[data-mode="light"] …`) so it wins over the
   CDN theme, which loads after docs.css. Dark mode uses github-dark,
   whose light-on-dark tokens already clear AA. */
html[data-mode="light"] .hljs-doctag,
html[data-mode="light"] .hljs-keyword,
html[data-mode="light"] .hljs-meta .hljs-keyword,
html[data-mode="light"] .hljs-template-tag,
html[data-mode="light"] .hljs-template-variable,
html[data-mode="light"] .hljs-type,
html[data-mode="light"] .hljs-variable.language_ { color: #cf222e; }
html[data-mode="light"] .hljs-built_in,
html[data-mode="light"] .hljs-symbol { color: #bc4c00; }
html[data-mode="light"] .hljs-code,
html[data-mode="light"] .hljs-comment,
html[data-mode="light"] .hljs-formula { color: #57606a; }
html[data-mode="light"] .hljs-name,
html[data-mode="light"] .hljs-quote,
html[data-mode="light"] .hljs-selector-pseudo,
html[data-mode="light"] .hljs-selector-tag { color: #1a7f37; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.doc-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1.5rem;
  font-size: .925rem;
  display: block;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.doc-content thead { background: var(--bg-subtle); }
.doc-content th, .doc-content td {
  border-bottom: 1px solid var(--border);
  padding: 9px 14px;
  text-align: left;
  vertical-align: top;
}
.doc-content th { font-weight: 650; color: var(--fg); white-space: nowrap; }
.doc-content tr:last-child td { border-bottom: 0; }
.doc-content tbody tr:hover { background: var(--bg-subtle); }
.doc-content table code { white-space: nowrap; }

/* --------------------------------------------------------------------------
   Blockquotes
   -------------------------------------------------------------------------- */
.doc-content blockquote {
  margin: 0 0 1.25rem;
  padding: .25rem 1.1rem;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
  font-style: italic;
}
.doc-content blockquote p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Callouts / admonitions
   -------------------------------------------------------------------------- */
.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--note);
  background: var(--note-bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 0 0 1.5rem;
  font-size: .95rem;
}
.callout-title {
  font-weight: 700;
  margin: 0 0 .35rem;
  color: var(--note);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.callout-title::before { content: "ℹ"; font-size: .95em; }
.callout > :last-child { margin-bottom: 0; }
.callout p { margin: 0 0 .6rem; }
.callout p:last-child { margin: 0; }

.callout.tip { border-left-color: var(--tip); background: var(--tip-bg); }
.callout.tip .callout-title { color: var(--tip); }
.callout.tip .callout-title::before { content: "✓"; }

.callout.warning { border-left-color: var(--warning); background: var(--warning-bg); }
.callout.warning .callout-title { color: var(--warning); }
.callout.warning .callout-title::before { content: "⚠"; }

.callout.danger { border-left-color: var(--danger); background: var(--danger-bg); }
.callout.danger .callout-title { color: var(--danger); }
.callout.danger .callout-title::before { content: "⛔"; }

/* --------------------------------------------------------------------------
   Version annotations
   -------------------------------------------------------------------------- */
.versionmod {
  border-left: 3px solid var(--tip);
  background: var(--tip-bg);
  padding: 8px 14px;
  margin: 0 0 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .9rem;
}
.versionmod > :last-child { margin-bottom: 0; }
.versionmod p { margin: 0; }
.versionmod.changed { border-left-color: var(--warning); background: var(--warning-bg); }
.versionmod .tag { font-weight: 700; color: var(--tip); }
.versionmod.changed .tag { color: var(--warning); }

/* --------------------------------------------------------------------------
   API reference block
   -------------------------------------------------------------------------- */
.apiref {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 1.5rem;
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}
.apiref-head {
  background: var(--bg-subtle);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: .6rem;
  flex-wrap: wrap;
}
.apiref-kind {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 99px;
}
.apiref-sym { font-family: var(--font-mono); font-weight: 700; font-size: 1rem; color: var(--fg); }
.apiref-body { padding: 14px 16px; }
.apiref-body > :last-child { margin-bottom: 0; }
.apiref-sig {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  overflow-x: auto;
  font-size: .85rem;
  margin: 0 0 .9rem;
}
.apiref table { margin: .85rem 0; }

/* --------------------------------------------------------------------------
   Cross reference + details
   -------------------------------------------------------------------------- */
.xref {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin: .25rem 0 1rem;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-weight: 500;
  transition: border-color .12s ease, background .12s ease;
}
.xref:hover { border-color: var(--link); background: var(--accent-soft); text-decoration: none; }
.xref::before { content: "→"; color: var(--muted); }

details.doc-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin: 0 0 1.25rem;
  background: var(--bg-subtle);
}
details.doc-details[open] { padding-bottom: 14px; }
details.doc-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--fg);
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
details.doc-details summary::-webkit-details-marker { display: none; }
details.doc-details summary::before {
  content: "▸";
  color: var(--muted);
  transition: transform .12s ease;
  display: inline-block;
}
details.doc-details[open] summary::before { transform: rotate(90deg); }
details.doc-details summary:hover { color: var(--link); }
details.doc-details > :not(summary) { margin-top: .75rem; }
details.doc-details > :last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Breadcrumbs, prev/next
   -------------------------------------------------------------------------- */
.breadcrumbs {
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .15rem .4rem;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--link); }
.breadcrumbs > span:last-child { color: var(--fg-soft); font-weight: 500; }

.prevnext {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  max-width: var(--measure);
}
.prevnext a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--fg-soft);
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.prevnext a:hover { border-color: var(--link); color: var(--link); background: var(--accent-soft); text-decoration: none; }

.muted { color: var(--muted); }

/* --------------------------------------------------------------------------
   Cards (home / section landing)
   -------------------------------------------------------------------------- */
.version-cards, .section-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
  margin: 2rem 0;
}
.card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  background: var(--bg-elevated);
  color: var(--fg);
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.card h3 { margin: 0 0 .4rem; font-size: 1.1rem; color: var(--fg); }
.card .muted { font-size: .9rem; line-height: 1.55; margin: 0; }

.badge {
  font-size: .68rem;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--tip-bg);
  color: var(--tip);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge.dev { background: var(--warning-bg); color: var(--warning); }
.badge.eol { background: var(--danger-bg); color: var(--danger); }

/* --------------------------------------------------------------------------
   Search page
   -------------------------------------------------------------------------- */
.search-page { max-width: 760px; margin: 3rem auto; padding: 0 1.5rem; }
.search-results { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.search-results li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.search-results li:hover { background: var(--bg-subtle); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .88rem;
}
.site-footer p { margin: 0; }
.site-footer strong { color: var(--fg-soft); }

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* --------------------------------------------------------------------------
   Doc images / snapshots
   Markdown wraps a lone image in a <p>, which the prose rules cap at the
   reading measure (~74ch) — too small for screenshots. Break image
   paragraphs out of the measure so the image fills the full content column,
   add a frame, and hint that a click opens the full-resolution file.
   -------------------------------------------------------------------------- */
.doc-content p:has(img) { max-width: none; }
.doc-content a:has(> img) { display: block; }
.doc-content img {
  display: block;
  width: 100%;
  height: auto;
  margin: 1.75rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  cursor: zoom-in;
}
