:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #1c2430;
  --muted: #647084;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-2: #9f1239;
  --warm: #f7c948;
  --soft: #eef6f4;
  --shadow: 0 10px 30px rgba(18, 31, 46, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-root {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 260px;
}

.brand-mark {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.section-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 980px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.15;
  white-space: nowrap;
}

.nav-link:hover {
  border-color: var(--line);
  background: var(--soft);
  text-decoration: none;
}

.caveat-strip {
  padding: 10px clamp(18px, 4vw, 48px);
  background: #fff7d6;
  border-bottom: 1px solid #ead58a;
  color: #5f4a00;
  font-size: 13px;
  line-height: 1.4;
}

.page-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 26px 0 44px;
}

.intro-grid,
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.intro-copy,
.section-band,
.control-panel,
.chart-stack {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro-copy,
.section-band {
  padding: 22px;
}

.section-band {
  margin-top: 22px;
}

.control-panel {
  padding: 18px;
}

.chart-stack {
  margin-top: 22px;
  padding: 16px;
}

.chart-stack > * + * {
  margin-top: 12px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.08;
}

h2 {
  margin: 0 0 14px;
  font-size: 20px;
  line-height: 1.25;
}

.lede {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

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

.metric-card {
  min-height: 122px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-label,
.metric-detail {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.metric-value {
  display: block;
  margin: 8px 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
}

.surface-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.surface-link {
  display: block;
  min-height: 46px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.control-label {
  display: block;
  margin: 14px 0 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.control-label:first-child {
  margin-top: 0;
}

.command-button {
  width: 100%;
  min-height: 40px;
  margin-top: 16px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.command-button:hover {
  background: #115e59;
}

.command-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.command-row .command-button {
  margin-top: 0;
}

.command-button.primary {
  background: var(--accent-2);
}

.command-button.primary:hover {
  background: #7f1230;
}

.section-heading {
  margin-top: 18px;
  padding-top: 4px;
  font-size: 17px;
}

.segmented-control label {
  display: block;
  margin: 7px 0;
  font-size: 14px;
}

.educational-grid {
  margin-top: 12px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.slider-control {
  margin-bottom: 14px;
}

.interpretation {
  margin: 4px 0 10px;
  padding: 12px 14px;
  background: var(--soft);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  color: #21443f;
  font-size: 14px;
  line-height: 1.45;
}

.provenance-panel {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}

.provenance-panel summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.shareable-link {
  margin-top: 14px;
}

.shareable-link .surface-link {
  margin-top: 6px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 650;
}

.method-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.method-list + .surface-grid {
  margin-top: 16px;
}

.footer {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 860px) {
  .topbar,
  .intro-grid,
  .two-column,
  .surface-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: block;
  }

  .nav {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .nav-link {
    white-space: normal;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .command-row {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(100vw - 18px, 760px);
    padding-top: 18px;
  }
}
