/*
 * Docs page styles. Neutral surfaces, one green accent, light/dark from the system setting.
 * This page does not load shell.css: it has its own header so the other pages keep their look.
 */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-subtle: #f6f7f8;
  --bg-code: #f4f5f6;
  --border: #e3e5e8;
  --border-strong: #cfd3d8;
  --text: #1b1f24;
  --text-muted: #57606a;
  --accent: #157a43;
  --accent-text: #ffffff;
  --accent-subtle: #e9f5ee;
  --warn: #8a5300;
  --warn-subtle: #fdf3e1;
  --focus: #157a43;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --header-h: 56px;
  --measure: 72ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --bg-subtle: #151820;
    --bg-code: #151820;
    --border: #262a33;
    --border-strong: #353a45;
    --text: #e6e8eb;
    --text-muted: #9aa3ad;
    --accent: #4cc38a;
    --accent-text: #08130d;
    --accent-subtle: #132a1e;
    --warn: #e6b450;
    --warn-subtle: #2a2212;
    --focus: #4cc38a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--text); background: var(--bg); font: 16px/1.65 var(--sans); }
img { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code, pre { font-family: var(--mono); }

/* Language switching. Without JS (no .js class) both languages stay visible, separated by " / ". */
html.js[data-ui-lang="en"] body [lang="vi"],
html.js[data-ui-lang="vi"] body [lang="en"] { display: none !important; }
html:not(.js) span[lang="en"] + span[lang="vi"]::before { content: " / "; }
html.js .no-js-hint { display: none; }
html:not(.js) .search, html:not(.js) .lang-switch { display: none; }

.skip-link { position: absolute; top: -48px; left: 12px; z-index: 100; padding: 8px 12px; color: var(--accent-text); background: var(--accent); border-radius: 6px; }
.skip-link:focus { top: 8px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--border); }
.site-header-inner { display: flex; align-items: center; gap: 16px; max-width: 1440px; height: var(--header-h); margin: 0 auto; padding: 0 24px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 6px; }
.brand-section { color: var(--text-muted); font-weight: 500; }
.brand-section::before { margin-right: 8px; color: var(--border-strong); content: "/"; }
.version-tag { padding: 1px 8px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; font: 500 0.75rem/1.6 var(--mono); }
.site-nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.site-nav a { padding: 6px 10px; color: var(--text-muted); border-radius: 6px; font-size: 0.9rem; text-decoration: none; white-space: nowrap; }
.site-nav a:hover { color: var(--text); background: var(--bg-subtle); }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.lang-switch { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 8px; }
.lang-switch button { min-width: 36px; padding: 4px 8px; color: var(--text-muted); background: none; border: 0; border-radius: 6px; font: 600 0.8rem var(--sans); cursor: pointer; }
.lang-switch button[aria-pressed="true"] { color: var(--accent-text); background: var(--accent); }

/* Three-column layout: sections, content, on-this-page. */
.layout { display: grid; grid-template-columns: 240px minmax(0, var(--measure)) 220px; gap: 48px; justify-content: center; max-width: 1440px; margin: 0 auto; padding: 0 24px; }
.sidebar, .toc { position: sticky; top: var(--header-h); align-self: start; max-height: calc(100vh - var(--header-h)); padding: 24px 0; overflow-y: auto; }
.search label { display: block; margin-bottom: 6px; font-size: 0.8rem; font-weight: 600; }
.search input { width: 100%; padding: 7px 10px; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 6px; font: inherit; font-size: 0.9rem; }
.search-status { min-height: 1.3em; margin: 6px 0 8px; color: var(--text-muted); font-size: 0.8rem; }
.no-js-hint { margin: 0 0 12px; color: var(--text-muted); font-size: 0.8rem; }
.sidebar-nav summary { margin-bottom: 4px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
@media (min-width: 900px) { .sidebar-nav summary { display: none; } }
.nav-group { margin: 18px 0 4px; color: var(--text); font-size: 0.8rem; font-weight: 650; }
.sidebar ul, .toc ul { margin: 0; padding: 0; list-style: none; }
.sidebar li a { display: block; padding: 4px 10px; color: var(--text-muted); border-left: 1px solid var(--border); font-size: 0.9rem; text-decoration: none; }
.sidebar li a:hover { color: var(--text); border-left-color: var(--border-strong); }
.sidebar li a.is-active { color: var(--accent); border-left: 2px solid var(--accent); padding-left: 9px; font-weight: 600; }
.toc-title { margin: 0 0 8px; font-size: 0.8rem; font-weight: 650; }
.toc a { display: block; padding: 3px 0; color: var(--text-muted); font-size: 0.85rem; line-height: 1.4; text-decoration: none; }
.toc a:hover { color: var(--text); }
.toc ul ul { margin: 2px 0 6px; padding-left: 12px; border-left: 1px solid var(--border); }
.toc ul ul a { font-size: 0.8rem; }
html.js .toc-list > li:not(.is-current) > ul { display: none; }
.toc-list > li.is-current > a { color: var(--text); font-weight: 600; }

/* Content typography */
.content { min-width: 0; padding: 32px 0 96px; }
.doc-section { padding-top: 8px; }
.doc-section + .doc-section { margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--border); }
.doc-section[hidden] { display: none; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 0.85rem; font-weight: 600; }
h1, h2, h3 { color: var(--text); line-height: 1.25; letter-spacing: -0.01em; }
h1 { margin: 0 0 12px; font-size: 2.1rem; font-weight: 700; }
h2 { margin: 0 0 12px; font-size: 1.6rem; font-weight: 700; }
h3 { margin: 32px 0 8px; font-size: 1.15rem; font-weight: 650; }
p, li { margin: 0 0 14px; }
ul, ol { margin: 0 0 16px; padding-left: 1.4rem; }
li { margin-bottom: 6px; }
.lede { color: var(--text-muted); font-size: 1.1rem; }
:not(pre) > code { padding: 0.1em 0.35em; background: var(--bg-code); border: 1px solid var(--border); border-radius: 4px; font-size: 0.86em; overflow-wrap: anywhere; }

.table-wrap { margin: 0 0 20px; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); background: var(--bg-subtle); font-size: 0.8rem; font-weight: 600; }
tr:last-child td { border-bottom: 0; }

.code-block, .docs-code { position: relative; margin: 0 0 20px; }
.code-block pre, .docs-code pre, .showcase-pre { margin: 0; padding: 14px 16px; overflow-x: auto; background: var(--bg-code); border: 1px solid var(--border); border-radius: 8px; font-size: 0.84rem; line-height: 1.6; tab-size: 2; }
.copy-button { position: absolute; top: 8px; right: 8px; padding: 2px 10px; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; font: 500 0.75rem var(--sans); cursor: pointer; opacity: 0; transition: opacity 120ms; }
.code-block:hover .copy-button, .docs-code:hover .copy-button, .copy-button:focus-visible { opacity: 1; }
@media (hover: none) { .copy-button { opacity: 1; } }

.prompt { margin: 0 0 16px; padding: 10px 16px; color: var(--text); background: var(--bg-subtle); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; }
.prompt p { margin: 0; }
.tools { color: var(--text-muted); font-size: 0.9rem; }
.tools > span:first-child, .tools > span:nth-child(2) { margin-right: 4px; font-weight: 600; }

/* Showcases: output produced by running the tools. */
.showcase { margin: 32px 0 0; padding: 20px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px; }
.showcase-head h3 { margin: 0 0 6px; font-size: 1.05rem; }
.showcase-meta { margin: 0 0 12px; color: var(--text-muted); font-size: 0.82rem; }
.showcase-badge { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 650; }
.showcase-badge-real { color: var(--accent); background: var(--accent-subtle); border: 1px solid var(--accent); }
.showcase-badge-simulation { color: var(--warn); background: var(--warn-subtle); border: 1px solid var(--warn); }
.showcase-note { font-size: 0.92rem; }
.showcase-step { margin: 18px 0 6px; font-size: 0.9rem; font-weight: 600; }
.showcase .docs-code { margin-bottom: 8px; }
.showcase .docs-code pre { max-height: 14rem; overflow: auto; background: var(--bg); }
.sidebar li, .toc li { margin: 0; }
.showcase-output { margin: 0 0 8px; }
.showcase-output summary { margin-bottom: 6px; color: var(--text-muted); font-size: 0.8rem; cursor: pointer; }
.showcase-pre { max-height: 22rem; overflow: auto; background: var(--bg); }
.showcase-figure { margin: 16px 0 8px; }
.showcase-figure img { display: block; width: auto; max-height: 24rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; image-rendering: pixelated; }
.showcase-figure figcaption { margin-top: 6px; color: var(--text-muted); font-size: 0.82rem; }
.showcase-repro { margin: 12px 0 0; color: var(--text-muted); font-size: 0.82rem; }
.showcase-repro > span { margin-right: 4px; font-weight: 600; }

.search-empty { color: var(--text-muted); }
.site-footer { padding: 24px; color: var(--text-muted); border-top: 1px solid var(--border); font-size: 0.85rem; text-align: center; }
.site-footer p { margin: 0; }

@media (max-width: 1200px) {
  .layout { grid-template-columns: 220px minmax(0, var(--measure)); gap: 40px; }
  .toc { display: none; }
}

@media (max-width: 900px) {
  .site-header { position: static; }
  .site-header-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px 12px; }
  .site-nav { order: 3; width: 100%; margin-left: 0; }
  .lang-switch { margin-left: auto; }
  .layout { display: block; padding: 0 16px; }
  .sidebar { position: static; max-height: none; padding: 16px 0 0; border-bottom: 1px solid var(--border); }
  .sidebar-nav { padding-bottom: 12px; }
  .content { padding-top: 24px; }
  html { scroll-padding-top: 12px; }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.4rem; }
  .showcase { padding: 14px; }
}

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
