/* ============================================================
   Rak docs — design system: opencode.ai (manpage aesthetic)
   Monospaced everywhere · cream canvas · ink · hairline rules
   No shadows, no gradients, no decorative imagery.
   ============================================================ */

:root {
  /* color */
  --ink: #201d1d;
  --ink-deep: #0f0000;
  --charcoal: #302c2c;
  --body: #424245;
  --mute: #646262;
  --stone: #6e6e73;
  --ash: #9a9898;
  --canvas: #fdfcfc;
  --surface-soft: #f8f7f7;
  --surface-card: #f1eeee;
  --surface-dark: #201d1d;
  --surface-dark-elevated: #302c2c;
  --hairline: rgba(15, 0, 0, 0.12);
  --hairline-strong: #646262;
  --on-dark: #fdfcfc;
  --on-dark-mute: #9a9898;
  /* semantic — reserved for the dark TUI surfaces only */
  --accent: #007aff;
  --accent-deep: #0056b3;
  --warning: #ff9f0a;
  --danger: #ff3b30;
  --success: #30d158;

  /* shape */
  --radius: 4px;
  --radius-lg: 8px;

  /* type */
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo,
    Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* layout */
  --content-w: 960px;
  --content-w-wide: 1100px;
  --section-gap: 96px;
  --spring-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* rule used on the inverted TUI surface */
  --tui-rule: rgba(253, 252, 252, 0.14);
}

/* Dark theme — the manpage inverts like an editor at night. */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

html[data-theme="dark"] {
  --ink: #f2f1ed;
  --ink-deep: #ffffff;
  --charcoal: #c9c7c2;
  --body: #b8b6b1;
  --mute: #8f8d88;
  --stone: #7a7873;
  --ash: #6e6e70;
  --canvas: #141312;
  --surface-soft: #1c1b1a;
  --surface-card: #252422;
  --surface-dark: #f2f1ed;
  --surface-dark-elevated: #d8d6d1;
  --hairline: rgba(250, 249, 245, 0.13);
  --hairline-strong: #7c7a75;
  --on-dark: #141312;
  --on-dark-mute: #6e6e70;
  --tui-rule: rgba(20, 19, 18, 0.18);
}

/* Gentle surface cross-fade when switching themes. */
*, *::before, *::after {
  transition-property: background-color, border-color, color;
  transition-duration: 0.18s;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  font: 400 16px/1.5 var(--font-mono);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--ink); color: var(--canvas); }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ash); border-radius: 0; border: 2px solid var(--canvas); }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--hairline-strong); text-underline-offset: 3px; transition: color 0.15s var(--spring-out), text-decoration-color 0.15s var(--spring-out); }
a:hover { color: var(--charcoal); text-decoration-color: var(--ink); }

.container { max-width: var(--content-w); margin-inline: auto; padding-inline: 1.5rem; }

/* ───────────── Header ───────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 56px;
}

.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; letter-spacing: 0; }
.brand:hover { color: var(--ink); }

.brand-mark {
  width: 24px;
  height: 24px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--canvas);
}

.brand-name { font-weight: 700; font-size: 1rem; }
.brand-ver { color: var(--mute); font-size: 0.78rem; }

.site-nav { display: flex; align-items: center; gap: 0.15rem; }
.site-nav a {
  color: var(--mute);
  font-size: 0.88rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); background: var(--surface-soft); text-decoration: none; }
.site-nav a.active { color: var(--ink); background: var(--surface-soft); }

.header-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ───────────── Buttons ───────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2px 20px;
  height: 36px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  line-height: 2;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s var(--spring-out), border-color 0.15s var(--spring-out), color 0.15s var(--spring-out);
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--ink); color: var(--on-dark); }
.btn-primary:hover { background: var(--charcoal); color: var(--on-dark); }
.btn-primary:active { background: var(--ink-deep); }

.btn-ghost { background: var(--canvas); border-color: var(--hairline-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-soft); color: var(--ink); border-color: var(--ink); }

.btn-sm { padding: 0 14px; height: 30px; font-size: 14px; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}
.text-link:hover { color: var(--charcoal); text-decoration: none; }
.text-link svg { transition: transform 0.2s var(--spring-out); }
.text-link:hover svg { transform: translateX(3px); }

/* ───────────── Badges / chips ───────────── */

.badge, .new-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.5rem;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--on-dark);
  background: var(--surface-dark);
  border-radius: var(--radius);
  text-transform: none;
}
.badge.spec { color: var(--on-dark); background: var(--surface-dark-elevated); }
.badge.vm { color: var(--ink); background: var(--surface-card); border: 1px solid var(--hairline); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--mute);
  border: 1px solid var(--hairline);
  background: var(--surface-soft);
}
.chip b { color: var(--ink); font-weight: 500; }

.mono-tag {
  display: inline-block;
  font-size: 0.85em;
  color: var(--ink);
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  padding: 0.05em 0.4em;
  border-radius: var(--radius);
  white-space: nowrap;
}

.tick { color: var(--ink); font-weight: 700; }
.cross { color: var(--ash); }

/* ───────────── Landing hero ───────────── */

.hero {
  padding: clamp(3.5rem, 9vw, 6rem) 0 clamp(2rem, 5vw, 3rem);
}

.hero-inner {
  max-width: 720px;
  margin-inline: auto;
  text-align: center;
}

.hero-title {
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 2.7rem);
  line-height: 1.2;
  letter-spacing: 0;
  margin: 1.2rem 0 0;
  color: var(--ink);
}

.hero-title .grad { color: var(--ink); }

.lead {
  margin: 1.4rem auto 0;
  max-width: 56ch;
  font-size: 16px;
  line-height: 1.6;
  color: var(--body);
}

.cta-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 2rem;
}

/* Dark TUI mockup — the single dark surface on the landing page. */
.hero-tui {
  margin: 3rem auto 0;
  max-width: 760px;
  background: var(--surface-dark);
  color: var(--on-dark);
  border-radius: var(--radius-lg);
  text-align: left;
  overflow: hidden;
}

.tui-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.1rem;
  border-bottom: 1px solid var(--tui-rule);
  font-size: 13px;
  color: var(--on-dark-mute);
}

.tui-tabs { display: flex; gap: 0.9rem; }
.tui-tab { color: var(--on-dark-mute); padding: 2px 4px; }
.tui-tab.active { color: var(--on-dark); border-bottom: 2px solid var(--on-dark); }

.tui-status { color: var(--on-dark-mute); }

.tui-wordmark {
  padding: 3rem 1.5rem 1.5rem;
  text-align: center;
  color: var(--on-dark);
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  line-height: 1.05;
  overflow: hidden;
}
.tui-wordmark pre {
  margin: 0;
  display: inline-block;
  text-align: left;
  font-weight: 400;
}

.tui-body { padding: 0 1.5rem 2.2rem; }
.tui-body pre { margin: 0; overflow-x: auto; }
.tui-body code { font-size: 14px; line-height: 1.6; color: var(--on-dark); }

.tui-prompt-row {
  margin-top: 1.4rem;
  background: var(--surface-dark-elevated);
  color: var(--on-dark);
  padding: 9px 14px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
  white-space: nowrap;
}

.tui-caret { color: var(--accent); animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.tui-keyhints {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--tui-rule);
  font-size: 13px;
  color: var(--on-dark-mute);
}

.tui-keyhints b { color: var(--on-dark); font-weight: 400; }

/* Syntax highlights inside the dark mockup only (semantic stand-ins). */
.hero-tui .tok-keyword { color: var(--accent); font-weight: 400; }
.hero-tui .tok-string { color: var(--warning); }
.hero-tui .tok-number { color: var(--success); }
.hero-tui .tok-comment { color: var(--on-dark-mute); font-style: italic; }
.hero-tui .tok-builtin { color: var(--on-dark); }
.hero-tui .tok-type { color: var(--success); }
.hero-tui .tok-regex { color: var(--warning); }
.hero-tui .tok-char { color: var(--warning); }
.hero-tui .tok-op { color: var(--on-dark-mute); }

/* ───────────── Sections (landing) ───────────── */

.section { padding: var(--section-gap) 0; }

.section-head { max-width: 720px; margin-bottom: 2.2rem; }

.kicker {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 0.8rem;
}

.section-title {
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--ink);
}

.section-sub { margin-top: 0.8rem; color: var(--body); font-size: 16px; line-height: 1.6; }

/* Hairline-bordered text blocks — the only card surface. */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
}

.card {
  background: var(--surface-soft);
  padding: 1.4rem 1.5rem;
  border-radius: 0;
}

.grid-2 .card { background: var(--canvas); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.card-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--ash); }
.card-dot.green { background: var(--success); }
.card-dot.cyan { background: var(--accent); }
.card-dot.amber { background: var(--warning); }

.status-list { list-style: none; }

.status-list li {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 0.55rem 0;
  font-size: 15px;
  color: var(--body);
  border-bottom: 1px solid var(--hairline);
}

.status-list li:last-child { border-bottom: 0; }

.status-list .icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  color: var(--stone);
}

.status-list li.wip .icon { color: var(--ash); }

.status-list .label { color: var(--ink); font-weight: 500; }

.status-pct {
  margin-top: 1.2rem;
  font-size: 13px;
  color: var(--mute);
  letter-spacing: 0.04em;
}

.progress {
  height: 3px;
  border-radius: 0;
  background: var(--hairline);
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--ink);
  width: 0;
  transition: width 1.2s var(--spring-out);
}

.notice {
  margin-top: 3rem;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: 0;
}

.notice h3 { color: var(--ink); }
.notice p { color: var(--body); font-size: 15px; margin-top: 0.8rem; max-width: 60ch; }
.notice .btn-row { margin-top: 1.4rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* Feature grid rows with ASCII bullets */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
}

.feature {
  background: var(--canvas);
  padding: 1.5rem 1.6rem;
  border-radius: 0;
  transition: background 0.15s var(--spring-out);
}
.feature:hover { background: var(--surface-soft); }

.feature-ico {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  margin-bottom: 0.8rem;
  color: var(--ink);
  font-family: var(--font-mono);
}
.feature-ico svg { display: none; }

.feature h4 { font-size: 1rem; color: var(--ink); margin-bottom: 0.4rem; font-weight: 700; }
.feature p { font-size: 14px; color: var(--body); line-height: 1.6; }

.feature-grid.narrow { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ───────────── Callouts ───────────── */

.callout {
  margin: 1.4rem 0;
  padding: 1rem 1.2rem;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.callout.tip { border-left-color: var(--hairline-strong); background: var(--surface-soft); }
.callout.warn { border-left-color: var(--hairline-strong); background: var(--surface-soft); }
.callout-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 0.4rem;
  text-transform: none;
  letter-spacing: 0.02em;
}
.callout p { color: var(--body); font-size: 15px; line-height: 1.6; margin: 0; }
.callout p + p { margin-top: 0.5rem; }
.callout code { color: var(--ink); background: var(--surface-card); padding: 0.04rem 0.3rem; border-radius: var(--radius); font-size: 0.9em; }

.highlight-box {
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
}
.highlight-box p { color: var(--ink); margin: 0; font-size: 15px; }

/* ───────────── Code blocks ───────────── */

.codeblock {
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  margin-top: 1.4rem;
  text-align: left;
}

.codeblock-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
}

.codeblock-bar .bar-dot { display: none; }

.codeblock-bar .bar-title {
  font-size: 13px;
  color: var(--mute);
  letter-spacing: 0.02em;
}

.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  padding: 1px 10px;
  height: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--mute);
  font-size: 13px;
  font-family: var(--font-mono);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.2s var(--spring-out), transform 0.2s var(--spring-out), color 0.15s, border-color 0.15s;
}
.codeblock:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; transform: none; }
.copy-btn:active { transform: scale(0.95); }
.copy-btn.copied { color: var(--ink); border-color: var(--ink); }

.codeblock pre {
  margin: 0;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  line-height: 1.6;
}

.codeblock code {
  font-size: 14px;
  color: var(--ink);
}

/* Monochrome syntax tokens on light surfaces */
.tok-comment { color: var(--mute); font-style: italic; }
.tok-string { color: var(--charcoal); }
.tok-number { color: var(--ink); }
.tok-keyword { color: var(--ink); font-weight: 700; }
.tok-builtin { color: var(--ink); }
.tok-type { color: var(--ink); }
.tok-regex { color: var(--stone); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.tok-char { color: var(--charcoal); }
.tok-op { color: var(--body); }

/* ───────────── Docs layout ───────────── */

.docs-body { padding: clamp(2rem, 5vw, 3.5rem) 0 0; }

.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  max-width: var(--content-w-wide);
}

.docs-toc {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.docs-toc a {
  color: var(--mute);
  font-size: 14px;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  width: fit-content;
}
.docs-toc a:hover { color: var(--ink); background: var(--surface-soft); text-decoration: none; }
.docs-toc a.active { color: var(--ink); background: var(--surface-card); }

.toc-group {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ash);
  padding: 1rem 0.6rem 0.2rem;
}

.toc-meta {
  margin: 1rem 0.6rem 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-size: 13px;
  color: var(--mute);
  line-height: 1.6;
}
.toc-meta b { color: var(--ink); font-weight: 500; }

.docs-content { min-width: 0; }

/* Doc typography */
.doc h1 {
  font-weight: 700;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: 0;
  margin: 0.4rem 0 1rem;
}

.doc .doc-intro {
  color: var(--body);
  font-size: 16px;
  line-height: 1.65;
  max-width: 62ch;
  margin-bottom: 2.2rem;
}

.doc h2 {
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.25;
  letter-spacing: 0;
  margin: 2.6rem 0 1rem;
  scroll-margin-top: 76px;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--hairline);
}

.doc h2:first-child { margin-top: 0; }

.doc h3 {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0;
  margin: 2rem 0 0.8rem;
  color: var(--ink);
}

.doc p {
  color: var(--body);
  line-height: 1.7;
  margin-bottom: 1rem;
  max-width: 68ch;
}

.doc a:not(.bt) { text-decoration: underline; text-decoration-color: var(--hairline-strong); text-underline-offset: 3px; }
.doc a:hover { color: var(--charcoal); text-decoration-color: var(--ink); }

.doc :not(pre) > code {
  font-size: 0.85em;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  padding: 0.12em 0.4em;
  border-radius: var(--radius);
  color: var(--ink);
  white-space: nowrap;
}

.doc td code, .doc th code {
  background: var(--canvas);
  border: 0;
  padding: 0;
  color: var(--ink);
}

.kbd {
  font-size: 13px;
  padding: 0.04rem 0.4rem;
  border: 1px solid var(--hairline);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
}

/* Tables */
.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4rem 0 1.8rem;
  font-size: 14px;
  border: 1px solid var(--hairline);
}

.doc thead th {
  text-align: left;
  padding: 0.65rem 1rem;
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--hairline);
}

.doc tbody td {
  padding: 0.65rem 1rem;
  color: var(--body);
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

.doc tbody tr:last-child td { border-bottom: 0; }
.doc tbody tr:hover td { background: var(--surface-soft); }

.doc td:first-child { color: var(--ink); font-size: 13px; white-space: nowrap; }

/* Doc hero split */
.doc-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  margin-bottom: 2.2rem;
}
.doc-hero .dh-copy h1 { margin: 0 0 1rem; }
.doc-hero-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.4rem; }

/* Part cards (feature family groups) */
.part-card {
  margin: 2rem 0 2.6rem;
  border: 1px solid var(--hairline);
  border-radius: 0;
  scroll-margin-top: 76px;
}
.part-card:first-of-type { margin-top: 1.4rem; }

.part-card-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-soft);
}
.part-card-header .kicker { margin: 0; font-size: 12px; }
.part-card-header h2 { margin: 0; font-size: 1.1rem; padding-bottom: 0; border-bottom: 0; }
.part-card-body { padding: 0.2rem clamp(1.1rem, 3vw, 2rem) 0.8rem; }

/* Feature spotlight rows */
.feature-cards { display: grid; gap: 1.4rem; margin: 1.6rem 0; }
.feature-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 1rem;
  padding: 1.1rem 0;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
}
.feature-card:last-child { border-bottom: 0; }
.feature-card .fc-ico {
  width: 44px; height: 44px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface-soft);
  display: grid; place-items: center;
  color: var(--charcoal);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.feature-card h4 { font-size: 1rem; color: var(--ink); margin-bottom: 0.35rem; letter-spacing: 0; }
.feature-card p { font-size: 14px; color: var(--body); line-height: 1.65; margin: 0; max-width: 62ch; }

/* ───────────── Footer ───────────── */

footer {
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--hairline);
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-inner p { color: var(--mute); font-size: 13px; }
.footer-inner a { color: var(--mute); font-size: 13px; text-decoration: none; }
.footer-inner a:hover { color: var(--ink); }

/* ───────────── Reveal ───────────── */

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s var(--spring-out), transform 0.6s var(--spring-out);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--canvas); }
}

/* ───────────── Responsive ───────────── */

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; max-width: var(--content-w); }
  .docs-toc {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
    max-height: none;
    padding: 0 0 0.5rem;
  }
  .section { padding: 64px 0; }
}

@media (max-width: 768px) {
  .site-nav { display: none; }
  .hero-tui { border-radius: var(--radius); }
}

@media (max-width: 640px) {
  .container { padding-inline: 1.1rem; }
  .brand-ver { display: none; }
  .doc-hero { grid-template-columns: 1fr; }
  .section { padding: 48px 0; }
  .codeblock code { font-size: 13px; }
  .copy-btn { opacity: 1; transform: none; }
  .feature-card { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}
/* ============================================================
   Markdown-driven docs viewer (docs.html)
   The page content is rendered from content/*.md at runtime.
   ============================================================ */

.toc-filter { margin: 0.4rem 0 0.4rem; }
.toc-filter input {
  width: 100%;
  font: 400 13px var(--font-mono);
  padding: 0.35rem 0.6rem;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  outline: none;
}
.toc-filter input:focus { border-color: var(--ink); }
.toc-filter input::placeholder { color: var(--ash); }

.toc-page { border-top: 1px solid var(--hairline); margin-top: 0.6rem; padding-top: 0.2rem; }
.toc-page .toc-group { padding-top: 0.8rem; }

.md-loading {
  color: var(--mute);
  font-size: 15px;
  padding: 3rem 0;
}

.md-error { margin: 3rem 0; }
.md-error h2 { color: var(--ink); }
.md-error code {
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  padding: 0.12em 0.4em;
  border-radius: var(--radius);
  font: inherit;
  font-family: var(--font-mono);
}
.md-error .codeblock { margin: 1.4rem 0; }

/* Cross-heading spacing in rendered pages */
.doc-section h1 {
  margin: 0 0 1.2rem;
}
.doc :not(pre) > code.md-code { white-space: normal; }

/* Blockquotes */
.doc blockquote {
  margin: 1.4rem 0;
  padding: 0.7rem 1.2rem;
  border-left: 3px solid var(--hairline-strong);
  color: var(--body);
  background: var(--surface-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.doc blockquote p { margin-bottom: 0.5rem; }
.doc blockquote p:last-child { margin-bottom: 0; }

/* Lists */
.doc ul, .doc ol { margin: 0 0 1.2rem; padding-left: 1.5rem; color: var(--body); line-height: 1.7; }
.doc li { margin: 0.25rem 0; }
.doc li > ul, .doc li > ol { margin-top: 0.25rem; margin-bottom: 0.25rem; }

/* Horizontal rule */
.doc hr { border: 0; border-top: 1px solid var(--hairline); margin: 2.4rem 0; }

/* Prev / next pager */
.md-pager-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 3rem 0 0;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hairline);
}
.md-pager {
  color: var(--mute);
  font-size: 14px;
  text-decoration: none;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  transition: color 0.15s, border-color 0.15s;
}
.md-pager:hover { color: var(--ink); border-color: var(--ink); text-decoration: none; }
.md-pager.next { margin-left: auto; }
