/* ---------- Tokens ---------- */
:root {
  --bg: #f6f3ec;
  --bg-alt: #eee9de;
  --surface: #fffdf8;
  --ink: #16202b;
  --ink-soft: #46515e;
  --muted: #6e7883;
  --line: #ddd6c7;
  --accent: #1f5f5b;
  --accent-ink: #ffffff;
  --accent-soft: #d9e8e4;
  --flag: #a4502a;
  --code-bg: #16202b;
  --code-ink: #e6e2d8;
  --code-kw: #8fc7bd;
  --code-str: #e2b57c;
  --code-com: #8a94a0;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 10px;
  --wrap: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --bg-alt: #171c23;
    --surface: #1c222a;
    --ink: #ece8df;
    --ink-soft: #b9bfc6;
    --muted: #8a939d;
    --line: #2c343e;
    --accent: #6fb8ad;
    --accent-ink: #0f1a19;
    --accent-soft: #1f3431;
    --flag: #e08a5f;
    --code-bg: #0c1015;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(2.2rem, 5.2vw, 3.6rem); max-width: 18ch; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

code { font-family: var(--mono); font-size: 0.88em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.muted { color: var(--muted); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
}
.wordmark-light { font-weight: 400; color: var(--ink-soft); }
.mark { width: 26px; height: 26px; fill: var(--accent); }
.nav { display: flex; gap: 22px; }
.nav a { color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; font-weight: 500; }
.nav a:hover { color: var(--ink); }
@media (max-width: 640px) { .nav { display: none; } }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 72px; }
.epigraph { margin: 0 0 1.6em; font-family: var(--serif); color: var(--muted); }
.epigraph blockquote { margin: 0; font-style: italic; font-size: 1.08rem; color: var(--ink-soft); }
.epigraph figcaption { margin-top: 2px; font-size: 0.92rem; }
.epigraph cite { font-style: italic; }
.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 60ch; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2em; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.1s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { border-color: var(--line); color: var(--ink); background: var(--surface); }

/* ---------- Stats ---------- */
.stats { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); padding: 32px 0 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
@media (min-width: 820px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { display: flex; flex-direction: column; }
.stat-value { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.92rem; }
.stats-note { color: var(--muted); font-size: 0.85rem; margin: 18px auto 0; }

/* ---------- Sections ---------- */
.section { padding: 88px 0; }
.section-alt { background: var(--bg-alt); }
.section > .wrap > h2 { margin-bottom: 1.2em; }

.two-col { display: grid; gap: 48px; align-items: center; }
.two-col-top { align-items: start; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* ---------- Timeline ---------- */
.timeline-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 24px 18px;
}
.timeline-caption { font-weight: 600; margin-bottom: 18px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
}
.timeline li { display: flex; gap: 16px; align-items: flex-start; padding: 8px 0; position: relative; }
.tl-version {
  flex: 0 0 44px;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 3px 0;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  position: relative;
}
.tl-body { display: flex; flex-direction: column; }
.tl-date { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-event { font-size: 0.97rem; }
.tl-event s { color: var(--muted); }
.tl-flag .tl-version { border-color: var(--flag); color: var(--flag); }
.tl-last .tl-version { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.timeline-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 0.88rem; }

/* ---------- Cards ---------- */
.card-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 8px;
}
.card p { color: var(--ink-soft); font-size: 0.97rem; }

/* ---------- Dataset ---------- */
.config-list { margin: 0 0 28px; }
.config-list > div { padding: 16px 0; border-bottom: 1px solid var(--line); }
.config-list > div:first-child { padding-top: 0; }
.config-list dt code { font-size: 1.05rem; font-weight: 500; color: var(--accent); }
.config-list dd { margin: 6px 0 0; color: var(--ink-soft); }
.facts { list-style: none; padding: 0; margin: 0; }
.facts li { padding: 6px 0; color: var(--ink-soft); }
.facts strong { color: var(--ink); }

.code {
  margin: 0 0 28px;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius);
  padding: 20px 22px;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
}
.code code { font-size: inherit; }
.c-kw { color: var(--code-kw); }
.c-str { color: var(--code-str); }
.c-com { color: var(--code-com); font-style: italic; }

.roadmap {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 18px;
}
.roadmap h3 { font-size: 1.05rem; margin-bottom: 0.3em; }
.roadmap p { color: var(--ink-soft); margin: 0; font-size: 0.97rem; }

/* ---------- Licensing ---------- */
.license-grid { display: grid; gap: 20px; }
@media (min-width: 760px) { .license-grid { grid-template-columns: 1fr 1fr; } }
.license {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
}
.license-featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.license-tag { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin: 0; }
.license-price { font-family: var(--serif); font-size: 1.9rem; font-weight: 600; margin: 4px 0 14px; }
.license ul { margin: 0 0 24px; padding-left: 1.1em; color: var(--ink-soft); flex: 1; }
.license li { padding: 3px 0; }
.license .btn { align-self: flex-start; overflow-wrap: anywhere; }
.fine { margin-top: 24px; font-size: 0.88rem; color: var(--muted); max-width: 75ch; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact p { color: var(--ink-soft); }
.contact-links a { font-size: 1.2rem; font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 40px; font-size: 0.88rem; color: var(--ink-soft); }
.footer-inner p { max-width: 80ch; }
.timeline-sub { display: block; font-weight: 400; font-size: 0.85rem; font-family: var(--mono); margin-top: 2px; }

/* ---------- Comparison ---------- */
.compare { margin: 28px 0 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.compare > div { display: grid; grid-template-columns: 11rem 1fr; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.compare > div:first-child { border-top: 0; }
.compare dt { font-weight: 600; font-size: 0.92rem; }
.compare dd { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.compare-us { background: var(--accent-soft); }
.compare-us dt { color: var(--accent); }
@media (max-width: 480px) { .compare > div { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Delivery options ---------- */
.delivery-grid { display: grid; gap: 20px; margin-bottom: 64px; }
@media (min-width: 760px) { .delivery-grid { grid-template-columns: 1fr 1fr; } }
.delivery {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.delivery p { color: var(--ink-soft); margin: 0; }
.delivery-icon {
  width: 36px; height: 36px; padding: 7px;
  border-radius: 8px;
  background: var(--accent-soft);
  stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  margin-bottom: 14px;
}
.included > div > h3 { font-size: 1.35rem; margin-bottom: 0.8em; }
.included .facts { margin-bottom: 28px; }
.code-caption { color: var(--ink-soft); font-size: 0.95rem; }
.included-lede { color: var(--ink-soft); margin-bottom: 0.4em; }
.included-list { margin: 0 0 24px; padding-left: 1.1em; color: var(--ink); }
.included-list li { padding: 3px 0; }

/* ---------- Footer nav ---------- */
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 1em; }
.footer-nav a { color: var(--ink-soft); }

/* ---------- Article pages (guides, cite, 404) ---------- */
.article { padding: 64px 0 88px; }
.article .wrap { max-width: 760px; }
.article h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); max-width: 22ch; }
.article h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); margin-top: 1.8em; }
.article p, .article li { color: var(--ink-soft); }
.article strong { color: var(--ink); }
.article ul, .article ol { padding-left: 1.2em; margin: 0 0 1.2em; }
.article li { padding: 3px 0; }
.breadcrumb { font-size: 0.88rem; color: var(--muted); margin-bottom: 1.4em; }
.breadcrumb a { color: var(--muted); }
.article-meta { color: var(--muted); font-size: 0.9rem; }
.article .code { margin: 1.2em 0 1.6em; }
.table-wrap { overflow-x: auto; margin: 1.2em 0 0.6em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.data-table { border-collapse: collapse; width: 100%; font-size: 0.93rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 10px 14px; text-align: right; border-top: 1px solid var(--line); }
.data-table td { white-space: nowrap; }
.data-table thead th { vertical-align: bottom; line-height: 1.3; }
.data-table thead th { border-top: 0; font-weight: 600; color: var(--ink); background: var(--bg-alt); }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table tr.total td { font-weight: 600; color: var(--ink); }
.table-note { font-size: 0.85rem; color: var(--muted); }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 22px 24px; margin: 2em 0; }
.callout p { color: var(--ink); margin: 0 0 0.8em; }
.callout .btn { margin-top: 4px; }
.guide-list { list-style: none; padding: 0; display: grid; gap: 16px; }
.guide-list li { padding: 0; }
.guide-list a { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.guide-list a:hover { border-color: var(--accent); }
.guide-list strong { display: block; font-family: var(--serif); font-size: 1.2rem; color: var(--ink); margin-bottom: 4px; }
.guide-list span { color: var(--ink-soft); font-size: 0.97rem; }
