/* docs.gormes.ai — docs layout aligned with gormes.ai landing. */

:root {
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;

  --bg-0: #0a0d11;
  --bg-1: #121720;
  --bg-2: #1a1f29;
  --border: #1e232e;
  --border-strong: #2a3140;

  --text: #ebe9e2;
  --muted: rgba(235, 233, 226, 0.62);
  --muted-strong: rgba(235, 233, 226, 0.80);
  --label: rgba(235, 233, 226, 0.48);

  --accent: #e8c547;
  --accent-hover: #f0d66c;
  --accent-ink: #1a1300;

  --status-shipped-fg: #5be79a;
  --status-progress-fg: #5bc7e7;
  --status-next-fg: #e7c25b;
  --status-later-fg: #8a99c7;

  --sidebar-w: 260px;
  --toc-w: 200px;
  --topbar-h: 60px;
  --pad: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern', 'liga', 'calt';
}

/* Grain overlay — same as landing */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* Drawer toggle (hidden checkbox + label pattern, pure CSS mobile drawer) */
.drawer-toggle { display: none; }
.drawer-btn {
  display: none;
  font-size: 20px;
  line-height: 1;
  padding: 8px 12px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.drawer-backdrop { display: none; }

/* ── Topbar ────────────────────────────────────────── */
.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 13, 17, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
}
.docs-topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--pad);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}
.docs-brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  font-variation-settings: "opsz" 144, "SOFT" 0;
  letter-spacing: -0.01em;
  color: var(--text);
}
.docs-brand:hover { color: var(--accent); }
.docs-search { flex: 1; max-width: 320px; }
.docs-topnav { margin-left: auto; display: flex; gap: 20px; }
.docs-topnav a {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.docs-topnav a:hover { color: var(--text); }

/* ── Shell layout ──────────────────────────────────── */
.docs-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--pad);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 40px;
  min-height: calc(100vh - var(--topbar-h));
}

/* ── Sidebar ───────────────────────────────────────── */
.docs-sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 28px 0;
  min-width: 0;
}
.docs-nav-group { margin-bottom: 28px; }
.docs-nav-group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 10px;
  padding-left: 10px;
  border-left: 2px solid currentColor;
}
.docs-nav-group-label-shipped { color: var(--status-shipped-fg); }
.docs-nav-group-label-progress { color: var(--status-progress-fg); }
.docs-nav-group-label-next { color: var(--status-next-fg); }
.docs-nav-list, .docs-nav-sublist { list-style: none; margin: 0; padding: 0; }
.docs-nav-list > li { margin-bottom: 2px; }
.docs-nav-list a, .docs-nav-sublist a {
  display: block;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-strong);
  border-left: 2px solid transparent;
  border-radius: 0;
}
.docs-nav-list a:hover, .docs-nav-sublist a:hover {
  color: var(--accent);
  border-left-color: var(--border-strong);
}
.docs-nav-list a[aria-current="page"],
.docs-nav-sublist a[aria-current="page"] {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--bg-1);
}
.docs-nav-sublist {
  padding-left: 16px;
  margin-top: 2px;
}
.docs-nav-sublist a { font-size: 11.5px; }

/* ── Main content ──────────────────────────────────── */
.docs-main {
  min-width: 0;
  padding: 36px 0 80px;
}
.docs-article {
  min-width: 0;
}
.docs-layout-with-toc {
  display: grid;
  grid-template-columns: 1fr var(--toc-w);
  gap: 32px;
  align-items: start;
}
.docs-content { min-width: 0; }
.docs-toc {
  position: sticky;
  top: calc(var(--topbar-h) + 36px);
  max-height: calc(100vh - var(--topbar-h) - 80px);
  overflow-y: auto;
  min-width: 0;
}

/* ── Article typography ────────────────────────────── */
.docs-breadcrumbs {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--label);
  margin-bottom: 14px;
}
.docs-breadcrumbs a { color: var(--muted); }
.docs-breadcrumb-sep { margin: 0 6px; color: var(--label); }

.docs-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 4.5vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  overflow-wrap: break-word;
}
.docs-lede {
  font-size: 16px;
  color: var(--muted-strong);
  margin: 0 0 28px;
  line-height: 1.55;
  max-width: 60ch;
  overflow-wrap: break-word;
}

.docs-content h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  font-variation-settings: "opsz" 60, "SOFT" 20;
  letter-spacing: -0.01em;
  margin: 44px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: break-word;
}
.docs-content h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  font-variation-settings: "opsz" 48, "SOFT" 15;
  margin: 32px 0 10px;
  overflow-wrap: break-word;
}
.docs-content p { margin: 0 0 14px; overflow-wrap: break-word; }
.docs-content ul, .docs-content ol { margin: 0 0 18px; padding-left: 22px; }
.docs-content li { margin-bottom: 4px; }
.docs-content li > p { margin-bottom: 4px; }
.docs-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 16px;
  margin: 18px 0;
  font-style: italic;
  color: var(--muted-strong);
}
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 13px;
  display: block;
  overflow-x: auto;
}
.docs-content thead th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-strong);
}
.docs-content tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* Inline code */
.docs-content code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-1);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--text);
}
.docs-content pre code { background: transparent; padding: 0; }

/* ── Code block (copy-button wrapper from render hook) ─ */
.cmd-wrap {
  position: relative;
  min-width: 0;
  margin: 18px 0;
}
.cmd {
  background: var(--bg-1);
  border: 1px solid var(--border);
  padding: 16px 92px 16px 16px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  margin: 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  line-height: 1.55;
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 2px;
  cursor: pointer;
  min-height: 32px;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { background: rgba(14, 59, 33, 1); color: var(--status-shipped-fg); border-color: rgba(14, 59, 33, 1); }

/* ── TOC (right side) ──────────────────────────────── */
.docs-toc-details summary {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--label);
  cursor: pointer;
  padding: 0 0 10px;
  list-style: none;
}
.docs-toc-details summary::marker, .docs-toc-details summary::-webkit-details-marker { display: none; }
.docs-toc-body ul { list-style: none; margin: 0; padding: 0; }
.docs-toc-body ul ul { padding-left: 12px; }
.docs-toc-body a {
  display: block;
  padding: 3px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  border-left: 2px solid transparent;
  padding-left: 8px;
}
.docs-toc-body a:hover { color: var(--accent); }

/* ── Home page ─────────────────────────────────────── */
.docs-home { padding-top: 40px; }
.docs-home-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(36px, 6vw, 58px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 14px 0 16px;
  font-variation-settings: "opsz" 144, "SOFT" 30;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--label);
  margin: 0 0 8px;
}
.docs-home-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 40px;
}
.docs-home-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 22px;
  color: var(--text);
  transition: border-color 0.2s, transform 0.2s;
}
.docs-home-card:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--text); }
.docs-home-card h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  margin: 8px 0 6px;
  color: var(--text);
}
.docs-home-card p { font-size: 13px; color: var(--muted-strong); margin: 0; line-height: 1.55; }
.docs-child-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.docs-child-list li {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 12px 14px;
}
.docs-child-list li a { font-family: var(--font-mono); font-size: 13px; }
.docs-child-list li p { margin: 4px 0 0; font-size: 12px; color: var(--muted-strong); }

/* ── Footer ────────────────────────────────────────── */
.docs-footer { border-top: 1px solid var(--border); margin-top: 60px; }
.docs-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.docs-footer p { margin: 0; font-size: 11px; color: var(--label); font-family: var(--font-mono); letter-spacing: 0.04em; }

/* ── Pagefind overrides (amber accent) ─────────────── */
.pagefind-ui {
  --pagefind-ui-scale: 0.8;
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--text);
  --pagefind-ui-background: var(--bg-1);
  --pagefind-ui-border: var(--border);
  --pagefind-ui-tag: var(--bg-2);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 3px;
  --pagefind-ui-font: var(--font-body);
}

/* ── Responsive — 1023px breakpoint ────────────────── */
@media (max-width: 1023px) {
  .docs-layout-with-toc { grid-template-columns: 1fr; }
  .docs-toc { position: static; max-height: none; margin-bottom: 24px; }
  .docs-toc-details { background: var(--bg-1); border: 1px solid var(--border); border-radius: 3px; padding: 10px 14px; }
  .docs-toc-details[open] { padding-bottom: 14px; }
  .docs-home-cards { grid-template-columns: 1fr; }
}

/* ── Responsive — 767px drawer breakpoint ──────────── */
@media (max-width: 767px) {
  .drawer-btn { display: inline-flex; align-items: center; }
  .docs-shell { grid-template-columns: 1fr; }
  .docs-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    height: calc(100vh - var(--topbar-h));
    width: min(300px, 85vw);
    background: var(--bg-0);
    border-right: 1px solid var(--border);
    padding: 20px 20px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 40;
  }
  .drawer-toggle:checked ~ .docs-shell .docs-sidebar { transform: translateX(0); }
  .drawer-toggle:checked ~ .docs-shell .drawer-backdrop {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 35;
    cursor: pointer;
  }
  .docs-main { padding-top: 24px; }
  .docs-topnav a:nth-child(1) { display: none; }
  .docs-topbar-inner { gap: 10px; }
  .docs-search { max-width: 100%; }
}

/* ── Responsive — 480px tight-mobile ───────────────── */
@media (max-width: 480px) {
  .cmd { padding-right: 80px; }
  .docs-footer-inner { flex-direction: column; align-items: flex-start; gap: 6px; }
  .docs-content table { font-size: 12px; }
}

/* ── Reduced motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation-duration: 0.001ms !important;
  }
}
