/* Archipelego docs theme.
   Built on the design system: every colour, size, radius, shadow, duration and easing is a token from
   tokens.css (compiled from design-system/project/tokens.json), and buttons, chips, wells and the logo are the
   bundle's own ap-* classes from bundle.css. The chrome stays calm and neutral; signal is the only hue and
   marks "you are here", focus and links (signal-deep). */

:root {
  color-scheme: light;
  --topbar-h: 64px;
  --sidebar-w: 280px;
  --toc-w: 232px;
  --measure: 720px;
  --gutter: var(--space-8);
}
[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + var(--space-6)); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

/* Focus: the selection ring, a 2px signal stroke with the signal halo, on every control. */
:focus { outline: none; }
:focus-visible { outline: var(--stroke-selection) solid var(--signal); outline-offset: 2px; box-shadow: var(--shadow-signal); }
.main:focus-visible { outline: none; box-shadow: none; }

.skip-link {
  position: fixed; top: var(--space-2); left: var(--space-2); z-index: 100;
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
  background: var(--signal); color: var(--on-signal); font-weight: 600; text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--duration-fast) var(--ease-out);
}
.skip-link:focus { transform: none; }

.grow { flex: 1; }

/* ---------- The logo, from the bundle's ap-logo classes ---------- */
.ap-logo-mark.is-animated .ap-logo-island-a,
.ap-logo-mark.is-animated .ap-logo-island-b,
.ap-logo-mark.is-animated .ap-logo-island-c { animation: ap-bob var(--duration-story) var(--ease-in-out) infinite alternate; transform-box: fill-box; }
.ap-logo-mark.is-animated .ap-logo-island-b { animation-delay: calc(var(--duration-story) / -3); }
.ap-logo-mark.is-animated .ap-logo-island-c { animation-delay: calc(var(--duration-story) / -1.5); }

/* ---------- Badge: "New", a quiet signal-soft pill like the bundle's "In focus" ---------- */
.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 var(--space-2);
  margin-left: var(--space-2); border-radius: var(--radius-pill);
  background: var(--signal-soft); color: var(--signal-deep);
  font: 600 11px/20px var(--font-sans); letter-spacing: 0.02em; white-space: nowrap; vertical-align: middle;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--space-3);
  min-height: var(--topbar-h); padding: var(--space-3) var(--space-6);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: var(--stroke-hairline) solid var(--hairline);
}
.brand { flex: none; border-radius: var(--radius-sm); }
.brand .ap-logo-word { font-size: 22px; }
.brand-docs { font: 500 13px/16px var(--font-mono); color: var(--ink-muted); margin-left: calc(var(--space-1) * -1); padding-top: 4px; }

.guide-tabs { display: flex; gap: var(--space-1); margin-left: var(--space-6); }
.guide-tab {
  display: inline-flex; align-items: center; height: 40px; padding: 0 var(--space-4);
  border-radius: var(--radius-pill); color: var(--ink-muted); text-decoration: none;
  font-size: 15px; font-weight: 600;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.guide-tab:hover { background: var(--ground-sunken); color: var(--ink); }
.guide-tab[aria-current="page"] { background: var(--ground-sunken); color: var(--ink); box-shadow: inset 0 0 0 var(--stroke-hairline) var(--hairline); }

.nav-toggle { display: none; }

/* Search */
.search { position: relative; display: flex; align-items: center; width: 300px; }
.search-glyph { position: absolute; left: 14px; color: var(--ink-muted); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 40px 0 38px;
  border-radius: var(--radius-pill); border: var(--stroke-hairline) solid var(--hairline);
  background: var(--ground-sunken); color: var(--ink);
  font: 400 15px/22px var(--font-sans);
  transition: border-color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out);
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--ink-faint); }
.search input:hover { border-color: var(--ink-faint); }
.search input:focus-visible { outline: none; border-color: var(--signal); box-shadow: var(--shadow-signal); background: var(--surface); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-key { position: absolute; right: 10px; }
.search input:focus ~ .search-key, .search input:not(:placeholder-shown) ~ .search-key { display: none; }
.search-results {
  position: absolute; top: calc(100% + var(--space-2)); right: 0; width: min(480px, calc(100vw - 2 * var(--space-4)));
  max-height: min(70vh, 560px); overflow: auto; padding: var(--space-2);
  background: var(--surface-raised); animation: ap-rise var(--duration-slow) var(--ease-out) both;
}
.search-results ul { list-style: none; margin: 0; padding: 0; }
.search-results a {
  display: block; padding: 10px var(--space-3); border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none;
}
.search-results a:hover, .search-results a.is-active { background: var(--ground-sunken); }
.search-results a:focus-visible { outline-offset: -2px; }
.sr-title { display: block; font-weight: 600; }
.sr-meta { display: block; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); }
.sr-text { display: block; margin-top: 2px; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.search-results mark { background: var(--signal-soft); color: var(--ink); border-radius: 2px; padding: 0 1px; }
.sr-empty { margin: 0; padding: var(--space-3); color: var(--ink-muted); }

/* Language menu */
.lang-menu { position: relative; }
.lang-menu > summary { list-style: none; cursor: pointer; gap: var(--space-1); height: 40px; padding: 0 var(--space-3); font-size: 13px; border-radius: var(--radius-pill); }
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu[open] > summary .ap-glyph { transform: rotate(180deg); }
.lang-menu > summary .ap-glyph { transition: transform var(--duration-base) var(--ease-out); }
.lang-code { display: none; font-family: var(--font-mono); }
.lang-list {
  position: absolute; top: calc(100% + var(--space-2)); right: 0; z-index: 50; min-width: 220px;
  list-style: none; margin: 0; padding: var(--space-2);
  background: var(--surface-raised); animation: ap-rise var(--duration-slow) var(--ease-out) both;
}
.lang-list a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.lang-list a:hover { background: var(--ground-sunken); }
.lang-list a[aria-current] { font-weight: 600; }

/* Theme toggle: one glyph per theme */
.theme-toggle .when-dark { display: none; }
[data-theme="dark"] .theme-toggle .when-dark { display: block; }
[data-theme="dark"] .theme-toggle .when-light { display: none; }

/* ---------- Page layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  align-items: start;
  max-width: 1440px; margin: 0 auto;
}
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); overflow-y: auto; overscroll-behavior: contain;
  padding: var(--space-8) var(--space-4) var(--space-12) var(--space-6);
  scrollbar-width: thin;
}
.sidebar-guides { display: none; }
.nav-guide { margin: 0 0 var(--space-4); padding: 0 var(--space-3); font: 600 20px/28px var(--font-display); letter-spacing: -0.015em; }
.nav-group + .nav-group { margin-top: var(--space-6); }
.nav-group-title { margin: 0 0 var(--space-1); padding: 0 var(--space-3); font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-muted); }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav a {
  display: flex; align-items: center; min-height: 36px; padding: 6px var(--space-3);
  border-radius: var(--radius-sm); color: var(--ink-muted); text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.nav a:hover { background: var(--ground-sunken); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ground-sunken); color: var(--ink); font-weight: 600; box-shadow: inset var(--stroke-selection) 0 0 var(--signal); }

.main { min-width: 0; padding: var(--space-12) var(--gutter) 0; }
.doc { max-width: var(--measure); margin: 0 auto; }

/* ---------- Article ---------- */
.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-muted); }
.eyebrow .badge { margin-left: 0; }
.doc h1 {
  margin: 0; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 4.2vw, 48px); line-height: 1.05; letter-spacing: -0.025em;
  text-wrap: balance;
}
.lead { margin: var(--space-4) 0 0; font-size: 20px; line-height: 28px; color: var(--ink-muted); text-wrap: pretty; }
.notice {
  display: flex; gap: var(--space-2); align-items: flex-start;
  margin: 0 0 var(--space-6); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); border: var(--stroke-hairline) dashed var(--ink-faint);
  background: var(--ground-sunken); color: var(--ink-muted); font-size: 13px; line-height: 18px;
}
.notice .ap-glyph { flex: none; margin-top: 1px; }

.prose { margin-top: var(--space-8); font-size: 16px; line-height: 26px; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 var(--space-4); }
.prose ul, .prose ol { padding-left: var(--space-6); }
.prose li { margin: var(--space-1) 0; }
.prose li::marker { color: var(--ink-muted); }
.prose h2 {
  position: relative; margin: var(--space-16) 0 var(--space-4);
  font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.015em;
  text-wrap: balance;
}
.prose h3 { position: relative; margin: var(--space-8) 0 var(--space-3); font-size: 20px; line-height: 28px; font-weight: 600; }
.prose h4 { margin: var(--space-6) 0 var(--space-2); font-size: 15px; line-height: 22px; font-weight: 600; }
.anchor {
  margin-left: var(--space-2); color: var(--ink-faint); text-decoration: none; font-weight: 500;
  opacity: 0; transition: opacity var(--duration-fast) var(--ease-out);
}
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.prose strong { font-weight: 600; }
.prose hr { border: 0; border-top: var(--stroke-hairline) solid var(--hairline); margin: var(--space-12) 0; }
.prose blockquote { margin: var(--space-6) 0; padding: 0 0 0 var(--space-4); border-left: 2px solid var(--hairline); color: var(--ink-muted); }

a { color: var(--signal-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
.prose a.ext::after {
  content: ""; display: inline-block; width: 0.7em; height: 0.7em; margin-left: 2px;
  background: currentColor; opacity: 0.7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5h10v10'/%3E%3Cpath d='M19 5L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5h10v10'/%3E%3Cpath d='M19 5L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Inline code and keys: numbers, paths and identifiers are mono, as in the app. */
.prose code {
  font-family: var(--font-mono); font-size: 0.84em; font-weight: 500;
  padding: 1px 6px; border-radius: var(--radius-xs);
  background: var(--ground-sunken); border: var(--stroke-hairline) solid var(--hairline);
  overflow-wrap: anywhere;
}
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 6px; margin: 0 1px;
  border-radius: var(--radius-xs); border: var(--stroke-hairline) solid var(--hairline); border-bottom-width: 2px;
  background: var(--surface); color: var(--ink);
  font: 600 12px/1 var(--font-mono); white-space: nowrap; vertical-align: 1px;
  box-shadow: 0 1px 0 var(--hairline);
}

/* Code blocks */
.code {
  margin: var(--space-6) 0; border-radius: var(--radius-md);
  border: var(--stroke-hairline) solid var(--hairline); background: var(--ground-sunken); overflow: hidden;
}
.code-head { display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4); border-bottom: var(--stroke-hairline) solid var(--hairline); }
.code-lang { font: 500 12px/16px var(--font-mono); color: var(--ink-muted); }
.code-copy {
  display: inline-flex; align-items: center; gap: var(--space-1); height: 28px; padding: 0 var(--space-2);
  border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--ink-muted);
  font: 600 12px/16px var(--font-sans); cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.code-copy:hover { background: var(--signal-soft); color: var(--signal-deep); }
.code-copy.is-done { color: var(--success); }
.code pre { margin: 0; padding: var(--space-4); overflow-x: auto; tab-size: 2; }
.code pre code { font: 500 13px/20px var(--font-mono); color: var(--ink); background: none; border: 0; padding: 0; white-space: pre; overflow-wrap: normal; }

/* Tables */
.table-wrap { margin: var(--space-6) 0; overflow-x: auto; border: var(--stroke-hairline) solid var(--hairline); border-radius: var(--radius-md); background: var(--surface); }
.prose table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; line-height: 22px; }
.prose th {
  text-align: left; vertical-align: bottom; padding: 10px 14px;
  background: var(--ground-sunken); color: var(--ink);
  font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em;
  border-bottom: var(--stroke-hairline) solid var(--hairline);
}
.prose td { padding: 10px 14px; vertical-align: top; border-top: var(--stroke-hairline) solid var(--hairline); }
.prose tr:first-child td { border-top: 0; }
.prose td code { white-space: nowrap; }

/* Callouts: a word plus a glyph, never colour alone. */
.callout {
  margin: var(--space-6) 0; padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline);
  background: var(--surface); box-shadow: var(--shadow-tile);
}
.callout > :last-child { margin-bottom: 0; }
.callout-label { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-2) !important; font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink); }
.callout-label .badge { margin-left: 0; }
.callout--note { background: var(--ground-sunken); box-shadow: none; }
.callout--note .callout-label { color: var(--ink-muted); }
.callout--warning { border-color: color-mix(in srgb, var(--warning) 55%, var(--hairline)); }
.callout--warning .callout-label { color: var(--warning); }
.callout--new { background: color-mix(in srgb, var(--signal-soft) 55%, var(--surface)); border-color: color-mix(in srgb, var(--signal) 30%, var(--hairline)); }

/* On this page */
.toc { position: sticky; top: calc(var(--topbar-h) + var(--space-12)); max-height: calc(100vh - var(--topbar-h) - var(--space-16)); overflow-y: auto; padding: 0 var(--space-6) var(--space-8) 0; }
.toc-title { margin: 0 0 var(--space-3); font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; }
.toc ul, .toc-mobile ul { list-style: none; margin: 0; padding: 0; border-left: var(--stroke-hairline) solid var(--hairline); }
.toc a, .toc-mobile a {
  display: block; padding: 5px 0 5px var(--space-3); margin-left: -1px;
  border-left: var(--stroke-selection) solid transparent;
  color: var(--ink-muted); text-decoration: none; font-size: 13px; line-height: 18px;
  transition: color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.toc .toc-3 a, .toc-mobile .toc-3 a { padding-left: var(--space-6); }
.toc a:hover, .toc-mobile a:hover { color: var(--ink); }
.toc a.is-current { color: var(--ink); font-weight: 600; border-left-color: var(--ink); }
.toc-mobile { display: none; margin-top: var(--space-6); border: var(--stroke-hairline) solid var(--hairline); border-radius: var(--radius-md); background: var(--surface); }
.toc-mobile > summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 var(--space-4); cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.toc-mobile > summary::-webkit-details-marker { display: none; }
.toc-mobile[open] > summary .ap-glyph { transform: rotate(180deg); }
.toc-mobile ul { margin: 0 var(--space-4) var(--space-4); }

/* Previous / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin: var(--space-16) 0 0; }
.pager-card {
  display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4);
  border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline);
  background: var(--surface); box-shadow: var(--shadow-tile); color: var(--ink); text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.pager-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--ink-faint); }
.pager-next { text-align: right; align-items: flex-end; }
.pager-label { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); }
.pager-title { font-weight: 600; font-size: 15px; line-height: 22px; }

.footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
  max-width: var(--measure); margin: var(--space-16) auto 0; padding: var(--space-6) 0 var(--space-12);
  border-top: var(--stroke-hairline) solid var(--hairline);
  font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted);
}
.footer p { margin: 0; flex: 1; }
.footer-app { font-weight: 600; }

/* ---------- Home ---------- */
.home { max-width: 1120px; margin: 0 auto; padding: var(--space-16) var(--space-6) 0; }
.hero { max-width: 760px; padding: var(--space-8) 0 var(--space-12); }
.hero-mark { margin-bottom: var(--space-6); }
.hero h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 7vw, 72px); line-height: 1; letter-spacing: -0.03em; text-wrap: balance; }
.hero .lead { font-size: 20px; line-height: 30px; }
.hero .ap-btn { margin-top: var(--space-6); text-decoration: none; }
.guide-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
.guide-card {
  display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-6);
  border-radius: var(--radius-lg); border: var(--stroke-hairline) solid var(--hairline);
  background: var(--surface); box-shadow: var(--shadow-tile);
}
.guide-card h2 { margin: var(--space-2) 0 0; font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.015em; }
.guide-card h2 a { color: var(--ink); text-decoration: none; }
.guide-card h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.guide-card > p { margin: 0; color: var(--ink-muted); }
.guide-card ul { list-style: none; margin: var(--space-2) 0 0; padding: var(--space-3) 0 0; border-top: var(--stroke-hairline) solid var(--hairline); }
.guide-card li { display: flex; align-items: center; padding: 4px 0; }
.home .footer { max-width: none; }

/* ---------- Language chooser and 404 ---------- */
.chooser { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-6); min-height: 100vh; padding: var(--space-12) var(--space-4); text-align: center; }
.chooser .ap-logo-word { font-size: 40px; }
.chooser h1 { margin: 0; font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.015em; }
.chooser .lead { margin: 0; max-width: 520px; }
.chooser-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.chooser-list .ap-btn, .chooser .ap-btn { width: 100%; min-width: 160px; text-decoration: none; }

/* ---------- Drawer scrim ---------- */
.scrim { position: fixed; inset: 0; z-index: 44; background: color-mix(in srgb, var(--ground-sunken) 72%, transparent); animation: arc-fade var(--duration-slow) var(--ease-out) both; }
@keyframes arc-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
  .toc-mobile { display: block; }
  .search { width: 240px; }
}
@media (max-width: 960px) {
  :root { --gutter: var(--space-6); }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-flex; }
  .guide-tabs { display: none; }
  .sidebar {
    position: fixed; z-index: 45; top: 0; left: 0; bottom: 0; height: 100%;
    width: min(340px, 88vw); padding: var(--space-6) var(--space-4) var(--space-12);
    background: var(--surface); border-right: var(--stroke-hairline) solid var(--hairline);
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0; box-shadow: var(--shadow-float);
    transform: translateX(-104%); visibility: hidden;
    transition: transform var(--duration-slow) var(--ease-out), visibility 0s linear var(--duration-slow);
  }
  .nav-open .sidebar { transform: none; visibility: visible; transition: transform var(--duration-slow) var(--ease-out), visibility 0s; }
  .sidebar-guides { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-6); padding-bottom: var(--space-4); border-bottom: var(--stroke-hairline) solid var(--hairline); }
  .sidebar-guides a { display: flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--ink-muted); text-decoration: none; font-weight: 600; }
  .sidebar-guides a[aria-current="page"] { color: var(--ink); background: var(--ground-sunken); }
  .nav a { min-height: 44px; }
  .guide-cards { grid-template-columns: minmax(0, 1fr); }
  .chooser-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  :root { --topbar-h: 112px; --gutter: var(--space-4); }
  .topbar { flex-wrap: wrap; padding: var(--space-2) var(--space-4); row-gap: var(--space-2); }
  .brand .ap-logo-word { font-size: 20px; }
  .grow { flex: 1 0 0; }
  .search { order: 10; width: 100%; flex: 1 0 100%; }
  .search input { height: 44px; }
  .search-results { left: 0; right: auto; width: 100%; }
  .lang-menu > summary { height: 44px; }
  .theme-toggle, .nav-toggle { width: 44px; height: 44px; }
  .lang-name, .brand-docs, .search-key { display: none; }
  .lang-code { display: inline; }
  .topbar { column-gap: var(--space-2); }
  .main { padding-top: var(--space-8); }
  .lead { font-size: 17px; line-height: 26px; }
  .prose h2 { margin-top: var(--space-12); font-size: 24px; line-height: 30px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager-next { text-align: left; align-items: flex-start; }
  .home { padding: var(--space-8) var(--space-4) 0; }
  .guide-card { padding: var(--space-5); }
  .lang-list { right: calc(var(--space-12) * -1); }
  .nav-toggle { margin-left: calc(var(--space-2) * -1); }
}
@media (pointer: coarse) {
  .nav a, .toc-mobile a, .lang-list a, .search-results a { min-height: 44px; }
  .code-copy { height: 36px; }
}

/* Motion: every duration collapses under reduced motion, and the logo holds still. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: var(--duration-instant) !important; animation-iteration-count: 1 !important; transition-duration: var(--duration-instant) !important; scroll-behavior: auto !important; }
  .ap-logo-mark.is-animated .ap-logo-island-a, .ap-logo-mark.is-animated .ap-logo-island-b, .ap-logo-mark.is-animated .ap-logo-island-c { animation: none; }
  .pager-card:hover, .ap-btn:hover { transform: none; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

@media print {
  .topbar, .sidebar, .toc, .toc-mobile, .pager, .code-copy, .scrim { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
}

/* Home guide cards: page lists read as a quiet index, links show on hover. */
.guide-card li a { color: var(--ink); text-decoration: none; }
.guide-card li a:hover { color: var(--signal-deep); text-decoration: underline; }
