/* Shared by every essay page: the head, the scrollytelling stage + cards (js/scrolly.js), sliders, the guess, the checker, the checks, the video block. */
.essay-head { padding: 56px 0 28px; width: min(100% - 32px, 820px); }
.essay-head h1 { margin-bottom: 0.6em; }
.essay-head h1 .pop { font-size: 0.95em; }
.dek { font-size: 1.25rem; line-height: 1.55; color: var(--ink-2); }
.byline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--ink-3); }

.red { color: var(--red-text); }
.blue { color: var(--blue-dk); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.sw.red { background: var(--red); }
.sw.blue { background: var(--blue); }
code { font: 500 0.88em ui-monospace, "SF Mono", Menlo, monospace; background: rgba(38, 50, 85, 0.07); padding: 2px 6px; border-radius: 6px; word-break: break-word; }

.prose h2 { margin-top: 2.6em; }
.prose { margin-top: 8px; }
.wide { width: min(100% - 32px, var(--wide)); margin-inline: auto; }
/* bars that grow when their layer shows (on 2s) */
.grow { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); transition: transform 0.5s steps(4); }
.grow.d1 { transition-delay: 0.25s; } .grow.d2 { transition-delay: 0.5s; } .grow.d3 { transition-delay: 0.75s; }
@media (prefers-reduced-motion: reduce) { .grow { transform: none; transition: none; } }

/* the quiz under the street */
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.choice { min-height: 52px; padding: 12px 22px; border-radius: 14px; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); font: 650 1rem var(--ui); cursor: pointer; transition: transform 0.15s, background 0.15s; }
.choice:hover { transform: translateY(-1px); }
.choice[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.answer { max-width: 560px; margin: 18px auto 0; font-size: 1.08rem; }

/* working cards */
.sums { margin: 0; padding: 0; list-style: none; font-size: clamp(1.25rem, 3.6vw, 1.6rem); line-height: 1.5; }


/* sliders: a navy pen line with a coin for a thumb (money looks like money) */
.slider { display: grid; gap: 6px; flex: 1; min-width: 240px; }
.slider .lab { font-weight: 600; font-size: 0.95rem; }
.slider output { font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--ink); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -15px; border-radius: 50%; background: var(--coin) radial-gradient(circle, transparent 52%, rgba(38, 50, 85, 0.25) 54%, transparent 58%); border: 2.5px solid var(--ink); box-shadow: 2px 3px 0 rgba(38, 50, 85, 0.18); }
input[type="range"]::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: var(--coin); border: 2.5px solid var(--ink); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--blue-dk); outline-offset: 2px; }
.readout { padding: 12px 4px 0; font-size: 1.05rem; min-height: 3.4em; }
.readout strong { font-variant-numeric: tabular-nums; }

/* the rate finder */
.rail-track { position: relative; display: block; }
.marks { position: absolute; inset: 0 17px; pointer-events: none; }
.marks i { position: absolute; top: -6px; translate: -50% 0; font: 400 1.35rem/1 var(--hand); -webkit-text-stroke: var(--hw) currentColor; paint-order: stroke fill; color: var(--red); font-style: normal; }
.marks i.ok { color: var(--green-dk); }
.ends { display: flex; justify-content: space-between; font: 400 1.05rem var(--hand); -webkit-text-stroke: var(--hw) currentColor; paint-order: stroke fill; color: var(--ink-2); }
.tries { display: flex; flex-wrap: wrap; gap: 10px; }

/* month 1, month 2: the £250 split */
.split { display: grid; gap: 14px; margin: 18px 0 30px; }
.split .row { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center; }
.split .mo { font: 400 1.25rem var(--hand); -webkit-text-stroke: var(--hw) currentColor; paint-order: stroke fill; }
.split .bar { display: flex; height: 54px; border: 2px solid var(--ink); border-radius: 6px 3px 6px 4px; overflow: hidden; background: var(--card); }
.split .bar span { display: flex; align-items: center; justify-content: center; font: 400 1.05rem var(--hand); -webkit-text-stroke: var(--hw) currentColor; paint-order: stroke fill; white-space: nowrap; overflow: hidden; position: relative; }
.split .bar span::before { content: ""; position: absolute; inset: -6px; filter: url(#crayon); z-index: 0; }
.split .bar .i::before { background: var(--red); }
.split .bar .p::before { background: var(--blue); }
.split .bar span b { position: relative; z-index: 1; font-weight: 400; }
.split .bar .i { border-right: 2px solid var(--ink); }
.split .note { grid-column: 2; font-size: 0.92rem; color: var(--ink-2); margin-top: -6px; }
.split .row { opacity: 0; transition: opacity 0.4s steps(3); }
.split.in .row { opacity: 1; }
.split.in .row:nth-child(2) { transition-delay: 0.7s; }

/* legend + table */

/* the checker */
.tool-sec { margin-top: 72px; padding: 8px 0 8px; }
.tool { display: grid; grid-template-columns: 1fr 1.05fr; gap: 28px; padding: 28px; margin-top: 8px; }
.inputs fieldset { border: 0; padding: 0; margin: 0 0 18px; display: grid; gap: 16px; }
.inputs legend { font-weight: 700; margin-bottom: 10px; font-size: 1.05rem; }
.field { display: grid; gap: 4px; }
.field > span:first-child { font-weight: 600; font-size: 0.95rem; }
.field small { color: var(--ink-3); font-size: 0.82rem; }
.field input[type="range"] { height: 36px; }
.num { position: relative; display: flex; align-items: center; background: #fff; border: 1.5px solid rgba(38, 50, 85, 0.35); border-radius: 12px; min-height: 50px; transition: border-color 0.15s; }
.num:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(61, 107, 179, 0.25); }
.num input { flex: 1; min-width: 0; border: 0; background: transparent; font: 600 1.15rem var(--ui); color: var(--ink); padding: 10px 14px; outline: none; font-variant-numeric: tabular-nums; }
.num.pre::before { content: attr(data-pre); padding-left: 14px; font-weight: 600; color: var(--ink-2); }
.num.pre input { padding-left: 6px; }
.num.post::after { content: attr(data-post); padding-right: 14px; color: var(--ink-3); font-size: 0.92rem; white-space: nowrap; }
.num.bad { border-color: var(--red); }
.results { display: grid; gap: 16px; align-content: start; }
.result .label { margin: 0; color: var(--ink-3); font-size: 1rem; }
.apr-big { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 2px; }
.apr-big .pop { font-size: clamp(2.8rem, 7vw, 3.8rem); }
.apr-big .hand { font-size: 1.6rem; }
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 0; padding-top: 14px; border-top: 1.5px dashed rgba(38, 50, 85, 0.25); }
.nums dt { font-size: 0.8rem; color: var(--ink-3); font-weight: 600; }
.nums dd { margin: 2px 0 0; font-weight: 750; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.vs-bars { display: grid; gap: 10px; }
.vs-bars .b { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; font-size: 0.9rem; }
.vs-bars .track { height: 22px; display: flex; border-radius: 4px; overflow: hidden; }
.vs-bars .pr { background: var(--coin); opacity: 0.7; }
.vs-bars .int.red { background: var(--red); }
.vs-bars .int.blue { background: var(--blue-dk); }
.vs-bars .tot { font-weight: 700; font-variant-numeric: tabular-nums; }
.verdict-line { margin: 0; font-size: 1.05rem; }
.verdict-line .pop { font-size: 1.3em; vertical-align: -0.1em; }
.assume { margin-top: 16px; }

/* three checks */
.checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 24px; }
.check { padding: 26px 24px 20px; }
.check .n { font: 400 2.4rem/1 var(--pop); color: var(--yellow); -webkit-text-stroke: 0.04em var(--ink); paint-order: stroke fill; display: block; margin-bottom: 10px; }
.check p { font-size: 0.98rem; color: var(--ink-2); margin: 0; }

.watch { display: grid; grid-template-columns: 220px 1fr; gap: 36px; align-items: center; padding: 32px; margin-top: 64px; }
.sources { margin-top: 48px; font-size: 0.92rem; color: var(--ink-2); }
.sources summary { cursor: pointer; font-weight: 700; color: var(--ink); padding: 10px 0; }
.sources li { margin-bottom: 8px; }

@media (max-width: 860px) {
  .tool { grid-template-columns: 1fr; padding: 20px; }
  .checks { grid-template-columns: 1fr; }
  .watch { grid-template-columns: 1fr; padding: 22px; }
  .watch .phone { max-width: 220px; }
}
@media (max-width: 520px) {
  .nums { grid-template-columns: 1fr 1fr; }
  .split .row { grid-template-columns: 1fr; gap: 6px; }
  .split .note { grid-column: 1; }
  .vs-bars .b { grid-template-columns: 1fr auto; }
  .vs-bars .track { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .sums li, .split .row { opacity: 1; transform: none; transition: none; }
}

.in .grow { transform: none; }
.results.stale .result, .results.stale .vs-bars { opacity: 0.35; }

/* ================================================================ the story: one pinned sheet, cards scroll over it */
.green { color: var(--green-dk); }
.scroll-cue { display: flex; align-items: center; gap: 8px; margin: 28px 0 0; font-size: 1.3rem; color: var(--ink-2); }
.scroll-cue svg { width: 18px; height: 28px; animation: cue 1.2s steps(3) infinite; }
@keyframes cue { 50% { transform: translateY(6px); } }

.scrolly { position: relative; margin-top: 40px; }
.stage { position: sticky; top: 72px; height: calc(100vh - 72px); height: calc(100svh - 72px); overflow: hidden; background: var(--card); border-block: 1px solid var(--line); }
.stage-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* layers of the sheet fade in on 2s */
.L { opacity: 0; transition: opacity 0.42s steps(4); }
.L.on { opacity: 1; }
.L.on .grow { transform: none; }

/* scoreboard + working card, pinned like the video's HUD */
.hud { position: absolute; left: 20px; top: 16px; right: calc(min(400px, 34vw) + 4vw + 28px); display: flex; gap: 16px; align-items: flex-start; pointer-events: none; z-index: 2; }
.board { display: grid; gap: 8px; flex: none; }
.mt { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px; background: var(--card); border: 1.5px solid var(--ink); box-shadow: 3px 4px 0 rgba(38, 50, 85, 0.08); font-size: 0.85rem; white-space: nowrap; }
.mt .who { font: 400 1.1rem/1 var(--hand); -webkit-text-stroke: var(--hw) currentColor; paint-order: stroke fill; min-width: 3.4em; }
.mt .rt b { font: 400 1.05rem var(--pop); }
.mt.dealer .rt b { color: var(--red-text); }
.mt.bank .rt b { color: var(--blue-dk); }
.mt .apr { padding-left: 10px; border-left: 1.5px dashed rgba(38, 50, 85, 0.3); font-weight: 600; }
.mt .apr .pop { font-size: 1.15rem; vertical-align: -0.1em; margin-left: 4px; }
.hud-card { padding: 12px 18px 10px; max-width: 460px; transform: rotate(-0.6deg); }
.hud-card .label { margin: 0 0 2px; font-size: 1rem; color: var(--ink-3); }
.hud-card .sums { font-size: 1.15rem; line-height: 1.45; }
.hud-card .sums li { display: none; opacity: 1; transform: none; }
.hud-card .sums li.in { display: list-item; }
.hud-card .sums li.new { animation: write 0.42s steps(3) both; }
@keyframes write { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }

/* the cards */
.steps { position: relative; z-index: 3; margin-top: calc(-100vh + 72px); margin-top: calc(-100svh + 72px); pointer-events: none; }
.step { min-height: 88vh; min-height: 88svh; display: flex; justify-content: flex-end; align-items: flex-start; padding: 0 4vw; }
.step:first-child { padding-top: 62vh; }
.step:last-child { min-height: 120vh; }
.step .card { position: relative; pointer-events: auto; width: min(400px, 34vw); padding: 18px 22px 6px; border-radius: 3px; background: var(--stock); transition: opacity 0.35s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 0 0 0.5px rgba(38, 50, 85, 0.16),
    0 1.5px 0 #ddd4bf, 0 2.5px 0 #cbc0a6, 0 3px 2px rgba(38, 50, 85, 0.22), 0 6px 14px -8px rgba(34, 48, 90, 0.18), 0 12px 18px -10px rgba(38, 50, 85, 0.22); }
.step:not(.on) .card { opacity: 0.55; }
.step .card p { font-size: 1.02rem; line-height: 1.55; margin-bottom: 0.9em; }
.step .card .chap { font-size: 1.3rem; color: rgba(38, 50, 85, 0.85); margin-bottom: 6px; }
.step .card blockquote { margin: 0 0 0.9em; padding: 10px 14px; font-size: 1.2rem; line-height: 1.35; border-left: 4px solid var(--yellow); background: rgba(242, 187, 59, 0.12); border-radius: 0 10px 10px 0; }
.step .card .choices { justify-content: flex-start; margin-bottom: 12px; }
.step .card .choice { padding: 10px 16px; min-height: 46px; font-size: 0.95rem; }
.step .card .answer { margin: 0 0 12px; font-size: 1rem; }
.step .card .slider { min-width: 0; margin-bottom: 10px; }
.step .card .readout { padding: 0; min-height: 3em; font-size: 0.98rem; }
.step .card .tries { margin-bottom: 14px; }
.step .card .verdict-line { min-height: 3.2em; }
.step .card .verdict-line .pop { margin-right: 0.35em; }
.step .card .callout-in { margin: 0 0 4px; }
.step .card .callout-in .pop { font-size: 2.4rem; }
.step .card .split .row { grid-template-columns: 70px 1fr; }
.step .card .split .mo { font-size: 1.05rem; }
.step .card .split .bar { height: 44px; }
.step .card .split .bar span { font-size: 0.95rem; }
.step .card .split .row { opacity: 1; }
.step.center { justify-content: center; }
.step .card.big { width: min(560px, 100%); text-align: center; padding: 26px 30px 12px; }
.step .card.big p { font-size: 1.3rem; }
.step .card.big .pop { font-size: 1.6em; vertical-align: -0.12em; }
.after-story { margin-top: 40px; }

@media (max-width: 899px) {
  .hud { right: 16px; left: 12px; top: 10px; flex-direction: column; gap: 6px; }
  .board { grid-auto-flow: column; gap: 6px; }
  .mt { padding: 5px 8px; gap: 6px; font-size: 0.75rem; }
  .mt .who { font-size: 0.95rem; min-width: 0; }
  .hud-card { padding: 6px 12px 4px; max-width: none; }
  .hud-card .label { display: none; }
  .hud-card .sums { font-size: 0.95rem; line-height: 1.35; }
  .hud-card .sums li.in { display: none; } /* phones: only the newest two lines */
  .hud-card .sums li.in.last, .hud-card .sums li.in.prev { display: list-item; }
  .step { justify-content: center; padding: 0 12px; min-height: 92svh; }
  .step .card { width: 100%; }
  .step:first-child { padding-top: 70svh; }
}
.step .card .split .note { grid-column: 1 / -1; margin-top: -2px; }

/* grey = the standing charge (the standing-charge essay): text, marks, the tool's bars */
.grey { color: #5d6378; }
mark.hl-grey { --mk: rgba(163, 168, 182, 0.5); }
.vs-bars .sc { background: var(--grey); }
.vs-bars .u { background: var(--blue); }
/* a scoreboard answer in words (handwriting, full ink), written in when the story answers it; on phones .board.rows lets the pills
   and the working card wrap as one row (pills side by side while they fit), so the HUD stays short */
.mt .ans { font: 400 1.25rem/1 var(--hand); -webkit-text-stroke: var(--hw) currentColor; paint-order: stroke fill; color: var(--ink); }
.mt .ans.set { animation: write 0.42s steps(3) both; }
@media (max-width: 899px) {
  .hud:has(.board.rows) { flex-direction: row; flex-wrap: wrap; }
  .board.rows { display: contents; }
  .mt .ans { font-size: 1.1rem; }
}

/* green = interest earned (the compound-interest essay): the tool's bars; choice groups that sit left in a form; a choice that
   doesn't apply right now (how often, when the rate is an AER) */
.vs-bars .g1 { background: var(--green); opacity: 0.6; }
.vs-bars .g2 { background: var(--green-dk); opacity: 0.85; }
.choices.left { justify-content: flex-start; }
.choice:disabled { opacity: 0.4; cursor: default; transform: none; }

/* the cards: cut-out card stock taped onto the drawing. What sells "paper on paper" (user refs: a letterpress coaster, stamps, die-cut
   stickers) is texture and thickness, not ink or a big floating shadow: a barely-visible warm grain + white speckle + fibres, a bright cut
   edge, a 2px visible side, a tight contact shadow. No ink border: ink means "part of the drawing" (the working card and pills keep theirs).
   Full tape on each chapter's first card, a faint corner stub on the rest; set --tape-col on the body for the essay's colour. */
:root {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .37 0 0 0 0 .3 10 0 0 0 -6.4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.22' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-w: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 8 0 0 0 -4.6'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.5' filter='url(%23n)'/%3E%3C/svg%3E");
  --fibre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .5' numOctaves='3' seed='5' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .5 0 0 0 0 .38 3 0 0 0 -1.75'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' opacity='.2' filter='url(%23n)'/%3E%3C/svg%3E");
  --stock: var(--grain), var(--grain-w), var(--fibre), #fffefa;
}
.step .card::before { content: ""; position: absolute; top: -7px; right: -10px; width: 46px; height: 18px; rotate: 38deg; opacity: 0.4;
  background: var(--tape-col, rgba(127, 167, 217, 0.45)); clip-path: polygon(0 8%, 4% 0, 8% 10%, 12% 2%, 88% 0, 92% 9%, 96% 1%, 100% 8%, 100% 92%, 96% 100%, 92% 90%, 88% 99%, 12% 100%, 8% 91%, 4% 100%, 0 92%); }
.step .card:has(> .chap)::before { top: -13px; right: auto; left: 50%; width: 110px; height: 28px; translate: -50% 0; rotate: -3deg; opacity: 1; box-shadow: 0 1px 2px rgba(38, 50, 85, 0.12); }
@media (max-width: 899px) {
  /* phones: the card's top edge meets the drawing's ground, so chapter tape sits on the corner, clear of the picture */
  .step .card::before { right: 2px; }
  .step .card:has(> .chap)::before { top: -9px; left: auto; right: 18px; width: 84px; height: 22px; translate: none; }
}
/* the working card and the pills are on the same stock, but keep their ink: they're props in the drawing */
.hud-card, .mt { background: var(--stock); }
