/* docs.css — shared stylesheet for guide.html, cli.html, api.html
   Matches the new Chalkboard visual language (from improved.html).
*/

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

:root {
  --bg: #0f0f0e;
  --bg-2: #15140f;
  --slate: #1e2620;
  --surface: #1a1918;
  --surface-2: #221f1a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8e4db;
  --muted: #8a857c;
  --muted-2: #5d5953;
  --accent: #d4c27a;
  --accent-dim: rgba(212, 194, 122, 0.12);
  --chalk: #f2ede2;
  --chalk-white: #ffffff;
  --ok: #8ab387;
  --warn: #c87a7a;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lora', Georgia, serif;
  font-size: 17px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Chalk grain + faint top vignette, same recipe as the homepage */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: screen;
}
body::after {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(212,194,122,0.05), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--chalk); }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 40px;
  position: relative;
  z-index: 1;
}

/* ── Nav (parity with homepage) ── */
nav.site {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(15,15,14,0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--chalk);
}
.brand-mark {
  width: 28px; height: 28px;
  border: 1px solid rgba(212,194,122,0.35);
  border-radius: 4px;
  background: transparent;
  position: relative;
  display: grid; place-items: center;
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}
.brand-mark::after {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  opacity: 0.15;
  border-radius: inherit;
  pointer-events: none;
}
.brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.15rem;
  letter-spacing: 0.005em;
}
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); }
.nav-sep {
  width: 1px; height: 16px;
  background: var(--border-strong);
  margin: 0 2px;
}
.nav-cta {
  border: 1px solid var(--border-strong);
  padding: 7px 14px;
  border-radius: 4px;
  color: var(--text) !important;
}
.nav-cta:hover { border-color: var(--accent); background: var(--accent-dim); }

/* ── Docs layout: sidebar + content ── */
.docs-layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 40px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0 72px;
  align-items: start;
  position: relative;
  z-index: 1;
}

.docs-content {
  min-width: 0;
  max-width: 780px;
}

.docs-sidebar {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-top: 72px;
  scrollbar-width: none;
}
.docs-sidebar::-webkit-scrollbar { display: none; }

.sidebar-heading {
  font-family: 'DM Mono', monospace;
  font-size: 0.60rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
  opacity: 0.7;
}
.sidebar-nav { display: flex; flex-direction: column; }
.sidebar-link,
.sidebar-sublink {
  font-family: 'DM Mono', monospace;
  font-size: 0.71rem;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 0;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.04em;
  line-height: 1.4;
}
.sidebar-link:hover,
.sidebar-sublink:hover { color: var(--text); }
.sidebar-link.active { color: var(--accent); }
.sidebar-sublink {
  font-size: 0.66rem;
  padding: 3px 0 3px 14px;
  border-left: 1px solid var(--border);
  opacity: 0.8;
}
.sidebar-sublink.active {
  color: var(--accent);
  border-left-color: var(--accent);
  opacity: 1;
}

/* ── Page hero ── */
.page-hero {
  padding: 72px 0 48px;
  border-bottom: 1px solid var(--border);
}
.page-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
  display: inline-flex; align-items: center; gap: 10px;
}
.page-label .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(212,194,122,0.15);
}
.page-hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.2rem, 4.8vw, 3.4rem);
  font-weight: 400;
  line-height: 1.1;
  color: var(--chalk);
  letter-spacing: -0.012em;
  margin-bottom: 18px;
}
.page-hero h1 em {
  font-style: italic;
  color: var(--accent);
  position: relative;
  white-space: nowrap;
}
.page-hero h1 em::after {
  content: '';
  position: absolute;
  left: 0; right: -2px; bottom: 2px;
  height: 9px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 12' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none'%3E%3Cpath d='M2 8 Q 60 2 120 6 T 238 5' stroke='%23d4c27a' stroke-width='1.6' fill='none' stroke-linecap='round' opacity='0.55'/%3E%3C/svg%3E") no-repeat;
  background-size: 100% 100%;
  pointer-events: none;
}
.page-hero p {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 560px;
  line-height: 1.72;
}
.page-hero p code {
  font-family: 'DM Mono', monospace;
  font-size: 0.86em;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ── Sections ── */
.section {
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
}
.section:last-child { border-bottom: none; }

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 22px;
}

.section h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.9rem;
  font-weight: 400;
  color: var(--chalk);
  letter-spacing: -0.005em;
  margin-bottom: 16px;
  line-height: 1.2;
}
.section h2 em { font-style: italic; color: var(--accent); }

.section h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.22rem;
  font-weight: 400;
  color: var(--chalk);
  margin: 36px 0 12px;
  letter-spacing: -0.002em;
}
.section h3:first-child { margin-top: 0; }

.prose {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.8;
  margin-bottom: 18px;
  max-width: 680px;
  text-wrap: pretty;
}
.prose code {
  font-family: 'DM Mono', monospace;
  font-size: 0.85em;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  padding: 1px 6px;
  border-radius: 3px;
}
.prose strong {
  color: var(--text);
  font-weight: 500;
}
.prose a { color: var(--accent); }
.prose a:hover { color: var(--chalk); text-decoration: underline; text-underline-offset: 3px; }

ol.prose, ul.prose { margin-left: 22px; }
ol.prose li, ul.prose li { margin-bottom: 6px; }

/* ── Callout ── */
.callout {
  border-left: 2px solid var(--accent);
  background: linear-gradient(90deg, var(--accent-dim), transparent 70%);
  padding: 16px 22px;
  margin: 20px 0 26px;
  border-radius: 0 4px 4px 0;
}
.callout p { color: var(--text); margin: 0; font-size: 0.95rem; }
.callout p + p { margin-top: 8px; }
.callout code { font-family: 'DM Mono', monospace; font-size: 0.85em; color: var(--accent); }

/* ── Code blocks ── */
.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 22px 26px;
  margin-bottom: 16px;
  position: relative;
  overflow-x: auto;
}
.code-block pre {
  font-family: 'DM Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.9;
  color: var(--text);
  white-space: pre;
}
.code-block .comment { color: var(--muted-2); font-style: italic; }
.code-block .cmd     { color: var(--chalk); }
.code-block .flag    { color: var(--accent); }
.code-block .str     { color: #a8c4a2; }

.code-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 28px 0 10px;
}
.code-label:first-child { margin-top: 0; }

/* ── Reference tables ── */
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.ref-table th {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  text-align: left;
  padding: 0 18px 14px 0;
  border-bottom: 1px solid var(--border-strong);
}
.ref-table td {
  padding: 14px 18px 14px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  vertical-align: top;
  line-height: 1.65;
}
.ref-table tr:last-child td { border-bottom: none; }
.ref-table td code {
  font-family: 'DM Mono', monospace;
  font-size: 0.82em;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  padding: 1px 5px;
  border-radius: 3px;
}
.ref-table td a { color: var(--accent); }
.ref-table td a:hover { color: var(--chalk); }

.flag-name {
  font-family: 'DM Mono', monospace;
  font-size: 0.82rem;
  color: var(--accent);
  white-space: nowrap;
}
.flag-default {
  font-family: 'DM Mono', monospace;
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}
.flag-required {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  color: var(--accent);
  border: 1px solid rgba(212, 194, 122, 0.3);
  padding: 1px 7px;
  border-radius: 2px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Method badges (API) ── */
.method {
  font-family: 'DM Mono', monospace;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  text-transform: uppercase;
}
.method-post {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(212, 194, 122, 0.28);
}
.method-get {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ── Feature cards (templates, themes) ── */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 10px;
  border-radius: 6px;
  overflow: hidden;
}
.cards.two { grid-template-columns: 1fr 1fr; }
.card {
  background: var(--bg);
  padding: 26px 24px;
  transition: background 0.2s;
}
.card:hover { background: var(--surface); }
.card-name {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: 0.08em;
}
.card h4 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--chalk);
  margin-bottom: 10px;
  letter-spacing: -0.002em;
}
.card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Screenshot frames ── */
.screenshot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s;
  margin-top: 8px;
}
.screenshot:hover { border-color: var(--border-strong); }
.screenshot img,
.screenshot video {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
}
.screenshot-caption {
  padding: 13px 18px;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.5;
  border-top: 1px solid var(--border);
}
.screenshots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 8px;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.2s;
}
.lightbox.active { opacity: 1; }
.lightbox img,
.lightbox video {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6);
}

/* ── Footer (parity with homepage) ── */
footer.site {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.f-left {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.f-links { display: flex; gap: 24px; }
.f-links a {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.f-links a:hover { color: var(--text); }

/* ── Next / prev page links ── */
.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 48px;
  border-top: 1px solid var(--border);
}
.page-nav a {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  background: var(--surface);
}
.page-nav a:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.page-nav a .dir {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}
.page-nav a .t {
  font-family: 'DM Serif Display', serif;
  font-size: 1.05rem;
  color: var(--chalk);
}
.page-nav a.next { text-align: right; }
.page-nav a.prev::before { content: '← '; color: var(--muted); }
.page-nav a.next::after { content: ' →'; color: var(--muted); }

/* ── Responsive ── */
@media (max-width: 980px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .docs-sidebar { display: none; }
  .docs-content { max-width: none; }
}

@media (max-width: 760px) {
  .wrap, .docs-layout { padding: 0 24px; }
  .nav-links .section-link, .nav-sep { display: none; }
  .cards, .cards.two { grid-template-columns: 1fr; }
  .screenshots { grid-template-columns: 1fr; }
  .page-nav { grid-template-columns: 1fr; }
  .page-hero h1 { font-size: 2rem; }
  .section h2 { font-size: 1.55rem; }
  .ref-table { font-size: 0.82rem; }
  footer.site .footer-inner { flex-direction: column; align-items: flex-start; }
}
