/* ═══════════════════════════════════════════
   Houston Developers — Design System
   Mirrors the Learn section (globals.css)
   ═══════════════════════════════════════════ */

:root {
  /* Space theme: the docs sit over the landing's fixed Milky Way background
     (space-bg.njk + /assets/space.css). Text is white-on-space, panels are
     NEAR-OPAQUE dark fills — never backdrop-filter, which re-blurs the moving
     photo every scroll frame on Gecko (see assets/space.css). */
  --background: transparent;
  --foreground: rgba(255, 255, 255, 0.92);
  --secondary: rgba(255, 255, 255, 0.05);
  --muted-foreground: rgba(255, 255, 255, 0.6);
  --border: rgba(255, 255, 255, 0.14);
  --gray-50: rgba(255, 255, 255, 0.06);
  --gray-100: rgba(255, 255, 255, 0.1);
  --gray-200: rgba(255, 255, 255, 0.14);
  --gray-300: rgba(255, 255, 255, 0.28);
  --gray-400: rgba(255, 255, 255, 0.4);
  --gray-500: rgba(255, 255, 255, 0.55);
  --gray-600: rgba(255, 255, 255, 0.65);
  --gray-700: rgba(255, 255, 255, 0.78);
  --gray-900: rgba(255, 255, 255, 0.9);
  --gray-950: #ffffff;
  --success: #4ade80;
  --info: #8ab4ff;
  --warning: #fbbf24;
  --danger: #f87171;
  --border-light: rgba(255, 255, 255, 0.1);
  --border-medium: rgba(255, 255, 255, 0.22);
  --border-heavy: rgba(255, 255, 255, 0.3);
  --panel: rgba(13, 15, 24, 0.86);
  --panel-solid: #0b0c13;
  --code-bg: rgba(8, 9, 15, 0.92);
}

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica,
    Arial, sans-serif;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.6;
}

code,
.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ═══════════════════════════════════════════
   Layout
   ═══════════════════════════════════════════ */

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  width: min(1280px, calc(100% - 32px));
  margin: 28px auto 72px;
  gap: 48px;
  padding: 48px 40px 96px;
  background: rgba(8, 10, 18, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
    width: calc(100% - 24px);
    margin-top: 12px;
    padding: 32px 22px 64px;
  }
}

/* ═══════════════════════════════════════════
   Sidebar
   ═══════════════════════════════════════════ */

.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 8px;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    max-height: none;
    margin-bottom: 32px;
    padding-right: 0;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
  }
}

.sidebar-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  margin-bottom: 12px;
  padding: 0 10px;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--gray-700);
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
  background: var(--gray-50);
  color: var(--gray-950);
}

.sidebar-nav a.active {
  background: var(--gray-100);
  color: var(--gray-950);
  font-weight: 500;
}

.sidebar-nav .num {
  color: var(--gray-400);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  min-width: 18px;
}

.sidebar-nav a.active .num { color: var(--gray-600); }

/* ═══════════════════════════════════════════
   Content
   ═══════════════════════════════════════════ */

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

.content-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  margin-bottom: 16px;
}

.content h1 {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--gray-950);
  margin-bottom: 20px;
}

.content .lead {
  font-size: 19px;
  line-height: 1.55;
  color: var(--muted-foreground);
  margin-bottom: 48px;
  max-width: 660px;
}

.content h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--gray-950);
  margin-top: 56px;
  margin-bottom: 16px;
  scroll-margin-top: 88px;
}

.content h2:first-of-type { margin-top: 0; }

.content h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--gray-950);
  margin-top: 32px;
  margin-bottom: 10px;
  scroll-margin-top: 88px;
}

.content p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--gray-700);
  margin-bottom: 16px;
}

.content p strong { color: var(--gray-950); font-weight: 600; }

.content ul,
.content ol {
  margin-bottom: 20px;
  padding-left: 22px;
  color: var(--gray-700);
}

.content li { margin-bottom: 8px; line-height: 1.65; }
.content li::marker { color: var(--gray-400); }

.content a.link {
  color: var(--info);
  text-decoration: none;
}
.content a.link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.content code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--gray-950);
}

/* ═══════════════════════════════════════════
   Code blocks (with copy button)
   ═══════════════════════════════════════════ */

.codeblock {
  position: relative;
  margin-bottom: 24px;
}

.codeblock pre {
  background: var(--code-bg);
  border: 1px solid var(--border-light);
  color: #f0f0f0;
  padding: 20px 24px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
}

.codeblock pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 13.5px;
}

.content pre {
  background: var(--code-bg);
  border: 1px solid var(--border-light);
  color: #f0f0f0;
  padding: 20px 24px;
  border-radius: 12px;
  overflow-x: auto;
  margin-bottom: 24px;
  font-size: 13.5px;
  line-height: 1.65;
}

.content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 13.5px;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #d4d4d4;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: ui-sans-serif, -apple-system, system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  opacity: 0;
}

.codeblock:hover .copy-btn { opacity: 1; }
.copy-btn:focus-visible { opacity: 1; outline: none; }
.copy-btn:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.copy-btn.copied { color: #6fe39a; border-color: rgba(111, 227, 154, 0.4); }

@media (max-width: 900px) {
  .copy-btn { opacity: 1; }
}

/* ═══════════════════════════════════════════
   Endpoint header (method + path)
   ═══════════════════════════════════════════ */

.endpoint {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--gray-50);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 20px 0;
  overflow-x: auto;
}

.method {
  flex: none;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 9px;
  border-radius: 6px;
  color: #fff;
}

.method.get { background: #2964aa; }
.method.post { background: #1c7d43; }
.method.delete { background: #b3382f; }

.endpoint .path {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 14px;
  color: var(--gray-950);
  white-space: nowrap;
}

.endpoint .path b { color: var(--info); font-weight: 600; }

/* ═══════════════════════════════════════════
   Field / reference tables
   ═══════════════════════════════════════════ */

.fields-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 28px;
  font-size: 14px;
}

.fields-table th {
  text-align: left;
  font-weight: 600;
  color: var(--gray-950);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--gray-50);
  font-size: 13px;
}

.fields-table th:first-child { border-top-left-radius: 8px; }
.fields-table th:last-child { border-top-right-radius: 8px; }

.fields-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--gray-700);
  vertical-align: top;
  line-height: 1.55;
}

.fields-table td:first-child { white-space: nowrap; }

.fields-table code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--gray-950);
}

.fields-table .req { color: var(--danger); font-weight: 600; font-size: 12px; }
.fields-table .opt { color: var(--gray-500); font-size: 12px; }

.table-scroll { overflow-x: auto; }

/* ═══════════════════════════════════════════
   On-this-page TOC
   ═══════════════════════════════════════════ */

.toc {
  background: var(--gray-50);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 48px;
}

.toc-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.toc ol {
  list-style: none;
  padding: 0;
  counter-reset: toc;
  margin: 0;
}

.toc li {
  counter-increment: toc;
  margin-bottom: 6px;
  font-size: 14px;
  padding-left: 0;
}

.toc li::before {
  content: counter(toc) ".";
  color: var(--gray-400);
  margin-right: 10px;
  font-variant-numeric: tabular-nums;
}

.toc a { color: var(--gray-700); transition: color 0.15s; }
.toc a:hover {
  color: var(--gray-950);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ═══════════════════════════════════════════
   Callouts
   ═══════════════════════════════════════════ */

.callout {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 24px 0;
  background: var(--gray-50);
}

.callout-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.callout p { margin-bottom: 0; font-size: 15px; color: var(--gray-700); }
.callout p + p { margin-top: 10px; }
.callout code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--gray-950);
}

.callout-info {
  background: color-mix(in oklch, var(--info) 14%, var(--panel-solid));
  border-color: color-mix(in oklch, var(--info) 20%, transparent);
}
.callout-info .callout-label { color: var(--info); }

.callout-warning {
  background: color-mix(in oklch, var(--warning) 14%, var(--panel-solid));
  border-color: color-mix(in oklch, var(--warning) 20%, transparent);
}
.callout-warning .callout-label { color: var(--warning); }

.callout-success {
  background: color-mix(in oklch, var(--success) 14%, var(--panel-solid));
  border-color: color-mix(in oklch, var(--success) 20%, transparent);
}
.callout-success .callout-label { color: var(--success); }

/* ═══════════════════════════════════════════
   Surface cards (overview)
   ═══════════════════════════════════════════ */

.hero { padding-top: 8px; }
.hero h1 {
  font-size: clamp(36px, 5vw, 52px);
  margin-bottom: 24px;
}
.hero .lead { font-size: 20px; margin-bottom: 36px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 28px 0;
}

.surface-card {
  display: block;
  padding: 22px 24px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: var(--panel);
  transition: border-color 0.15s, box-shadow 0.2s, transform 0.15s;
}

.surface-card:hover {
  border-color: var(--border-medium);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.surface-card .surface-kicker {
  font-size: 12px;
  font-weight: 600;
  color: var(--info);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.surface-card .surface-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-950);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.surface-card .surface-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted-foreground);
}

/* ═══════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════ */

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary { background: var(--gray-950); color: #0d0d0d; }
.btn-primary:hover { background: rgba(255, 255, 255, 0.85); }
.btn-secondary {
  background: var(--panel);
  color: var(--gray-950);
  border: 1px solid var(--border-medium);
}
.btn-secondary:hover { background: var(--gray-50); }

/* ═══════════════════════════════════════════
   Prev / Next
   ═══════════════════════════════════════════ */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--border-light);
}

.pager a {
  display: flex;
  flex-direction: column;
  padding: 18px 22px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  transition: border-color 0.15s, background 0.15s;
}

.pager a:hover { border-color: var(--border-medium); background: var(--gray-50); }
.pager .pager-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
  font-weight: 500;
}
.pager .pager-title { font-size: 15px; font-weight: 600; color: var(--gray-950); }
.pager .next { text-align: right; }
.pager .spacer { border: none; background: transparent; }
.pager .spacer:hover { background: transparent; border: none; }

/* ═══════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════ */

.footer {
  border-top: 1px solid var(--border-light);
  padding: 32px;
  text-align: center;
  color: var(--gray-500);
  font-size: 13px;
}
