/* ==========================================================================
   OpenCode Blueprint — design system
   Single stylesheet for the whole docs site. Vanilla CSS, no frameworks.
   All colors and tokens live in the :root custom properties below.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   1. Design tokens
--------------------------------------------------------------------------- */
:root {
  /* Brand — aligned with canonnimu.net (bronze → gold) */
  --brand-1: #ba6b3c;            /* bronze */
  --brand-2: #c7a86b;            /* gold */
  --brand-gradient: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 100%);

  /* Surfaces (light) — paper tones of canonnimu.net */
  --bg: #faf8f5;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(250, 248, 245, 0.78);
  --bg-code: #16283c;
  --border: #e8e3d9;
  --border-strong: #d3ccc0;

  /* Text (light) */
  --text: #2b2a28;
  --text-secondary: #6b6a68;
  --text-muted: #9a9488;
  --text-invert: #faf8f5;

  /* Accents */
  --accent: #ba6b3c;
  --accent-soft: rgba(186, 107, 60, 0.1);
  --success: #4a7c59;
  --success-soft: rgba(74, 124, 89, 0.1);
  --warning: #b8860b;
  --warning-soft: rgba(184, 134, 11, 0.1);
  --danger: #b0433a;
  --danger-soft: rgba(176, 67, 58, 0.1);
  --info: #2c425c;
  --info-soft: rgba(44, 66, 92, 0.1);

  /* Typography */
  --font-sans: "Inter", ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;

  /* Layout */
  --sidebar-w: 288px;
  --header-h: 60px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(43, 42, 40, 0.06);
  --shadow-md: 0 8px 24px rgba(43, 42, 40, 0.09);
  --shadow-lg: 0 20px 48px rgba(43, 42, 40, 0.14);
  --glass-blur: 16px;

  --content-w: 800px;
}

[data-theme="dark"] {
  --bg: #0f1e2c;
  --bg-elevated: #16283c;
  --bg-glass: rgba(15, 30, 44, 0.82);
  --bg-code: #0c1824;
  --border: #2c425c;
  --border-strong: #3a5578;

  --text: #ece7dd;
  --text-secondary: #a8b0bc;
  --text-muted: #76849a;

  --accent: #d48c5b;
  --accent-soft: rgba(212, 140, 91, 0.14);
  --success: #8fbf9d;
  --success-soft: rgba(143, 191, 157, 0.12);
  --warning: #e3c166;
  --warning-soft: rgba(227, 193, 102, 0.12);
  --danger: #e08a80;
  --danger-soft: rgba(224, 138, 128, 0.12);
  --info: #9fb8d4;
  --info-soft: rgba(159, 184, 212, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.55);
}

/* ---------------------------------------------------------------------------
   2. Base
--------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.25s ease, color 0.25s ease;
}

html, body { overflow-x: clip; }

img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------------------
   3. Reading progress bar
--------------------------------------------------------------------------- */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--brand-gradient);
  z-index: 1000;
  border-radius: 0 2px 2px 0;
}

/* ---------------------------------------------------------------------------
   4. Header (glassmorphism)
--------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border);
  z-index: 900;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--brand-gradient);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
}
.brand .logo svg { width: 18px; height: 18px; }
.brand small { font-weight: 500; color: var(--text-muted); font-size: 12px; }

.header-spacer { flex: 1; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .sun-icon { display: none; }
[data-theme="dark"] .icon-btn .sun-icon { display: block; }
[data-theme="dark"] .icon-btn .moon-icon { display: none; }

/* Search */
.search-wrap { position: relative; width: min(320px, 38vw); }
.search-input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  transition: border 0.18s ease, box-shadow 0.18s ease;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-wrap .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-wrap .search-icon svg { width: 16px; height: 16px; }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 950;
}
.search-results.open { display: block; }
.search-result {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
}
.search-result:hover { background: var(--accent-soft); text-decoration: none; }
.search-result .sr-title { font-weight: 600; }
.search-result .sr-path {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.search-result em { color: var(--accent); font-style: normal; }
.search-empty { padding: 14px; color: var(--text-muted); font-size: 14px; }

/* Hamburger (mobile) */
.hamburger { display: none; }

/* ---------------------------------------------------------------------------
   5. Layout: sidebar + main
--------------------------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 0;
  max-width: 1480px;
  margin: 0 auto;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 24px 12px 48px 16px;
  border-right: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-link .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 18px;
}
.nav-link.active .num { color: var(--accent); }

/* Sub-sections of the current chapter (filled from the DOM) */
.nav-subs { margin: 2px 0 6px 18px; padding-left: 12px; border-left: 2px solid var(--border); }
.nav-sub {
  display: block;
  padding: 4px 8px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: 6px;
}
.nav-sub:hover { color: var(--text); text-decoration: none; }
.nav-sub.active { color: var(--accent); font-weight: 600; }

.main { min-width: 0; }

.content {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 48px 40px 96px;
}

/* ---------------------------------------------------------------------------
   6. Typography & content
--------------------------------------------------------------------------- */
.content h1, .content h2, .content h3, .content h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 16px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.content h1 {
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 12px;
}

.content h2 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  margin-top: 56px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.content h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 36px;
}

.content h4 {
  font-size: 1.08rem;
  font-weight: 700;
  margin-top: 28px;
}

.content p { margin: 0 0 18px; }
.content ul, .content ol { margin: 0 0 18px; padding-left: 24px; }
.content li { margin: 6px 0; }
.content li > ul, .content li > ol { margin: 6px 0; }

.content strong { font-weight: 650; }

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* Inline code */
.content code:not(.hljs):not(.language-markup) {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 6px;
}
[data-theme="dark"] .content code:not(.hljs):not(.language-markup) { color: var(--accent); }

kbd {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Chapter meta */
.chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
}
.badge--green { background: var(--success-soft); color: var(--success); }
.badge--amber { background: var(--warning-soft); color: var(--warning); }
.badge--red   { background: var(--danger-soft); color: var(--danger); }
.badge--cyan  { background: var(--info-soft); color: var(--info); }

/* ---------------------------------------------------------------------------
   7. Callouts
--------------------------------------------------------------------------- */
.callout {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--bg-elevated);
  margin: 0 0 20px;
  box-shadow: var(--shadow-sm);
}
.callout .callout-icon {
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1.4;
}
.callout .callout-body { min-width: 0; }
.callout .callout-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.callout p { margin: 0 0 6px; font-size: 15px; }
.callout p:last-child { margin-bottom: 0; }
.callout ul { margin: 4px 0 0; padding-left: 18px; }
.callout li { margin: 3px 0; font-size: 15px; }
.callout code { font-size: 0.86em; }

.callout--tip { border-left-color: var(--success); }
.callout--tip .callout-title { color: var(--success); }
.callout--warning { border-left-color: var(--warning); }
.callout--warning .callout-title { color: var(--warning); }
.callout--danger { border-left-color: var(--danger); }
.callout--danger .callout-title { color: var(--danger); }
.callout--info { border-left-color: var(--info); }
.callout--info .callout-title { color: var(--info); }

/* ---------------------------------------------------------------------------
   8. Code blocks & copy buttons
--------------------------------------------------------------------------- */
.codeblock { position: relative; margin: 0 0 22px; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }

.codeblock pre {
  margin: 0;
  padding: 18px 18px 18px 20px;
  overflow-x: auto;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.codeblock code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: #e2e8f0;
  background: transparent !important;
  padding: 0;
}

.codeblock .code-lang {
  position: absolute;
  top: 10px; right: 44px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  user-select: none;
}

.copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  cursor: pointer;
  opacity: 0;
  transition: all 0.18s ease;
}
.codeblock:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(148, 163, 184, 0.25); color: #fff; }
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn.copied { background: rgba(34, 197, 94, 0.25); color: #4ade80; border-color: rgba(34, 197, 94, 0.4); }

/* Highlight.js token colors tuned for the dark code surface */
.hljs-keyword, .hljs-selector-tag, .hljs-literal { color: #c792ea; }
.hljs-string, .hljs-regexp, .hljs-attr { color: #c3e88d; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #f78c6c; }
.hljs-title, .hljs-title.class_, .hljs-title.function_ { color: #82aaff; }
.hljs-comment, .hljs-quote { color: #546e7a; font-style: italic; }
.hljs-name, .hljs-tag { color: #89ddff; }
.hljs-variable, .hljs-template-variable, .hljs-params { color: #eeffff; }
.hljs-built_in, .hljs-type { color: #ffcb6b; }
.hljs-meta, .hljs-meta .hljs-keyword { color: #89ddff; }
.hljs-function { color: #82aaff; }
.hljs-attribute, .hljs-selector-class, .hljs-selector-id { color: #c3e88d; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
.hljs-section { color: #ffcb6b; }
.hljs-addition { color: #c3e88d; background: rgba(35, 134, 54, 0.12); }
.hljs-deletion { color: #ff5370; background: rgba(255, 83, 112, 0.12); }

/* Mermaid */
.mermaid-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 0 0 22px;
  overflow-x: auto;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.mermaid-block pre { text-align: left; font-size: 13px; }

/* ---------------------------------------------------------------------------
   9. Tables
--------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 0 22px; border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; background: var(--bg-elevated); font-size: 14.5px; }
.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--accent-soft); }
.table td code, .table th code { font-size: 0.88em; }

/* Comparison tables (with/without graphify) */
.table--compare td:first-child { font-weight: 650; white-space: nowrap; color: var(--accent); }
.table--compare .yes { color: var(--success); font-weight: 650; }
.table--compare .no { color: var(--danger); font-weight: 650; }

/* ---------------------------------------------------------------------------
   10. Cards, grids, steps, timeline
--------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 0 0 24px;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.card .card-icon {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand-gradient);
  color: #fff;
  font-size: 18px;
  margin-bottom: 14px;
}
.card h4 { margin: 0 0 8px; font-size: 15.5px; letter-spacing: -0.01em; }
.card p { margin: 0; font-size: 14px; color: var(--text-secondary); }

.steps { counter-reset: steps; list-style: none; padding-left: 0; margin: 0 0 24px; }
.steps > li {
  counter-increment: steps;
  position: relative;
  padding: 0 0 28px 52px;
  margin: 0;
}
.steps > li::before {
  content: counter(steps);
  position: absolute;
  left: 0; top: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}
.steps > li::after {
  content: "";
  position: absolute;
  left: 16px; top: 38px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(var(--border-strong), transparent);
}
.steps > li:last-child::after { display: none; }
.steps strong { display: block; margin-bottom: 4px; font-size: 15.5px; }
.steps p { margin: 0 0 8px; font-size: 15px; }
.steps pre, .steps .codeblock { margin-top: 10px; }

.timeline { list-style: none; margin: 0 0 24px; padding-left: 0; }
.timeline > li {
  position: relative;
  padding: 0 0 24px 28px;
  margin: 0;
}
.timeline > li::before {
  content: "";
  position: absolute;
  left: 4px; top: 8px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--brand-gradient);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.timeline > li::after {
  content: "";
  position: absolute;
  left: 9px; top: 26px;
  bottom: 2px;
  width: 2px;
  background: linear-gradient(var(--border-strong), transparent);
}
.timeline > li:last-child::after { display: none; }
.timeline strong { font-weight: 650; }
.timeline p { margin: 4px 0 0; font-size: 15px; color: var(--text-secondary); }

/* ---------------------------------------------------------------------------
   11. Hero (landing page)
--------------------------------------------------------------------------- */
.hero {
  position: relative;
  text-align: center;
  padding: 110px 24px 90px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 300px at 20% 10%, rgba(186, 107, 60, 0.16), transparent 60%),
    radial-gradient(600px 300px at 80% 20%, rgba(199, 168, 107, 0.15), transparent 60%),
    radial-gradient(500px 260px at 50% 100%, rgba(212, 140, 91, 0.1), transparent 60%);
  pointer-events: none;
}
.hero > * { position: relative; }

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 auto 20px;
  max-width: 900px;
}
.hero h1 .gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .subtitle {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 36px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-bottom: 44px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn--primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 8px 24px rgba(186, 107, 60, 0.35);
}
.btn--primary:hover { box-shadow: 0 12px 32px rgba(186, 107, 60, 0.45); }
.btn--ghost {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-terminal {
  max-width: 780px;
  margin: 0 auto;
  text-align: left;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  background: var(--bg-code);
}
.hero-terminal .term-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: rgba(148, 163, 184, 0.1);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.hero-terminal .term-bar span { width: 11px; height: 11px; border-radius: 50%; }
.hero-terminal .term-bar span:nth-child(1) { background: #ff5f57; }
.hero-terminal .term-bar span:nth-child(2) { background: #febc2e; }
.hero-terminal .term-bar span:nth-child(3) { background: #28c840; }
.hero-terminal .term-title { margin-left: 10px; font-family: var(--font-mono); font-size: 12px; color: #64748b; }
.hero-terminal pre {
  margin: 0;
  padding: 22px 24px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: #e2e8f0;
}
.hero-terminal .c1 { color: #89ddff; }
.hero-terminal .c2 { color: #c3e88d; }
.hero-terminal .c3 { color: #ffcb6b; }
.hero-terminal .c4 { color: #f78c6c; }
.hero-terminal .cm { color: #546e7a; }

/* Feature cards band */
.section-band { padding: 64px 24px; }
.section-band .band-title {
  text-align: center;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.section-band .band-sub { text-align: center; color: var(--text-secondary); max-width: 620px; margin: 0 auto 40px; }
.band-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; max-width: 1100px; margin: 0 auto; }

.feature-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.feature-card .fc-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 21px;
  margin-bottom: 16px;
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.feature-card h3 { margin: 0 0 8px; font-size: 17px; letter-spacing: -0.01em; }
.feature-card p { margin: 0; font-size: 14.5px; color: var(--text-secondary); }

/* Chapter cards */
.chapter-list { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.chapter-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: all 0.2s ease;
}
.chapter-card:hover {
  transform: translateX(4px);
  border-color: var(--accent);
  text-decoration: none;
  box-shadow: var(--shadow-md);
}
.chapter-card .cc-num {
  flex: 0 0 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 15px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
}
.chapter-card .cc-title { font-weight: 700; font-size: 16px; color: var(--text); }
.chapter-card .cc-desc { font-size: 13.5px; color: var(--text-secondary); margin-top: 2px; }
.chapter-card .cc-arrow { margin-left: auto; color: var(--text-muted); font-size: 18px; }

/* Stats band */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; max-width: 1000px; margin: 0 auto; }
.stat {
  text-align: center;
  padding: 26px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
}
.stat .stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 6px; font-weight: 600; }

/* ---------------------------------------------------------------------------
   12. Workflow diagram (pure CSS)
--------------------------------------------------------------------------- */
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 26px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}
.flow .step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
}
.flow .step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-1); }
.flow .step--done { background: var(--success-soft); border-color: transparent; color: var(--success); }
.flow .step--done .dot { background: var(--success); }
.flow .step--ai { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.flow .step--ai .dot { background: var(--accent); }
.flow .arrow { color: var(--text-muted); font-size: 17px; }

/* ---------------------------------------------------------------------------
   13. Buttons, chips, misc
--------------------------------------------------------------------------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.chip {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.back-to-top {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 0.25s ease;
  z-index: 800;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; transform: none; }
.back-to-top:hover { color: var(--accent); border-color: var(--accent); }
.back-to-top svg { width: 18px; height: 18px; }

.footer {
  text-align: center;
  padding: 32px 24px 48px;
  color: var(--text-muted);
  font-size: 13.5px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer a { color: var(--text-secondary); }

/* ---------------------------------------------------------------------------
   14. Sidebar overlay / mobile
--------------------------------------------------------------------------- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.5);
  backdrop-filter: blur(4px);
  z-index: 940;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

@media (max-width: 1024px) {
  .hamburger { display: grid; }
  .search-wrap { width: 44px; }
  .search-input { padding: 0; border: none; background: transparent; color: transparent; cursor: pointer; }
  .search-input::placeholder { color: transparent; }
  .search-input:focus { box-shadow: none; border-color: transparent; }
  .search-results { position: fixed; top: calc(var(--header-h) + 8px); left: 12px; right: 12px; width: auto; max-height: calc(100vh - var(--header-h) - 40px); }

  /* Tapping the search icon expands a full-width search panel below the header */
  .search-wrap.expanded {
    position: fixed;
    top: 8px; left: 12px; right: 12px;
    width: auto;
    z-index: 970;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-md);
  }
  .search-wrap.expanded .search-input {
    padding: 0 14px 0 38px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: text;
    font-size: 15px;
  }
  .search-wrap.expanded .search-input::placeholder { color: var(--text-muted); }
  .search-wrap.expanded .search-results {
    top: calc(100% + 8px);
    left: 0; right: 0;
    display: none;
    position: absolute;
    box-shadow: var(--shadow-lg);
  }
  .search-wrap.expanded .search-results.open { display: block; }

  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: min(86vw, 360px);
    max-width: 100%;
    height: calc(100vh - var(--header-h));
    z-index: 950;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    border-right: 1px solid var(--border);
    border-bottom: none;
    background: var(--bg-elevated);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

  .sidebar .nav-link { padding: 12px 12px; font-size: 15px; }
  .sidebar .nav-sub { padding: 8px 8px; font-size: 14px; }

  .content { padding: 36px 24px 72px; }
  .hero { padding: 90px 18px 70px; }
  .brand small { display: none; }
}

@media (max-width: 560px) {
  .content { padding: 24px max(16px, env(safe-area-inset-left)) 64px; }
  .content p { font-size: 16.5px; line-height: 1.78; }
  .content li { font-size: 16px; line-height: 1.7; }
  .content code:not(.hljs):not(.language-markup) { word-break: break-word; }
  .content h2 { margin-top: 40px; }
  .content h3 { margin-top: 30px; }

  .site-header { gap: 10px; padding: 0 12px; }
  .icon-btn { width: 40px; height: 40px; }

  .table td, .table th { padding: 10px 12px; }
  .table { font-size: 14px; }

  .callout { padding: 14px 14px; gap: 10px; }
  .callout .callout-icon { font-size: 16px; }

  .codeblock pre { padding: 14px 14px 14px 16px; font-size: 12.5px; }
  .codeblock code { font-size: 12.5px; }
  .code-lang { display: none; }
  .copy-btn { opacity: 1; width: 34px; height: 34px; }

  .steps > li { padding: 0 0 24px 46px; }
  .steps > li::before { width: 32px; height: 32px; font-size: 14px; }
  .steps > li::after { left: 15px; }

  .card { padding: 18px; }
  .feature-card { padding: 22px; }
  .card-grid { grid-template-columns: 1fr; }

  .chapter-card { padding: 14px 16px; gap: 14px; flex-wrap: wrap; }
  .chapter-card .cc-num { flex-basis: 38px; height: 38px; font-size: 13px; }
  .chapter-card .cc-arrow { display: none; }

  .flow { flex-direction: column; align-items: stretch; padding: 18px; }
  .flow .arrow { transform: rotate(90deg); text-align: center; }
  .flow .step { white-space: normal; text-align: center; justify-content: center; padding: 12px 14px; font-size: 14px; }

  .hero { padding: 72px 16px 56px; }
  .hero .subtitle { font-size: 1rem; }
  .hero-terminal pre { padding: 16px 16px; font-size: 12px; }

  .section-band { padding: 48px 16px; }
  .mermaid-block { padding: 16px; }

  .back-to-top { bottom: 16px; right: 16px; width: 46px; height: 46px; }
  .footer { padding: 24px 16px 40px; }
}

@media (max-width: 420px) {
  .brand > span:not(.logo) { display: none; }
  .site-header { padding: 0 10px; }
  .content { padding-left: 16px; padding-right: 16px; }
  .hero h1 { font-size: 2rem; }
  .steps > li { padding-left: 42px; }
}

/* ---------------------------------------------------------------------------
   15. Print styles (print.html + any page)
--------------------------------------------------------------------------- */
@media print {
  :root { --bg: #ffffff; --text: #111827; --text-secondary: #374151; --border: #e5e7eb; --bg-code: #f3f4f6; }

  .progress-bar, .site-header, .sidebar, .back-to-top, .copy-btn, .code-lang,
  .search-wrap, .footer nav { display: none !important; }

  .layout { display: block; }
  .content { max-width: none; padding: 0; }
  .codeblock pre { border: 1px solid #d1d5db; page-break-inside: avoid; }
  .codeblock code { color: #1f2937; }
  .callout, .card, .table-wrap, .mermaid-block, .hero-terminal, .flow { page-break-inside: avoid; }
  h1, h2, h3 { page-break-after: avoid; }
  a { color: inherit; text-decoration: none; }
  .chapter-break { page-break-before: always; }
}
