/* ==========================================================
   Check In On Them — styles
   Palette: cool mist + navy ink; amber = the burden; teal = improvement & help
   ========================================================== */

:root {
  --bg: #EEF2F6;
  --ink: #1B2A41;
  --muted: #53647C;
  --rule: #CCD6E2;
  --amber: #E39A2D;
  --chart-amber: #B56B12;
  --chart-slate: #687C96;
  --teal: #1E7568;
  --recs-bg: #E2EEE9;
  --recs-muted: #53647C;
  --slate: #8C9AAE;
  --link: #1D5C93;
  --help-bg: #163F3A;
  --help-ink: #F1F6F4;
  --bar-bg: #1B2A41;
  --bar-ink: #EEF2F6;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121C2C;
    --ink: #E5EBF3;
    --muted: #9DAEC4;
    --rule: #2B3B53;
    --amber: #ECA543;
    --chart-amber: var(--amber);
    --chart-slate: var(--slate);
    --teal: #5CC4B2;
    --recs-bg: #172B30;
    --recs-muted: #A5B8C9;
    --slate: #6F829E;
    --link: #8CC3F0;
    --help-bg: #0F3531;
    --help-ink: #EAF4F1;
    --bar-bg: #0D2D2A;
    --bar-ink: #E5EBF3;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121C2C;
  --ink: #E5EBF3;
  --muted: #9DAEC4;
  --rule: #2B3B53;
  --amber: #ECA543;
  --chart-amber: var(--amber);
  --chart-slate: var(--slate);
  --teal: #5CC4B2;
  --recs-bg: #172B30;
  --recs-muted: #A5B8C9;
  --slate: #6F829E;
  --link: #8CC3F0;
  --help-bg: #0F3531;
  --help-ink: #EAF4F1;
  --bar-bg: #0D2D2A;
  --bar-ink: #E5EBF3;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.12;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }
p + p { margin-top: 1em; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 100;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 6px;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 40px);
}

.prose { max-width: 40rem; }

/* ---------- Help bar ---------- */
.helpbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bar-bg);
  color: var(--bar-ink);
  padding: calc(9px + env(safe-area-inset-top, 0px)) clamp(16px, 4vw, 32px) 9px;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: center;
}
.helpbar a { color: inherit; font-weight: 700; text-decoration: underline; }
.helpbar a {
  margin-inline-start: 0.35em;
  white-space: nowrap;
}
.helpbar a:focus-visible { outline-color: var(--bar-ink); }
.help a:focus-visible { outline-color: var(--help-ink); }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(40px, 8vh, 96px) 0 clamp(24px, 4vh, 48px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}

.kicker {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.hero-num {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(5.25rem, 15vw, 11rem);
  line-height: 0.88;
  letter-spacing: -0.035em;
  margin: 0.12em 0 0.2em;
  font-variation-settings: "opsz" 72;
  white-space: nowrap;
}

.hero-line {
  font-size: clamp(1.25rem, 2.3vw, 1.6rem);
  line-height: 1.35;
  font-weight: 500;
  max-width: 24ch;
}

.hero-sub {
  margin-top: 1.1em;
  color: var(--muted);
  max-width: 34ch;
}

.scroll-cue {
  display: inline-block;
  margin-top: 2em;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--amber);
  padding-bottom: 2px;
}
.scroll-cue:hover { border-bottom-color: var(--ink); }

/* Seats */
.seats { margin: 0; }

.seat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(8px, 1.4vw, 14px);
}

.seat svg { display: block; width: 100%; height: auto; overflow: visible; }

.seat .s {
  fill: transparent;
  stroke: var(--slate);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.seat.on .s {
  animation: seat-on 0.7s ease forwards;
  animation-delay: calc(var(--i, 0) * 120ms + 450ms);
}

@keyframes seat-on {
  to { fill: var(--amber); stroke: var(--amber); }
}

.seats figcaption {
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .seats { max-width: 440px; }
}

/* ---------- Sections ---------- */
.section {
  padding: clamp(56px, 8vw, 96px) 0;
}

.section h2 {
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  letter-spacing: -0.015em;
  margin-bottom: 0.55em;
}

.lede {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.8vw, 1.9rem);
  line-height: 1.35;
}
.lede strong {
  font-weight: 600;
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--amber) 38%, transparent) 62%);
}

.takeaway {
  margin-top: 2.2rem;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  line-height: 1.3;
  max-width: 30ch;
}

/* ---------- Figures & charts ---------- */
.figure {
  margin: 2.4rem 0 0;
  max-width: 840px;
}

.chart { width: 100%; min-height: 200px; }
.chart svg { display: block; overflow: visible; }

.chart text { font-family: var(--sans); }
.chart .axis { fill: var(--muted); font-size: 12px; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .baseline { stroke: var(--muted); stroke-width: 1; }

.chart .trend-line { fill: none; stroke: var(--chart-amber); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart .pt { fill: var(--bg); stroke: var(--chart-amber); stroke-width: 2.5; }
.chart .pt-last { fill: var(--chart-amber); }
.chart .val { fill: var(--ink); font-size: 13px; font-weight: 600; }
.chart .val-last { font-size: 16px; font-weight: 700; }

.chart .row-label { fill: var(--ink); font-size: 14px; font-weight: 500; }

.chart .bar-f { fill: var(--chart-amber); }
.chart .bar-m { fill: var(--chart-slate); }
.chart .bar-val { fill: var(--ink); font-size: 13px; font-weight: 600; }

.legend {
  display: flex;
  gap: 1.4rem;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.key { display: inline-flex; align-items: center; gap: 0.45rem; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.sw-amber { background: var(--chart-amber); border-radius: 2px; }
.sw-slate { background: var(--chart-slate); border-radius: 2px; }

/* 2023–2025 comparison rows */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 1rem;
  line-height: 1.5;
}

.comparison-table caption {
  padding: 0 0 1.625rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: left;
}

.comparison-label-col { width: 56%; }
.comparison-value-col { width: 22%; }

.comparison-table thead th {
  padding: 0 0 0.75rem 1.375rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: right;
  border-bottom: 1px solid var(--rule);
}
.comparison-table thead th:first-child { padding-left: 0; text-align: left; }
.comparison-table thead .comparison-current { color: var(--teal); }

.comparison-table tbody th {
  padding: 1.375rem 1.125rem 1.375rem 0;
  font-weight: 500;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}
.comparison-table tbody td {
  padding: 1.375rem 0 1.375rem 1.375rem;
  vertical-align: middle;
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--rule);
}

.comparison-value {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 1.3125rem;
  line-height: 1.1;
}
.comparison-current .comparison-value { color: var(--teal); font-weight: 600; }

.comparison-track {
  display: block;
  height: 5px;
  background: color-mix(in srgb, var(--rule) 60%, var(--bg));
}
.comparison-fill {
  display: block;
  height: 100%;
  background: color-mix(in srgb, var(--muted) 75%, var(--bg));
}
.comparison-current .comparison-fill { background: var(--teal); }

.comparison-scale {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

@media (max-width: 440px) {
  .comparison-label-col { width: 52%; }
  .comparison-value-col { width: 24%; }
  .comparison-table tbody th { padding-right: 0.75rem; }
  .comparison-table tbody td, .comparison-table thead th { padding-left: 0.75rem; }
  .comparison-table thead th:first-child { padding-left: 0; }
  .comparison-value { font-size: 1.25rem; }
}

figcaption { margin-top: 1rem; }

.chart-note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 62ch;
}

.narrow-note { margin-top: 2rem; }

.src {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- Everyday duo ---------- */
.duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 6vw, 72px);
  margin-top: 2.2rem;
  max-width: 840px;
}

.stat-num {
  font-family: var(--serif);
  font-size: clamp(3.4rem, 8vw, 5.4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 500;
}

.stat-text {
  margin-top: 0.6rem;
  max-width: 24ch;
  font-size: 1.05rem;
}

@media (max-width: 560px) {
  .duo { grid-template-columns: 1fr; }
}

/* ---------- Factors ---------- */
.factors {
  list-style: none;
  margin: 2.2rem 0 0;
  padding: 0;
  max-width: 840px;
  border-top: 1px solid var(--rule);
}

.factors li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name apr"
    "effect apr";
  column-gap: 2rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--rule);
}

.f-name {
  grid-area: name;
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.3;
}
.f-effect {
  grid-area: effect;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 1rem;
}
.apr {
  grid-area: apr;
  align-self: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}
.factors li p + p { margin-top: 0.2rem; }
.factors li .apr { margin-top: 0; }

@media (max-width: 560px) {
  .factors li {
    grid-template-columns: 1fr;
    grid-template-areas: "name" "effect" "apr";
  }
  .factors li .apr { margin-top: 0.3rem; }
}

/* ---------- Recommendations ---------- */
.recs {
  margin-top: clamp(56px, 8vw, 88px);
  max-width: 840px;
  padding: 32px;
  background: var(--recs-bg);
  color: var(--ink);
  border-top: 3px solid var(--teal);
}

.recs-kicker {
  margin-bottom: 12px;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.recs-title {
  font-size: clamp(1.9rem, 4.8vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 30px;
}

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

.recs h4 {
  color: var(--teal);
  font-family: var(--sans);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 15px;
}

.recs ul {
  margin: 0;
  padding-left: 20px;
  font-size: 1rem;
  line-height: 1.65;
}
.recs li + li { margin-top: 16px; }
.recs li::marker { color: var(--teal); }
.recs strong { font-weight: 600; }

.recs .src {
  margin-top: 28px;
  color: var(--recs-muted);
  font-size: 0.75rem;
  line-height: 1.5;
}
.recs .src a { color: inherit; }

@media (max-width: 560px) {
  .recs { padding: 24px; }
  .recs-grid { grid-template-columns: 1fr; gap: 30px; }
}

/* ---------- Help ---------- */
.help {
  background: var(--help-bg);
  color: var(--help-ink);
  padding: clamp(64px, 11vw, 120px) 0;
}

.help h2 {
  font-size: clamp(2rem, 4.4vw, 3rem);
  max-width: 18ch;
  letter-spacing: -0.015em;
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: 2.6rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 48px);
  max-width: 960px;
}

.steps li { counter-increment: step; }

.steps li::before {
  content: counter(step);
  display: block;
  font-family: var(--serif);
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 0.7rem;
  opacity: 0.55;
}

.steps h3 {
  font-size: 1.35rem;
  margin-bottom: 0.45rem;
}

.steps p { font-size: 1rem; opacity: 0.92; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 2.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--help-ink);
  color: var(--help-bg);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--help-ink);
}
.btn:hover { text-decoration: none; filter: brightness(0.94); }

.btn-ghost {
  background: transparent;
  color: var(--help-ink);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); filter: none; }

.help :focus-visible { outline-color: var(--help-ink); }

.emergency {
  margin-top: 1.6rem;
  font-weight: 600;
}

@media (max-width: 760px) {
  .steps { grid-template-columns: 1fr; }
}

/* ---------- Notes ---------- */
.notes { font-size: 1rem; }

.notes h3 {
  font-size: 1.35rem;
  margin: 2.2rem 0 0.8rem;
}

.sources { padding-left: 1.4em; margin: 0; }
.sources li + li { margin-top: 0.6rem; }
.sources cite { font-style: italic; }

.plain { padding-left: 1.1em; margin: 0; }
.plain li + li { margin-top: 0.6rem; }

.small { color: var(--muted); font-size: 0.92rem; margin-bottom: 1rem; }

.questions { margin: 0; }
.questions dt { font-weight: 700; margin-top: 1rem; }
.questions dd { margin: 0.25rem 0 0; color: var(--muted); }

/* ---------- Footer ---------- */
.footer {
  padding: 32px 0 48px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .seat.on .s {
    animation: none;
    fill: var(--amber);
    stroke: var(--amber);
  }
}
