/* docs/docs.css — shared stylesheet for guide.html and api.html */

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

:root {
  --bg: #111110;
  --surface: #1a1918;
  --border: rgba(255, 255, 255, 0.07);
  --text: #e8e4db;
  --muted: #7a7570;
  --accent: #c8b97a;
  --accent-dim: rgba(200, 185, 122, 0.12);
  --chalk: #f0ebe0;
}

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

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;
}

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.025;
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}

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

.docs-content {
  min-width: 0; /* prevent grid blowout from wide <pre> blocks */
}

/* ── Sidebar ── */
.docs-sidebar {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding-top: 64px; /* align with .page-hero padding-top */
  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: 16px;
  opacity: 0.55;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
}

.sidebar-link {
  font-family: 'DM Mono', monospace;
  font-size: 0.71rem;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 0;
  transition: color 0.15s;
  letter-spacing: 0.04em;
  line-height: 1.35;
}

.sidebar-link:hover { color: var(--text); }
.sidebar-link.active { color: var(--accent); }

.sidebar-sublink {
  font-family: 'DM Mono', monospace;
  font-size: 0.66rem;
  color: var(--muted);
  text-decoration: none;
  padding: 3px 0 3px 12px;
  border-left: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.02em;
  line-height: 1.35;
  opacity: 0.7;
}

.sidebar-sublink:hover { color: var(--text); opacity: 1; }
.sidebar-sublink.active { color: var(--accent); border-left-color: var(--accent); opacity: 1; }

/* ── Nav ── */
nav {
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.container--nav {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 32px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.15rem;
  color: var(--chalk);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  font-weight: 400;
  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-github {
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 3px;
  color: var(--text) !important;
  transition: border-color 0.2s, background 0.2s !important;
}

.nav-github:hover {
  border-color: var(--accent) !important;
  background: var(--accent-dim) !important;
}

/* ── Page hero (slimmer than homepage) ── */
.page-hero {
  padding: 64px 0 52px;
  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: 20px;
}

.page-hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--chalk);
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

.page-hero p {
  font-size: 1rem;
  color: var(--muted);
  max-width: 520px;
  line-height: 1.75;
}

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

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

.section h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--chalk);
  margin-bottom: 10px;
}

.section h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--chalk);
  margin: 32px 0 10px;
}

.section h3:first-child {
  margin-top: 0;
}

.prose {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 20px;
  max-width: 680px;
}

.prose code {
  font-family: 'DM Mono', monospace;
  font-size: 0.85em;
  color: var(--text);
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Code blocks ── */
.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px 28px;
  margin-bottom: 16px;
  position: relative;
  overflow-x: auto;
}

.code-block pre {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.9;
  color: var(--text);
  white-space: pre;
}

.code-block .comment { color: var(--muted); }
.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.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  margin-top: 24px;
}

.code-label:first-child {
  margin-top: 0;
}

/* ── Reference tables ── */
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.ref-table th {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  text-align: left;
  padding: 0 16px 12px 0;
  border-bottom: 1px solid var(--border);
}

.ref-table td {
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  vertical-align: top;
  line-height: 1.6;
}

.ref-table tr:last-child td {
  border-bottom: none;
}

.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.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.flag-required {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: var(--accent);
  border: 1px solid rgba(200, 185, 122, 0.3);
  padding: 1px 6px;
  border-radius: 2px;
  white-space: nowrap;
}

.ref-table td code {
  font-family: 'DM Mono', monospace;
  font-size: 0.82em;
  color: var(--text);
}

/* ── Method badges ── */
.method {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 2px;
  white-space: nowrap;
}

.method-post {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(200, 185, 122, 0.25);
}

.method-get {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ── Option tags (reused from homepage) ── */
.option-groups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 8px;
}

.option-group h4 {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.option-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 2px;
}

/* ── Feature cards (for templates) ── */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 8px;
}

.card {
  background: var(--bg);
  padding: 28px 24px;
  transition: background 0.2s;
}

.card:hover {
  background: var(--surface);
}

.card-name {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.card h4 {
  font-family: 'DM Serif Display', serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--chalk);
  margin-bottom: 8px;
}

.card p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ── Screenshot gallery ── */
.screenshots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 8px;
}

.screenshots.triple {
  grid-template-columns: 1fr 1fr 1fr;
}

.screenshot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.screenshot:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.screenshot img,
.screenshot video {
  width: 100%;
  height: auto;
  display: block;
}

.screenshot img,
.screenshot video {
  cursor: pointer;
}

.screenshot-caption {
  padding: 14px 18px;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.5;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  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: 4px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6);
}

/* ── Footer ── */
footer {
  padding: 40px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-left {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
}

.footer-right a {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.08em;
  transition: color 0.2s;
}

.footer-right a:hover {
  color: var(--text);
}

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

  .docs-sidebar {
    display: none;
  }
}

@media (max-width: 600px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .option-groups {
    grid-template-columns: 1fr 1fr;
  }

  .ref-table {
    font-size: 0.8rem;
  }

  .screenshots,
  .screenshots.triple {
    grid-template-columns: 1fr;
  }

  .page-hero h1 {
    font-size: 1.8rem;
  }

  footer {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}
