/* ASGE docsite — shared styles */

:root {
  --bg: #ffffff;
  --bg-alt: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f0f1f5;
  --border: #e3e5ea;
  --text: #14161c;
  --text-muted: #5b6472;
  --accent: #6a4cf0;
  --accent-2: #0f9c8c;
  --accent-contrast: #ffffff;
  --warn: #b45309;
  --danger: #c0392b;
  --code-bg: #f0f1f5;
  --shadow: 0 1px 2px rgba(20, 22, 28, 0.06), 0 8px 24px rgba(20, 22, 28, 0.06);
  --radius: 12px;
  --header-h: 64px;
  --max-w: 1680px;
  color-scheme: light;
}

:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --bg: #0b0e14;
    --bg-alt: #10131b;
    --surface: #12161f;
    --surface-2: #171c27;
    --border: #232837;
    --text: #e6e8ee;
    --text-muted: #8b96a8;
    --accent: #9c8bff;
    --accent-2: #2dd4bf;
    --accent-contrast: #0b0e14;
    --warn: #f5b452;
    --danger: #f87171;
    --code-bg: #0d1017;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0e14;
  --bg-alt: #10131b;
  --surface: #12161f;
  --surface-2: #171c27;
  --border: #232837;
  --text: #e6e8ee;
  --text-muted: #8b96a8;
  --accent: #9c8bff;
  --accent-2: #2dd4bf;
  --accent-contrast: #0b0e14;
  --warn: #f5b452;
  --danger: #f87171;
  --code-bg: #0d1017;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

code, pre, kbd, .mono {
  font-family: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

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

img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 3rem; }
h3 { font-size: 1.25rem; }
p { color: var(--text); }
.lede { color: var(--text-muted); font-size: 1.1rem; }

/* ---------- top nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.brand img { width: 26px; height: 26px; }
.brand:hover { text-decoration: none; opacity: 0.85; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.nav-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.nav-toggle { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { opacity: 0.9; text-decoration: none; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- hero ---------- */
.hero {
  padding: 88px 0 56px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(700px 320px at 12% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(700px 320px at 100% 0%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 60%);
}
.hero .kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 { max-width: 820px; margin: 0 0 18px; }
.hero .lede { max-width: 640px; margin-bottom: 30px; }

.hero-stats {
  display: flex;
  gap: 28px;
  margin-top: 48px;
  flex-wrap: wrap;
}
.hero-stats .stat b { display: block; font-size: 1.6rem; }
.hero-stats .stat span { color: var(--text-muted); font-size: 0.85rem; }

/* ---------- sections / cards ---------- */
section { padding: 56px 0; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 10px; }
.card p { color: var(--text-muted); margin: 0; font-size: 0.95rem; }
.card .card-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  flex-shrink: 0;
}

/* example cards */
.example-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.example-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.example-card .thumb {
  aspect-ratio: 16/10;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
}
.example-card .thumb img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.example-card .thumb .noshot {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 12px;
}
.example-card .playable-badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--accent-2); color: #06231f;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.03em;
  padding: 4px 8px; border-radius: 999px;
  text-transform: uppercase;
}
.example-card .body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.example-card h3 { margin: 0; font-size: 1.05rem; }
.example-card p { color: var(--text-muted); font-size: 0.9rem; margin: 0; flex: 1; }
.example-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-done { color: #0f9c8c; background: color-mix(in srgb, #0f9c8c 16%, transparent); }
.badge-progress { color: var(--warn); background: color-mix(in srgb, var(--warn) 18%, transparent); }
.badge-todo { color: var(--text-muted); background: var(--surface-2); }

/* ---------- roadmap list ---------- */
.roadmap-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.roadmap-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.roadmap-item .name { font-weight: 600; flex: 1; }

/* ---------- code blocks ---------- */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
}
:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.15em 0.4em;
  font-size: 0.85em;
}
.code-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
  margin: 20px 0;
}
.code-card .code-card-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}
.code-card pre { border: none; border-radius: 0; margin: 0; }
.copy-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 6px; font-size: 0.72rem; padding: 3px 9px; cursor: pointer;
}
.copy-btn:hover { color: var(--text); background: var(--surface); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--text-muted); font-weight: 600; }

/* ---------- steps ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 24px 0; }
.steps > li {
  position: relative;
  padding: 4px 0 24px 44px;
  border-left: 2px solid var(--border);
  margin-left: 17px;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute; left: -18px; top: 0;
  width: 34px; height: 34px;
  background: var(--accent); color: var(--accent-contrast);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}
.steps h3 { margin: 0 0 8px; }

/* ---------- platform tabs ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  background: none; border: none; cursor: pointer;
  padding: 9px 14px; font-weight: 600; font-size: 0.88rem;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- breadcrumb / back link ---------- */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.9rem; font-weight: 600; margin-bottom: 18px; }
.back-link:hover { color: var(--text); text-decoration: none; }

/* ---------- example detail page ---------- */
.example-hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center;
}
@media (max-width: 860px) { .example-hero { grid-template-columns: 1fr; } }
.example-media {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  background: var(--surface-2); box-shadow: var(--shadow);
}
.example-media img, .example-media iframe { width: 100%; display: block; border: 0; aspect-ratio: 4/3; background: #000; }
.controls-list { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.controls-list li { display: flex; gap: 10px; align-items: baseline; font-size: 0.92rem; }
.controls-list kbd {
  background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 6px; padding: 2px 8px; font-size: 0.78rem; font-weight: 700; white-space: nowrap;
}

.play-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
  border-radius: 10px; padding: 12px 14px; font-size: 0.88rem; margin: 16px 0;
}

/* ---------- releases ---------- */
.release-card { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.release-card .release-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.release-card h3 { margin: 0; }
.release-card time { color: var(--text-muted); font-size: 0.85rem; }
.release-card .release-body { color: var(--text-muted); font-size: 0.92rem; margin-top: 10px; }
.release-card .release-body h1, .release-card .release-body h2, .release-card .release-body h3 { font-size: 1rem; margin: 14px 0 6px; }
.release-card .release-body ul { padding-left: 20px; }
.release-card .assets { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; height: 18px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.error-note { color: var(--danger); font-size: 0.9rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; margin-top: 40px; color: var(--text-muted); font-size: 0.88rem; }
.site-footer .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--text-muted); font-weight: 600; }
.site-footer a:hover { color: var(--text); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- API reference ---------- */
.api-tree h4 { margin: 0 0 10px; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.layout:has(.api-tree) { grid-template-columns: 280px minmax(0, 1fr); }
.layout:has(.api-tree) .article { max-width: none; overflow-wrap: anywhere; }
.layout:has(.api-tree) .toc-wrap { display: none; }

.api-tree details { margin-bottom: 2px; }
.api-tree summary {
  cursor: pointer;
  list-style: none;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}
.api-tree summary::-webkit-details-marker { display: none; }
.api-tree summary::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  color: var(--text-muted);
  transition: transform 0.12s ease;
}
.api-tree details[open] > summary::before { transform: rotate(90deg); }
.api-tree summary:hover { background: var(--surface-2); }
.api-tree summary a { color: var(--text); }
.api-tree summary a:hover { text-decoration: none; }
.api-tree ul { list-style: none; padding-left: 22px; margin: 2px 0 8px; }
.api-tree ul li a {
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.83rem;
  color: var(--text-muted);
}
.api-tree ul li a:hover, .api-tree ul li a.active { background: var(--surface-2); color: var(--text); text-decoration: none; }
.api-tree details details { margin-left: 4px; }

.api-title { margin-top: 8px; overflow-wrap: anywhere; }
.api-title .tag { vertical-align: middle; margin-left: 8px; }
.api-title code { font-size: 0.6em; }
.api-inherits { color: var(--text-muted); font-size: 0.92rem; }
.api-detailed { margin: 16px 0; }
.api-detailed p, .api-member-body p { margin: 0 0 10px; }
.api-detailed p:last-child, .api-member-body p:last-child { margin-bottom: 0; }

.api-diagram { margin: 20px 0; }
.api-diagram h4 { margin: 0 0 10px; font-size: 0.95rem; color: var(--text-muted); }
.api-diagram pre.mermaid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  text-align: center;
}

.api-section-title { margin-top: 32px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.api-member {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.api-member:target { border-color: var(--accent); }
.api-member-sig {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-family: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.84rem;
  background: var(--code-bg);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.api-member-sig code { background: none; border: none; padding: 0; font-size: 1em; }
.api-anchor-link { color: var(--text-muted); font-weight: 700; flex-shrink: 0; opacity: 0; transition: opacity 0.12s ease; }
.api-member-sig:hover .api-anchor-link, .api-anchor-link:focus { opacity: 1; }
.api-anchor-link:hover { color: var(--accent); }
.api-member-name { color: var(--accent); font-weight: 600; }
.api-member-body { padding: 12px 16px; font-size: 0.9rem; color: var(--text-muted); }
.api-member-body:empty { display: none; }
.api-member-note { font-size: 0.85rem; margin-top: 6px; }
.api-location-line { font-size: 0.8rem; color: var(--text-muted); margin-top: 8px; }
.api-location { font-family: ui-monospace, monospace; }
.api-kind-tag { font-size: 0.72rem; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.api-prot-protected { color: var(--warn); border-color: var(--warn); }
.api-prot-private { color: var(--danger); border-color: var(--danger); }

.api-callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 0.88rem;
  background: var(--surface-2);
}
.api-callout-label { font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; color: var(--accent); }
.api-callout-warning, .api-callout-attention { border-left-color: var(--warn); }
.api-callout-warning .api-callout-label, .api-callout-attention .api-callout-label { color: var(--warn); }
.api-callout-bug, .api-callout-todo { border-left-color: var(--danger); }
.api-callout-bug .api-callout-label, .api-callout-todo .api-callout-label { color: var(--danger); }
.api-callout-return, .api-callout-param { border-left-color: var(--accent-2); }
.api-callout-return .api-callout-label, .api-callout-param .api-callout-label { color: var(--accent-2); }
.api-param-table { width: 100%; margin: 4px 0 0; }
.api-param-table td { border: none; padding: 4px 8px 4px 0; vertical-align: top; font-size: 0.87rem; }
.api-param-table td:first-child { white-space: nowrap; width: 1%; }

.api-enum-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin-top: 8px; }
.api-enum-values.has-descriptions { display: flex; flex-direction: column; }
.api-enum-value { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; background: var(--surface-2); }
.api-enum-value code { background: none; border: none; padding: 0; color: var(--accent); font-weight: 600; }
.api-enum-value .api-member-body { padding: 4px 0 0; }
.api-enum-value .api-member-body:empty { display: none; }

@media (max-width: 860px) {
  .api-layout { flex-direction: column; }
  .api-sidebar {
    width: 100%;
    position: static;
    height: auto;
    max-height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .api-main { padding: 24px 20px 48px; }
}

/* ======================================================================
   Docs layout: sidebar | article | table of contents  (palette unchanged)
   ====================================================================== */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 230px;
  gap: 40px;
  align-items: start;
  padding-top: 32px;
  padding-bottom: 64px;
}
.layout.no-sidebar { grid-template-columns: minmax(0, 1fr) 210px; }

.sidebar, .toc-wrap {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  font-size: 0.9rem;
}
.side-group { margin-bottom: 22px; }
.side-group h4, .toc h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.side-group ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.side-group a {
  display: block;
  padding: 6px 12px;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
}
.side-group a:hover { color: var(--text); text-decoration: none; border-left-color: var(--text-muted); }
.side-group a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.toc li a {
  display: block;
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
}
.toc li.l3 a { padding-left: 26px; }
.toc li a:hover { color: var(--text); text-decoration: none; }
.toc li a.active { color: var(--accent); border-left-color: var(--accent); }

.article { min-width: 0; max-width: none; }
.article > h1:first-child { margin-top: 0; }
.article h2 { padding-top: 0.5rem; border-top: 1px solid var(--border); margin-top: 2.5rem; scroll-margin-top: calc(var(--header-h) + 16px); }
.article h3 { margin-top: 1.8rem; scroll-margin-top: calc(var(--header-h) + 16px); }
.article img { border: 1px solid var(--border); border-radius: var(--radius); margin: 16px 0; }
.article table { width: 100%; border-collapse: collapse; }
.article th, .article td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.article section { padding: 0; }

/* mobile drawer (hidden on desktop) */
.drawer { display: none; }

/* ---------- search ---------- */
.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.search-btn:hover { background: var(--surface-2); color: var(--text); }
.search-btn kbd {
  font-size: 0.7rem;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
}
.search-modal {
  width: min(640px, calc(100vw - 32px));
  margin: 12vh auto 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.search-modal::backdrop { background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(3px); }
.search-modal input {
  width: 100%;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  outline: none;
}
.search-results { max-height: 50vh; overflow-y: auto; padding: 8px; }
.search-results h5 { margin: 10px 8px 4px; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.search-results a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.search-results a small { display: block; color: var(--text-muted); }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--surface-2); text-decoration: none; }
.search-empty { padding: 18px; color: var(--text-muted); text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .layout.no-sidebar { grid-template-columns: minmax(0, 1fr); }
  .toc-wrap { display: none; }
}
@media (max-width: 960px) {
  .layout, .layout.no-sidebar, .layout:has(.api-tree) { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidebar { display: none; }
  .nav-links, .search-btn span, .search-btn kbd { display: none; }
  .nav-toggle { display: inline-flex; }
  .drawer {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    z-index: 40;
    overflow-y: auto;
    padding: 16px 20px 40px;
    background: var(--bg);
  }
  body.drawer-open .drawer { display: block; }
  body.drawer-open { overflow: hidden; }
  .drawer-sections { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
  .drawer-sections a { padding: 8px 12px; border-radius: 8px; background: var(--surface-2); color: var(--text); font-weight: 600; }
  .drawer-sections a[aria-current="page"] { background: var(--accent); color: var(--accent-contrast); }
  .drawer .side-group a { padding: 10px 12px; }
}

/* Legacy hero/section markup reused inside the docs article */
.article .container { max-width: none; padding: 0; }
.article .hero { padding: 0 0 8px; border: 0; background: none; }
.article section.alt { background: none; border: 0; }
.article .example-hero { grid-template-columns: minmax(0, 1fr); }
.article .example-media { margin-top: 16px; }

.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

/* releases: compact list rows (full notes open in their own view) */
.release-row { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.release-row-title { font-weight: 700; min-width: 9rem; }
.release-row time { margin-left: auto; color: var(--text-muted); font-size: 0.85rem; }
.release-row .assets { flex-basis: 100%; display: flex; gap: 8px; flex-wrap: wrap; }
