/* Keep It In Cash — homepage story.
   Without JavaScript, or with reduced motion, the story is a sequence of still illustrations with their text.
   story.js adds .is-live: each chapter becomes a tall scroll track with a sticky stage, and scroll position
   drives the camera, the figures and the captions. */

.story { position: relative; background: var(--ivory); }
.story-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.story-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 20px; padding-top: 10px; padding-bottom: 10px; }
.story-bar .eyebrow { margin: 0; }
.story-bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 20px; }
@media (max-width: 560px) {
  .story-bar .eyebrow { display: none; }
  .story-bar-actions { gap: 2px 14px; }
  .story-bar-actions .link-quiet { font-size: .84rem; }
}
.story-sound {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 22px; background: #fffdf9;
  font: 600 .74rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--charcoal); cursor: pointer;
}
.story-sound[aria-pressed="true"] { background: var(--charcoal); color: var(--ivory); border-color: var(--charcoal); }

/* ---------- Still sequence (default) */
.stage { display: grid; }
.scene { position: relative; margin: 0; background: var(--charcoal); }
.scene > svg { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
@media (max-width: 760px) { .scene > svg { aspect-ratio: 4 / 5; } }
.scene-copy { background: var(--ivory); padding: 22px 20px 44px; }
.scene-copy > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.cap { font: 500 clamp(1.7rem, 3.6vw, 2.8rem)/1.12 var(--serif); color: var(--charcoal); margin-top: 0; margin-bottom: .35em; text-wrap: balance; }
.cap-lead { font-size: clamp(2.1rem, 5vw, 4rem); }
.cap-head { font-size: clamp(2.2rem, 5.2vw, 4.2rem); }
.cap-sub { font: 400 clamp(1rem, 1.6vw, 1.2rem)/1.5 var(--sans); }
.cap-sub { margin: .7em 0 0; }
.scene-note { margin: 0; padding: 0 20px 20px; background: var(--ivory); font: 500 .78rem/1.4 var(--sans); color: var(--ink-2); text-align: center; }

/* ---------- Live (scroll-driven) */
.story.is-live .chapter { position: relative; height: calc(var(--units) * var(--unit-h, 22vh) + 100vh); height: calc(var(--units) * var(--unit-h, 22svh) + 100svh); }
.story.is-live .stage { position: sticky; top: 0; display: block; height: 100vh; height: 100svh; overflow: hidden; background: #1c140e; }
.story.is-live .scene { position: absolute; inset: 0; opacity: 0; background: none; will-change: opacity; }
.story.is-live .scene > svg { visibility: hidden; width: 100%; height: 100%; aspect-ratio: auto; }
.story.is-live .stage::before { /* paper grain over every scene */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .14; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .22 0 0 0 0 .14 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}
.story.is-live .stage::after { /* scrim behind captions */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 52%; pointer-events: none; z-index: 1;
  background: linear-gradient(to top, rgba(28, 18, 10, .62), rgba(28, 18, 10, .28) 45%, transparent);
}
.story.is-live .scene-copy {
  position: absolute; z-index: 2; left: max(20px, 6vw); right: max(20px, 6vw); bottom: max(28px, 9vh);
  padding: 0; background: none; pointer-events: none;
}
.story.is-live .scene-copy > * { margin: 0; max-width: 17em; }
.story.is-live .cap { position: absolute; left: 0; bottom: 0; opacity: 0; color: #fbf6ec; text-shadow: 0 2px 18px rgba(20, 12, 6, .55); will-change: opacity, transform; }
.story.is-live .cap-sub { max-width: 26em; color: #efe6d8; text-shadow: 0 2px 14px rgba(20, 12, 6, .6); }
.story.is-live .cap-head { margin: 0; color: inherit; }
.story.is-live .scene-note {
  position: absolute; z-index: 2; right: max(20px, 4vw); top: calc(var(--header-h) + 12px); padding: 6px 12px; border-radius: 14px;
  background: rgba(28, 18, 10, .55); color: #efe6d8; opacity: 0;
}
.story.is-live .scene-copy a { pointer-events: auto; }
@media (max-width: 760px) {
  .story.is-live .scene-copy { bottom: max(24px, 7vh); }
}

/* ---------- Scenes built from crops: memory, the side-by-side finale */
.scene-type { background: #15110d; }
.scene-memory, .split { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
@media (max-width: 760px) { .scene-memory, .split { aspect-ratio: 4 / 5; } }
.memory, .memory-black { position: absolute; inset: 0; }
.memory svg, .split-panel svg { display: block; width: 100%; height: 100%; }
.memory[data-el="mem-aaji"] { filter: sepia(.45) brightness(.92); }
.memory-black { background: #050404; pointer-events: none; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #15110d; }
.split-panel { overflow: hidden; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } }
.story.is-live .scene-memory, .story.is-live .split { position: absolute; inset: 0; aspect-ratio: auto; }
.story.is-live .scene-memory { background: #15110d; }

/* ---------- Voices: Listen to Sheela, Rohan, Ananya */
.voice-inline { margin: 0 0 14px; }
.story.is-live .voice-inline { display: none; }
.voice {
  position: absolute; z-index: 3; left: max(20px, 6vw); top: calc(var(--header-h) + 14px);
  display: grid; grid-template-columns: auto auto; align-items: center; gap: 4px 12px;
  padding: 8px 16px 10px 8px; border-radius: 30px; background: rgba(21, 17, 13, .62); color: #fbf6ec;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.voice[hidden] { display: none; }
.voice-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 6px; border: 0; border-radius: 22px;
  background: none; color: inherit; font: 600 .82rem var(--sans); letter-spacing: .04em; cursor: pointer;
}
.voice-btn:focus-visible { outline: 2px solid #fbf6ec; outline-offset: 2px; }
.voice-icon { position: relative; width: 32px; height: 32px; border-radius: 50%; background: #fbf6ec; flex: none; }
.voice-icon::before { /* play triangle */
  content: ""; position: absolute; left: 12px; top: 9px; border-style: solid; border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent var(--charcoal);
}
.voice.is-playing .voice-icon::before { /* pause bars */
  left: 10px; top: 10px; width: 4px; height: 12px; border: 0; background: var(--charcoal); box-shadow: 8px 0 0 var(--charcoal);
}
.voice-meta { font: 500 .78rem var(--sans); color: #d9cfbf; font-variant-numeric: tabular-nums; }
.voice-bar { grid-column: 1 / -1; height: 2px; margin: 0 0 0 48px; background: rgba(251, 246, 236, .22); border-radius: 1px; overflow: hidden; }
.voice-bar i { display: block; height: 100%; width: 0; background: #fbf6ec; }
.voice-read { grid-column: 2; grid-row: 1; justify-self: end; display: none; }
@media (min-width: 561px) {
  .voice { grid-template-columns: auto auto auto; }
  .voice-read { display: inline-flex; grid-column: 3; align-items: center; min-height: 44px; color: #fbf6ec; font: 600 .74rem var(--sans); letter-spacing: .06em; text-transform: uppercase; text-underline-offset: 4px; }
  .voice-read:hover { color: #fff; }
}
@media (max-width: 560px) { .voice { left: 12px; } }

/* ---------- Transcripts */
.transcripts { padding: clamp(40px, 6vw, 72px) 0 clamp(56px, 8vw, 96px); border-top: 1px solid var(--line); }
.transcripts h2 { font-size: clamp(2rem, 4vw, 2.8rem); }
.transcript summary { font: 500 1.6rem/1.2 var(--serif); }
.transcript summary span { margin-left: auto; padding-right: 16px; font: 500 .8rem var(--sans); letter-spacing: .06em; color: var(--ink-2); }
.transcript > .btn { margin: 4px 0 18px; }
.transcript-text { max-width: 62ch; padding-bottom: 24px; }
.transcript-text p { margin-bottom: .9em; color: var(--charcoal); }
.transcript:target, .transcript[open] { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- Brand reveal */
.cap-brand img { width: clamp(150px, 18vw, 220px); height: auto; margin: 0 auto 10px; }
.story:not(.is-live) .cap-brand img { content: url("/img/logo/original-on-transparent.svg"); }
.story.is-live .cap-brand { left: 0; right: 0; bottom: 18vh; max-width: none; text-align: center; }
.story.is-live .cap-brand .cap-sub { max-width: none; font: italic 500 clamp(1.4rem, 2.6vw, 2rem)/1.3 var(--serif); }

/* ---------- The pause: savings challenge */
.challenge-card .field-pair { grid-template-columns: 1fr 1fr; }
.challenge-card .field-label { font-weight: 600; font-size: .82rem; letter-spacing: .04em; margin-bottom: 8px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.presets .chip { min-height: 44px; }
.presets .chip[aria-pressed="true"] { background: var(--charcoal); border-color: var(--charcoal); color: var(--ivory); }
.challenge-card label output { font-weight: 700; color: var(--plum); margin-left: 4px; }
.challenge-card input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--plum); }
.challenge-result { border-top: 1px solid var(--line); padding-top: 20px; }
.challenge-result .result-rows { margin-top: 0; }
.challenge-result .result-rows dd { font-variant-numeric: tabular-nums; }
.mini-tracker { list-style: none; padding: 0; margin: 14px 0; display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.mini-tracker li { aspect-ratio: 1.5; border: 1px solid var(--line-strong); border-radius: 3px; background: #fffdf9; transition: background .2s; }
.mini-tracker li.on { background: var(--plum); border-color: var(--plum); }
.challenge-plan { font-size: .9rem; color: var(--ink-2); margin: 0; }
.story-pause .btn { margin-top: 8px; }

/* ---------- End */
.story-end { padding: clamp(56px, 8vw, 104px) 0 clamp(24px, 4vw, 48px); }
.story-end-inner { max-width: 820px; }
.story-end h2 { font-size: clamp(2.4rem, 5vw, 3.8rem); }
