/*
 * BaseURL marketing site. One stylesheet, no framework, no web fonts.
 * Tokens match the dashboard (src/app/globals.css) so the two feel like
 * one product. Light and dark are chosen by prefers-color-scheme.
 * No inline styles anywhere, so the strict CSP in _headers holds.
 */
:root {
  color-scheme: light;
  --plane: #f9f9f7;
  --surface: #ffffff;
  --surface-2: #f2f1ee;
  --ink: #0b0b0b;
  --ink-2: #3f3e3b;
  --muted: #5f5e5a;
  --border: rgba(11, 11, 11, 0.12);
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-soft: #e8effd;
  --code-bg: #111214;
  --code-ink: #e8e8e6;
  --code-muted: #a3a29c;
  --code-accent: #8dbcf2;
  --focus: #2563eb;
  /* Brand gradient (the logo), deeper on light surfaces for contrast. */
  --brand-1: #0e7490;
  --brand-2: #2563eb;
  --brand-3: #9333ea;
  --radius: 10px;
  --max: 72rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --plane: #0d0d0d;
    --surface: #161615;
    --surface-2: #1f1f1d;
    --ink: #f0efec;
    --ink-2: #d2d1cb;
    --muted: #a8a69f;
    --border: rgba(255, 255, 255, 0.14);
    --accent: #38bdf8;
    --accent-hover: #7dd3fc;
    --accent-ink: #0b0b0b;
    --accent-soft: #0f2536;
    --code-bg: #070708;
    --code-ink: #e8e8e6;
    --code-muted: #9c9a93;
    --code-accent: #8dbcf2;
    --focus: #7dd3fc;
    --brand-1: #22d3ee;
    --brand-2: #3b82f6;
    --brand-3: #a855f7;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--plane);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 0.6em; }
h1 { font-size: clamp(2rem, 6vw, 3.5rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

code, pre, kbd { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.35em;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
}
.skip-link:focus { top: 1rem; color: var(--accent-ink); }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.narrow { max-width: 46rem; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-mark { flex: none; display: block; }
.wordmark { letter-spacing: -0.01em; }
.wordmark-accent, .text-gradient {
  color: var(--brand-2);
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav { display: flex; align-items: center; gap: 0.5rem 1.25rem; flex-wrap: wrap; }
.nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--ink); text-decoration: underline; }
.nav .btn { color: var(--accent-ink); }
.nav .btn:hover { color: var(--accent-ink); text-decoration: none; }
.nav .btn-secondary { color: var(--ink); }
.nav .btn-secondary:hover { color: var(--ink); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--muted); }
.btn-small { min-height: 2.4rem; padding: 0.4rem 0.9rem; font-size: 0.95rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

/* Hero */
.hero { padding: 4.5rem 0 3.5rem; }
.eyebrow {
  display: inline-block;
  margin: 0 0 1.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}
.hero h1 { max-width: 20ch; }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 40rem; }
.fineprint { font-size: 0.95rem; color: var(--muted); margin-top: 1rem; }
.hero-grid { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 60rem) {
  .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}
.diff-card pre { font-size: 0.95rem; line-height: 1.9; }
.diff-card .del { color: #f2a7a0; }
.diff-card .add { color: #9be09b; font-weight: 700; }
.diff-note { margin: 0; padding: 0.75rem 1rem; border-top: 1px solid rgba(255, 255, 255, 0.1); color: var(--code-muted); font-size: 0.9rem; }

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.step-num {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.75rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

/* Sections */
.section { padding: 3.5rem 0; border-top: 1px solid var(--border); }
.section-intro { color: var(--ink-2); max-width: 40rem; margin-bottom: 2rem; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card p { color: var(--ink-2); margin: 0; }
.tag {
  display: inline-block;
  margin-top: 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

/* Code */
.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: 1.25rem;
}
figure { margin: 0; min-width: 0; }
.code-card {
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-card figcaption {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--code-muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}
.code-card pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.875rem;
}
.code-card pre:focus-visible { outline-offset: -3px; }
.code-card .hl { color: var(--code-accent); font-weight: 700; }
.code-card .cm { color: var(--code-muted); }

/* Table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; }
caption {
  text-align: left;
  padding: 0.9rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
}
th, td { text-align: left; padding: 0.8rem 1rem; vertical-align: top; }
thead th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
tbody tr + tr th, tbody tr + tr td { border-top: 1px solid var(--border); }
tbody th { font-weight: 600; }
td code { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.models .model-name { display: block; font-weight: 600; }
.models td code { font-size: 0.85em; color: var(--muted); }
@media (max-width: 40rem) {
  .models thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .models tr { display: block; padding: 0.75rem 1rem; }
  .models tbody tr + tr { border-top: 1px solid var(--border); }
  .models th, .models td { display: flex; justify-content: space-between; gap: 1rem; padding: 0.2rem 0; border: 0; text-align: right; }
  .models tbody tr + tr th, .models tbody tr + tr td { border-top: 0; }
  .models th { text-align: left; }
  .models td::before { content: attr(data-label); color: var(--muted); font-size: 0.9rem; text-align: left; }
  .models td .model-name { display: inline; }
  .models td code { display: block; }
}

/* FAQ */
.faq { display: grid; gap: 0.75rem; }
details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
summary {
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-weight: 600;
  list-style-position: inside;
}
summary:focus-visible { outline-offset: -3px; }
details > div { padding: 0 1.25rem 1.1rem; color: var(--ink-2); }
details > div p:last-child { margin-bottom: 0; }

/* Final call to action */
.cta {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 1.5rem;
  text-align: center;
}
.cta .actions { justify-content: center; }
.cta p { color: var(--ink-2); margin-left: auto; margin-right: auto; max-width: 36rem; }

/* Legal pages */
.legal { padding: 3rem 0 4rem; }
.legal h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); }
.legal h2 { font-size: 1.35rem; margin-top: 2.25rem; }
.legal h3 { font-size: 1.05rem; margin-top: 1.5rem; }
.legal p, .legal li { color: var(--ink-2); }
.legal ul, .legal ol { padding-left: 1.4rem; margin: 0 0 1em; }
.legal li + li { margin-top: 0.35em; }
.meta-line { color: var(--muted); font-size: 0.95rem; }
.placeholder {
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0 0.25em;
  font-weight: 600;
  color: var(--ink);
}
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 1rem;
}
.toc h2 { font-size: 1rem; margin: 0 0 0.5rem; }
.toc ol { margin: 0; columns: 2 14rem; column-gap: 2rem; }
.toc li { break-inside: avoid; }

/* 404 */
.notfound { padding: 6rem 0; text-align: center; }
.notfound .actions { justify-content: center; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}
.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--ink); }
.site-footer p { margin: 0; }

@media (max-width: 40rem) {
  .hero { padding: 3rem 0 2.5rem; }
  .section { padding: 2.75rem 0; }
  .nav .nav-text { display: none; }
}

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