/* Reddit lead finder. Same order as the series: heading, stats, quote, the
   problem, before, now, what changed. Every section reads with no scroll
   effects; page.js adds the feed and the turn on top. The page's own ground
   is the 8 AM dawn: pre-dawn night under Before, warm morning light at Now.
   Loaded after the engine and the site stylesheet, so site tokens win. */

:root {
  --sc-canvas: var(--bg);
  --sc-ink: var(--text);
  --sc-accent: var(--accent);
  --sc-font-display: var(--h-font);
  --sc-font-text: var(--b-font);
  --sc-font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;

  /* Before: the hour before dawn. Now: 8 AM light. */
  --night: #0f1626;
  --night-2: #172036;
  --night-line: #26304a;
  --dawn: #fbf1e6;
  --before-ink: #f2f2f2;
  --before-soft: #a3aabb;                   /* 7.6:1 on --night */
  /* #FD3A25 clears 5.1:1 on --night but not 4.5:1 on the light grounds, so
     small accent text on light uses the deeper stop. */
  --accent-on-dark: var(--accent);
  --accent-on-light: #c8200f;               /* 5.2:1 on --dawn */
  --dawn-soft: #5f5a55;                     /* 6.2:1 on --dawn */

  --side-pad: clamp(24px, 5vw, 88px);
  --gap: clamp(56px, 8vh, 96px);
}

/* Owner's decision for the series: an ordinary header at the top. */
.tf-header { position: absolute; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------- layout -- */
.rl { background: var(--bg); color: var(--text); }
.wrap { max-width: 76rem; margin-inline: auto; padding-inline: var(--side-pad); }
.rl > .wrap + .wrap, .rl > .wrap + section, .rl > section + .wrap { margin-top: var(--gap); }
.prose > * { max-width: 46rem; }
.prose > * + * { margin-top: 18px; }
.prose p { font-size: 1.1rem; line-height: 1.7; color: var(--muted); }
.prose p strong { color: var(--text); }
.rl h2 { font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.8rem); letter-spacing: -.02em; }
.rl h3 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.8rem); letter-spacing: -.01em; }

/* ---------------------------------------------------------------- hero --
   First light: a low sun warming the corner, and the morning sheet already
   waiting in front of it. */
.rl-hero {
  position: relative; overflow: clip;
  padding-top: clamp(150px, 22vh, 220px); padding-bottom: 24px;
}
.hero-copy { position: relative; z-index: 2; }
.hero-copy > * + * { margin-top: 20px; }
.eyebrow { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-on-light); }
.hero-line {
  font-family: var(--h-font); font-weight: 700;
  font-size: clamp(2.2rem, 1.2rem + 3.2vw, 4rem);
  line-height: 1.06; letter-spacing: -.03em;
  max-width: 17ch; margin: 0;
}
.lead { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); line-height: 1.6; max-width: 40ch; color: var(--muted); }

.plane { position: absolute; margin: 0; pointer-events: none; }
.plane--sun {
  inset: -340px 0 0 0; z-index: 0;
  background:
    radial-gradient(38rem 26rem at 82% 92%, color-mix(in oklab, #ffb37a 55%, transparent), transparent 70%),
    radial-gradient(60rem 30rem at 80% 110%, color-mix(in oklab, #ffd9b8 70%, transparent), transparent 75%);
  /* The glow fades out before the hero ends, so it never stops on a hard line. */
  -webkit-mask-image: linear-gradient(#000 55%, transparent 98%);
          mask-image: linear-gradient(#000 55%, transparent 98%);
}
.plane--mid { z-index: 1; right: max(var(--side-pad), calc((100% - 76rem) / 2 + var(--side-pad))); bottom: 40px; width: 17rem; }
.dawn-sheet {
  display: flex; flex-direction: column; gap: 10px; padding: 18px 20px;
  background: var(--card-bg); border-radius: var(--card-radius); box-shadow: var(--card-shadow);
}
.dawn-title { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); }
.dawn-title b { color: var(--accent-on-light); }
.dawn-row { height: 8px; border-radius: 4px; background: var(--line); }
.dawn-row i { display: block; height: 100%; width: calc(var(--m) * 100%); border-radius: inherit; background: var(--accent-on-light); }

/* --------------------------------------------------------------- stats -- */
.rl > .stats { margin-top: 56px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.stat {
  display: flex; flex-direction: column; padding: 26px 26px 28px;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--card-radius);
}
.stat-viz { height: 64px; margin-bottom: 22px; }

/* 15 subreddits: 15 feeds, each lighting up. */
.viz-feeds { display: grid; grid-template-columns: repeat(5, 18px); gap: 6px 8px; align-content: center; }
.viz-feeds i { width: 18px; height: 14px; border-radius: 4px; background: var(--accent-on-light); }

/* Top 5: 5 scores, every one past the line at 60. */
.viz-top { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 5px; max-width: 12rem; }
.viz-top i { display: block; height: 7px; width: calc(var(--m) * 100%); border-radius: 4px; background: var(--accent-on-light); }
.viz-line { position: absolute; left: 60%; top: 4px; bottom: 4px; width: 2px; background: var(--text); }

/* $3 to $11 a month: a narrow band on a long, cheap scale. */
.viz-cost { display: flex; align-items: center; max-width: 12rem; }
.cost-track { position: relative; display: block; width: 100%; height: 12px; border-radius: 6px; background: var(--line); }
.cost-fill { position: absolute; top: 0; bottom: 0; left: 15%; width: 40%; border-radius: inherit; background: var(--accent-on-light); }

/* Entry: the cards rise one after another, then each picture fills. Motion
   only; without it everything shows finished. */
.rl-motion .stat { transition: opacity .7s var(--sc-ease-out, ease-out), transform .7s var(--sc-ease-out, ease-out); transition-delay: calc(var(--n) * 120ms); }
.rl-motion .stats:not(.is-in) .stat { opacity: 0; transform: translateY(28px); }
.rl-motion .viz-feeds i { transition: transform .35s var(--sc-ease-out, ease-out), opacity .35s; transition-delay: calc(.4s + var(--i) * 60ms); }
.rl-motion .stats:not(.is-in) .viz-feeds i { transform: scale(.4); opacity: .15; }
.rl-motion .viz-top i { transition: width .8s var(--sc-ease-out, ease-out); transition-delay: calc(.6s + var(--i) * 110ms); }
.rl-motion .stats:not(.is-in) .viz-top i { width: 4%; }
.rl-motion .cost-fill { transition: width .9s var(--sc-ease-out, ease-out) .8s; }
.rl-motion .stats:not(.is-in) .cost-fill { width: 0; }
.stat-n {
  margin: 0; font-family: var(--h-font); font-weight: 700; color: var(--text);
  font-size: clamp(2.2rem, 1.6rem + 2vw, 3.4rem); line-height: 1.05; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.stat-l { margin: 8px 0 0; font-size: 1rem; color: var(--muted); }

/* --------------------------------------------------------------- quote -- */
.quote { margin-block: 0; }
.quote p {
  margin: 0; font-family: var(--h-font); font-weight: 600; color: var(--text);
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 3rem); line-height: 1.2; letter-spacing: -.025em;
  max-width: 26ch; text-wrap: balance;
}
.quote footer { margin-top: 20px; color: var(--muted); }

/* -------------------------------------------------------------- before --
   The hour before dawn. Runs from the Before heading, through the feed, to
   the top of the turn, where the light comes up. */
.before {
  background: var(--night); color: var(--before-ink);
  padding-top: var(--gap); padding-bottom: var(--gap);
}
.before h2, .before h3 { color: #fff; }
.before .prose p { color: var(--before-soft); }
.before .prose p strong { color: #fff; }
.before .cost { margin-top: var(--gap); }
.before .cost .cost-line { font-size: clamp(1.2rem, 1rem + .6vw, 1.45rem); line-height: 1.5; }

.grind { margin-top: 48px; }
.grind-stage { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(32px, 5vw, 80px); align-items: start; }
.steps { margin: 20px 0 0; padding-left: 1.4em; color: var(--before-soft); font-size: 1.1rem; line-height: 1.5; }
.steps li + li { margin-top: 8px; }

.counter { margin-top: 28px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.counter-n {
  font-family: var(--sc-font-mono); font-weight: 600; font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 2rem + 4vw, 5.5rem); line-height: 1; color: var(--accent-on-dark);
}
.counter-l { color: var(--before-soft); }

.feed-note { font-size: 14px; color: var(--before-soft); margin: 0 0 10px; }
.scene-stack { display: flex; flex-direction: column; gap: 16px; }

/* Step 1: the 15 tabs. */
.tabs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.tabs li {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--night-line);
  background: var(--night-2); color: #e4e7ee; font-size: 14px;
}

/* Steps 2 to 4: the feed. Skipped posts grey out, their reason stays readable. */
.feed { border: 1px solid var(--night-line); border-radius: 14px; background: #0b111e; padding: 12px; }
.feed-track { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.post {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 10px 14px; border-radius: 10px; background: var(--night-2); border: 1px solid transparent;
}
.post-sub { grid-column: 1; font-size: 13px; color: var(--before-soft); }
.post-t { grid-column: 1; font-size: 15px; color: #fff; }
.why {
  grid-column: 2; grid-row: 1 / 3; justify-self: end;
  padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: transparent; color: transparent; transition: background .3s, color .3s;
}
.post.is-skip .post-sub, .post.is-skip .post-t { opacity: .35; text-decoration: line-through; text-decoration-color: color-mix(in oklab, #fff 40%, transparent); }
.post.is-skip .why { background: #2a3350; color: #e4e7ee; }
.post.is-keep { border-color: var(--accent-on-dark); background: #2a1720; }
.post.is-keep .why { background: var(--accent-on-light); color: #fff; }   /* white on the deeper red: 5.6:1 */
.reply { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--night-line); }
.reply-h { font-size: 13px; font-weight: 700; color: var(--before-soft); }
.reply-t { font-size: 15px; line-height: 1.45; color: #fff; }

/* The pinned feed. Only with motion: page.js sets .rl-motion and drives the
   classes, so the static page above is the finished state. */
.rl-motion .grind { margin-top: 0; }
.rl-motion .grind-stage { align-items: stretch; padding-block: clamp(56px, 10vh, 112px); background: var(--night); }
.rl-motion .grind-copy { display: flex; flex-direction: column; justify-content: center; }
.rl-motion .scene { display: flex; flex-direction: column; min-height: 0; }
.rl-motion .scene-stack { flex: 1; min-height: 0; display: grid; gap: 0; }
.rl-motion .scene-stack > * { grid-area: 1 / 1; min-height: 0; will-change: transform, opacity; }
.rl-motion .tabs { align-self: center; justify-content: center; }
.rl-motion .tabs li { transition: opacity .25s, transform .25s, border-color .25s; }
.rl-motion .tabs li:not(.is-open) { opacity: 0; transform: translateY(10px) scale(.92); }
.rl-motion .tabs li.is-current { border-color: var(--accent-on-dark); }
.rl-motion .feed { overflow: hidden; -webkit-mask-image: linear-gradient(transparent, #000 8%, #000 88%, transparent); mask-image: linear-gradient(transparent, #000 8%, #000 88%, transparent); }
.rl-motion .feed-track { will-change: transform; }
.rl-motion .post.is-skip:not(.is-grey) .post-sub, .rl-motion .post.is-skip:not(.is-grey) .post-t { opacity: 1; text-decoration-color: transparent; }
.rl-motion .post.is-skip:not(.is-grey) .why { background: transparent; color: transparent; }
.rl-motion .post .post-sub, .rl-motion .post .post-t { transition: opacity .35s, text-decoration-color .35s; }
.rl-motion .post.is-keep:not(.is-lit) { border-color: transparent; background: var(--night-2); }
.rl-motion .post.is-keep:not(.is-lit) .why { background: transparent; color: transparent; }
.rl-motion .reply:not(.is-on) { opacity: 0; }
.rl-motion .reply { transition: opacity .3s; }
.rl-motion .reply-t.is-typing::after {
  content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px;
  background: var(--accent-on-dark); animation: rl-blink 1s steps(1) infinite;
}
@keyframes rl-blink { 50% { opacity: 0; } }

/* One step at a time, as in the series. page.js gives each its own opacity,
   lift and blur, and sets --sp (0 to 1) for the progress bar. */
.rl-motion .steps { display: grid; list-style: none; padding-left: 0; margin-top: 28px; }
.rl-motion .steps li {
  grid-area: 1 / 1; margin: 0; color: #fff;
  font-family: var(--h-font); font-weight: 600; letter-spacing: -.01em;
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2.1rem); line-height: 1.25;
  will-change: transform, opacity, filter;
}
.rl-motion .steps li::before {
  content: "Step " counter(list-item) " of 4"; display: block; margin-bottom: 10px;
  font-family: var(--b-font); font-size: 14px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-on-dark);
}
.rl-motion .steps::after {
  content: ""; grid-area: 2 / 1; margin-top: 24px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-on-dark) calc(var(--sp, 0) * 100%), var(--night-line) 0);
}

/* ----------------------------------------------------------------- now --
   The peak. With motion the stage starts in the night, the light comes up
   (--lit, 0 to 1), the 15 feeds pour into the meter, then the sheet lands.
   Without motion it is simply the finished sheet on morning light. */
.now { padding-bottom: 0; }
.turn-stage {
  --lit: 1;
  background: color-mix(in oklab, var(--dawn) calc(var(--lit) * 100%), var(--night));
  display: flex; align-items: center;
  padding-block: var(--gap);
}
.turn-grid { width: 100%; display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(32px, 5vw, 80px); align-items: center; }
.turn-now > * + * { margin-top: 16px; }
.turn-now h2 { font-size: clamp(3rem, 2rem + 4vw, 5.5rem); line-height: 1; letter-spacing: -.04em; }
.turn-before { display: none; }
.rl-motion .turn-copy { display: grid; }
.rl-motion .turn-copy > * { grid-area: 1 / 1; align-self: center; }
.rl-motion .turn-before {
  display: block; margin: 0; max-width: 15ch; color: #fff;
  font-family: var(--h-font); font-weight: 600; letter-spacing: -.02em;
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.4rem); line-height: 1.12;
}
.time { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-on-light); }
.turn-line { font-size: clamp(1.2rem, 1rem + .6vw, 1.5rem); line-height: 1.5; color: var(--text); max-width: 26ch; }
.now > .prose { margin-top: 8px; padding-top: var(--gap); }
.now .pull { font-family: var(--h-font); font-weight: 600; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); line-height: 1.25; color: var(--text); letter-spacing: -.02em; }

.turn-objects { display: grid; }
.turn-objects > * { grid-area: 1 / 1; align-self: center; }

/* The pour: 15 feeds, posts falling onto the meter, the line at 60. */
.pour { display: none; }
.rl-motion .pour { display: flex; flex-direction: column; gap: 0; max-width: 34rem; will-change: opacity, transform; }
.pour-feeds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pour-feeds li {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
  padding: 6px 4px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: var(--card-bg); color: var(--text); box-shadow: var(--card-shadow);
}
.pour-fall { position: relative; height: clamp(120px, 22vh, 220px); }
.pour-fall i {
  position: absolute; top: 0; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%;
  background: var(--accent-on-light); will-change: transform, opacity;
}
.pour-fall i.is-low { background: #9a948e; }
.meter-bar {
  position: relative; height: 18px; border-radius: 9px; background: #e7ddd2;
}
.meter-keep { position: absolute; left: 60%; right: 0; top: 0; bottom: 0; border-radius: 0 9px 9px 0; background: color-mix(in oklab, var(--accent-on-light) 22%, #fff); }
.meter-line { position: absolute; left: 60%; top: -10px; bottom: -10px; width: 3px; margin-left: -1px; background: var(--text); border-radius: 2px; }
.meter-scale { position: relative; margin: 14px 0 0; height: 1.2em; font-size: 13px; font-weight: 600; color: var(--dawn-soft); }
.meter-scale span { position: absolute; top: 0; }
.meter-scale span:first-child { left: 0; }
.meter-scale span:last-child { right: 0; }
.meter-60 { left: 60%; transform: translateX(-50%); color: var(--text); white-space: nowrap; }

/* The sheet: the morning's 5, each with its opener written. */
.sheet {
  background: var(--card-bg); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); padding: 24px 28px; max-width: 38rem;
}
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sheet-title { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--text); }
.sheet-time { margin: 0; font-size: 14px; font-weight: 700; color: var(--accent-on-light); }
.sheet-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.sheet-rows { list-style: none; margin: 8px 0 0; padding: 0; }
.sheet-rows li {
  display: grid; grid-template-columns: 8.5rem 1fr 4.5rem auto; gap: 4px 14px; align-items: center;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px;
}
.row-sub { font-family: var(--sc-font-mono); font-size: 13px; color: var(--muted); }
.row-pain { color: var(--text); }
.row-meter { height: 6px; border-radius: 3px; background: var(--line); }
.row-meter i { display: block; height: 100%; width: calc(var(--m) * 100%); border-radius: inherit; background: var(--accent-on-light); }
.row-op { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #fbe3df; color: #9e1a0c; white-space: nowrap; }
.sheet-opener { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--bg); font-size: 14px; line-height: 1.5; color: var(--text); }
.sheet-opener b { display: block; margin-bottom: 4px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-on-light); }
.sheet-foot { margin: 12px 0 0; font-size: 14px; color: var(--muted); }

.rl-motion .turn-stage { height: 100svh; padding-block: 0; }
.rl-motion .turn-stage .sheet { opacity: 0; }

/* --------------------------------------------------------------- close -- */
.close { display: flex; flex-direction: column; align-items: flex-start; padding-bottom: calc(var(--gap) * 1.5); }
.close > * + * { margin-top: 18px; }
.close p { font-size: 1.1rem; color: var(--muted); max-width: 46rem; }
.close .tf-btn { margin-top: 28px; }
.rl .tf-btn:active { transform: translateY(0) scale(.98); filter: brightness(1.05); }

/* --------------------------------------------------------------- tablet -- */
@media (max-width: 1000px) {
  .plane--mid { display: none; }
}

/* ---------------------------------------------------------------- phone -- */
@media (max-width: 760px) {
  .logo-site { display: inline-block; padding-block: 7px; }
  .menu-toggle { padding: 14px 10px; }
  .rl-hero { padding-top: 130px; }
  .hero-line { font-size: clamp(1.9rem, 1.2rem + 3vw, 2.5rem); max-width: 18ch; }
  .stats { grid-template-columns: 1fr; gap: 16px; }
  .grind-stage, .turn-grid { grid-template-columns: 1fr; }
  .post-t, .reply-t { font-size: 14px; }
  .why { font-size: 12px; padding: 2px 8px; }
  /* The pinned feed is one screen tall: step and count on top, the scene fills the rest. */
  .rl-motion .grind-stage { grid-template-rows: auto 1fr; gap: 16px; padding-block: 72px 92px; }
  .rl-motion .steps { margin-top: 16px; }
  .rl-motion .steps li { font-size: 1.25rem; }
  .rl-motion .steps::after { margin-top: 14px; }
  .rl-motion .counter { margin-top: 12px; }
  .rl-motion .counter-n { font-size: 2.4rem; }
  .rl-motion .grind-copy h3 { font-size: 1.15rem; }
  .tabs li { font-size: 12px; padding: 4px 9px; }
  .rl-motion .turn-grid { gap: 16px; }
  .pour-feeds { grid-template-columns: repeat(3, 1fr); }
  .pour-feeds li { font-size: 11px; padding: 4px 2px; }
  .pour-fall { height: 90px; }
  /* The finished turn has to fit one phone screen. */
  .turn-now h2 { font-size: 2.6rem; }
  .turn-now > * + * { margin-top: 8px; }
  .turn-line { font-size: 1.05rem; max-width: none; }
  .sheet { padding: 14px 16px; }
  .sheet-head { padding-bottom: 8px; }
  .sheet-note { margin-top: 6px; font-size: 12px; }
  .sheet-rows { margin-top: 4px; }
  .sheet-rows li { grid-template-columns: 1fr 3.5rem auto; gap: 2px 10px; padding: 5px 0; font-size: 13px; }
  .row-sub { grid-column: 1; font-size: 12px; }
  .row-pain { grid-column: 1 / -1; grid-row: 2; }
  .sheet-opener { margin-top: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.4; }
  .sheet-foot { display: none; }
}
@media (max-width: 760px) and (max-height: 720px) {
  .rl-motion .turn-before { font-size: 1.8rem; }
  .time { display: none; }   /* never the illustration note: it stays with the sample rows */
  .turn-line { font-size: .98rem; }
}
