/* John Rivera — Channel 3. A dark room, one television, and everything happens on the screen. */
:root {
  --black: #030305;
  --navy: #0d1a63;
  --red: #c8141c;
  --red-deep: #3c0406;
  --teal: #74f2c8;
  --osd: #eef4ff;
  --osd-dim: #a9c6ff;
  --blue: #0b3aa8;
  --osd-font: "VT323", ui-monospace, monospace;
  --cap-font: "Arimo", Arial, Helvetica, sans-serif;
  --set-w: min(64vw, calc((100svh - 200px) * 1.333), 1000px);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--black); color: var(--osd); overflow: hidden; }
body { font: 400 17px/1.5 var(--cap-font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: 12px; z-index: 100; padding: 0.4em 0.8em; background: var(--osd); color: var(--blue); font: 24px/1 var(--osd-font); transform: translateY(-200%); }
.skip:focus { transform: none; }
.sr-nav:focus-within { position: fixed; left: 12px; top: 56px; z-index: 100; width: auto; height: auto; clip: auto; margin: 0; padding: 1rem 1.4rem; background: #000; border: 2px solid var(--osd); white-space: normal; }
.sr-nav ul { margin: 0; padding: 0; list-style: none; font: 24px/1.3 var(--osd-font); }

.in-tv .preview-tag { display: none; }
.preview-tag { position: fixed; right: 12px; bottom: 10px; z-index: 90; padding: 0.25em 0.55em; background: #f2c230; color: #1a1406; font: 18px/1 var(--osd-font); letter-spacing: 0.04em; text-decoration: none; text-transform: uppercase; }

/* ================= THE ROOM ================= */
/* Nothing but black and the light the screen gives off. */
.room { position: fixed; inset: 0; overflow: hidden; transform-origin: 50% 50%; will-change: transform; background: #010102; }
.floor-glow { position: absolute; left: 50%; top: calc(var(--sy, 46%) + var(--set-w) * 0.44); width: calc(var(--set-w) * 1.25); height: calc(var(--set-w) * 0.22); translate: -50% 0; border-radius: 50%; pointer-events: none; opacity: 0; background: radial-gradient(closest-side, rgba(70, 130, 255, 0.32), rgba(40, 80, 220, 0.08) 60%, transparent); filter: blur(6px); }
.glow { position: absolute; left: 50%; top: var(--sy, 46%); width: calc(var(--set-w) * 2); aspect-ratio: 1.5; translate: -50% -50%; pointer-events: none; mix-blend-mode: screen; opacity: 0; background: radial-gradient(closest-side, rgba(70, 140, 255, 0.34), rgba(30, 70, 220, 0.09) 40%, transparent 70%); }

/* ================= THE SCREEN ================= */
.set { position: absolute; left: 50%; top: 46%; width: var(--set-w); translate: -50% -50%; }
.glass { position: relative; aspect-ratio: 4 / 3; border-radius: 9% / 12%; overflow: hidden; background: #000; outline: none; cursor: pointer; box-shadow: 0 0 0 1px rgba(120, 170, 255, 0.10), 0 0 4vw 0.4vw rgba(60, 120, 255, 0.28); }
.glass canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.glass-fx { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(60% 40% at 28% 12%, rgba(255, 255, 255, 0.10), transparent 70%), linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0 20%, transparent 36%); box-shadow: inset 0 0 5vw 1vw rgba(0, 0, 0, 0.6), inset 0 0 0.8vw 0.3vw rgba(0, 0, 0, 0.85); }
.glass:focus-visible { box-shadow: 0 0 0 2px var(--teal), 0 0 4vw 0.4vw rgba(60, 120, 255, 0.28); }

/* The film's own subtitles, under the frame. */
.subtitle { position: absolute; left: 50%; bottom: max(3.5vh, 22px); z-index: 6; width: min(90vw, 900px); translate: -50% 0; margin: 0; text-align: center; font: 600 clamp(19px, 1.7vw, 28px)/1.3 var(--cap-font); color: #fff; text-shadow: 0 0 3px #000, 0 2px 3px #000, 0 0 1px #000; opacity: 0; transition: opacity 0.4s; pointer-events: none; }
.subtitle.is-on { opacity: 1; }

/* Film grain over everything, and a lens vignette. */
.grain { position: fixed; inset: -50%; z-index: 60; pointer-events: none; background-image: var(--grain); background-size: 220px 220px; opacity: 0.16; mix-blend-mode: overlay; animation: grain 0.9s steps(6) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 17% { transform: translate(-7%, 4%); } 33% { transform: translate(5%, -9%); } 50% { transform: translate(-3%, 8%); } 67% { transform: translate(9%, 2%); } 83% { transform: translate(-8%, -5%); } }
.vignette { position: fixed; inset: 0; z-index: 59; pointer-events: none; background: radial-gradient(120% 95% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.75) 100%); }

/* ================= INSIDE THE TV ================= */
.inside { position: fixed; inset: 0; z-index: 30; background: #020a2e; overflow: hidden; }
.inside[hidden] { display: none; }
.inside-field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.inside-fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 20, 0.1) 0 1px, transparent 1px 3px); box-shadow: inset 0 0 12vmin 3vmin rgba(0, 0, 0, 0.75); border-radius: 2.4vmin; }
.osd-bar { position: absolute; left: 0; right: 0; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: max(16px, env(safe-area-inset-top)) clamp(16px, 4vw, 52px) 0; font: clamp(22px, 1.9vw, 30px)/1 var(--osd-font); text-shadow: 0 0 8px rgba(150, 200, 255, 0.9), 2px 2px 0 rgba(0, 10, 60, 0.6); }
.osd-ch { flex: 1; text-align: center; color: var(--osd-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osd-btn { all: unset; cursor: pointer; padding: 0.15em 0.45em; white-space: nowrap; color: var(--osd); }
.osd-btn:hover, .osd-btn:focus-visible { background: var(--osd); color: var(--blue); text-shadow: none; }
.inside-scroll { position: absolute; inset: 0; z-index: 2; overflow-y: auto; overscroll-behavior: contain; padding: clamp(70px, 9vh, 100px) clamp(16px, 5vw, 64px) clamp(90px, 12vh, 130px); scrollbar-width: none; }
.inside-scroll::-webkit-scrollbar { display: none; }
.ch { max-width: 1240px; min-height: 100%; margin: 0 auto; transform-origin: 50% 45%; }
.ch[hidden] { display: none; }
.osd-k { margin: 0 0 0.4rem; font: clamp(22px, 1.8vw, 28px)/1 var(--osd-font); color: var(--osd-dim); text-shadow: 0 0 8px rgba(150, 200, 255, 0.7); }
.ch-h { margin: 0 0 1.2rem; font: clamp(64px, 8vw, 128px)/0.85 var(--osd-font); letter-spacing: 0.01em; text-shadow: 0 0 14px rgba(150, 200, 255, 0.85), 4px 4px 0 rgba(0, 10, 60, 0.55); }
.ch-deck { max-width: 34em; margin: 0 0 1.4rem; font: 400 clamp(17px, 1.25vw, 20px)/1.55 var(--cap-font); color: #e3ecff; text-shadow: 0 1px 2px rgba(0, 0, 30, 0.7); }
.osd-link { display: inline-block; padding: 0.15em 0.45em; margin-left: -0.45em; font: clamp(22px, 1.8vw, 28px)/1 var(--osd-font); text-decoration: none; text-shadow: 0 0 8px rgba(150, 200, 255, 0.8); }
.osd-link:hover, .osd-link:focus-visible { background: var(--osd); color: var(--blue); text-shadow: none; outline: none; }

/* Chapter 2: Nearbuy plays on the set. The phone is the picture. Beside it, the scene list is the tape's
   index: one segment per scene, as long as its share of the cut, lit up to the scene that's playing. */
.ch--nearbuy {
  --nb-dur: 89.37;                                                   /* the cut's length, in seconds */
  --nb-h: clamp(300px, calc(100svh - clamp(196px, 25vh, 260px)), 800px); /* the phone's screen, which is the video */
  --nb-w: calc(var(--nb-h) * 720 / 1566);
  --nb-r: calc(var(--nb-w) * 0.115);                                     /* the screen's corners */
  --nb-bz: clamp(7px, calc(var(--nb-w) * 0.032), 11px);                  /* the bezel, drawn outside the video's box */
  --nb-box: clamp(26px, 2vw, 32px);                                      /* a scene's number tag */
  --nb-rule: rgba(169, 198, 255, 0.24);
  --nb-track: rgba(169, 198, 255, 0.26);
  --nb-lit: rgba(222, 233, 255, 0.5);
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: "info screen scenes";
  align-items: center; column-gap: clamp(36px, 4.4vw, 80px);
  min-height: calc(100svh - clamp(160px, 21vh, 230px));
}
.ch--nearbuy .osd-k { letter-spacing: 0.06em; }

/* The copy: a column as tall as the phone. The title sits level with its top; the facts and the link settle to its foot, level with the transport. */
.ch--nearbuy .nb-info { grid-area: info; justify-self: end; width: min(100%, 30rem); min-height: var(--nb-h); display: flex; flex-direction: column; }
.ch--nearbuy .ch-h { margin: 0 0 1.3rem; font-size: clamp(64px, 8.2vw, 124px);
  text-shadow: -0.02em 0 rgba(255, 46, 76, 0.36), 0.02em 0 rgba(70, 205, 255, 0.36), 0 0 16px rgba(150, 200, 255, 0.8), 4px 4px 0 rgba(0, 10, 60, 0.5); }
.ch--nearbuy .ch-deck { max-width: 31em; margin: 0 0 1.6rem; font-size: clamp(17px, 1.2vw, 19px); line-height: 1.6; color: #e6eeff; text-wrap: pretty; }
.nb-facts { margin: auto 0 14px; border-top: 1px solid var(--nb-rule); }
.nb-facts div { display: grid; grid-template-columns: 5.4rem minmax(0, 1fr); column-gap: 1rem; align-items: baseline; padding: 0.7rem 0 0.75rem; border-bottom: 1px solid var(--nb-rule); }
.nb-facts dt { font: clamp(20px, 1.45vw, 23px)/1.05 var(--osd-font); letter-spacing: 0.05em; color: var(--osd-dim); text-shadow: 0 0 8px rgba(150, 200, 255, 0.55); }
.nb-facts dd { margin: 0; font: 15px/1.5 var(--cap-font); color: #d9e4ff; text-wrap: pretty; }
.ch--nearbuy .nb-info .osd-link { align-self: flex-start; font-size: clamp(22px, 1.75vw, 28px); letter-spacing: 0.04em; }

/* The phone. The <video> is the screen, edge to edge: the swoop lands on its box, so the bezel, rim and
   glow are all shadows outside it. */
.nb-screen { grid-area: screen; position: relative; z-index: 0; width: var(--nb-w); height: var(--nb-h); aspect-ratio: 720 / 1566; border-radius: var(--nb-r); overflow: hidden; background: #000;
  box-shadow:
    0 0 0 1px #000,
    0 0 0 var(--nb-bz) #090a10,
    0 0 0 calc(var(--nb-bz) + 1px) rgba(190, 210, 255, 0.36),
    0 0 0 calc(var(--nb-bz) + 3px) rgba(0, 3, 22, 0.6),
    0 0 80px 12px rgba(80, 140, 255, 0.3),
    0 60px 110px -40px rgba(0, 0, 8, 0.95); }
.nb-screen video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The glass: a faint sheen from the top right that stays off the N in the top left, so the flying N and the app's look the same when they swap. */
.nb-screen::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; background: linear-gradient(205deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 22%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07); }

/* The scene list, as tall as the phone: SCENES level with its top, the transport level with its bottom. */
.nb-scenes { grid-area: scenes; justify-self: start; width: min(100%, 290px); height: var(--nb-h); display: flex; flex-direction: column; }
.nb-scenes .osd-k { margin: 0 0 16px; }
.nb-list { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.nb-list li { flex: var(--len) 1 0px; min-height: calc(var(--nb-box) + 30px); display: flex; }
.nb-ch { all: unset; box-sizing: border-box; cursor: pointer; position: relative; flex: 1 1 auto; display: grid; grid-template-columns: var(--nb-box) minmax(0, 1fr) auto; column-gap: 14px; align-items: center; align-content: start; padding: 0 2px 12px 0;
  font: clamp(22px, 1.75vw, 28px)/1 var(--osd-font); letter-spacing: 0.03em; color: var(--osd-dim); text-shadow: 0 0 8px rgba(150, 200, 255, 0.55); -webkit-tap-highlight-color: transparent; }
.nb-ch > span:first-child { display: grid; place-items: center; height: var(--nb-box); border: 1px solid rgba(169, 198, 255, 0.5); font-size: 0.78em; letter-spacing: 0.02em; }
.nb-ch > span:last-child { font-size: 0.86em; }
/* Each scene's stretch of tape, under its number: the track, and the light that fills it. */
.nb-ch::before, .nb-ch::after { content: ""; position: absolute; left: calc(var(--nb-box) / 2 - 1px); top: calc(var(--nb-box) + 7px); bottom: 7px; width: 2px; }
.nb-ch::before { background: var(--nb-track); }
.nb-ch::after { background: var(--osd); transform: scaleY(var(--fill, 0)); transform-origin: 50% 0; }
/* Scenes already played. */
.nb-list li:has(~ li > [aria-current="true"]) .nb-ch { color: #dce7ff; }
.nb-list li:has(~ li > [aria-current="true"]) .nb-ch > span:first-child { border-color: rgba(220, 232, 255, 0.78); }
.nb-list li:has(~ li > [aria-current="true"]) .nb-ch::after { transform: none; background: var(--nb-lit); }
/* The scene playing now: its tag lit like the OSD's selection. */
.nb-ch[aria-current="true"] { color: var(--osd); text-shadow: 0 0 10px rgba(150, 200, 255, 0.9); }
.nb-ch[aria-current="true"] > span:first-child { background: var(--osd); border-color: var(--osd); color: var(--blue); text-shadow: none; box-shadow: 0 0 14px rgba(150, 200, 255, 0.7); }
.nb-ch[aria-current="true"]::after { box-shadow: 0 0 10px rgba(150, 200, 255, 0.95); }
.nb-ch:hover { color: var(--osd); }
.nb-ch:hover > span:first-child { border-color: var(--osd); }
.nb-ch:hover::before { background: rgba(238, 244, 255, 0.45); }
.nb-ch:focus-visible > span:nth-child(2) { outline: 2px solid var(--osd); outline-offset: 4px; }
html:not(.still) .nb-ch, html:not(.still) .nb-ch > span { transition: color 0.2s, background-color 0.2s, border-color 0.2s; }
/* room.js sets --fill on each scene from the playhead a few times a second; the transition smooths the steps. */
html:not(.still) .nb-ch::after { transition: transform 0.3s linear; }

.nb-transport { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 14px; border-top: 1px solid var(--nb-rule); font: clamp(22px, 1.75vw, 28px)/1 var(--osd-font); letter-spacing: 0.03em; }
.nb-transport .osd-btn { margin-left: -0.45em; text-shadow: 0 0 8px rgba(150, 200, 255, 0.8); }
.nb-transport .osd-btn:hover, .nb-transport .osd-btn:focus-visible { text-shadow: none; }
.nb-time { color: var(--osd-dim); white-space: nowrap; text-shadow: 0 0 8px rgba(150, 200, 255, 0.55); }

/* The demo's captions, burned in under the picture. */
.caption { position: absolute; left: 50%; bottom: max(16px, 3.2vh); z-index: 6; width: min(860px, 88vw); translate: -50% 0; margin: 0; text-align: center; font: 600 clamp(17px, 1.4vw, 23px)/1.35 var(--cap-font); color: #fff; text-shadow: 0 0 3px #000, 0 2px 3px #000, 0 0 1px #000; text-wrap: balance; pointer-events: none; }
.caption:empty { display: none; }

/* Chapters still being re-shot. */
.ch--stub { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); align-items: center; gap: clamp(24px, 5vw, 80px); min-height: calc(100svh - clamp(160px, 21vh, 230px)); }
.stub-thumb { margin: 0; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 2vmin; box-shadow: 0 0 0 2px rgba(238, 244, 255, 0.22), 0 0 50px rgba(120, 180, 255, 0.3); background: #04114a; }
.stub-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(0.85) contrast(1.05); }
.stub-card { width: 100%; height: 100%; display: grid; place-content: center; text-align: center; font: clamp(40px, 5vw, 72px)/0.9 var(--osd-font); text-shadow: 0 0 14px rgba(150, 200, 255, 0.85); }
.stub-card small { display: block; margin-top: 0.4em; font-size: 0.45em; color: var(--osd-dim); }
.stub-note { font: clamp(22px, 1.8vw, 28px)/1.2 var(--osd-font); color: var(--teal); text-shadow: 0 0 8px rgba(116, 242, 200, 0.7); animation: blink 1.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.15; } }

/* Contact links on the setup screen are real links for keyboards and screen readers. */
.lunge { animation: rgbsplit 0.6s ease-out; }
@keyframes rgbsplit { 0% { text-shadow: -6px 0 rgba(255, 40, 60, 0.8), 6px 0 rgba(60, 200, 255, 0.8); filter: brightness(1.6); } 100% { filter: none; } }

/* ================= small screens ================= */
/* Below desktop the scene list turns on its side: one strip of tape, the scenes labelled under it, the transport above. */
@media (max-width: 1100px) {
  .nb-scenes { justify-self: stretch; width: 100%; height: auto; }
  .nb-scenes .osd-k { display: none; }
  .nb-transport { order: -1; padding: 0 0 12px; border: 0; }
  .nb-list { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px; padding-top: 20px; }
  .nb-list li { display: block; min-height: 0; }
  .nb-ch { position: static; width: 100%; column-gap: 10px; padding: 7px 6px 7px 0; }
  .nb-ch::before, .nb-ch::after { top: 0; bottom: auto; height: 6px; left: calc(100% * var(--at) / var(--nb-dur)); width: calc(100% * var(--len) / var(--nb-dur) - 4px); }
  .nb-ch::after { transform: scaleX(var(--fill, 0)); transform-origin: 0 50%; }
  .nb-ch:hover { background: rgba(238, 244, 255, 0.07); }
  .nb-ch:focus-visible { outline: 2px solid var(--osd); outline-offset: 2px; }
  .nb-ch:focus-visible > span:nth-child(2) { outline: none; }
  .nb-ch:focus-visible::before { background: rgba(238, 244, 255, 0.45); }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .ch--nearbuy { --nb-h: min(clamp(300px, calc(100svh - clamp(196px, 25vh, 260px)), 800px), calc(40vw * 1566 / 720));
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info screen" "scenes screen"; row-gap: 30px; column-gap: clamp(32px, 5vw, 56px); align-content: center; }
  .ch--nearbuy .nb-info { justify-self: stretch; width: auto; min-height: 0; align-self: start; }
  .ch--nearbuy .nb-facts { margin: 0 0 1.6rem; }
  .ch--nearbuy .nb-scenes { align-self: end; max-width: 30rem; }
}
@media (max-width: 760px) {
  :root { --set-w: min(92vw, calc((100svh - 160px) * 1.333)); }
  .ch--stub { grid-template-columns: 1fr; align-content: start; gap: 1.6rem; min-height: 0; }
  /* A phone gets the phone first, its transport and scenes right under it, then the copy. */
  .ch--nearbuy { --nb-h: clamp(280px, 56svh, 620px); --nb-box: 24px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "screen" "scenes" "info"; align-content: start; min-height: 0; }
  .ch--nearbuy .nb-screen { justify-self: center; }
  .ch--nearbuy .nb-scenes { margin-top: calc(var(--nb-bz) + 18px); }
  .ch--nearbuy .nb-info { justify-self: stretch; width: auto; min-height: 0; margin-top: 40px; }
  .ch--nearbuy .nb-facts { margin: 0 0 1.6rem; }
  .nb-ch { font-size: 21px; }
  .nb-transport { font-size: 23px; }
  .ch-h { font-size: clamp(54px, 16vw, 80px); }
  .ch--nearbuy .ch-h { margin-bottom: 1rem; font-size: clamp(56px, 19vw, 84px); }
  /* On a phone the copy scrolls under the caption, so the caption docks as a subtitle band across the foot of the screen. */
  .caption { left: 0; right: 0; bottom: 0; width: auto; translate: none; padding: 10px 20px max(12px, env(safe-area-inset-bottom)); font-size: 15px; background: rgba(1, 2, 12, 0.95); border-top: 1px solid rgba(169, 198, 255, 0.2); box-shadow: 0 -12px 24px rgba(0, 0, 10, 0.45); }
  .osd-ch { font-size: 0.8em; }
}
/* The narrowest phones: each scene's time drops under its name. */
@media (max-width: 370px) {
  .nb-ch { grid-template-columns: var(--nb-box) minmax(0, 1fr); row-gap: 3px; }
  .nb-ch > span:first-child { grid-row: span 2; }
  .nb-ch > span:last-child { font-size: 0.78em; }
}

/* Reduced motion: no flicker, no grain crawl, no lunges. */
.still .grain, .still .stub-note { animation: none; }
.still .lunge { animation: none; }
.stub-logo { width: 100%; height: 100%; display: grid; place-items: center; }
.stub-thumb .stub-logo img { width: auto; height: 100%; object-fit: contain; filter: none; }
