:root {
  color-scheme: light dark;
  --text: #1c1b19;
  --muted: #5f5b54;
  --rule: #e2ddd5;
  --accent: #b3593f;
  --accent-strong: #9c4a33;
  --bg: #faf9f7;
  --surface: #ffffff;
  --quote-bg: #f5f2ee;
  --nav-bg: rgba(250, 249, 247, 0.92);
  --shadow: 0 1px 3px rgba(28, 27, 25, 0.07), 0 8px 24px rgba(28, 27, 25, 0.05);
  --on-accent: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e8e5e0;
    --muted: #a39e96;
    --rule: #35322d;
    --accent: #d1785c;
    --accent-strong: #dd8f76;
    --bg: #171614;
    --surface: #201e1b;
    --quote-bg: #242220;
    --nav-bg: rgba(23, 22, 20, 0.92);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    --on-accent: #211511;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 106.25%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 0.5rem 1rem;
  z-index: 20;
}

.skip:focus {
  left: 0;
}

/* Navigation */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.nav-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--text);
  letter-spacing: 0.01em;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.nav-toggle-bars {
  display: inline-block;
  width: 16px;
  height: 2px;
  background: currentColor;
  position: relative;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: currentColor;
}

.nav-toggle-bars::before {
  top: -5px;
}
.nav-toggle-bars::after {
  top: 5px;
}

.nav-links {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.nav-links a {
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--muted);
}

.nav-links a:hover {
  color: var(--accent-strong);
}

/* Hero */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--rule);
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-strong);
  margin: 0 0 1rem;
}

h1 {
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
}

.subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 2.5rem;
  max-width: 56ch;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.stat-num {
  display: block;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-strong);
}

.stat-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 0.25rem;
}

/* Sections */
section {
  padding: 3rem 0 0.5rem;
}

h2 {
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
}

h3 {
  font-size: 1.05rem;
  margin: 1.75rem 0 0.5rem;
}

p {
  margin: 0 0 1rem;
}

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

a:hover {
  color: var(--accent-strong);
}

.scope-note {
  background: var(--quote-bg);
  border-radius: 8px;
  padding: 0.85rem 1.1rem;
  font-size: 0.92rem;
  color: var(--muted);
}

blockquote {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--accent);
  background: var(--quote-bg);
  border-radius: 0 8px 8px 0;
}

blockquote p {
  margin: 0;
}

ul,
ol {
  padding-left: 1.4rem;
  margin: 0 0 1rem;
}

li {
  margin-bottom: 0.6rem;
}

.data-list li {
  margin-bottom: 0.8rem;
}

.tldr-list {
  list-style: none;
  padding-left: 0;
}

.tldr-list li {
  margin-bottom: 0.9rem;
  padding-left: 1.1rem;
  border-left: 3px solid var(--accent);
}

/* Steps */
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.5rem 3.2rem;
  margin: 0;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 1.02rem;
  top: 2.5rem;
  bottom: 0.2rem;
  width: 2px;
  background: var(--rule);
}

.steps h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.steps p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.steps p a {
  color: var(--text);
}

/* Chart */
.chart-block {
  margin: 2rem 0;
  padding: 1.5rem 1.25rem 1.25rem;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.chart-title {
  font-weight: 650;
  color: #1c1b19;
  margin: 0 0 1rem;
}

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

.chart-scroll svg {
  display: block;
  width: 100%;
  min-width: 540px;
  height: auto;
}

.chart-block .val {
  font-size: 20px;
  font-weight: 650;
  fill: #1c1b19;
  text-anchor: middle;
}

.chart-block .yr {
  font-size: 18px;
  fill: #5f5b54;
  text-anchor: middle;
}

.chart-block .note {
  font-size: 15px;
  fill: #5f5b54;
  text-anchor: middle;
}

.chart-block .cat {
  font-size: 17px;
  fill: #5f5b54;
}

.chart-source {
  font-size: 0.8rem;
  color: #5f5b54;
  margin: 0.75rem 0 0;
}

.post-figure {
  margin: 2rem 0;
}

.post-figure img {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 12px;
}

.post-figure figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.llm-block {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--quote-bg);
  border-radius: 12px;
}

.llm-block h3 {
  margin-top: 0;
}

.llm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 0.75rem;
}

.llm-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.chart-block figcaption {
  font-size: 0.85rem;
  color: #5f5b54;
  margin-top: 0.35rem;
}

/* Template cards */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.template-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.template-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.template-card p {
  font-size: 0.88rem;
  color: var(--muted);
  flex: 1;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--accent);
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
}

.btn:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--on-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--accent-strong);
}

.btn-ghost:hover {
  background: var(--quote-bg);
  color: var(--accent-strong);
}

/* Footer */
footer {
  margin-top: 4rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--muted);
}

footer p {
  margin-bottom: 0.75rem;
}

@media (max-width: 560px) {
  .hero {
    padding: 2.5rem 0 2rem;
  }

  .nav-toggle:not([hidden]) {
    display: inline-flex;
  }

  /* With JS active (.js-nav), collapse the links behind the toggle */
  .nav-links.js-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    gap: 0;
    padding: 0.25rem 0 0.5rem;
  }

  .nav-links.js-nav.open {
    display: flex;
  }

  .nav-links.js-nav a {
    padding: 0.6rem 0;
    font-size: 0.95rem;
    border-top: 1px solid var(--rule);
  }

  /* Without JS the links simply wrap, as before */
  .nav-links:not(.js-nav) {
    gap: 0.8rem;
  }
}

@media print {
  :root {
    --text: #000;
    --muted: #333;
    --rule: #999;
    --accent: #000;
    --accent-strong: #000;
    --bg: #fff;
    --surface: #fff;
    --quote-bg: #f2f2f2;
    --nav-bg: #fff;
    --shadow: none;
    --on-accent: #fff;
  }

  .topnav,
  .hero-actions,
  .card-actions,
  .skip {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .stat,
  .template-card,
  .chart-block {
    box-shadow: none;
    border: 1px solid #999;
  }

  a {
    color: #000;
  }

  main a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    word-break: break-all;
    color: #333;
  }

  .chart-scroll {
    overflow: visible;
  }

  .chart-scroll svg {
    min-width: 0;
  }

  section {
    padding-top: 1.5rem;
  }

  .steps > li::before {
    background: #000;
    color: #fff;
  }

  @page {
    margin: 2cm;
  }
}

.lead {
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 60ch;
  margin: 0 0 1.5rem;
}

.hero-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.chart-scroll:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.editorial-note {
  border-left: 3px solid var(--accent);
  background: var(--quote-bg);
  border-radius: 0 8px 8px 0;
  padding: 0.85rem 1.1rem;
  font-weight: 600;
  font-size: 0.92rem;
}

/* Contact form */
.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.form-field textarea {
  resize: vertical;
}

.form-field input:focus-visible,
.form-field select:focus-visible,
.form-field textarea:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

#cf-status {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
}
