/* After the lights came on. Palette tokens live here and in js/common.js (LC.C). */
:root {
  --night: #0f1b33;     /* page background, map page */
  --deep: #08101f;      /* ocean / deepest layer */
  --panel: #172846;     /* raised surfaces on night pages */
  --lamp: #ffc857;      /* light: electricity access, highlights */
  --ember: #f2795c;     /* people without access, warnings */
  --fog: #c7d0e0;       /* text on night */
  --mist: #8a97b0;      /* secondary text on night */
  --paper: #f6f3ec;     /* page background, story and explorer */
  --ink: #1a2238;       /* text on paper */
  --dusk: #5b6786;      /* secondary text on paper */
  --rule: #d9d3c5;      /* hairlines on paper */
  --accent: #2c5aa0;    /* links, focus, health series */
  --moss: #4a8f6a;      /* education series */
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Public Sans", "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--body); font-size: 17px; line-height: 1.55; color: var(--ink); background: var(--paper); }
body.night { background: var(--night); color: var(--fog); }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.1; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); font-variation-settings: "opsz" 144; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.15rem; font-family: var(--body); font-weight: 600; }
p { margin: 0 0 1em; max-width: 34em; }
a { color: var(--accent); text-underline-offset: 3px; }
.night a { color: var(--lamp); }
small, .small { font-size: .85rem; color: var(--dusk); }
.night .small { color: var(--mist); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* nav */
.nav { display: flex; align-items: center; gap: 1.2rem; padding: .9rem 1.4rem; font-size: .95rem; }
.nav .brand { font-family: var(--display); font-size: 1.05rem; color: inherit; text-decoration: none; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a { color: inherit; text-decoration: none; padding: .25rem 0; border-bottom: 2px solid transparent; }
.nav a[aria-current] { border-bottom-color: var(--lamp); }
.night .nav { position: absolute; top: 0; left: 0; right: 0; z-index: 5; }

/* story layout */
.hero { min-height: 92vh; display: grid; align-content: center; padding: 3rem 1.4rem 6rem; max-width: 1180px; margin: 0 auto; position: relative; }
.hero h1 { max-width: 12em; }
.hero .dek { font-size: 1.25rem; max-width: 30em; color: var(--dusk); }
.hero .src { margin-top: 1.5rem; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: .9; -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent 92%); mask-image: linear-gradient(to bottom, #000 35%, transparent 92%); }
.scrolly { position: relative; max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(280px, 34%) 1fr; gap: 2rem; padding: 0 1.4rem; }
.steps { padding-bottom: 40vh; }
.step { min-height: 78vh; display: flex; flex-direction: column; justify-content: center; opacity: .3; transition: opacity .35s; }
.step.is-active { opacity: 1; }
.step h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
.step .note { font-size: .82rem; color: var(--dusk); border-left: 2px solid var(--rule); padding-left: .7rem; }
.graphic { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; }
.graphic svg { width: 100%; height: auto; max-height: 92vh; overflow: visible; }
.graphic .caption { position: absolute; left: 0; bottom: 1.2rem; font-size: .85rem; color: var(--dusk); max-width: 40em; }
.graphic .big { position: absolute; right: 0; top: 2rem; text-align: right; font-family: var(--display); font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; }
.graphic .big small { display: block; font-family: var(--body); font-size: .85rem; color: var(--dusk); margin-top: .35rem; }
.after { max-width: 1180px; margin: 2rem auto 0; padding: 0 1.4rem 4rem; display: grid; grid-template-columns: minmax(280px, 34%) 1fr; gap: 2rem; }
.after .cta { display: inline-block; background: var(--ink); color: var(--paper); padding: .9rem 1.3rem; text-decoration: none; border-radius: 3px; font-weight: 500; }
.after .cta.alt { background: transparent; color: var(--ink); border: 1px solid var(--ink); margin-left: .6rem; }
details { border-top: 1px solid var(--rule); padding: 1rem 0; }
summary { cursor: pointer; font-weight: 600; }
footer { border-top: 1px solid var(--rule); padding: 1.6rem 1.4rem 2.5rem; font-size: .82rem; color: var(--dusk); }
footer p { max-width: 70em; }
.night footer { border-color: rgba(255,255,255,.08); }

@media (max-width: 800px) {
  .nav { gap: .8rem; padding: .7rem 1rem; font-size: .88rem; }
  .nav .brand { max-width: 34vw; }
  .scrolly, .after { grid-template-columns: 1fr; gap: 0; }
  .graphic { position: sticky; top: 0; height: 52vh; background: var(--paper); z-index: 1; align-items: flex-start; padding-top: .5rem; }
  .graphic svg { max-height: 50vh; }
  .graphic .big { top: .2rem; }
  .graphic .caption { bottom: .3rem; }
  .step { min-height: 60vh; justify-content: flex-end; padding-bottom: 3rem; }
  .steps { order: 2; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .step { transition: none; } }

.step .inset { display: block; width: 100%; max-width: 380px; height: auto; margin-top: 1.2rem; overflow: visible; }
.graphic .big .year { font-size: clamp(3.4rem, 7vw, 6rem); letter-spacing: -.02em; }
.graphic .switch { position: absolute; right: 0; top: 9.5rem; display: flex; gap: .3rem; }
.graphic .switch button { background: transparent; border: 1px solid var(--rule); color: var(--ink); padding: .3rem .8rem; border-radius: 999px; cursor: pointer; font-size: .85rem; }
.graphic .switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.graphic .switch[hidden], .graphic .tip[hidden] { display: none; }
.graphic .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--paper); font-size: .8rem; padding: .35rem .55rem; border-radius: 4px; max-width: 220px; z-index: 2; }
@media (max-width: 800px) { .graphic .switch { top: 4.6rem; } .step .inset { max-width: 100%; } }

/* friendlier story: short version, chapters, takeaways, methods */
.kicker { font-size: .8rem; font-weight: 600; color: var(--dusk); margin: 0 0 .5rem; }
.hero .short { margin: 1.4rem 0 0; max-width: 40em; border-left: 3px solid var(--lamp); padding-left: 1rem; }
.hero .short ol { margin: 0; padding-left: 1.2rem; }
.hero .short li { margin-bottom: .3rem; }
.chapters { position: sticky; top: 0; z-index: 4; display: flex; gap: 1.6rem; padding: .6rem 1.4rem .7rem; background: rgba(246,243,236,.94); backdrop-filter: blur(6px); font-size: .82rem; max-width: 1180px; margin: 0 auto; }
.chapters a { color: var(--dusk); text-decoration: none; white-space: nowrap; }
.chapters a b { display: inline-block; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 1px solid var(--rule); text-align: center; line-height: 1.35rem; font-weight: 600; margin-right: .3rem; }
.chapters a.is-active { color: var(--ink); }
.chapters a.is-active b { background: var(--lamp); border-color: var(--lamp); }
.chapters .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--lamp); width: 0; transition: width .2s; }
.scrolly .graphic { top: 2.4rem; height: calc(100vh - 2.4rem); }
.takeaways { max-width: 1180px; margin: 0 auto; padding: 2rem 1.4rem 1rem; }
.takeaways ol { padding-left: 1.3rem; max-width: 44em; }
.takeaways li { margin-bottom: .7rem; }
.methods dt { font-weight: 600; margin-top: .9rem; }
.methods dd { margin: .2rem 0 0; max-width: 40em; color: var(--ink); }
.lic { border-collapse: collapse; width: 100%; font-size: .9rem; margin: .6rem 0 .8rem; }
.lic th, .lic td { text-align: left; padding: .45rem .5rem .45rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.lic th { font-weight: 600; }
@media (max-width: 800px) {
  .chapters { gap: .9rem; overflow-x: auto; padding: .5rem 1rem; }
  .chapters a span { display: none; }
  .scrolly .graphic { top: 2.3rem; height: 52vh; }
}

.nav .brand .bulb { vertical-align: -3px; margin-right: .45rem; color: #d9a03f; }
.night .nav .brand .bulb { color: var(--lamp); }
.scrollcue { position: absolute; left: 50%; bottom: 1.6rem; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: .4rem; color: var(--ink); text-decoration: none; font-size: .85rem; font-weight: 600; }
.scrollcue i { display: block; width: 28px; height: 44px; border: 2px solid var(--ink); border-radius: 14px; position: relative; background: var(--paper); }
.scrollcue i::after { content: ""; position: absolute; left: 50%; top: 8px; width: 6px; height: 10px; margin-left: -3px; border-radius: 3px; background: #d9a03f; animation: cue 1.6s ease-in-out infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(16px); opacity: 0; } 100% { transform: translateY(0); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .scrollcue i::after { animation: none; } }
@media (max-width: 800px) { .scrollcue { position: static; transform: none; margin: 1.2rem auto 0; } }
