/* Moonlight design system, rebuilt from brutalist tech references (Miscreants, Justin Jackson, PlanetScale, Oxide):
   sans display headings at normal word spacing, mono for labels, data and controls, full-width ruled sections,
   two-column section grid, square corners, one moon-yellow highlight. */
:root {
  /* Color: cool neutral light mode, softer than pure black on white */
  --bg: #f5f6f7;
  --surface: #fbfbfc;       /* tables, inputs and plans sit a step lighter than the page */
  --ink: #1b1d21;           /* 15:1 on bg */
  --muted: #5c626a;         /* 5.9:1 on bg */
  --line: #e1e4e8;          /* row dividers */
  --rule: #c5cad1;          /* structural rules and box borders */
  --moon: #ffe14d;
  --on-moon: #1b1d21;
  --invert-bg: #1d2024;
  --invert-fg: #eef0f2;
  --invert-muted: #a3a9b1;
  --dot: rgba(27, 29, 33, 0.085);
  --shadow: 0 1px 0 rgba(27, 29, 33, 0.03), 0 10px 28px -18px rgba(27, 29, 33, 0.25);

  /* Spacing: 8px base */
  --s1: 4px;
  --s2: 8px;
  --s3: 16px;
  --s4: 24px;
  --s5: 32px;
  --s6: 48px;
  --s7: 64px;
  --s8: 96px;
  --gutter: clamp(20px, 3.4vw, 48px);   /* Miscreants and Oxide sit at 40px on a 1440 screen */
  --section: clamp(72px, 8vw, 120px);
  --measure: 62ch;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* Dark: soft charcoal, dim ink and rules, a muted moon. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151515; --surface: #1a1a1a; --ink: #e4e4e4; --muted: #9c9c9c;
    --line: #242424; --rule: #353535; --moon: #d9c056; --on-moon: #151515;
    --invert-bg: #202020; --invert-fg: #e4e4e4; --invert-muted: #9c9c9c;
    --dot: rgba(255, 255, 255, 0.05);
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px -18px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151515; --surface: #1a1a1a; --ink: #e4e4e4; --muted: #9c9c9c;
  --line: #242424; --rule: #353535; --moon: #d9c056; --on-moon: #151515;
  --invert-bg: #202020; --invert-fg: #e4e4e4; --invert-muted: #9c9c9c;
  --dot: rgba(255, 255, 255, 0.05);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px -18px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code, pre { font-family: var(--mono); font-size: 0.86em; }
:focus-visible { outline: 2px solid var(--moon); outline-offset: 2px; }
p { margin: 0 0 20px; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter); }

/* Type. Headings are sans with normal word spacing; tight tracking only where the size can take it. */
h1, h2, h3 { font-family: var(--sans); font-weight: 500; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(40px, 5.6vw, 80px); line-height: 1.04; letter-spacing: -0.035em; }
h2 { font-size: clamp(30px, 3.4vw, 48px); line-height: 1.08; letter-spacing: -0.03em; max-width: 16ch; }
h3 { font-size: 20px; line-height: 1.3; letter-spacing: -0.012em; }
.label, .rule-label, .fig-label, th, .plan .name, .example-list .who {
  font: 500 12px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.label { margin: 0 0 var(--s5); }

/* The highlight: a band from just above the x-height to just below the baseline, padded on both sides. */
.mark {
  background: linear-gradient(transparent 14%, var(--moon) 14%, var(--moon) 92%, transparent 92%);
  color: var(--on-moon);
  padding: 0 0.12em 0 0.07em;   /* capitals carry their own left side bearing, so the left side needs less */
  margin: 0 -0.02em 0 0;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
#tech-word, #tech-count { transition: opacity 0.18s ease; }
#tech-word.is-swapping, #tech-count.is-swapping { opacity: 0; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); height: 72px; }
.logo { display: block; line-height: 0; }
.logo svg { display: block; height: 20px; width: auto; }
.logo-hat, .logo-word, .logo-cursor { fill: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-hat, :root:not([data-theme="light"]) .logo-cursor { fill: var(--moon); } }
:root[data-theme="dark"] .logo-hat, :root[data-theme="dark"] .logo-cursor { fill: var(--moon); }
.logo-cursor { animation: blink 1.06s steps(1, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .logo-cursor { animation: none; } }
.nav { display: flex; align-items: center; gap: var(--s5); font: 500 12px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.nav a { text-decoration: none; }
.nav .nav-link:hover { text-decoration: underline; }
@media (max-width: 860px) { .nav .nav-link { display: none; } .nav { gap: var(--s3); } }
@media (max-width: 560px) { .nav .btn-small { display: none; } }
@media (max-width: 400px) { .logo svg { height: 16px; } }

/* Buttons and inputs: mono caps, square, Miscreants-style solid fill */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 22px;
  font: 500 13px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--ink); border-radius: 0; cursor: pointer;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--bg); color: var(--ink); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-small { height: 36px; padding: 0 14px; font-size: 11px; letter-spacing: 0.1em; }

/* Hero: copy on the left, the real data table on the right as a captioned figure (Oxide's "Fig. 1") */
.hero {
  padding: clamp(56px, 7vw, 112px) 0 var(--section);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 24px 24px;
  background-position: -12px -12px;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s6) clamp(48px, 6vw, 96px); align-items: start; }
@media (max-width: 1024px) { .hero-grid { grid-template-columns: 1fr; } }
.answer { margin: var(--s5) 0 0; font: 400 15px/1.6 var(--mono); color: var(--muted); max-width: 60ch; }
.answer strong { color: var(--ink); font-weight: 700; }
.lede { margin: var(--s4) 0 0; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.55; max-width: 40ch; }
.lookup-block { margin-top: var(--s6); max-width: 620px; }
.lookup-title { font-size: 20px; line-height: 1.3; letter-spacing: -0.012em; max-width: none; margin-bottom: var(--s3); }
.lookup { display: flex; box-shadow: var(--shadow); }
.lookup input {
  flex: 1; min-width: 0; height: 56px; padding: 0 var(--s3);
  font: 400 16px/1 var(--mono); color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-right: 0; border-radius: 0;
}
.lookup input:focus { border-color: var(--ink); outline: none; }
.lookup input::placeholder { color: var(--muted); }
.lookup .btn { height: 56px; }
.hero-alt { margin: var(--s3) 0 0; font: 400 13px/1.6 var(--mono); color: var(--muted); }
@media (max-width: 480px) {
  .lookup { flex-direction: column; }
  .lookup input { border-right: 1px solid var(--rule); border-bottom: 0; }
}

.fig-label { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--s3); }
.fig-tag { border: 1px solid var(--rule); padding: 3px 6px; color: var(--ink); }
.adoption { margin: 0; }
.adoption .table-wrap { box-shadow: var(--shadow); }
.adoption tr.is-current td { background: color-mix(in srgb, var(--moon) 30%, var(--surface)); }
.adoption tr.is-current td:first-child { box-shadow: inset 3px 0 0 var(--moon); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .adoption tr.is-current td { background: color-mix(in srgb, var(--moon) 14%, var(--surface)); } }
:root[data-theme="dark"] .adoption tr.is-current td { background: color-mix(in srgb, var(--moon) 14%, var(--surface)); }
.adoption figcaption { margin-top: var(--s3); font: 400 12px/1.6 var(--mono); color: var(--muted); }

/* Lookup result */
.result { margin-top: var(--s5); }
.result[hidden] { display: none; }
.result .table-wrap { box-shadow: var(--shadow); }
.result-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s4); margin-bottom: var(--s3); font: 400 13px/1.5 var(--mono); }
.result-head strong { font-size: 15px; }
.pills { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.pill { font: 500 12px/1 var(--mono); padding: var(--s2) 10px; border: 1px solid var(--rule); }
.pill-pass { background: var(--moon); color: var(--on-moon); border-color: var(--moon); }
.notice { padding: var(--s3); border: 1px solid var(--rule); background: var(--surface); font: 400 14px/1.6 var(--mono); }

/* Tables: mono data in a ruled box, numbers right-aligned (PlanetScale's 1px grid) */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); font: 400 14px/1.45 var(--mono); }
th, td { text-align: left; padding: 13px var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; line-height: 1; border-bottom: 1px solid var(--rule); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }

/* Sections: a mono "// 01" label on a full-width rule, then a 5/7 split (Miscreants) */
section.block { padding: 0 0 var(--section); }
.rule-label { margin: 0 0 var(--s6); padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s5) clamp(40px, 6vw, 96px); align-items: start; }
.split .section-head { position: sticky; top: var(--s5); }
.section-head .intro { margin-top: var(--s4); color: var(--muted); max-width: 44ch; }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .split .section-head { position: static; }
  .rule-label { margin-bottom: var(--s5); }
}
.prose { max-width: var(--measure); }

/* Ruled rows (Miscreants' service list) */
.rows { border-top: 1px solid var(--rule); }
.row { padding: var(--s5) 0; border-bottom: 1px solid var(--rule); }
.row:first-child { padding-top: var(--s4); }
.row h3 { display: flex; align-items: center; gap: 12px; margin-bottom: var(--s3); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.row h3::before { content: ""; flex: none; width: 10px; height: 10px; background: var(--moon); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 18%, transparent); }
.row p { max-width: var(--measure); }
.filters { margin-top: var(--s3); }
.filters li { position: relative; padding: 6px 0 6px 28px; max-width: var(--measure); }
.filters li::before { content: "+"; position: absolute; left: 4px; top: 6px; font: 500 15px/1.7 var(--mono); color: var(--muted); }
.example-list { margin-top: var(--s2); }
.example-list li { display: grid; grid-template-columns: 190px 1fr; gap: var(--s4); align-items: baseline; padding: 12px 0; border-top: 1px dashed var(--line); }
.example-list li:first-child { border-top: 0; }
@media (max-width: 560px) { .example-list li { grid-template-columns: 1fr; gap: var(--s1); } }

/* Agents */
.steps-intro { margin-bottom: var(--s3); }
.steps { counter-reset: step; border-top: 1px solid var(--rule); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 40px 1fr; gap: var(--s3); padding: 18px 0; border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(step, decimal-leading-zero); font: 500 13px/1.75 var(--mono); color: var(--muted); }
.steps code { font-weight: 500; }
pre.config {
  margin: var(--s6) 0 0; padding: var(--s5); overflow-x: auto;
  background: var(--invert-bg); color: var(--invert-fg);
  border: 1px solid var(--rule); border-radius: 0;
  font-size: 13px; line-height: 1.7;
}
.config-note { font: 400 12px/1.6 var(--mono); color: var(--muted); margin-top: var(--s3); }
@media (max-width: 480px) { pre.config { padding: var(--s4); font-size: 12px; } }

/* Pricing: a 2 by 2 ruled grid */
.plans { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rule); background: var(--surface); box-shadow: var(--shadow); }
.plan { padding: var(--s5) var(--s4); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.plan:nth-child(2n) { border-right: 0; }
.plan:nth-last-child(-n+2) { border-bottom: 0; }
.plan .name { margin-bottom: var(--s4); }
.plan .price { font: 500 44px/1 var(--sans); letter-spacing: -0.03em; margin-bottom: var(--s3); }
.plan .price small { font: 400 14px/1 var(--mono); letter-spacing: 0; color: var(--muted); }
.plan .credits { font: 400 14px/1.5 var(--mono); }
.plan-featured { background: var(--invert-bg); color: var(--invert-fg); }
.plan-featured .name, .plan-featured .price small { color: var(--invert-muted); }
@media (max-width: 480px) {
  .plans { grid-template-columns: 1fr; }
  .plan { border-right: 0; border-bottom: 1px solid var(--rule); padding: var(--s4); }
  .plan:nth-last-child(2) { border-bottom: 1px solid var(--rule); }
  .plan:last-child { border-bottom: 0; }
}
.pricing-note { margin-top: var(--s5); max-width: var(--measure); color: var(--muted); }
.free-grant { margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s4); }
.free-grant p { margin: 0; max-width: 48ch; }
@media (max-width: 480px) { .free-grant .btn { width: 100%; } }

/* FAQ */
.faq-list { border-top: 1px solid var(--rule); }
.faq-list details { border-bottom: 1px solid var(--rule); }
.faq-list summary { cursor: pointer; list-style: none; padding: var(--s4) 0; display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; font: 500 18px/1 var(--mono); color: var(--muted); }
.faq-list details[open] summary::after { content: "-"; }
.faq-list details p { padding: 0 0 var(--s4); margin: 0; max-width: var(--measure); }

/* Footer */
.site-footer { padding: var(--s5) 0 var(--s7); font: 400 12px/1.7 var(--mono); color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s4); }
.site-footer .wrap::before { content: ""; flex-basis: 100%; border-top: 1px solid var(--rule); margin-bottom: var(--s2); }
.site-footer p { margin: 0; max-width: 64ch; }

/* Sample lookup (Fig. 2) inside the first row */
.sample { margin: var(--s5) 0 0; }
.sample figcaption { margin-top: var(--s3); font: 400 12px/1.6 var(--mono); color: var(--muted); }

/* Hero figure: top-aligned with the copy so its label sits on the same line as the hero label */
.hero .adoption { padding-top: 0; }
.adoption .fig-label { margin-bottom: var(--s4); }
.adoption th, .adoption td { padding: 14px 18px; }

/* Example searches: a 2 by 2 ruled grid */
.example-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.example { padding: var(--s4); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--surface); display: flex; flex-direction: column; gap: var(--s3); }
.example .who { margin: 0; font: 500 12px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.example .what { margin: 0; font-size: 19px; line-height: 1.45; font-weight: 500; letter-spacing: -0.01em; }
.example .filters-used { margin: auto 0 0; font: 400 12px/1.5 var(--mono); color: var(--muted); }
@media (max-width: 640px) { .example-grid { grid-template-columns: 1fr; } }

/* Pricing comparison table */
.plan-table { font-size: 14px; }
.plan-table th, .plan-table td { padding: 16px 18px; vertical-align: middle; }
.plan-table thead th { font: 600 16px/1.2 var(--sans); letter-spacing: -0.01em; text-transform: none; color: var(--ink); padding-top: 20px; padding-bottom: 20px; }
.plan-table tbody th { font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.plan-table td { font-variant-numeric: tabular-nums; }
.plan-table .price-row td { font: 400 14px/1 var(--mono); color: var(--muted); }
.plan-table .price-row strong { font: 500 30px/1 var(--sans); letter-spacing: -0.03em; color: var(--ink); margin-right: 4px; }
.plan-table .is-rec { background: color-mix(in srgb, var(--moon) 16%, var(--surface)); }
.plan-table thead .is-rec { box-shadow: inset 0 3px 0 var(--moon); }
.rec-tag { display: block; margin-top: 6px; font: 500 10px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .plan-table .is-rec { background: color-mix(in srgb, var(--moon) 8%, var(--surface)); } }
:root[data-theme="dark"] .plan-table .is-rec { background: color-mix(in srgb, var(--moon) 8%, var(--surface)); }
.topup { margin-top: var(--s4); font-size: 16px; }
.topup strong { font-weight: 600; }
.pricing-note { margin-top: var(--s3); font-size: 15px; }
@media (max-width: 560px) { .plan-table th, .plan-table td { padding: 12px 10px; } .plan-table .price-row strong { font-size: 24px; } }

/* Pricing spans the full width so four plans fit without wrapping */
#pricing .split { grid-template-columns: 1fr; gap: var(--s5); }
#pricing .split .section-head { position: static; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s4) clamp(40px, 6vw, 96px); align-items: end; }
#pricing .section-head .intro { margin-top: 0; }
#pricing .section-head h2 { max-width: none; }
.plan-table td, .plan-table th { white-space: nowrap; }
.plan-table tbody th { width: 22%; }
@media (max-width: 900px) { #pricing .split .section-head { grid-template-columns: 1fr; } }

/* Free credits call to action */
.free-grant { padding: var(--s5); border: 1px solid var(--rule); background: color-mix(in srgb, var(--moon) 14%, var(--surface)); box-shadow: inset 4px 0 0 var(--moon); }
.free-grant h3 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: var(--s2); }
.free-grant p { max-width: 52ch; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .free-grant { background: color-mix(in srgb, var(--moon) 7%, var(--surface)); } }
:root[data-theme="dark"] .free-grant { background: color-mix(in srgb, var(--moon) 7%, var(--surface)); }
