:root {
  --bg: #f3efe6;
  --bg-elevated: rgba(255, 250, 240, 0.72);
  --bg-strong: #f7f1e7;
  --ink: #1f2522;
  --muted: #5d675f;
  --line: rgba(31, 37, 34, 0.12);
  --accent: #155e63;
  --accent-soft: #6db4a7;
  --signal: #8d3f2f;
  --signal-soft: #e1a587;
  --gold: #b89047;
  --positive: #2f7f66;
  --negative: #a44433;
  --shadow: 0 18px 60px rgba(34, 31, 24, 0.12);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --max-width: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(212, 188, 120, 0.22), transparent 26rem),
    radial-gradient(circle at 85% 20%, rgba(109, 180, 167, 0.14), transparent 24rem),
    linear-gradient(180deg, #f7f4ec 0%, #f3efe6 38%, #ece4d7 100%);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  line-height: 1.6;
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

code {
  padding: 0.12rem 0.36rem;
  border-radius: 999px;
  background: rgba(21, 94, 99, 0.08);
  font-family: "SFMono-Regular", "Consolas", monospace;
  font-size: 0.92em;
}

.page-shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(243, 239, 230, 0.78);
  border-bottom: 1px solid var(--line);
  z-index: -1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--signal-soft));
  box-shadow: 0 0 0 4px rgba(21, 94, 99, 0.08);
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-nav a {
  padding-bottom: 0.18rem;
  border-bottom: 1px solid transparent;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  color: var(--ink);
  border-color: currentColor;
}

.section {
  padding: 5.5rem 0;
}

.section + .section {
  border-top: 1px solid rgba(31, 37, 34, 0.08);
}

.hero-section {
  padding-top: 3rem;
}

.hero-copy {
  display: grid;
  gap: 1.2rem;
  max-width: none;
}

.hero-copy h1,
.section-head h2,
.section-copy h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.97;
}

.hero-copy h1 {
  font-size: clamp(2.6rem, 2.6vw, 4.8rem);
  max-width: none;
  line-height: 1.02;
}

.hero-dek,
.section-dek,
.hero-summary,
.section-copy p,
.detail-copy p,
.method-grid p {
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-summary {
  display: grid;
  gap: 0.55rem;
  max-width: none;
}

.hero-story {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  margin-top: 3rem;
  align-items: start;
}

.sticky-figure {
  position: relative;
  top: auto;
}

.chart-frame,
.takeaway-panel,
.story-step,
.snapshot-card,
.detail-note {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(31, 37, 34, 0.09);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 248, 240, 0.62)),
    var(--bg-elevated);
  box-shadow: var(--shadow);
}

.chart-frame::after,
.takeaway-panel::after,
.snapshot-card::after,
.story-step::after,
.detail-note::after {
  content: "";
  position: absolute;
  inset: auto auto 0 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(184, 144, 71, 0.45), rgba(21, 94, 99, 0.06));
}

.frame-label,
.snapshot-label,
.metric-label,
.chip {
  display: inline-flex;
  width: fit-content;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(21, 94, 99, 0.08);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart-frame {
  padding: 1.1rem 1rem 1.1rem;
}

.hero-frame {
  min-height: 58rem;
}

.chart-slot {
  min-height: 16rem;
}

.hero-frame .chart-slot {
  min-height: 50rem;
}

.chart-medium {
  min-height: 25rem;
}

.chart-large {
  min-height: 30rem;
}

.chart-small {
  min-height: 15rem;
}

.story-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.story-step {
  padding: 1.35rem 1.4rem 1.45rem;
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease;
}

.story-step.is-active {
  transform: translateY(-4px);
  border-color: rgba(21, 94, 99, 0.28);
  background:
    linear-gradient(180deg, rgba(240, 252, 250, 0.9), rgba(255, 246, 236, 0.8)),
    var(--bg-elevated);
}

.step-index {
  display: block;
  margin-bottom: 0.65rem;
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.story-step h2,
.detail-note h3 {
  margin: 0 0 0.45rem;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: 1.1rem;
  line-height: 1.1;
}

.story-step p,
.detail-note p,
.snapshot-body p,
.method-grid p,
.takeaway-list li {
  margin: 0;
  color: var(--muted);
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 2rem;
  align-items: start;
}

.narrow {
  max-width: 40rem;
}

.section-head {
  display: grid;
  gap: 0.8rem;
  max-width: none;
  margin-bottom: 2rem;
}

.section-head h2 {
  font-size: clamp(1.95rem, 3.4vw, 3.25rem);
  line-height: 1.04;
}

.section-copy h2 {
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 1.05;
}

.snapshot-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.snapshot-card {
  padding: 1.4rem;
}

.snapshot-card h3 {
  margin: 0.55rem 0 0.3rem;
  font-size: 1.6rem;
}

.snapshot-body {
  display: grid;
  gap: 0.8rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.metric {
  padding: 0.95rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(31, 37, 34, 0.08);
}

.metric-value {
  margin-top: 0.2rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.metric-value.positive {
  color: var(--positive);
}

.metric-value.negative {
  color: var(--negative);
}

.snapshot-grid {
  align-items: center;
}

.detail-section {
  display: grid;
  gap: 1.6rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(20rem, 0.8fr);
  gap: 1.6rem;
}

.detail-sticky {
  position: sticky;
  top: 6.5rem;
  display: grid;
  gap: 1rem;
}

.chart-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.detail-copy {
  display: grid;
  gap: 1rem;
}

.detail-note {
  padding: 1.25rem 1.35rem;
}

.annotation-list,
.takeaway-list {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
}

.annotation-list li + li,
.takeaway-list li + li {
  margin-top: 0.65rem;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.takeaway-panel {
  height: 100%;
  padding: 1.4rem;
}

.takeaway-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.takeaway-list {
  margin-top: 1rem;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.alt-surface {
  background: linear-gradient(180deg, rgba(222, 235, 231, 0.18), rgba(240, 229, 216, 0.28));
  border-radius: 3rem;
  padding-inline: clamp(1rem, 3vw, 2rem);
}

.site-footer {
  padding-bottom: 3rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.chart-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  max-width: 18rem;
  padding: 0.75rem 0.85rem;
  border-radius: 1rem;
  background: rgba(23, 28, 27, 0.92);
  color: #fbf7ef;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  font-size: 0.9rem;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 0, 0);
  transition: opacity 140ms ease;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.axis path,
.axis line,
.domain {
  stroke: rgba(31, 37, 34, 0.18);
}

.grid line {
  stroke: rgba(31, 37, 34, 0.08);
}

.axis text,
.grid text,
.chart-title,
.annotation-label {
  fill: rgba(31, 37, 34, 0.76);
  font-size: 12px;
}

.series-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1080px) {
  .hero-story,
  .section-grid,
  .detail-layout,
  .comparison-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .sticky-figure,
  .detail-sticky {
    position: relative;
    top: auto;
  }

  .story-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(calc(100% - 1rem), var(--max-width));
  }

  .site-header,
  .site-footer,
  .section {
    padding-left: 0.2rem;
    padding-right: 0.2rem;
  }

  .top-nav {
    justify-content: flex-start;
    font-size: 0.88rem;
  }

  .snapshot-cards,
  .chart-row,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    font-size: clamp(3rem, 13vw, 4.8rem);
  }

  .section-head h2 {
    font-size: clamp(2.2rem, 10vw, 3.2rem);
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
