:root {
  --navy:  #192854;
  --amber: #FBB228;
  --slate: #475569;
  --blue:  #3651AA;
  --cream: #FAF6EE;
  --white: #FFFFFF;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--navy);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}

main { display: block; }

section {
  min-height: 100vh;
  padding: 10vh 8vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

h1 {
  font-weight: 800;
  font-size: clamp(48px, 7vw, 96px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h2 {
  font-weight: 700;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}

p {
  font-size: 20px;
  max-width: 640px;
  color: var(--navy);
}

p + p { margin-top: 1rem; }

.label {
  font-weight: 600;
  font-size: 14px;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.huge-number {
  font-weight: 800;
  font-size: clamp(80px, 12vw, 160px);
  line-height: 1;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

/* Section background variants */
.section-dark { background: var(--navy); color: var(--white); }
.section-dark p { color: var(--white); }
.section-light { background: var(--white); color: var(--navy); }
.section-cream { background: var(--cream); color: var(--navy); }

/* Reveal-on-scroll utility */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 600ms ease-out, transform 600ms ease-out; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Placeholder cleanup */
.placeholder { background: var(--cream); }

.hook {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 80% 30%, rgba(54, 81, 170, 0.25) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 70%, rgba(251, 178, 40, 0.10) 0%, transparent 60%),
    var(--navy);
  background-size: 200% 200%;
  animation: hookGradient 18s ease-in-out infinite;
}

@keyframes hookGradient {
  0%, 100% { background-position: 0% 0%, 100% 100%; }
  50%      { background-position: 30% 20%, 60% 80%; }
}

.hook-content { max-width: 920px; }
.hook h1 { color: var(--white); }
.hook-sub { color: var(--amber); font-weight: 600; font-size: 24px; margin-top: 1.5rem; }

.brand {
  font-weight: 600;
  font-size: 13px;
  color: var(--cream);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  opacity: 0.7;
}

.scroll-cue {
  position: absolute;
  bottom: 4vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--cream);
  opacity: 0.6;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  animation: scrollBounce 2.4s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(6px); }
}

.reveal-section {
  background: var(--navy);
  text-align: center;
}

.reveal-content {
  margin: 0 auto;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.reveal-setup { color: var(--cream); opacity: 0.7; }
.reveal-caption { color: var(--white); font-size: 22px; max-width: 640px; }
.reveal-caveat { color: var(--cream); opacity: 0.5; font-size: 14px; }

/* Explainer card sitting between the headline and the caveat — defines what the
   affordability threshold means in plain language. */
.explainer-box {
  margin-top: 1rem;
  max-width: 640px;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--amber);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
}
.explainer-label {
  font-weight: 700;
  font-size: 11px;
  color: var(--amber);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  max-width: none;
}
.explainer-box p:not(.explainer-label) {
  color: var(--cream);
  font-size: 15px;
  line-height: 1.55;
  max-width: none;
}
.explainer-box strong { color: var(--white); font-weight: 700; }

.frame-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6vw;
  align-items: start;
}

.frame-left { max-width: 540px; }
.frame-left .label { margin-bottom: 1rem; }

.frame-step {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 1.5rem;
  margin-top: 2.5rem;
  align-items: start;
}

.step-num {
  font-weight: 800;
  font-size: 32px;
  color: var(--amber);
  line-height: 1;
}

.frame-step p { font-size: 17px; }

.frame-right {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  margin-top: 3rem;
}

.frame-visual {
  background: var(--cream);
  border-radius: 12px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.bundle-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.bundle-icon {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(25, 40, 84, 0.08);
}

.visual-caption {
  font-size: 13px;
  color: var(--slate);
  text-align: center;
  line-height: 1.4;
  max-width: 100%;
}

.visual-caption-top { margin-bottom: 0.5rem; }

/* Right-column visual headers — small "step + title" linking each box to the
   corresponding numbered explanation on the left. */
.visual-header {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 0.85rem;
  width: 100%;
}
.visual-step {
  font-weight: 800;
  font-size: 14px;
  color: var(--amber);
  letter-spacing: 0.05em;
  line-height: 1;
}
.visual-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--slate);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.visual-caption-divider {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(71, 85, 105, 0.15);
}

/* Household lineup: 20 small figures in a row, the 4th-from-left (= 20th percentile)
   highlighted in amber and slightly elevated.  Wrapper holds the callout row above
   and the poorest/richest axis below. */
.hh-lineup-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0.2rem;
}

.hh-callout-row,
.hh-lineup {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
}

.hh-callout-row { align-items: flex-end; min-height: 36px; }

.hh-callout-slot {
  width: 14px;
  display: flex;
  justify-content: center;
}
.hh-callout-slot.is-highlight { width: 18px; }

.hh-callout {
  font-size: 10px;
  font-weight: 700;
  color: var(--amber);
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
  letter-spacing: 0.02em;
  transform: translateX(0);
}

.hh-figure svg {
  display: block;
  width: 14px;
  height: 21px;
  fill: var(--slate);
  opacity: 0.45;
  transition: fill 200ms ease, opacity 200ms ease, transform 200ms ease;
}

.hh-figure.is-highlight svg {
  width: 18px;
  height: 27px;
  fill: var(--amber);
  opacity: 1;
  transform: translateY(-3px);
  filter: drop-shadow(0 2px 4px rgba(251, 178, 40, 0.4));
}

.hh-axis {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding-top: 0.4rem;
  font-size: 11px;
  color: var(--slate);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Lognormal curve wrapper with bottom axis */
.lognormal-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}
#lognormal-svg {
  display: block;
  width: 100%;
  height: 140px;
}
.lognormal-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--slate);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 0.3rem;
}

/* Footnote definition (k) under the equation block */
.eq-footnote {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(71, 85, 105, 0.15);
  font-size: 12px;
  color: var(--slate);
  line-height: 1.5;
}
.eq-footnote strong { color: var(--amber); font-weight: 800; }

.equation {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 14px;
  font-weight: 600;
  color: var(--slate);
}

.eq-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.eq-divider { color: var(--amber); font-weight: 800; }
.eq-equals  { color: var(--amber); font-weight: 800; font-size: 18px; }
.eq-result  { color: var(--navy); }
.eq-headline { color: var(--amber); font-weight: 800; }

.chart-section { background: var(--white); }
.chart-section h2 { margin-bottom: 1rem; }
.chart-section p { margin-bottom: 2.5rem; max-width: 760px; }

.chart-container {
  width: 100%;
  max-width: 900px;
  height: 480px;
  margin: 0 auto;
}

.playground { padding: 8vh 6vw; }
.playground-header { max-width: 760px; margin-bottom: 4rem; }

.playground-layout {
  display: grid;
  grid-template-columns: 40fr 60fr;
  gap: 4vw;
  align-items: start;
}

.playground-inputs {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.input-block {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-row label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  font-weight: 600;
  color: var(--slate);
}

.input-value {
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--cream);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  background: var(--amber);
  border: 2px solid var(--navy);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 150ms ease;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }

input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--amber);
  border: 2px solid var(--navy);
  border-radius: 50%;
  cursor: pointer;
}

select {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--slate);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
}

#appliance-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 360px;
  overflow-y: auto;
  margin-top: 1rem;
}

/* Collapsible bundle composition block — closed by default */
.bundle-block { padding-top: 1rem; padding-bottom: 1rem; }

.bundle-details > summary {
  list-style: none;             /* remove default disclosure triangle */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.bundle-details > summary::-webkit-details-marker { display: none; }
.bundle-details > summary::marker { content: ''; }

.bundle-chevron {
  display: inline-block;
  color: var(--slate);
  font-size: 14px;
  transition: transform 200ms ease;
}

.bundle-details[open] .bundle-chevron {
  transform: rotate(180deg);
}

.bundle-details > summary:hover .label,
.bundle-details > summary:hover .bundle-chevron {
  color: var(--navy);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.6rem;
  background: var(--cream);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 150ms ease;
}

.toggle-row:hover { background: #f0eadf; }
.toggle-row.is-on { background: rgba(251, 178, 40, 0.18); }
.toggle-row input[type="checkbox"] { accent-color: var(--amber); cursor: pointer; }
.toggle-row .toggle-label { flex: 1; font-weight: 600; color: var(--navy); }

.reset-btn {
  margin-top: 0.5rem;
  align-self: flex-end;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  color: var(--slate);
  background: transparent;
  border: 1px solid var(--slate);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 150ms ease;
}

.reset-btn:hover { background: var(--slate); color: var(--white); }

.playground-results {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: sticky;
  top: 4vh;
}

.headline-card {
  background: var(--navy);
  color: var(--white);
  border-radius: 12px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
}

.headline-card .label { color: var(--cream); opacity: 0.7; }
.headline-card .huge-number {
  font-size: clamp(56px, 7vw, 96px);
  color: var(--amber);
  transition: transform 200ms ease;
}
.headline-card.is-pulsing .huge-number { transform: scale(1.02); }
.headline-detail { color: var(--cream); font-size: 14px; opacity: 0.85; }

.playground-tornado {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
}
.playground-tornado .label { margin-bottom: 1rem; }
.chart-mini { height: 360px; }

.site-footer {
  background: var(--navy);
  color: var(--cream);
  padding: 3rem 8vw;
  text-align: center;
  font-size: 13px;
  opacity: 0.8;
}

.site-footer p { color: var(--cream); font-size: 13px; max-width: none; }

/* Final polish: ensure ECharts svg text inherits Inter */
.echarts-tooltip { font-family: var(--font-body) !important; }

/* Back-to-hub link */
.back-to-hub {
  position: absolute; top: 16px; left: 16px; z-index: 100;
  font: 600 12px 'Inter', system-ui;
  color: var(--cream); opacity: 0.6;
  text-decoration: none; letter-spacing: 0.05em;
  background: rgba(0,0,0,0.2); padding: 6px 12px; border-radius: 4px;
  transition: opacity 200ms;
}
.back-to-hub:hover { opacity: 1; }
