/* ============================================================
   TINOC — design system
   A modern systems programming language that transpiles to C99.
   Refined dark · minimal · professional.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --bg-0: #0a0e0d;
  --bg-1: #0d1210;
  --bg-2: #111715;
  --bg-3: #151c1a;
  --bg-glass: rgba(10, 14, 13, 0.86);

  --mint: #5eead4;
  --mint-bright: #8ff5e6;
  --mint-soft: #9ff0e2;
  --mint-dim: #1e7768;
  --mint-ink: #062019;

  --ink: #e8efec;
  --ink-dim: #a3b0ab;
  --ink-faint: #6c7974;
  --ink-ghost: #48534f;

  --line: rgba(235, 245, 241, 0.08);
  --line-strong: rgba(235, 245, 241, 0.16);

  --warm: #e6c68f;
  --peach: #e5ae7a;
  --rose: #efb0cd;

  --font-display: "Google Sans Flex", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Google Sans Flex", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Google Sans Code", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --nav-h: 76px;
  --container: 1120px;
  --shadow-sm: 0 2px 10px -2px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 14px 34px -14px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 26px 60px -22px rgba(0, 0, 0, 0.65);
  --glow: 0 8px 26px -6px rgba(94, 234, 212, 0.45);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(94, 234, 212, 0.24); color: var(--ink); }

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

a { color: var(--mint); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--mint-bright); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
  color: var(--ink);
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

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

.container {
  width: min(var(--container), 92vw);
  margin-inline: auto;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ---------- Utilities ---------- */
.muted { color: var(--ink-dim); }
.mono { font-family: var(--font-mono); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.center { text-align: center; }
.mt-0 { margin-top: 0; }

body.menu-locked { overflow: hidden; }
/* ---------- Header / nav ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  padding: 16px 0 0;
}

.nav-pill {
  display: flex;
  align-items: center;
  gap: 20px;
  width: min(var(--container), 92vw);
  margin-inline: auto;
  height: 58px;
  padding: 0 10px 0 18px;
  border-radius: var(--radius-pill);
  background: rgba(12, 17, 15, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.nav-pill.scrolled {
  background: rgba(12, 17, 15, 0.92);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.nav-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; flex-shrink: 0; display: block; }
.brand-word {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
  white-space: nowrap;
}
.nav-logo { height: 26px; width: auto; } /* legacy fallback */

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-dim);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-link:hover { color: var(--ink); background: rgba(235, 245, 241, 0.05); }
.nav-link.active { color: var(--ink); font-weight: 600; }

.nav-cta { display: flex; align-items: center; gap: 10px; }
.nav-menu-cta { display: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  padding: 9px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s ease;
}
.nav-toggle:hover { background: rgba(235, 245, 241, 0.06); }
.nav-toggle span {
  width: 20px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  background: var(--mint);
  color: var(--mint-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 8px -2px rgba(94, 234, 212, 0.35);
}
.btn-primary:hover {
  background: var(--mint-bright);
  color: var(--mint-ink);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), var(--glow);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ink);
  background: transparent;
}
.btn-ghost:hover {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.06);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-sm { padding: 8px 15px; font-size: 0.84rem; }
.btn-lg { padding: 13px 26px; font-size: 0.98rem; }

/* ---------- Sections / headers ---------- */
.section { padding: 92px 0; position: relative; }
.section-tight { padding: 64px 0; }
.section + .section { border-top: 1px solid var(--line); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mint);
  margin-bottom: 16px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--mint-dim);
}
.eyebrow.center { justify-content: center; }
.eyebrow.center::after {
  content: "";
  width: 22px; height: 1px;
  background: var(--mint-dim);
}

.section-head { max-width: 680px; margin-bottom: 48px; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
.section-head .lead { color: var(--ink-dim); font-size: 1.05rem; margin-top: 4px; }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Hero (landing) ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-h) + 64px) 0 88px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(760px 420px at 50% -6%, rgba(94, 234, 212, 0.08), transparent 70%),
    radial-gradient(560px 320px at 85% 12%, rgba(94, 234, 212, 0.04), transparent 65%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  width: min(840px, 92vw);
}
.hero-logo {
  width: min(460px, 88vw);
  height: auto;
  aspect-ratio: 1427 / 439;
  object-fit: contain;
  margin: 0 auto 28px;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.45));
}
.hero h1 {
  font-size: clamp(2.3rem, 5.4vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}
.hero h1 .accent { color: var(--mint); }
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--ink-dim);
  max-width: 600px;
  margin: 0 auto 34px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 60px;
}

/* hero code window */
.code-window {
  position: relative;
  text-align: left;
  width: min(720px, 92vw);
  margin: 0 auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: var(--bg-1);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.code-window-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 42px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.window-dots { display: flex; gap: 6px; }
.window-dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(235, 245, 241, 0.24); }
.window-tabs {
  display: flex;
  gap: 2px;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  height: 100%;
}
.window-tab {
  padding: 0 12px;
  color: var(--ink-faint);
  cursor: pointer;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: inherit;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.window-tab:hover { color: var(--ink); }
.window-tab.active {
  color: var(--ink);
  border-bottom-color: var(--mint);
}
.code-window-body { padding: 0; }
.code-window pre {
  margin: 0;
  padding: 20px 22px 24px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--ink);
  min-height: 228px;
}
.cursor-blink::after {
  content: "▋";
  color: var(--mint);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.window-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  background: var(--bg-2);
}
.window-foot .ok { color: var(--mint); }
/* ---------- Philosophy strip ---------- */
.philosophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.phil-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  padding: 24px 22px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.phil-card:hover {
  border-color: var(--line-strong);
  background: var(--bg-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.phil-card .num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 10px;
}
.phil-card h3 { font-size: 1rem; margin-bottom: 5px; }
.phil-card p { font-size: 0.88rem; color: var(--ink-dim); margin: 0; }

/* ---------- Feature cards ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.feature-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  padding: 28px 24px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-card:hover {
  border-color: var(--line-strong);
  background: var(--bg-3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.feature-icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid var(--line);
  color: var(--mint);
  margin-bottom: 16px;
}
.feature-icon svg { width: 20px; height: 20px; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 7px; }
.feature-card p { font-size: 0.9rem; color: var(--ink-dim); margin: 0; }

/* ---------- Code blocks (docs & generic) ---------- */
.code-block {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-1);
  margin: 16px 0 24px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.code-block pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.83rem;
  line-height: 1.7;
  color: var(--ink);
  tab-size: 4;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--ink-faint);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.copy-btn:hover { color: var(--ink); border-color: var(--line-strong); background: rgba(235, 245, 241, 0.04); }
.copy-btn.copied { color: var(--mint); border-color: var(--mint-dim); }
.copy-btn svg { width: 12px; height: 12px; }

/* Contained scrolling for code & tables */
.code-block pre, .code-window pre, .syntax-box, .table-wrap, .docs-sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-ghost) transparent;
}
.code-block pre::-webkit-scrollbar, .code-window pre::-webkit-scrollbar,
.syntax-box::-webkit-scrollbar, .table-wrap::-webkit-scrollbar, .docs-sidebar::-webkit-scrollbar {
  height: 8px; width: 8px;
}
.code-block pre::-webkit-scrollbar-thumb, .code-window pre::-webkit-scrollbar-thumb,
.syntax-box::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb, .docs-sidebar::-webkit-scrollbar-thumb {
  background: var(--ink-ghost);
  border-radius: 999px;
}
.code-block pre::-webkit-scrollbar-thumb:hover, .code-window pre::-webkit-scrollbar-thumb:hover,
.syntax-box::-webkit-scrollbar-thumb:hover, .table-wrap::-webkit-scrollbar-thumb:hover, .docs-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
}
.code-block pre::-webkit-scrollbar-track, .code-window pre::-webkit-scrollbar-track,
.syntax-box::-webkit-scrollbar-track, .table-wrap::-webkit-scrollbar-track, .docs-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

/* Tinoc syntax colors */
.tok-kw { color: var(--mint); font-weight: 500; }
.tok-type { color: var(--mint-soft); }
.tok-str { color: var(--warm); }
.tok-num { color: var(--peach); }
.tok-cmt { color: var(--ink-ghost); font-style: italic; }
.tok-pre { color: var(--rose); font-weight: 500; }
.tok-fn { color: var(--ink); }
.tok-op { color: var(--ink-faint); }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 16px 0 24px;
}
table.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--bg-1);
}
.docs-table th {
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--bg-2);
  white-space: nowrap;
}
.docs-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-dim);
  vertical-align: top;
}
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table tbody tr { transition: background 0.14s ease; }
.docs-table tbody tr:hover { background: rgba(235, 245, 241, 0.03); }
.docs-table code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--mint-soft);
  background: rgba(94, 234, 212, 0.07);
  padding: 1px 6px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ---------- Inline code & callouts ---------- */
code.inline {
  font-family: var(--font-mono);
  font-size: 0.84em;
  color: var(--mint-soft);
  background: rgba(94, 234, 212, 0.07);
  padding: 2px 6px;
  border-radius: 6px;
}

.callout {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  padding: 18px 22px;
  margin: 18px 0;
  font-size: 0.92rem;
  color: var(--ink-dim);
  box-shadow: var(--shadow-sm);
}
.callout strong { color: var(--ink); }
.callout.warn { background: rgba(229, 174, 122, 0.06); }
.callout.warn strong { color: var(--peach); }

.note-list { margin: 0; padding-left: 4px; list-style: none; }
.note-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 7px;
  color: var(--ink-dim);
  font-size: 0.92rem;
}
.note-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--mint);
  font-family: var(--font-mono);
}

/* ---------- CTA band ---------- */
.cta-band {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  padding: 56px 40px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.cta-band h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); margin-bottom: 12px; }
.cta-band p { color: var(--ink-dim); max-width: 540px; margin: 0 auto 28px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- Landing specifics ---------- */
.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 52px;
  align-items: center;
}
@media (max-width: 900px) { .split { grid-template-columns: 1fr; gap: 34px; } }

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.type-chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.type-chip:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.type-chip code {
  font-family: var(--font-mono);
  color: var(--mint);
  font-size: 0.9rem;
}
.type-chip span {
  font-size: 0.74rem;
  color: var(--ink-faint);
  font-family: var(--font-display);
}

.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li {
  position: relative;
  padding: 0 0 30px 52px;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--mint);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.steps li::after {
  content: "";
  position: absolute;
  left: 17px; top: 36px;
  width: 1px;
  height: calc(100% - 36px);
  background: var(--line);
}
.steps li:last-child::after { display: none; }
.steps h3 { font-size: 1.05rem; margin-bottom: 4px; }
.steps p { color: var(--ink-dim); font-size: 0.9rem; margin: 0; }

/* ---------- Community ---------- */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}
.channel-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  padding: 26px 24px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.channel-card:hover {
  border-color: var(--line-strong);
  background: var(--bg-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.channel-card .channel-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}
.channel-card .channel-name .badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--bg-3);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.channel-card p { font-size: 0.9rem; color: var(--ink-dim); margin: 0; flex: 1; }
.channel-card .btn { align-self: flex-start; }

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 36px;
}
.stat {
  min-width: 140px;
  padding: 18px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat span { font-size: 0.76rem; color: var(--ink-faint); font-family: var(--font-display); }

/* ---------- Page hero (subpages) ---------- */
.page-hero {
  position: relative;
  padding: calc(var(--nav-h) + 56px) 0 52px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.page-hero h1 { font-size: clamp(2rem, 4.6vw, 3rem); font-weight: 800; margin-bottom: 12px; }
.page-hero p { color: var(--ink-dim); max-width: 620px; margin: 0 auto; font-size: 1.05rem; }
/* ---------- Docs layout ---------- */
.docs-shell {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  padding: 56px 0 110px;
}
@media (max-width: 980px) {
  .docs-shell { grid-template-columns: 1fr; gap: 8px; }
}

.docs-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 22px);
  max-height: calc(100vh - var(--nav-h) - 44px);
  overflow-y: auto;
  padding: 6px 14px 14px 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-ghost) transparent;
}
@media (max-width: 980px) {
  .docs-sidebar {
    position: static;
    max-height: none;
    padding: 0;
  }
}

.docs-search {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.86rem;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 18px;
  transition: border-color 0.18s ease;
}
.docs-search::placeholder { color: var(--ink-faint); }
.docs-search:focus { outline: none; border-color: var(--mint-dim); }

.docs-nav-group { margin-bottom: 22px; }
.docs-nav-group > h4 {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 6px;
  padding-left: 14px;
}
.docs-nav { list-style: none; margin: 0; padding: 0; }
.docs-nav a {
  display: block;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-dim);
  padding: 7px 14px;
  border-radius: 12px;
  transition: color 0.15s ease, background 0.15s ease;
}
.docs-nav a:hover { color: var(--ink); background: rgba(235, 245, 241, 0.04); }
.docs-nav a.active {
  color: var(--mint);
  background: rgba(94, 234, 212, 0.08);
  font-weight: 600;
}
.docs-nav a.hidden { display: none; }

.docs-content { min-width: 0; }
.docs-content article { padding-top: 8px; }
.docs-content article + article { margin-top: 64px; }
.docs-content h2 {
  font-size: clamp(1.5rem, 2.8vw, 1.95rem);
  scroll-margin-top: calc(var(--nav-h) + 26px);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.docs-content h3 { font-size: 1.15rem; margin-top: 30px; }
.docs-content h4 { font-size: 1rem; margin-top: 24px; }
.docs-content p { color: var(--ink-dim); }
.docs-content p code { color: var(--mint-soft); }
.docs-content .lead { font-size: 1.06rem; color: var(--ink); }
.docs-content .lead code { font-size: 0.95em; }

.prose { color: var(--ink-dim); }
.prose b, .prose strong { color: var(--ink); }

.syntax-box {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.7;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin: 12px 0 22px;
  overflow-x: auto;
  white-space: pre;
  color: var(--ink-dim);
  box-shadow: var(--shadow-sm);
}

.toc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 24px 0 8px;
}
.toc-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg-2);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.toc-card:hover {
  border-color: var(--line-strong);
  background: var(--bg-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.toc-card code { font-family: var(--font-mono); color: var(--mint); font-size: 0.88rem; }
.toc-card span {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-family: var(--font-display);
}

.back-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--bg-glass);
  color: var(--ink-dim);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.15s ease;
}
.back-top.show { opacity: 1; transform: none; pointer-events: auto; }
.back-top:hover { color: var(--mint); border-color: var(--mint-dim); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 28px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand .nav-brand { margin-bottom: 14px; }
.footer-brand .brand-mark { width: 26px; height: 26px; }
.footer-brand .brand-word { font-size: 1rem; color: var(--ink); }
.footer-brand p { color: var(--ink-faint); font-size: 0.88rem; max-width: 300px; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 12px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-col a {
  color: var(--ink-dim);
  font-size: 0.88rem;
  font-family: var(--font-display);
  font-weight: 500;
}
.footer-col a:hover { color: var(--mint); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.82rem;
  font-family: var(--font-display);
}
.footer-bottom .heart { color: var(--rose); }

/* ---------- 404 ---------- */
.notfound {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 20px;
}
.notfound .code {
  font-family: var(--font-mono);
  font-size: clamp(5rem, 16vw, 9rem);
  font-weight: 700;
  line-height: 1;
  color: var(--mint);
  margin-bottom: 12px;
}
.notfound h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
.notfound p { color: var(--ink-dim); max-width: 460px; margin: 0 auto 28px; }

/* ---------- Responsive nav ---------- */
@media (max-width: 860px) {
  .nav-pill { gap: 10px; }
  .nav-cta { margin-left: auto; }
  .nav-links {
    position: fixed;
    top: calc(var(--nav-h) + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    width: min(420px, 92vw);
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    padding: 14px;
    max-height: calc(100dvh - var(--nav-h) - 28px);
    overflow-y: auto;
    background: rgba(12, 17, 15, 0.98);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 5;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  }
  .nav-links.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
  }
  .nav-link { font-size: 1.02rem; padding: 13px 14px; text-align: center; }
  .nav-toggle { display: flex; }
  .nav-cta .btn-ghost,
  .nav-cta .btn-primary { display: none; }
  .nav-menu-cta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  .nav-menu-cta .btn { width: 100%; }
}

/* ---------- Docs mobile contents toggle ---------- */
.docs-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.docs-toggle:hover { border-color: var(--mint-dim); }
.docs-toggle::after {
  content: "";
  margin-left: auto;
  width: 8px; height: 8px;
  border-right: 2px solid var(--mint);
  border-bottom: 2px solid var(--mint);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
}
.docs-toggle[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-2px); }
@media (max-width: 980px) {
  .docs-toggle { display: flex; }
  .docs-sidebar { display: none; }
  .docs-sidebar.open { display: block; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .section { padding: 72px 0; }
  .section-tight { padding: 48px 0; }
  .page-hero { padding: calc(var(--nav-h) + 40px) 0 44px; }
  .hero { padding: calc(var(--nav-h) + 40px) 0 60px; }
  .hero h1 { font-size: clamp(2rem, 8.5vw, 2.6rem); }
  .hero-sub { font-size: 1rem; }
  .hero-actions { gap: 10px; margin-bottom: 44px; }
  .cta-band { padding: 44px 20px; }
  .code-window pre,
  .code-block pre,
  .syntax-box {
    font-size: 0.78rem;
    padding: 16px 14px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .code-window pre { min-height: 0; }
  .docs-content article + article { margin-top: 52px; }
  .stat { min-width: 128px; padding: 16px 18px; }
  .stat b { font-size: 1.5rem; }
}
@media (max-width: 480px) {
  .btn-lg { padding: 12px 18px; font-size: 0.94rem; }
  .hero-actions .btn { flex: 1 1 auto; }
  .type-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

/* ---------- Micro UX refinements ---------- */
/* Guarantee every code element uses the mono face (fixes stray system monospace) */
pre, code, kbd, samp {
  font-family: var(--font-mono);
}

/* Balanced, readable headings */
h1, h2, h3, h4 {
  text-wrap: balance;
}

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  text-rendering: optimizeLegibility;
}

::placeholder { color: var(--ink-faint); opacity: 1; }

/* In-content links: subtle underline for better scanability */
.docs-content a:not(.btn),
.prose a,
.muted a {
  text-decoration: underline;
  text-decoration-color: rgba(94, 234, 212, 0.3);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.docs-content a:not(.btn):hover,
.prose a:hover,
.muted a:hover {
  color: var(--mint-bright);
  text-decoration-color: var(--mint);
}

/* Comfortable reading measure for docs prose */
.docs-content article { max-width: 74ch; }
@media (max-width: 980px) { .docs-content article { max-width: none; } }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
