/* Sunset Dunes public page. Every interface colour is a token so light and
   dark mode stay in step; the video overlay palette is defined separately. */

:root {
  color-scheme: light;
  --bg: #f7f6f1;
  --surface: #fff;
  --surface-2: #f0efe8;
  --stage: #11120e;
  --ink: #181812;
  --ink-2: #555349;
  --ink-3: #858175;
  --line: #e3e0d6;
  --line-2: #cac6b9;
  --accent: #246fc7;
  --accent-2: #164d8d;
  --accent-soft: #eaf3fd;
  --bar: #b8d4f4;
  --bar-hi: #246fc7;
  --modeled: #f0c36c;
  --warn-bg: #fdf4df;
  --warn-ink: #765714;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(22, 22, 16, .05), 0 10px 28px rgba(22, 22, 16, .07);
  --mode-walking: #22d3ee;
  --mode-running: #fbbf24;
  --mode-biking: #f472b6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121310;
    --surface: #1d1e1a;
    --surface-2: #272822;
    --ink: #f4f3ec;
    --ink-2: #b8b5a9;
    --ink-3: #898579;
    --line: #30312b;
    --line-2: #48483f;
    --accent: #4a93ea;
    --accent-2: #96c2f3;
    --accent-soft: #182d45;
    --bar: #245f9f;
    --bar-hi: #4a93ea;
    --modeled: #b8862e;
    --warn-bg: #2c2517;
    --warn-ink: #e2c483;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .28);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.58 ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; }
button { color: inherit; }

.masthead {
  max-width: 1360px;
  margin: 0 auto;
  padding: 38px 28px 0;
}
.brand h1 {
  margin: 0;
  font-size: clamp(32px, 4.2vw, 48px);
  line-height: 1.03;
  letter-spacing: -.035em;
}
.brand p {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 17px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-top: 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 650;
  cursor: pointer;
}
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab.on { background: var(--ink); color: var(--bg); }

main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 26px 28px 64px;
}
.tab-panel:focus { outline: none; }
.video-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  column-gap: 36px;
  align-items: start;
}
.stage { grid-column: 1; grid-row: 1; }
.summary-card { grid-column: 2; grid-row: 1 / span 2; }

/* Video */
.when { margin-bottom: 14px; }
.when h2 {
  margin: 0;
  font-size: clamp(24px, 2.6vw, 31px);
  line-height: 1.15;
  letter-spacing: -.025em;
}
.when p {
  margin: 3px 0 0;
  color: var(--ink-2);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.heading-picker {
  position: relative;
  display: table;
  max-width: 100%;
  padding-right: 25px;
  border-radius: 7px;
  cursor: pointer;
}
.heading-picker::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 6px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: .55;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
@media (hover: hover) {
  .heading-picker:hover::after { opacity: 1; }
  .heading-picker:hover h2,
  .heading-picker:hover p { color: var(--accent-2); }
}
.heading-picker:focus-within {
  outline: none;
}
.heading-picker:focus-within::after {
  border-color: var(--accent);
  opacity: 1;
}
.heading-picker:focus-within h2,
.heading-picker:focus-within p {
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.heading-picker select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.hour-heading-picker {
  margin-top: 3px;
  color: var(--ink-2);
}
.hour-heading-picker p { margin: 0; }
.when-meta {
  display: block;
}
.when-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
}
.when .when-stats p {
  font-size: 13px;
  font-weight: 600;
}
.when .hour-count { color: var(--ink-2); }
.when .day-estimate {
  color: var(--accent-2);
}
.when-stats strong {
  margin-right: 3px;
  font-size: 19px;
  font-weight: 780;
  letter-spacing: -.02em;
}
.frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--stage);
  box-shadow: var(--shadow);
}
.frame video { display: block; width: 100%; height: 100%; object-fit: contain; }
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity .16s ease;
}
.frame.video-waiting #overlay { opacity: 0; }
.clock {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 11px;
  border-radius: 8px;
  background: rgba(10, 10, 8, .65);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.frame-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 24px;
  background: radial-gradient(circle at center, rgba(16, 19, 18, .18), rgba(10, 11, 9, .5));
  color: #f4f3ec;
  text-align: center;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: .01em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .65);
  z-index: 3;
}
.video-loader {
  position: relative;
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, .18);
  border-top-color: #75b9ff;
  border-right-color: #75b9ff;
  border-radius: 50%;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35));
  animation: video-loader-spin .78s cubic-bezier(.55, .12, .45, .88) infinite;
}
.frame-msg:not(.loading) .video-loader { display: none; }
@keyframes video-loader-spin {
  to { transform: rotate(1turn); }
}
@media (prefers-reduced-motion: reduce) {
  .video-loader { animation-duration: 1.8s; }
}

.controls {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 14px;
}
.play {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}
.play:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.play:disabled, .toggle:disabled, .speed button:disabled { opacity: .42; cursor: default; }
.play svg { width: 20px; height: 20px; fill: currentColor; }
.scrub {
  flex: 1 1 auto;
  min-width: 60px;
  height: 22px;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.scrub::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(var(--accent), var(--accent)) 0/var(--pct, 0%) 100% no-repeat, var(--line-2);
}
.scrub::-moz-range-track { height: 5px; border-radius: 3px; background: var(--line-2); }
.scrub::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--accent); }
.scrub::-webkit-slider-thumb {
  width: 15px; height: 15px; margin-top: -5px;
  appearance: none;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}
.scrub::-moz-range-thumb {
  width: 12px; height: 12px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}
.elapsed {
  flex: none;
  color: var(--ink-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.speed {
  flex: none;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 999px;
}
.speed button {
  border: 0;
  padding: 7px 14px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.speed button + button { border-left: 1px solid var(--line-2); }
.speed button.on { background: var(--accent); color: #fff; }
.toggle {
  flex: none;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 7px 14px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.toggle.on { border-color: var(--accent); background: var(--accent); color: #fff; }

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-top: 12px;
  color: var(--ink-2);
  font-size: 12.5px;
}
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .key i {
  width: 11px; height: 11px;
  border: 2px solid currentColor;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
}
.legend [data-mode="walking"] i { color: var(--mode-walking); }
.legend [data-mode="running"] i { color: var(--mode-running); }
.legend [data-mode="biking"] i { color: var(--mode-biking); }
.legend .beach-key { margin-left: -2px; }
.legend .beach-key i {
  border-color: #9ca3af;
  border-style: dotted;
  box-shadow: none;
}
.legend .seen { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }

select {
  min-width: 190px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 8px 11px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
/* Summary and charts */
.summary-card, .assumption-card, .result-card, .worked-example {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.summary-card { padding: 26px; }
.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.summary-card h2, .section-intro h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: -.03em;
}
.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 11px;
}
.headline-totals { margin: 20px 0; }
.total {
  padding: 15px 14px 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-radius: 12px;
  background: var(--accent-soft);
}
.big {
  display: block;
  color: var(--accent-2);
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 750;
  line-height: 1;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}
.cap { display: block; margin-top: 5px; color: var(--ink-2); font-size: 12.5px; line-height: 1.35; }
.evidence {
  margin: 0 0 22px;
  padding: 17px 0 19px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.evidence h3 { margin: 0 0 10px; font-size: 14px; }
.evidence-bar { height: 8px; overflow: hidden; border-radius: 999px; background: var(--modeled); }
.evidence-bar i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .25s ease; }
.evidence p { margin: 9px 0 0; color: var(--ink-2); font-size: 13.5px; }
.model-source { color: var(--ink-3) !important; }
.profile { margin: 0; }
.profile figcaption {
  margin-bottom: 9px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.profile figcaption small { color: var(--ink-2); font-weight: 400; letter-spacing: 0; text-transform: none; }
.chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 92px;
  border-bottom: 1px solid var(--line);
}
.chart .bar {
  position: relative;
  flex: 1 1 0;
  height: var(--height, 1%);
  min-height: 1px;
  overflow: hidden;
  border-radius: 3px 3px 0 0;
  background: var(--modeled);
}
.chart .bar .measured-part {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: var(--measured, 0%);
  background: var(--bar);
}
.chart .bar.now { box-shadow: inset 0 0 0 2px var(--bar-hi); }
.chart .bar.now .measured-part { background: var(--bar-hi); }
.axis { display: flex; justify-content: space-between; margin: 5px 0 0; color: var(--ink-3); font-size: 11px; }
.chart-key { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 0; color: var(--ink-3); font-size: 11.5px; }
.chart-key span { display: inline-flex; align-items: center; gap: 5px; }
.chart-key i { width: 9px; height: 9px; border-radius: 2px; }
.chart-key i.measured { background: var(--bar); }
.chart-key i.modeled { background: var(--modeled); }
.learn-links { display: grid; gap: 6px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.text-link {
  width: fit-content;
  border: 0;
  padding: 2px 0;
  background: transparent;
  color: var(--accent-2);
  font-weight: 650;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Math tab */
.reading-layout { max-width: 1160px; margin: 0 auto; }
.section-intro { max-width: 780px; margin-bottom: 28px; }
.section-intro > p:last-child { margin: 10px 0 0; color: var(--ink-2); font-size: 17px; }
.formula-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 34px;
  padding: 0;
  list-style: none;
}
.formula-steps li {
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: 28px auto;
  gap: 2px 9px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.formula-steps li > span {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
}
.formula-steps b { align-self: center; line-height: 1.3; }
.formula-steps small { grid-column: 2; color: var(--ink-3); line-height: 1.4; }
.math-columns { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 42px; align-items: start; }
.prose { max-width: 74ch; }
.prose > h1 { display: none; }
.prose h2 {
  margin: 40px 0 10px;
  font-size: clamp(23px, 2.5vw, 30px);
  line-height: 1.2;
  letter-spacing: -.025em;
}
.prose h2:first-of-type { margin-top: 0; }
.prose p { margin: 0 0 16px; color: var(--ink-2); font-size: 17px; }
.prose ul { margin: 0 0 22px; padding-left: 22px; color: var(--ink-2); font-size: 16px; }
.prose li { margin: 7px 0; padding-left: 3px; }
.prose strong { color: var(--ink); }
.prose code:not(pre code) { padding: 1px 5px; border-radius: 5px; background: var(--surface-2); color: var(--ink); }
.prose pre {
  overflow-x: auto;
  margin: 18px 0 22px;
  padding: 18px;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--surface);
  color: var(--ink);
  font: 650 15px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}
.math-display {
  overflow-x: auto;
  margin: 18px 0 24px;
  padding: 20px 22px;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--surface);
  color: var(--ink);
}
.math-display math {
  width: max-content;
  min-width: 100%;
  margin: 0;
  font-family: "STIX Two Math", "Cambria Math", "Times New Roman", serif;
  font-size: clamp(18px, 2vw, 23px);
  text-align: left;
}
.math-display mtext { color: var(--ink-2); font-size: .82em; }
.math-assumptions {
  margin: 22px 0 30px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent-soft) 38%, var(--surface));
}
.math-assumptions-kicker {
  margin: 0 0 11px !important;
  color: var(--accent-2) !important;
  font-size: 10px !important;
  font-weight: 780;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.math-assumption-group + .math-assumption-group {
  margin-top: 17px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
}
.math-assumption-group h3 {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}
.math-assumption-group ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.math-assumption-group li {
  margin: 0;
  padding: 12px 13px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink-2);
  line-height: 1.3;
}
.math-assumption-mode {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  font-size: 12px;
}
.math-assumption-group .dot {
  width: 7px;
  height: 7px;
}
.math-assumption-mode strong { color: var(--ink); }
.math-assumption-metric {
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}
.math-assumption-value {
  color: var(--accent-2);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
}
.math-assumption-metric span {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
}
.math-assumption-group small {
  display: block;
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.35;
}
.worked-example { position: sticky; top: 18px; padding: 22px; }
.worked-example h3, .assumption-card h3, .result-card h3 { margin: 0 0 16px; font-size: 21px; letter-spacing: -.015em; }
.mini-receipt { display: grid; gap: 9px; }
.mini-row { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); font-size: 14px; }
.mini-row strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.example-total { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); font-weight: 700; }
.example-total strong { color: var(--accent-2); font-size: 22px; font-variant-numeric: tabular-nums; }
.fine-print { color: var(--ink-3); font-size: 13px; line-height: 1.5; }
.secondary {
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 650;
  cursor: pointer;
}
.secondary:hover { border-color: var(--accent); color: var(--accent-2); }

/* Calculator */
.calculator-intro { max-width: 850px; }
.calculator-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 34px; align-items: start; }
.assumption-card, .result-card { padding: 26px; }
.result-card { position: sticky; top: 18px; }
.madlib { margin: 0 0 20px; font-size: 17px; }
.assumption-cell select {
  -webkit-appearance: none;
  appearance: none;
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background-color: color-mix(in srgb, var(--accent-soft) 78%, var(--surface));
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent-2) 50%),
    linear-gradient(135deg, var(--accent-2) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) calc(50% - 1px),
    calc(100% - 10px) calc(50% - 1px);
  background-repeat: no-repeat;
  background-size: 5px 5px;
  color: var(--accent-2);
  font-weight: 720;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 45%, transparent);
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.assumption-cell select:hover {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}
.assumption-cell select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.control-lede { margin: 0 0 10px; color: var(--ink-2); font-size: 14px; }
.assumption-table {
  display: grid;
  grid-template-columns: minmax(100px, 1.1fr) repeat(2, minmax(110px, 1fr));
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.assumption-table > * { padding: 11px 12px; border-bottom: 1px solid var(--line); }
.assumption-table > *:not(:nth-child(3n + 1)) { border-left: 1px solid var(--line); }
.assumption-table > *:nth-last-child(-n + 3) { border-bottom: 0; }
.assumption-head { background: var(--surface-2); color: var(--ink-3); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.assumption-head:first-child { color: transparent; }
.assumption-head-control { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.assumption-head-control .info { flex: 0 0 auto; margin-left: 0; }
.mode-name { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.mode-name i, .receipt .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
[data-mode="walking"] i, .dot[data-mode="walking"] { background: var(--mode-walking); }
[data-mode="running"] i, .dot[data-mode="running"] { background: var(--mode-running); }
[data-mode="biking"] i, .dot[data-mode="biking"] { background: var(--mode-biking); }
.assumption-cell { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.assumption-cell select {
  width: 100%;
  min-width: 72px;
  height: 40px;
  padding: 0 34px 0 12px;
  border-radius: 10px;
  font-size: 14px;
}
.info {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: 3px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent-2);
  font: 700 12px/1 Georgia, serif;
  vertical-align: 2px;
  cursor: help;
}
.info:hover, .info[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); }
.info-popover {
  position: fixed;
  z-index: 50;
  width: min(280px, calc(100vw - 32px));
  padding: 12px 13px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
}
.receipt { width: 100%; margin: 0 0 18px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.calc-day-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 16px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.calc-day-picker select { min-width: 0; width: 190px; text-transform: none; letter-spacing: 0; }
.receipt th { padding: 8px 0; color: var(--ink-2); font-size: 14.5px; font-weight: 500; text-align: left; }
.receipt th small { display: block; color: var(--ink-3); font-size: 12px; font-weight: 400; }
.receipt td { padding: 8px 0; text-align: right; white-space: nowrap; }
.receipt .dot { margin-right: 7px; vertical-align: middle; }
.receipt tfoot th, .receipt tfoot td { border-top: 1px solid var(--line-2); color: var(--ink); font-weight: 750; }
.calc-totals { margin-bottom: 16px; }

select:focus-visible, input:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 1080px) {
  .video-layout, .calculator-layout { grid-template-columns: minmax(0, 1fr); }
  .stage { grid-column: 1; grid-row: 1; }
  .summary-card { grid-column: 1; grid-row: 2; margin-top: 28px; }
  .summary-card, .result-card { position: static; }
  .summary-card { max-width: none; }
}

@media (max-width: 820px) {
  .formula-steps { grid-template-columns: 1fr 1fr; }
  .math-columns { grid-template-columns: minmax(0, 1fr); }
  .worked-example { position: static; }
  .assumption-table { grid-template-columns: minmax(94px, 1fr) repeat(2, minmax(92px, 1fr)); overflow-x: auto; }
}

@media (max-width: 620px) {
  .masthead { padding: 18px 20px 0; }
  .brand h1 { font-size: 30px; }
  .brand p { margin-top: 6px; font-size: 15px; }
  .tabs { gap: 4px; margin-top: 14px; padding-bottom: 8px; }
  .tab { padding: 6px 10px; font-size: 14px; }
  main { padding: 14px 20px 48px; }
  .video-layout { gap: 8px; }
  .when { margin-bottom: 10px; }
  .when h2 { font-size: 24px; }
  .when p { font-size: 15px; }
  .when-stats { flex-wrap: nowrap; gap: 0 5px; }
  .when .when-stats p { font-size: 12px; }
  .when-stats strong { font-size: 17px; }
  .controls {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    gap: 6px 8px;
    margin-top: 8px;
  }
  .play { width: 38px; height: 38px; }
  .elapsed { grid-column: 2; grid-row: 1; font-size: 12px; }
  .speed { grid-column: 4; grid-row: 1; }
  .toggle { grid-column: 5; grid-row: 1; }
  .speed button, .toggle { padding: 6px 10px; }
  .scrub { grid-column: 1 / -1; grid-row: 2; width: 100%; min-width: 0; }
  .legend {
    display: grid;
    grid-template-columns: auto auto auto minmax(0, 1fr);
    gap: 4px 10px;
    margin-top: 7px;
    padding-left: 8px;
    font-size: 11.5px;
  }
  .legend .key { gap: 4px; }
  .legend .beach-key { grid-column: 1 / span 3; margin-left: 0; }
  .legend .seen { grid-column: 4; margin-left: 0; justify-self: end; white-space: nowrap; }
  .summary-card { grid-row: 2; margin-top: 8px; }
  .summary-card, .assumption-card, .result-card { padding: 20px; }
  .summary-card { padding-top: 16px; }
  .summary-card .headline-totals { margin-top: 8px; }
  .formula-steps { grid-template-columns: 1fr; }
  .formula-steps li { min-height: 0; }
  .math-assumption-group ul { grid-template-columns: 1fr; }
  .assumption-table {
    display: block;
    overflow: visible;
    border: 0;
    border-radius: 0;
  }
  .assumption-head { display: none; }
  .mode-name {
    margin-top: 14px;
    padding: 0 0 6px;
    border: 0;
  }
  .assumption-cell {
    padding: 8px 0;
    border: 0 !important;
  }
  .assumption-cell::before { content: attr(data-label); flex: 1; color: var(--ink-3); font-size: 13px; }
  .assumption-cell select { width: auto; min-width: 96px; }
  .prose p { font-size: 16px; }
}

@media (max-width: 380px) {
  .masthead { padding-top: 16px; }
  .tabs { margin-top: 10px; }
  main { padding-top: 12px; }
  .tab { padding-right: 8px; padding-left: 8px; font-size: 13px; }
}
