/* BARMM story page, styled after FYT's article template on fyt.ph
   (e.g. "Clearing the Green"): mist header with cover card on the right,
   720px DM Sans column, Poppins blue subheads, lime-bar featured quotes.
   Credits band follows FYT's in-depth stories. Dark mode follows the reader's system setting. */
:root {
  --blue: #0064ba;
  --night: #00539b;
  --mint: #7cd5a7;
  --lime: #dfe748;
  --ink: #1b1926;
  --text: #555555;
  --pale: #e3fff1;
  --off: #f8f8f8;
  --mist: #e5eded;
  --tr: #2a4c73;            /* translation text, as in FYT quote boxes */
  /* scrolly tokens */
  --bg: #ffffff; --fg: var(--ink); --muted: var(--text); --square: #dfe1e6; --ember: #0064ba;
  --pop: var(--mint); --title: var(--blue); --outline: #b9bbc2; --card: #ffffff; --quote-bg: #f3f4f7; --rule: #e4e5ea;
  --display: "Poppins", Arial, sans-serif;
  --body: "DM Sans", Arial, sans-serif;
  --label: "DM Sans", Arial, sans-serif;
  --serif: "Newsreader", Georgia, serif;   /* reading text: story paragraphs, translations, scrolly cards */
  --col: 720px;
  --content: #333333;     /* body text: same as the Flourish chart headline */
  --meta: #333333;
}
/* ---------- dark mode (follows the reader's system setting) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1926; --card: #232130; --rule: #2c2a38; --off: #232130;
    --ink: #ffffff; --content: #e9e8ee; --meta: #e9e8ee; --text: #b4b3bb;
    --blue: #6fb3ff;            /* blue text (subheads, quotes, links), lightened for dark backgrounds */
    --tr: #a9c8ec;              /* translations and attributions */
    --square: #34323f; --outline: #5a5866; --pop: #dfe748; --title: #6fb3ff;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--content);
  font-family: var(--body); font-size: 20px; line-height: 1.6; letter-spacing: .01em;
}
a { color: var(--blue); }
.story > p a, .credits a { color: var(--blue); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.story > p a:hover { text-decoration-thickness: 2px; }
.credits a { color: var(--lime); }

/* ---------- column ---------- */
.story > p, .story > h2, .story > blockquote {
  max-width: calc(var(--col) + 48px); margin-left: auto; margin-right: auto;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.wide { max-width: 1000px; margin: 48px auto; padding: 0 24px; }
.full { max-width: 1180px; margin: 56px auto; padding: 0 16px; }

/* ---------- header: looping drone video with a blue vignette and grid, lime headline ----------
   The video sits on the right; the blue tint and grid sit on the text side and fade out
   across the left part of the video. On phones the video sits on top and fades into the blue below. */
.hero {
  position: relative; overflow: hidden; color: #fff; min-height: min(92vh, 860px);
  display: flex; align-items: flex-end;
  background: #005cad;          /* flat, so the vignette meets it without a seam */
}
.hero::before {                 /* blueprint grid on the text side */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 38%, transparent 62%);
          mask-image: linear-gradient(90deg, #000 0, #000 38%, transparent 62%);
}
.hero-media { position: absolute; top: 0; right: 0; bottom: 0; width: 66%; pointer-events: none; }
/* the video is background only: touches pass through to the page (so swipes scroll),
   and the phone's own play button never shows over it */
.hero-video { pointer-events: none; opacity: 0; transition: opacity .5s; }
/* the still frame sits behind the video; the video only becomes visible once it is
   actually playing, so a phone that blocks autoplay never shows its play button */
.hero-media { background: url("img/hero-barmm-poster.jpg") center / cover no-repeat; }
.hero-video.is-playing { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .hero-video { transition: none; } }
.hero-video::-webkit-media-controls,
.hero-video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; display: block; }
.hero-media::after {            /* blue vignette: solid at the video's left edge, clear by about 40% across */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, #005cad 0%, rgba(0,92,173,.75) 15%, rgba(0,92,173,0) 42%),
    linear-gradient(0deg, rgba(0,60,120,.45) 0%, rgba(0,60,120,0) 30%);
}
.hero-inner { position: relative; z-index: 2; width: 100%; max-width: 1200px; margin: 0 auto; padding: 140px 24px 56px; }
.hero-inner > * { max-width: min(680px, 52vw); }
h1 {
  font-family: var(--display); font-weight: 700; color: var(--lime);
  font-size: clamp(32px, 3.9vw, 56px); line-height: 1.08; letter-spacing: -.03em;
  margin: 0 0 22px; text-wrap: balance;
}
.byline { font-family: var(--body); font-weight: 400; font-size: 17px; line-height: 1.5; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 10px; }
.deck { font-size: 18px; line-height: 1.5; margin: 0 0 14px; color: #fff; }
.date { font-size: 15px; margin: 0 0 26px; opacity: .85; }
.scroll-cue { display: inline-flex; align-items: center; gap: 8px; font-family: var(--body); font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--lime); margin: 0; }
.scroll-icon { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(-3px); } 50% { transform: translateY(5px); } }
@media (prefers-reduced-motion: reduce) { .scroll-icon { animation: none; } }
.hero-credit { position: absolute; right: 16px; bottom: 10px; z-index: 2; margin: 0; font-size: 12px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
@media (max-width: 860px) {
  .hero { min-height: 0; display: block; }
  .hero::before {               /* grid only on the blue below the video */
    -webkit-mask-image: linear-gradient(180deg, transparent 0, transparent 50vw, #000 calc(50vw + 80px));
            mask-image: linear-gradient(180deg, transparent 0, transparent 50vw, #000 calc(50vw + 80px));
  }
  .hero-media { position: relative; width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .hero-media::after { background: linear-gradient(180deg, rgba(0,92,173,0) 55%, #005cad 100%); }
  .hero-inner { padding: 8px 24px 44px; margin-top: -24px; }
  .hero-inner > * { max-width: none; }
  .hero-credit { position: static; padding: 0 24px 20px; margin-top: -28px; color: rgba(255,255,255,.85); text-shadow: none; }
}

/* ---------- body copy ---------- */
.story { padding-top: 48px; }
.story > p { margin-top: 0; margin-bottom: 20px; font-family: var(--serif); font-size: 21px; line-height: 1.6; letter-spacing: 0; }
.story > h2 {
  font-family: var(--display); font-weight: 700; font-size: clamp(30px, 3.2vw, 45px); line-height: 1.2;
  color: var(--blue); letter-spacing: 0; margin-top: 48px; margin-bottom: 16px;
}

/* drop cap on the opening paragraph, in the heading typeface.
   initial-letter sizes it to exactly 3 lines: its top lines up with the top of
   the first line's capitals and its foot sits on the third line's baseline.
   flow-root keeps a short opener from letting the next paragraph wrap around it. */
/* The opener is the same size as the rest of the body. */
.story > p.dropcap { display: flow-root; }
.story > p.dropcap::first-letter {
  font-family: var(--display); font-weight: 700; color: var(--blue);
  -webkit-initial-letter: 3; initial-letter: 3; margin-right: .14em;
}
/* browsers without initial-letter (e.g. Firefox): a float sized to about 3 lines */
@supports not ((initial-letter: 3) or (-webkit-initial-letter: 3)) {
  .story > p.dropcap::first-letter { float: left; font-size: 5.3em; line-height: .74; padding: .07em .06em 0 0; }
}

/* English translation of a Filipino quote, run as its own paragraph */
/* Filipino quotes are italic; their English translations stay upright, full column width */
.story > p.tr { color: var(--meta); font-style: normal; }
.story i[lang="fil"] { font-style: italic; }

/* big standalone line */
.story > p.callout {
  font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1.35; color: var(--blue);
  margin-top: 28px; margin-bottom: 28px; letter-spacing: 0;
}
/* ---------- featured quotes ----------
   Not repeats: the real quote, styled where it sits in the text. Quote, then
   (for Filipino quotes) the English translation at the same width, then an
   attribution line, all beside a lime bar. Used for the three strongest quotes only. */
.story > .qc { max-width: var(--col); width: calc(100% - 48px); margin: 32px auto; border-left: 8px solid var(--lime); padding: 4px 0 4px 28px; }
.qc blockquote { margin: 0; }
.qc .qc-q { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(24px, 2.6vw, 30px); line-height: 1.25; letter-spacing: -.01em; color: var(--blue); }
.qc .qc-en { margin: 10px 0 0; font-family: var(--serif); font-size: 21px; line-height: 1.45; letter-spacing: 0; color: var(--tr); }
.qc figcaption { margin: 12px 0 0; font-size: 15px; line-height: 1.4; color: var(--tr); text-align: left; }
@media (max-width: 560px) { .story > .qc { width: calc(100% - 32px); padding-left: 20px; } }

/* ---------- figures ---------- */
figure { margin: 0; }
/* photo and screenshot captions: the caption on one line, the credit on the line below */
figcaption { margin-top: 10px; font-size: 16px; line-height: 1.45; color: var(--content); text-align: left; }
figcaption small { display: block; margin-top: 4px; font-size: 13px; line-height: 1.4; color: var(--text); }
.flourish-embed { min-height: 520px; }

/* screenshot of a Facebook post */
.post { max-width: calc(var(--col) + 48px); margin: 44px auto; padding: 0 24px; }
.post img, .post .ph { border-radius: 0; }
.post img { display: block; width: 100%; height: auto; }
.post-stack img + img { margin-top: 10px; }
/* full photos: wider than the text column to break up long stretches of text */
.story > .photo { max-width: 1000px; margin: 48px auto; padding: 0 24px; }
.photo img { display: block; width: 100%; height: auto; border-radius: 0; }
.photo figcaption { text-align: left; max-width: var(--col); margin: 10px auto 0; }
@media (max-width: 560px) { .story > .photo { padding: 0; } .photo figcaption { padding: 0 16px; } }
.story > .post-tall { max-width: 560px; }   /* tall post screenshots; comment strips use the full column */
.post .ph {
  border: 2px dashed #9cc3e6; background: var(--off);
  aspect-ratio: 16 / 10; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 20px; font-size: 15px; color: var(--text); line-height: 1.4;
}
.post .ph b { color: var(--blue); font-family: var(--display); font-weight: 600; display: block; margin-bottom: 6px; }
.post .ph code { font-size: 12px; margin-top: 8px; }


/* ---------- credits band: credits, then a collapsible methodology ---------- */
.method summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; margin: 0; user-select: none; }
.method summary::-webkit-details-marker { display: none; }
.method summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
.method[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.method[open] summary { margin-bottom: 12px; }
.method summary:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
.credits { margin-top: 72px; background: linear-gradient(180deg, #0064ba, #00539b); padding: 64px 24px 80px; color: #fff; }
/* one text size for the whole footer: names in the credits, methodology, grant box, SpotLyf note */
.credits-card { --footer-text: 13px; max-width: var(--col); margin: 0 auto; font-size: var(--footer-text); line-height: 1.6; }
.credits-kicker {
  font-family: var(--label); font-weight: 700; font-size: 13px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--lime); margin: 0 0 10px;
}
.credits-card hr { border: 0; border-top: 1px solid rgba(255,255,255,.3); margin: 28px 0 24px; }
.credits-card p { margin: 0 0 .9em; }
.credits-card p:last-child { margin-bottom: 0; }
.credits-card dl { margin: 0; display: grid; gap: 8px; }
.credits-card dl > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.credits-card dt { font-family: var(--label); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.75); }
.credits-card dd { margin: 0; font-family: var(--label); font-size: var(--footer-text); font-weight: 500; letter-spacing: .02em; }

/* grant acknowledgement (boxed, above the methodology) and the SpotLyf note (below the credits) */
.grant-box { border: 1px solid rgba(255,255,255,.4); border-radius: 10px; padding: 16px 20px; margin: 0 0 28px; background: rgba(0,0,0,.12); }
.grant-box p { margin: 0; font-size: var(--footer-text); line-height: 1.6; }
.tool-note { display: flex; align-items: center; gap: 20px; margin-top: 22px; }
.tool-note img { flex: 0 0 auto; width: 140px; height: auto; }
.credits-card .tool-note p { margin: 0; font-size: var(--footer-text); line-height: 1.6; color: rgba(255,255,255,.9); }
@media (max-width: 560px) { .tool-note { flex-direction: column; align-items: flex-start; gap: 12px; } .tool-note img { width: 120px; } }

/* placeholder text still to fill in */
.todo { background: #fff3b0; color: #1b1926; padding: 0 .2em; border-radius: 2px; }

/* =========================================================
   Traitor-charge scrolly (ported from barmm-election-narrative)
   ========================================================= */
.scrolly { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: start; }
.scrolly .steps { grid-column: 1; grid-row: 1; padding-bottom: 20vh; }
.scrolly .graphic {
  grid-column: 2; grid-row: 1; position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 6vh);
  height: 88vh; display: flex; align-items: center; justify-content: center;
}
.scrolly .graphic svg { width: 100%; height: 100%; max-height: 640px; overflow: visible; }
.scrolly .step { min-height: 78vh; display: flex; align-items: center; }
.scrolly .card {
  background: var(--card); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,40,90,.12);
  padding: 22px 24px; max-width: 32em; transition: opacity .3s; font-size: 19px; line-height: 1.5; color: var(--ink);
}
.scrolly .step:not(.active) .card { opacity: .45; }
.scrolly .card p { margin: 0 0 12px; }
.scrolly .card p:last-child { margin-bottom: 0; }
.hl-grey { background: var(--square); color: var(--fg); padding: 0 .2em; border-radius: 2px; font-weight: 700; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hl-blue { background: var(--ember); color: #ffffff; padding: 0 .2em; border-radius: 2px; font-weight: 700; }
.hl-lime { background: var(--pop); color: #1b1926; padding: 0 .15em; border-radius: 2px; font-weight: 700; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.qhead { font-family: var(--label); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--blue); }
.scrolly .card .qhead { margin: 0 0 2px; line-height: 1.2; }
.scrolly .card .qlede { font-family: var(--display); font-weight: 600; font-size: 1.05em; line-height: 1.3; margin: 0 0 14px; }
.quote { position: relative; margin: 0 0 16px; padding: 2px 0 2px 18px; border-left: 6px solid var(--lime); }
.quote:last-child { margin-bottom: 0; }
.quote .orig { font-style: italic; }
.quote .tr { display: block; font-size: 15px; color: var(--tr); margin-top: 6px; }
.quote .qdate { display: block; font-family: var(--label); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
/* Quote groups: the card is pinned while two scroll triggers pass behind it.
   The second quote appears (and fades in) on the second trigger; then the card scrolls away. */
.scrolly .step-group { display: grid; }
.scrolly .step-group > * { grid-area: 1 / 1; }
.scrolly .step-group > .card { position: sticky; top: 22vh; align-self: start; z-index: 1; }
.scrolly .step.trigger { min-height: 70vh; }
.scrolly .step.trigger:last-child { min-height: 95vh; }
.scrolly .step-group:not(.active) > .card { opacity: .45; }
.scrolly .step-group .quote.later { display: none; }
.scrolly .step-group[data-state="q2"] .quote.later,
.scrolly .step-group[data-state="q4"] .quote.later { display: block; animation: quote-in .5s ease both; }
@keyframes quote-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .scrolly .step-group .quote.later { animation: none !important; } }
.sq { fill: var(--square); transition: transform .9s cubic-bezier(.6,.05,.25,1), fill .5s, opacity .5s; transform-box: view-box; }
svg[data-hot="1"] .sq.b { fill: var(--ember); }
svg[data-hot="1"] .sq.b.pop { fill: var(--pop); }
.ln { fill: none; }
.ln.box { stroke: var(--outline); stroke-width: .5; }
.lbl { font-family: var(--body); font-size: 9px; fill: var(--muted); }
.lbl.date { font-size: 8px; }
.lbl.hl { font-family: var(--display); font-weight: 700; font-size: 22px; fill: var(--title); }
.layer { opacity: 0; transition: opacity .5s; pointer-events: none; }
.layer.on { opacity: 1; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 820px) {
  .scrolly { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .scrolly .graphic {
    grid-column: 1; grid-row: 1; z-index: 1; height: 50vh;
    top: env(safe-area-inset-top, 0px); background: var(--bg);
  }
  .scrolly .steps { grid-column: 1; grid-row: 2; position: relative; z-index: 2; margin-top: -10vh; }
  .scrolly .step { min-height: 115vh; align-items: flex-start; }
  .scrolly .step:first-child { min-height: 90vh; }
  .scrolly .step:not(.active) .card { opacity: .9; }
  .scrolly .step-group > .card { top: calc(50vh + 12px); padding: 16px 18px; font-size: 16px; }
  .scrolly .step-group .quote .tr { font-size: 14px; }
  .scrolly .step-group .card .qlede { margin-bottom: 10px; }
  .scrolly .step.trigger { min-height: 80vh; }
  .scrolly .step.trigger:last-child { min-height: 100vh; }
  .scrolly .step-group:not(.active) > .card { opacity: .9; }
}
@media (max-width: 560px) {
}
@media (prefers-reduced-motion: reduce) {
  .sq, .layer, .scrolly .card { transition: none; }
}
@media (max-width: 560px) { .story > p, .qc .qc-en { font-size: 19px; } }
