/* ---- Data chapter ---- */
.counter { margin-top: 1.6rem; padding-top: 1.1rem; border-top: 1px solid var(--hair); display: grid; display: block; }
.counter-main {
  font-stretch: 125%; font-weight: 780; font-size: clamp(1.7rem, 3.4vw, 3.4rem); line-height: 1; letter-spacing: -0.02em;
  white-space: nowrap; margin: 0;
}
.counter-lbl { display: inline-block; max-width: 6em; overflow: hidden; vertical-align: bottom; transition: max-width 0.5s var(--ease-out), opacity 0.4s; }
.counter.is-full .counter-lbl { max-width: 0; opacity: 0; margin-right: -0.25em; }
.counter-n { display: inline-block; min-width: 2.1ch; text-align: right; color: var(--noodle); }
.counter-of { color: var(--dim); font-weight: 600; }
.counter-note { font-size: var(--fs-caption); line-height: 1.45; color: var(--dim); margin-top: 0.6rem; max-width: 30rem; }
.counter-sub { grid-column: 1; font-size: 1rem; color: var(--dim); margin-top: 0.5rem; font-variant-numeric: tabular-nums; min-height: 1.6em; }
.stats { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; margin-top: 1.4rem; }
.stats > div { padding: 0 clamp(0.9rem, 2.2vw, 1.75rem); border-left: 1px solid var(--hair); display: flex; flex-direction: column-reverse; }
.stats > div:first-child { padding-left: 0; border-left: 0; }
.stats dd { font-stretch: 112%; font-weight: 760; font-size: clamp(1.4rem, 2.4vw, 2rem); line-height: 1.1; letter-spacing: -0.02em; }
.stats dt { font-size: var(--fs-caption); color: var(--dim); }
.closing { margin-top: 1.4rem; font-stretch: 125%; font-weight: 780; letter-spacing: -0.015em; line-height: 1.05; color: var(--held); font-size: clamp(1.6rem, 3.2vw, 3.4rem); text-wrap: balance; }
@media (max-width: 820px), (orientation: portrait) and (max-width: 1100px) {
  .counter { margin-top: 1rem; padding-top: 0.8rem; }
  .counter-main { font-size: clamp(1.7rem, 8.4vw, 2.3rem); }
  .stats { margin-top: 1rem; }
  .closing { margin-top: 0.8rem; font-size: 1rem; }
}

/* ---- Cameras ---- */
.feed { margin-top: 1.4rem; }
.feed-screen {
  position: relative; background: #0a0c0d; padding: 0.55rem; border-radius: 4px;
  box-shadow: 0 0 0 1px var(--hair), 0 40px 80px -30px var(--shadow), inset 0 0 0 1px rgba(255,255,255,0.03);
}
.feed-screen video { display: block; width: 100%; height: auto; border-radius: 1px; }
.feed-screen .clip-play { z-index: 2; }
.feed-screen::after { /* faint vignette so it reads as a display, not a sticker */
  content: ""; position: absolute; inset: 0.55rem; pointer-events: none;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.45);
}
.feed-tag {
  position: absolute; bottom: 1.1rem; z-index: 1; font-size: var(--fs-micro); line-height: 1; padding: 0.32rem 0.55rem;
  background: rgba(10,12,13,0.72); color: rgba(243, 234, 214, 0.9); border-radius: 999px; font-variant-numeric: tabular-nums;
}
.feed-tag--l { left: 1.1rem; }
.feed-tag--r { right: 1.1rem; }
.feed figcaption { margin-top: 0.85rem; }

/* ---- Policies ---- */
.seg {
  display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 999px;
  background: rgba(var(--veil-rgb), 0.78); box-shadow: inset 0 0 0 1px var(--hair-strong); margin-bottom: 1.6rem;
}
.seg-btn {
  min-width: 7.5rem; min-height: 2.75rem; padding: 0 1.4rem; border-radius: 999px; font-weight: 650; font-stretch: 100%;
  color: var(--seg-idle); transition: background-color 0.3s var(--ease-out), color 0.3s;
}
.seg-btn:hover { color: var(--ivory); }
.seg-btn[aria-pressed="true"] { background: var(--noodle); color: var(--on-accent); }
.specs { margin-bottom: 1.4rem; animation: spec-in 0.5s var(--ease-out); }
@keyframes spec-in { from { opacity: 0; transform: translateY(6px); } }
.spec-lead { font-stretch: 112%; font-weight: 780; font-size: clamp(1.6rem, 2.7vw, 2.3rem); line-height: 1.05; letter-spacing: -0.02em; margin-bottom: 0.9rem; }
.specs li { padding: 0.55rem 0; border-top: 1px solid var(--hair); font-variant-numeric: tabular-nums; }
.specs li:last-child { border-bottom: 1px solid var(--hair); }

/* ---- Test chapter ---- */
.giant-cell {
  font-stretch: 125%; font-weight: 900; line-height: 0.78; letter-spacing: -0.045em;
  font-size: clamp(6rem, 11vw, 10rem); color: var(--held); margin: 0 0 0.05em -0.05em; max-width: none !important;
  background: linear-gradient(to bottom, var(--held) 35%, rgba(var(--held-rgb), 0.4));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  -webkit-user-select: none; user-select: none;
}
.clip { position: relative; background: #0a0c0d; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px var(--hair), 0 30px 60px -25px var(--shadow); aspect-ratio: 9 / 16; }
.clip--wide { aspect-ratio: 848 / 464; }
.clip video { width: 100%; height: 100%; object-fit: cover; }
.clip-play, .reel-play {
  position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(to top, rgba(10,12,13,0.5), transparent 50%);
}
.clip-play svg, .reel-play svg { width: 3.4rem; height: 3.4rem; padding: 1rem 0.85rem 1rem 1.15rem; border-radius: 50%; background: var(--noodle); fill: var(--on-accent); transition: transform 0.3s var(--ease-out); }
.clip-play:hover svg, .reel-play:hover svg { transform: scale(1.08); }

/* ---- Results ---- */
.rows { display: grid; gap: 2rem; margin: 0.5rem 0 1.8rem; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.7rem; }
.row-head h3 { font-stretch: 100%; font-weight: 700; font-size: 1.125rem; letter-spacing: -0.005em; }
.row-score { font-size: 1rem; color: var(--dim); }
.row-score .num { font-stretch: 112%; font-weight: 780; font-size: 1.35rem; color: var(--ivory); }
.dots { display: grid; grid-template-columns: repeat(20, 1fr); gap: clamp(3px, 0.7vw, 6px); margin-bottom: 1.1rem; }
.dot { aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(var(--ivory-rgb), 0.4); transition: background-color 0.9s ease, box-shadow 0.9s ease; }
.dot.is-hit { background: var(--noodle); box-shadow: none; }
.dots.is-armed .dot.is-hit:not(.is-on) { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(var(--ivory-rgb), 0.4); }
.track { position: relative; height: 0.625rem; background: rgba(var(--ivory-rgb), 0.09); border-radius: 999px; }
.range {
  position: absolute; top: 0; bottom: 0; left: calc(var(--lo) * 1%); width: calc((var(--hi) - var(--lo)) * 1%);
  background: rgba(var(--noodle-rgb), 0.62); border-radius: 999px; transform-origin: calc((var(--pt) - var(--lo)) / (var(--hi) - var(--lo)) * 100%) 50%;
  transition: transform 0.9s var(--ease-out) 0.3s, opacity 0.6s 0.3s;
}
.interval.is-armed .range { transform: scaleX(0); opacity: 0; }
.point { position: absolute; top: -0.3rem; bottom: -0.3rem; left: calc(var(--pt) * 1%); width: 3px; margin-left: -1.5px; background: var(--ivory); border-radius: 2px; }
.ticks { display: flex; justify-content: space-between; font-size: var(--fs-micro); color: var(--dim); margin-top: 0.4rem; font-variant-numeric: tabular-nums; }
.ci { display: flex; justify-content: space-between; gap: 1rem; font-size: var(--fs-caption); color: var(--dim); margin-top: 0.4rem; }
.ci .num { color: var(--ivory); font-weight: 600; }
.ci-r { text-align: right; }
.panel .ci, .panel .row-score, .panel .counter-main, .panel .counter-sub { max-width: none; }
@media (max-width: 820px), (orientation: portrait) and (max-width: 1100px) { .feed-tag { font-size: var(--fs-micro); bottom: 0.9rem; } .feed-tag--l { left: 0.9rem; } .feed-tag--r { right: 0.9rem; } }

/* Results payoff headline and task line */
.results-title { font-stretch: 125%; font-weight: 800; font-size: clamp(3.2rem, 5vw, 5.4rem); line-height: 0.94; letter-spacing: -0.02em; margin-bottom: 1.6rem; }
.results-title span { display: block; white-space: nowrap; }
.task { color: var(--ivory); margin-bottom: 1.6rem; max-width: 34rem; }
.clip--inset { width: 200px; aspect-ratio: 420 / 249; }
.clip--inset .clip-play svg { width: 2.6rem; height: 2.6rem; padding: 0.75rem 0.6rem 0.75rem 0.9rem; }
@media (max-width: 820px), (orientation: portrait) and (max-width: 1100px) { .results-title { font-size: clamp(2.8rem, 15vw, 4.2rem); } }

/* Feathered veil behind text on desktop so bright scenes never fight the copy */
@media (min-width: 821px) and (orientation: landscape), (min-width: 1101px) {
  .chapter:not(.chapter--hero):not(.chapter--film) .panel::before {
    content: ""; position: absolute; z-index: -1; pointer-events: none; inset: -3.5rem -5rem -3.5rem -9rem;
    background: radial-gradient(ellipse 75% 62% at 34% 50%, rgba(var(--veil-rgb), 0.72), rgba(var(--veil-rgb), 0.5) 55%, rgba(var(--veil-rgb), 0) 100%);
  }
  .chapter--data .panel::before { inset: -3rem -3rem -3rem -9rem; }
}
/* Reduced motion: no scrub-driven reveals, no entrance animation */
@media (prefers-reduced-motion: reduce) {
  .specs { animation: none; }
  .counter-lbl { transition: none; }
  [data-scrub-in] { opacity: 1 !important; transform: none !important; }
}

/* Always-visible pause/play toggle on looping clips */
.clip { --tg: 2.75rem; }
.clip-toggle {
  position: absolute; right: 0.15rem; bottom: 0.15rem; z-index: 4; width: var(--tg, 2.75rem); height: var(--tg, 2.75rem);
  display: grid; place-items: center; border-radius: 50%;
}
.clip-toggle svg { width: 1.6rem; height: 1.6rem; padding: 0.4rem; border-radius: 50%; fill: var(--media-ink); background: rgba(10, 12, 13, 0.72); transition: background-color 0.2s; }
.clip-toggle:hover svg { background: rgba(10, 12, 13, 0.92); }
.feed-screen { position: relative; }
.feed-screen .clip-toggle { right: 0.7rem; top: 0.7rem; bottom: auto; }
.clip--inset .clip-toggle { --tg: 2.25rem; right: 0; bottom: 0; }
.clip--inset .clip-toggle svg { width: 1.4rem; height: 1.4rem; padding: 0.3rem; }

.chapter--task .closing { margin-top: 1.1rem; }
.chapter--data .closing.closing--quiet { margin-top: 1.1rem; font-stretch: 100%; font-weight: 600; font-size: var(--fs-body); letter-spacing: 0; line-height: 1.4; color: var(--held-text); text-shadow: none; }
.footer-links { margin-bottom: 0.4rem !important; }
.footer-links a { text-decoration: underline; text-underline-offset: 0.2em; }
.panel .lede--sub { font-size: clamp(0.9375rem, 1.05vw, 1.0625rem); color: var(--caption); max-width: 30rem; }

/* ---- Portrait tablets (stacked layout, >= 600px wide): the phone composition with tablet-sized type and panels. Query = stacked.js isTabletStacked ---- */
@media (min-width: 600px) and (max-width: 820px) and (min-height: 700px), (orientation: portrait) and (min-width: 821px) and (max-width: 1100px) {
  .counter-main { font-size: clamp(2.2rem, 5.6vw, 3.2rem); }
  .closing { font-size: 1.5rem; }
  .clip-row .clip { width: min(24rem, 100%); }
  .results-title { font-size: clamp(4.2rem, 12vw, 6.4rem); }
}

/* Recording time-lapse: a small inset inside the data pin. Desktop: bottom right, under the 3D grid. */
.lapse { position: absolute; right: var(--gutter); bottom: 3.6rem; width: clamp(12rem, 16.5vw, 16rem); margin: 0; pointer-events: auto; z-index: 3; }
.lapse .clip { width: 100%; }
.lapse figcaption { margin-top: 0.5rem; font-size: var(--fs-micro); line-height: 1.35; color: rgba(var(--ivory-rgb), 0.82); text-shadow: 0 1px 8px rgba(var(--wall-2-rgb), 0.9); }
@media (max-width: 820px), (orientation: portrait) and (max-width: 1100px) {
  /* Phone / tablet: the 3D owns the top of the pin. The inset sits in its clear upper-left corner, small. */
  .lapse { right: auto; left: var(--gutter); bottom: auto; top: calc(var(--topbar-h) + 0.9rem); width: min(9.5rem, 34vw); }
  .lapse figcaption { font-size: 0.6875rem; }
}
@media (min-width: 600px) and (max-width: 820px) and (min-height: 700px), (orientation: portrait) and (min-width: 821px) and (max-width: 1100px) {
  .lapse { width: min(14rem, 30vw); top: calc(var(--topbar-h) + 1.6rem); }
  .lapse figcaption { font-size: 0.8125rem; }
}

/* Fullscreen button on every video (js/ui/fullscreen.js): top-right of the frame; hover/focus reveal on mouse devices,
   always visible on touch. The feed's pause toggle owns its top-right, so the feed's button sits top-left. */
.fs-btn {
  position: absolute; right: 0.15rem; top: 0.15rem; z-index: 5; width: 2.75rem; height: 2.75rem;
  display: grid; place-items: center; border-radius: 50%; color: var(--media-ink); transition: opacity 0.25s;
}
.fs-btn svg { width: 1.6rem; height: 1.6rem; padding: 0.4rem; border-radius: 50%; background: rgba(10, 12, 13, 0.72); transition: background-color 0.2s; }
.fs-btn:hover svg { background: rgba(10, 12, 13, 0.92); }
.fs-btn:focus-visible { outline: 2px solid var(--noodle); outline-offset: -4px; }
.clip--inset .fs-btn { width: 2.25rem; height: 2.25rem; right: 0; top: 0; }
.clip--inset .fs-btn svg { width: 1.4rem; height: 1.4rem; padding: 0.3rem; }
.feed-screen .fs-btn { right: auto; left: 0.7rem; top: 0.7rem; }
@media (hover: hover) and (pointer: fine) {
  .fs-btn { opacity: 0; }
  .clip:hover .fs-btn, .frame:hover .fs-btn, .feed-screen:hover .fs-btn, .fs-btn:focus-visible { opacity: 1; }
}
/* the clips crop to fill their frames; fullscreen must show the whole picture */
video:fullscreen { object-fit: contain !important; width: 100% !important; height: 100% !important; background: #000; }
video:-webkit-full-screen { object-fit: contain !important; width: 100% !important; height: 100% !important; background: #000; }
@media (prefers-reduced-motion: reduce) { .fs-btn { transition: none; } }
