Skip to content
Browse blocks

A video-first hero: a film-leader countdown cuts to your film playing with subtitles, the screen lights the room, and a 35mm chapter strip scrubs and jumps through it.

Used forVideo sales letters and course launchesProduct launch filmsAgencies and studiosCoaches and creators

Install with the shadcn CLI

$ npx shadcn@latest add @hairline/cinema-hero

Older shadcn CLI, or a network that blocks ui.shadcn.com? Install by URL: shadcn add https://hairlineui.com/r/cinema-hero.json. More

Templates

Need the whole page?

64 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 8 are free.

Where it’s used

  • Video sales letters and course launches

    The film plays muted with subtitles on arrival, and the chapters show what’s inside before anyone presses play.

  • Product launch films

    A two-minute walkthrough split into chapters that people can jump between.

  • Agencies and studios

    A showreel or case-study film with the work itself lighting the page.

  • Coaches and creators

    A talking-head pitch that reads on mute and books the call underneath.

What it handles for you

A video hero usually means a third-party embed with its own branding, a poster nobody clicks, and no way to see what’s in the film.

Instead of wiring upYouTube or Vimeo embedcustom video player chromechapter listsubtitle overlay
  1. Starts itself, reads on mute

    After the leader the film plays muted from `video.start` with your captions burned in, and pauses when it scrolls off screen.

  2. Chapters on a film strip

    One frame per chapter with its number, timecode and title in the margin. The strip follows the film, drags to scrub and clicks to jump.

  3. Light from the film

    The playing frame is sampled a few times a second and its colour washes the wall. A cross-origin film without CORS still plays; the light just stays neutral.

  4. Sound in place

    "Watch with sound", a click on the screen or the sound key plays the real film with audio, without a modal.

  5. Your own film

    Pass an mp4, a poster, chapters with stills and caption lines. No player library and no embed.

  6. Dark and light

    Tone "dark" or "light", with every colour as an --ch-* variable; the film strip stays film-dark in both.

Overview

Video sales pages usually drop a YouTube embed under a headline, and nobody presses play. Cinema hero puts your film on a screen in a dark room and starts it for them. A 3·2·1 film leader runs on load, then the film plays muted with its subtitles burned in, so it reads without sound. The screen is the room’s only light: its colour, sampled from the playing frame, washes the wall behind it. Under the screen a 35mm strip runs edge to edge, one frame per chapter, with the chapter number, timecode and title printed in the film margin. The strip pulls down a frame each time the film crosses a chapter; visitors drag it to scrub and click a frame to jump. "Watch with sound" plays the real film from the top, in place.

States

leader
On load a grey film leader counts 3·2·1 with a sweeping hand, in CSS, then cuts to the film.
preview
The film plays muted with burned-in subtitles; the strip pulls down a frame at each chapter and the wall takes the frame’s colour.
scrub
Dragging the strip shows the still under the gate on the screen; letting go jumps to that chapter.
sound
"Watch with sound" plays the film from the top with audio; a click on the screen pauses it.
phone
The headline and actions stack, the screen runs full width and the strip swipes sideways; the nav folds into a menu that pushes the page down.
reduced motion
No leader and no autoplay: the poster shows with a play mark and the strip stays still until a visitor presses play.

Usage

usage.tsx
import { CinemaHero } from "@/components/cinema-hero";<CinemaHero  brand="Hankly"  headline={["Free components", "that look expensive"]}  highlight="look expensive"  subheadline="Watch the build, then install any of them with one command."  primaryAction={{ label: "Browse the components", href: "/ui" }}  video={{ src: "/film.mp4", poster: "/film-poster.webp", start: 3.2 }}  chapters={[    { title: "Sign in", time: 29.2, still: "/ch-1.webp" },    { title: "Just talk", time: 36, still: "/ch-2.webp" },  ]}  captions={[{ start: 3.3, end: 4.8, text: "That's one line of React." }]}/>

Depends on lucide-react, installed for you by the CLI along with the keyframes it needs.

Chapters and subtitles from your own film

Encode the film as H.264 (960×540 is plenty), export one still per chapter at 16:9, and turn your subtitle file into caption lines. The colours are --ch-* variables and the type is --ch-display and --ch-sans.

example.tsx
import { Barlow, Barlow_Condensed } from "next/font/google";import { CinemaHero } from "@/components/cinema-hero";import { captions } from "./film-captions"; // [{ start, end, text }] from your .srtconst display = Barlow_Condensed({ subsets: ["latin"], weight: ["600"] });const sans = Barlow({ subsets: ["latin"], weight: ["400", "500"] });export default function Page() {  return (    <CinemaHero      tone="dark"      style={{        "--ch-display": display.style.fontFamily,        "--ch-sans": sans.style.fontFamily,        "--ch-signal": "#7de2d1",      } as React.CSSProperties}      brand="Northdesk"      eyebrow="A four-minute walkthrough"      headline={["Close the books", "before lunch"]}      highlight="before lunch"      subheadline="Watch a controller run month-end in four minutes, then try it on your own ledger."      primaryAction={{ label: "Start a trial", href: "/signup" }}      video={{ src: "/films/month-end.mp4", poster: "/films/month-end.webp", start: 2 }}      chapters={[        { title: "Import the bank feed", time: 12, still: "/films/ch1.webp" },        { title: "Match in bulk", time: 58, still: "/films/ch2.webp" },        { title: "Lock the period", time: 171, still: "/films/ch3.webp" },      ]}      captions={captions}    />  );}

Props

brand
string
Name in the nav.
logo
ReactNode
Replaces the default reel mark.
navLinks
{ label: string; href: string }[]
Links in the bar; they fold into a menu under 900px.
navSecondaryAction / navPrimaryAction
{ label: string; href?: string; onClick?: () => void }
A quiet link and the signal button at the right of the bar.
eyebrow
string
One plain line above the headline.
headline
string[]
One or two lines, set in the display face, uppercase.
highlight
string
A phrase inside the headline painted in --ch-signal.
subheadline
string
The sentence under the headline.
primaryAction
{ label: string; href?: string; onClick?: () => void }
The signal button beside "Watch with sound".
watchLabel= "Watch with sound"
string
Label of the button that plays the film from the top with audio; the film’s length shows beside it.
video
{ src: string; poster?: string; start?: number; duration?: number }
The film. `start` is where the muted preview begins; `duration` shows before the metadata loads.
chapters
{ title: string; time: number; still: string }[]
One frame of the strip per chapter, in order.
captions
{ start: number; end: number; text: string }[]
Subtitle lines burned into the screen.
countdown= true
boolean
Run the 3·2·1 leader before the film.
tone= "dark"
"dark" | "light"
The room’s tone; the film strip stays dark in both.

Accessibility and motion

  • Colours: --ch-room, --ch-wall, --ch-ink, --ch-ink-2, --ch-ink-3, --ch-rule, --ch-hover, --ch-signal, --ch-on-signal, --ch-film, --ch-film-edge, --ch-mask, --ch-spill-amount. They never inherit your shadcn theme.
  • The film loads with preload="metadata" and plays muted and inline, which every current browser allows; if autoplay is refused, the poster shows with a play mark.
  • The room’s light reads a 32×18 copy of the frame, which needs the film on your origin or served with CORS. Without it, everything else works.
  • Chapters are buttons with their title and time as labels, and the arrow keys move between them. The subtitles are real text.
  • Under prefers-reduced-motion there is no leader and no autoplay.

Requirements

React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.

Source

components/cinema-hero.tsx
"use client";import * as React from "react";import { ArrowRight, ArrowUpRight, Menu, Pause, Play, Volume2, VolumeX, X } from "lucide-react";/* ───────────────────────────────────────────────────────── * CINEMA HERO: the screening * *   leader    on load the screen runs a film-leader countdown, 3·2·1, *             in CSS, then cuts to the film playing muted with its *             subtitles burned in. *   room      the screen is the only light. Its colour, sampled from the *             playing frame, falls on the wall behind it and shows in a *             reflection on the floor under it. *   strip     a 35mm strip runs edge to edge under the screen. Each frame *             is a chapter still with its number, timecode and title *             printed in the margins. It pulls down a frame as the film *             crosses a chapter; drag it to scrub, click a frame to jump. *   sound     "Watch with sound" (or a click on the screen) plays the *             real film with sound, in place. * * Every colour is a --ch-* variable on the root (tone "dark" or * "light"); type comes from --ch-display and --ch-sans. * ───────────────────────────────────────────────────────── */export interface CinemaHeroLink {  label: string;  href: string;}export interface CinemaHeroAction {  label: string;  href?: string;  onClick?: () => void;}export interface CinemaHeroVideo {  /** An mp4 (H.264) the browser can play inline. */  src: string;  poster?: string;  /** Where the muted preview starts, in seconds (skip a slow cold open). */  start?: number;  /** Length in seconds, shown before the metadata loads. */  duration?: number;}export interface CinemaHeroChapter {  title: string;  /** Start of the chapter, in seconds. */  time: number;  /** A still from the chapter (16:9). */  still: string;}export interface CinemaHeroCaption {  start: number;  end: number;  text: string;}export interface CinemaHeroProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {  brand: string;  logo?: React.ReactNode;  navLinks?: CinemaHeroLink[];  navSecondaryAction?: CinemaHeroAction;  navPrimaryAction?: CinemaHeroAction;  eyebrow?: string;  /** One or two headline lines. */  headline: string[];  /** A phrase inside the headline painted in the signal colour. */  highlight?: string;  subheadline: string;  primaryAction: CinemaHeroAction;  /** Label of the button that plays the film with sound from the top. */  watchLabel?: string;  video: CinemaHeroVideo;  chapters: CinemaHeroChapter[];  /** Subtitles burned into the screen. */  captions?: CinemaHeroCaption[];  /** Run the 3·2·1 leader before the film. */  countdown?: boolean;  tone?: "dark" | "light";}const TONES: Record<"dark" | "light", Record<string, string>> = {  dark: {    "--ch-room": "#0b0d12",    "--ch-wall": "#11141b",    "--ch-ink": "#f2f0ea",    "--ch-ink-2": "#a9abb3",    "--ch-ink-3": "#686c76",    "--ch-rule": "rgba(242, 240, 234, 0.1)",    "--ch-hover": "#1a1e27",    "--ch-signal": "#f5d142",    "--ch-on-signal": "#15120a",    "--ch-film": "#16120e",    "--ch-film-edge": "#211b15",    "--ch-mask": "#050608",    "--ch-hole": "#35302a",    "--ch-signal-text": "#f5d142",    "--ch-spill-amount": "0.42",  },  light: {    "--ch-room": "#e4e5e8",    "--ch-wall": "#d9dbe0",    "--ch-ink": "#101115",    "--ch-ink-2": "#4f525a",    "--ch-ink-3": "#8a8d95",    "--ch-rule": "rgba(16, 17, 21, 0.1)",    "--ch-hover": "#d4d6db",    "--ch-signal": "#f2c919",    "--ch-on-signal": "#15120a",    "--ch-film": "#17130f",    "--ch-film-edge": "#241d16",    "--ch-mask": "#0b0c0f",    "--ch-hole": "#e4e5e8",    "--ch-signal-text": "#7a5f00",    "--ch-spill-amount": "0.22",  },};const DEFAULT_LINKS: CinemaHeroLink[] = [  { label: "Components", href: "#components" },  { label: "Templates", href: "#templates" },  { label: "Pricing", href: "#pricing" },  { label: "Docs", href: "#docs" },];const EASE = "cubic-bezier(0.16, 1, 0.3, 1)";/** A projector pulls a frame down hard and lets it settle. */const PULLDOWN = "cubic-bezier(0.22, 1.25, 0.36, 1)";const LEADER_FRAMES = 4;const NO_CAPTIONS: CinemaHeroCaption[] = [];const FOCUS =  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ch-signal)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--ch-room)]";const CSS = `@property --ch-sweep { syntax: '<angle>'; inherits: false; initial-value: 0deg; }@keyframes ch-sweep { from { --ch-sweep: 0deg; } to { --ch-sweep: 360deg; } }@keyframes ch-num { 0%, 100% { opacity: 0; } 2%, 98% { opacity: 1; } }@keyframes ch-cut { to { opacity: 0; visibility: hidden; } }@keyframes ch-flicker { 0%, 100% { opacity: 1; } 50% { opacity: 0.93; } }@keyframes ch-rise { from { transform: translate3d(0, 105%, 0); } to { transform: none; } }@keyframes ch-fade { from { opacity: 0; transform: translate3d(0, 10px, 0); } to { opacity: 1; transform: none; } }@keyframes ch-sub { from { opacity: 0; } to { opacity: 1; } }[data-ch] .ch-leader { animation: ch-cut 1ms linear 1.86s forwards; }[data-ch] .ch-sweep { animation: ch-sweep 0.62s linear 3; background: conic-gradient(from 0deg, rgba(255,255,255,0.2) var(--ch-sweep), transparent 0); }[data-ch] .ch-leader-inner { animation: ch-flicker 0.12s steps(2) infinite; }[data-ch] .ch-num { opacity: 0; animation: ch-num 0.62s linear both; }[data-ch] .ch-rise { animation: ch-rise 900ms ${EASE} both; }[data-ch] .ch-fade { animation: ch-fade 800ms ${EASE} both; }[data-ch] .ch-sub { animation: ch-sub 140ms linear both; }@media (prefers-reduced-motion: reduce) {  [data-ch] .ch-leader { display: none; }  [data-ch] .ch-rise, [data-ch] .ch-fade, [data-ch] .ch-sub, [data-ch] .ch-leader-inner { animation: none; }}`;const reducedQuery = "(prefers-reduced-motion: reduce)";function subscribeReduced(cb: () => void) {  const mq = window.matchMedia(reducedQuery);  mq.addEventListener("change", cb);  return () => mq.removeEventListener("change", cb);}function useReducedMotion() {  return React.useSyncExternalStore(subscribeReduced, () => window.matchMedia(reducedQuery).matches, () => false);}function clock(seconds: number) {  const s = Math.max(0, Math.floor(seconds));  return `${String(Math.floor(s / 60)).padStart(2, "0")}:${String(s % 60).padStart(2, "0")}`;}function chapterAt(chapters: CinemaHeroChapter[], t: number) {  let idx = 0;  for (let i = 0; i < chapters.length; i++) if (t + 0.05 >= chapters[i].time) idx = i;  return idx;}/* ── pieces ─────────────────────────────────────────────── */function ActionLink({ action, className, children }: { action: CinemaHeroAction; className: string; children: React.ReactNode }) {  if (action.href && !action.onClick) {    return (      <a href={action.href} className={className}>        {children}      </a>    );  }  return (    <button type="button" onClick={action.onClick} className={className}>      {children}    </button>  );}function ReelMark() {  return (    <svg viewBox="0 0 24 24" aria-hidden="true" className="size-[22px] shrink-0">      <rect x="2" y="4" width="20" height="16" rx="2.5" fill="currentColor" />      {[5.5, 9.5, 13.5, 17.5].map((x) => (        <React.Fragment key={x}>          <rect x={x} y="5.6" width="2" height="1.8" rx=".5" fill="var(--ch-room)" />          <rect x={x} y="16.6" width="2" height="1.8" rx=".5" fill="var(--ch-room)" />        </React.Fragment>      ))}      <rect x="4.5" y="8.8" width="15" height="6.4" rx="1" fill="var(--ch-signal)" />    </svg>  );}function SignalButton({ action, small = false, className = "" }: { action: CinemaHeroAction; small?: boolean; className?: string }) {  return (    <ActionLink      action={action}      className={`group inline-flex shrink-0 cursor-pointer touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-[6px] bg-[var(--ch-signal)] font-semibold tracking-[-0.005em] text-[var(--ch-on-signal)] transition-transform duration-150 active:scale-[0.97] ${        small ? "h-9 px-3.5 text-[13px]" : "h-12 px-5 text-[15px]"      } ${FOCUS} ${className}`}    >      <span>{action.label}</span>      <ArrowUpRight        className="size-4 transition-transform duration-300 group-hover:-translate-y-px group-hover:translate-x-0.5"        strokeWidth={2.2}        style={{ transitionTimingFunction: EASE }}      />    </ActionLink>  );}function HeadlineLine({ line, highlight, marker }: { line: string; highlight?: string; marker: boolean }) {  const idx = highlight ? line.indexOf(highlight) : -1;  if (!highlight || idx === -1) return <>{line}</>;  return (    <>      {line.slice(0, idx)}      <span        className={          marker            ? "box-decoration-clone bg-[var(--ch-signal)] px-[0.06em] text-[var(--ch-on-signal)]"            : "text-[var(--ch-signal)]"        }      >        {highlight}      </span>      {line.slice(idx + highlight.length)}    </>  );}/** Film-leader countdown: grey leader, rings, crosshair, a sweep and 3·2·1. */function Leader({ ref }: { ref?: React.Ref<HTMLDivElement> }) {  return (    <div ref={ref} aria-hidden="true" className="ch-leader absolute inset-0 z-20 overflow-hidden bg-[#3a3a38]">      <div className="ch-leader-inner absolute inset-0">        <div className="ch-sweep absolute left-1/2 top-1/2 aspect-square w-[150%] -translate-x-1/2 -translate-y-1/2" />        <div className="absolute inset-x-0 top-1/2 h-px bg-white/45" />        <div className="absolute inset-y-0 left-1/2 w-px bg-white/45" />        <div className="absolute left-1/2 top-1/2 aspect-square h-[78%] -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white/70" />        <div className="absolute left-1/2 top-1/2 aspect-square h-[62%] -translate-x-1/2 -translate-y-1/2 rounded-full border border-white/55" />        {["3", "2", "1"].map((n, i) => (          <span            key={n}            className="ch-num absolute inset-0 grid place-items-center text-[clamp(56px,16cqw,170px)] font-semibold leading-none text-white"            style={{ animationDelay: `${i * 0.62}s`, fontFamily: "var(--ch-display, inherit)" }}          >            {n}          </span>        ))}      </div>    </div>  );}/* ── the hero ───────────────────────────────────────────── */type Phase = "leader" | "preview" | "sound" | "paused" | "still";export function CinemaHero({  brand,  logo,  navLinks = DEFAULT_LINKS,  navSecondaryAction,  navPrimaryAction,  eyebrow,  headline,  highlight,  subheadline,  primaryAction,  watchLabel = "Watch with sound",  video,  chapters,  captions = NO_CAPTIONS,  countdown = true,  tone = "dark",  className = "",  style,  ...props}: CinemaHeroProps) {  const reduced = useReducedMotion();  const rootRef = React.useRef<HTMLElement>(null);  const videoRef = React.useRef<HTMLVideoElement>(null);  const leaderRef = React.useRef<HTMLDivElement>(null);  const reflectRef = React.useRef<HTMLCanvasElement>(null);  const spillRef = React.useRef<HTMLDivElement>(null);  const trackRef = React.useRef<HTMLDivElement>(null);  const [menuOpen, setMenuOpen] = React.useState(false);  const [phase, setPhase] = React.useState<Phase>(countdown ? "leader" : "still");  const [chapter, setChapter] = React.useState(0);  const [caption, setCaption] = React.useState<string | null>(null);  const [now, setNow] = React.useState(0);  const [duration, setDuration] = React.useState(video.duration ?? 0);  const [scrubbing, setScrubbing] = React.useState<number | null>(null);  const phaseRef = React.useRef(phase);  phaseRef.current = phase;  const captionsRef = React.useRef(captions);  captionsRef.current = captions;  const chaptersRef = React.useRef(chapters);  chaptersRef.current = chapters;  const dragRef = React.useRef<{ id: number; x: number; fw: number; from: number; moved: boolean } | null>(null);  const start = video.start ?? 0;  const shownChapter = scrubbing ?? chapter;  /* the film loop: subtitles, chapter, clock, the room's light */  React.useEffect(() => {    const v = videoRef.current;    const root = rootRef.current;    if (!v || !root) return;    const canvas = reflectRef.current;    const ctx = canvas?.getContext("2d", { willReadFrequently: true }) ?? null;    let canRead = true;    const spill = [40, 48, 70];    const target = [40, 48, 70];    let frame = 0;    let raf = 0;    let lastCap = -2;    let lastChapter = -1;    let lastSecond = -1;    const paintRoom = () => {      if (!ctx || !canvas) return;      try {        if (v.readyState >= 2) ctx.drawImage(v, 0, 0, canvas.width, canvas.height);      } catch {        return;      }      if (canRead && frame % 12 === 0) {        try {          const d = ctx.getImageData(0, 0, canvas.width, canvas.height).data;          let r = 0, g = 0, b = 0, n = 0;          for (let i = 0; i < d.length; i += 16) {            r += d[i];            g += d[i + 1];            b += d[i + 2];            n++;          }          if (n) {            // keep the hue, lift it a little: the screen is a light, not a swatch            const m = Math.max(r, g, b) / n || 1;            const lift = Math.min(1.8, 150 / m);            target[0] = Math.min(255, (r / n) * lift);            target[1] = Math.min(255, (g / n) * lift);            target[2] = Math.min(255, (b / n) * lift);          }        } catch {          canRead = false; // a cross-origin film without CORS: the reflection still draws, the light stays neutral        }      }      let changed = false;      for (let i = 0; i < 3; i++) {        const next = spill[i] + (target[i] - spill[i]) * 0.06;        if (Math.abs(next - spill[i]) > 0.4) changed = true;        spill[i] = next;      }      if (changed && spillRef.current) {        spillRef.current.style.setProperty("--ch-spill", `${spill[0] | 0} ${spill[1] | 0} ${spill[2] | 0}`);      }    };    const step = () => {      raf = 0;      const t = v.currentTime;      const captions = captionsRef.current;      const chapters = chaptersRef.current;      // subtitles: the line under the playhead, if any      let cap = -1;      for (let i = 0; i < captions.length; i++) {        if (t >= captions[i].start && t < captions[i].end) {          cap = i;          break;        }        if (captions[i].start > t) break;      }      if (cap !== lastCap) {        lastCap = cap;        setCaption(cap >= 0 ? captions[cap].text : null);      }      const c = chapterAt(chapters, t);      if (c !== lastChapter) {        lastChapter = c;        setChapter(c);      }      const sec = Math.floor(t);      if (sec !== lastSecond) {        lastSecond = sec;        setNow(t);      }      frame++;      paintRoom();      if (!v.paused && !v.ended) raf = requestAnimationFrame(step);    };    const kick = () => {      if (!raf) raf = requestAnimationFrame(step);    };    const onMeta = () => {      if (Number.isFinite(v.duration) && v.duration > 0) setDuration(v.duration);    };    const onEnded = () => {      if (phaseRef.current === "preview") {        v.currentTime = start;        void v.play();      } else {        setPhase("paused");      }    };    const onSeeked = () => kick();    v.addEventListener("play", kick);    v.addEventListener("seeked", onSeeked);    v.addEventListener("loadedmetadata", onMeta);    v.addEventListener("loadeddata", kick);    v.addEventListener("ended", onEnded);    onMeta();    // the poster lights the room before the film runs    if (video.poster && ctx && canvas) {      const img = new Image();      img.onload = () => {        if (v.readyState >= 2) return;        try {          ctx.drawImage(img, 0, 0, canvas.width, canvas.height);        } catch {          /* ignore */        }      };      img.src = video.poster;    }    // a muted preview only runs while the screen is on screen    const io = new IntersectionObserver(      ([entry]) => {        if (!entry) return;        if (!entry.isIntersecting && phaseRef.current === "preview" && !v.paused) v.pause();        if (entry.isIntersecting && phaseRef.current === "preview" && v.paused) void v.play().catch(() => setPhase("still"));      },      { threshold: 0.15 },    );    io.observe(v);    return () => {      cancelAnimationFrame(raf);      io.disconnect();      v.removeEventListener("play", kick);      v.removeEventListener("seeked", onSeeked);      v.removeEventListener("loadedmetadata", onMeta);      v.removeEventListener("loadeddata", kick);      v.removeEventListener("ended", onEnded);    };  }, [start, video.poster]);  /* the leader runs in CSS on load; when it ends, the film starts muted */  React.useEffect(() => {    const v = videoRef.current;    if (!v) return;    if (reduced || !countdown) {      setPhase("still");      return;    }    let cancelled = false;    const begin = () => {      if (cancelled || phaseRef.current !== "leader") return;      v.muted = true;      if (v.currentTime < start) v.currentTime = start;      v.play()        .then(() => !cancelled && setPhase("preview"))        .catch(() => !cancelled && setPhase("still"));    };    const anims = (leaderRef.current?.getAnimations?.() ?? []).filter(      (a) => (a as Animation & { animationName?: string }).animationName === "ch-cut",    );    if (anims.length) {      Promise.all(anims.map((a) => a.finished)).then(begin, begin);    } else {      begin();    }    return () => {      cancelled = true;    };  }, [reduced, countdown, start]);  const playWithSound = (from?: number) => {    const v = videoRef.current;    if (!v) return;    v.muted = false;    if (from != null) v.currentTime = from;    setPhase("sound");    void v.play().catch(() => setPhase("paused"));  };  const onScreenClick = () => {    const v = videoRef.current;    if (!v) return;    if (phase === "preview" || phase === "leader") return playWithSound();    if (phase === "sound") {      v.pause();      setPhase("paused");      return;    }    playWithSound(phase === "still" && v.currentTime < start ? 0 : undefined);  };  const toggleMute = (e: React.MouseEvent) => {    e.stopPropagation();    const v = videoRef.current;    if (!v) return;    if (phase === "preview") return playWithSound();    v.muted = !v.muted;    setPhase(v.muted ? "preview" : "sound");  };  const jumpTo = (i: number) => {    const v = videoRef.current;    const c = chapters[i];    if (!v || !c) return;    setChapter(i);    v.currentTime = c.time;    if (phase === "sound" || phase === "paused" || phase === "still") {      if (phase !== "sound") playWithSound(c.time);    } else {      void v.play().catch(() => setPhase("still"));    }  };  /* drag the strip: the screen shows the still under the gate, release jumps */  const onStripDown = (e: React.PointerEvent<HTMLDivElement>) => {    if (e.button !== 0) return;    const frameEl = trackRef.current?.querySelector<HTMLElement>("[data-frame]");    const fw = frameEl?.getBoundingClientRect().width ?? 180;    dragRef.current = { id: e.pointerId, x: e.clientX, fw, from: chapter, moved: false };  };  const onStripMove = (e: React.PointerEvent<HTMLDivElement>) => {    const d = dragRef.current;    if (!d || d.id !== e.pointerId) return;    const dx = e.clientX - d.x;    if (!d.moved && Math.abs(dx) < 6) return;    if (!d.moved) {      d.moved = true;      e.currentTarget.setPointerCapture(e.pointerId);    }    const pos = Math.max(-0.45, Math.min(chapters.length - 0.55, d.from - dx / d.fw));    trackRef.current?.style.setProperty("--ch-pos", String(pos));    const nearest = Math.round(Math.max(0, Math.min(chapters.length - 1, pos)));    setScrubbing((s) => (s === nearest ? s : nearest));  };  const onStripUp = (e: React.PointerEvent<HTMLDivElement>) => {    const d = dragRef.current;    dragRef.current = null;    if (!d || !d.moved) return;    const target = scrubbing ?? d.from;    setScrubbing(null);    trackRef.current?.style.removeProperty("--ch-pos");    jumpTo(target);    e.preventDefault();  };  const onStripKey = (e: React.KeyboardEvent, i: number) => {    let next: number | null = null;    if (e.key === "ArrowRight") next = Math.min(chapters.length - 1, i + 1);    if (e.key === "ArrowLeft") next = Math.max(0, i - 1);    if (next !== null) {      e.preventDefault();      jumpTo(next);      trackRef.current?.querySelector<HTMLElement>(`[data-frame="${next}"]`)?.focus();    }  };  const display: React.CSSProperties = { fontFamily: "var(--ch-display, inherit)" };  const rootStyle = { ...TONES[tone], fontFamily: "var(--ch-sans, inherit)", ...style } as React.CSSProperties;  const playing = phase === "preview" || phase === "sound";  const total = duration || video.duration || 0;  const progress = total ? Math.min(1, now / total) : 0;  const active = chapters[shownChapter];  const leaderTail = Array.from({ length: LEADER_FRAMES }, (_, i) => i);  return (    <section      ref={rootRef}      data-ch=""      data-tone={tone}      aria-label={`${brand} hero`}      style={rootStyle}      className={`@container relative isolate flex w-full flex-col overflow-clip rounded-[14px] bg-[var(--ch-room)] text-[var(--ch-ink)] [-webkit-tap-highlight-color:transparent] ${className}`}      {...props}    >      <style>{CSS}</style>      {/* the screen's light on the wall and floor */}      <div        ref={spillRef}        aria-hidden="true"        className="pointer-events-none absolute inset-0 -z-10"        style={{          ["--ch-spill" as string]: "40 48 70",          background:            "radial-gradient(70% 46% at 50% 56%, rgb(var(--ch-spill) / var(--ch-spill-amount)), transparent 72%), linear-gradient(180deg, var(--ch-wall), var(--ch-room) 58%)",        }}      />      {/* nav */}      <header className="relative z-20 flex h-16 shrink-0 items-center gap-4 px-4 @[768px]:px-8">        <a href="#top" className={`inline-flex items-center gap-2 rounded-[6px] text-[18px] font-semibold uppercase tracking-[0.01em] ${FOCUS}`} style={display}>          {logo ?? <ReelMark />}          <span>{brand}</span>        </a>        <nav aria-label="Primary" className="ml-6 hidden items-center gap-0.5 @[900px]:flex">          {navLinks.map((l) => (            <a              key={l.label}              href={l.href}              className={`inline-flex h-9 items-center rounded-[6px] px-3 text-[14px] font-medium text-[var(--ch-ink-2)] transition-colors hover:bg-[var(--ch-hover)] hover:text-[var(--ch-ink)] ${FOCUS}`}            >              {l.label}            </a>          ))}        </nav>        <div className="ml-auto flex items-center gap-1.5">          {navSecondaryAction && (            <ActionLink              action={navSecondaryAction}              className={`hidden h-9 items-center rounded-[6px] px-3 text-[14px] font-medium text-[var(--ch-ink-2)] transition-colors hover:bg-[var(--ch-hover)] hover:text-[var(--ch-ink)] @[600px]:inline-flex ${FOCUS}`}            >              {navSecondaryAction.label}            </ActionLink>          )}          {navPrimaryAction && <SignalButton action={navPrimaryAction} small className="hidden @[600px]:inline-flex" />}          <button            type="button"            aria-expanded={menuOpen}            aria-label={menuOpen ? "Close menu" : "Open menu"}            onClick={() => setMenuOpen((o) => !o)}            className={`inline-flex size-10 cursor-pointer touch-manipulation items-center justify-center rounded-[8px] transition-colors hover:bg-[var(--ch-hover)] @[900px]:hidden ${FOCUS}`}          >            {menuOpen ? <X className="size-5" strokeWidth={1.8} /> : <Menu className="size-5" strokeWidth={1.8} />}          </button>        </div>      </header>      <div        className="relative z-20 grid shrink-0 @[900px]:hidden"        style={{ gridTemplateRows: menuOpen ? "1fr" : "0fr", transition: reduced ? "none" : `grid-template-rows 320ms ${EASE}` }}        inert={!menuOpen}      >        <div className="min-h-0 overflow-clip">          <div className="mx-4 mb-3 rounded-[10px] bg-[var(--ch-hover)] p-2 @[768px]:mx-8">            {navLinks.map((l) => (              <a                key={l.label}                href={l.href}                onClick={() => setMenuOpen(false)}                className={`flex h-12 items-center justify-between rounded-[6px] px-3 text-[20px] font-semibold uppercase tracking-[0.01em] ${FOCUS}`}                style={display}              >                {l.label}                <ArrowRight className="size-4 text-[var(--ch-ink-3)]" strokeWidth={2} />              </a>            ))}            {(navPrimaryAction || navSecondaryAction) && (              <div className="mt-1 flex flex-col gap-2 p-1 @[600px]:hidden">                {navPrimaryAction && <SignalButton action={navPrimaryAction} className="w-full" />}                {navSecondaryAction && (                  <ActionLink                    action={navSecondaryAction}                    className={`inline-flex h-11 items-center justify-center rounded-[6px] text-[15px] font-medium text-[var(--ch-ink-2)] ${FOCUS}`}                  >                    {navSecondaryAction.label}                  </ActionLink>                )}              </div>            )}          </div>        </div>      </div>      {/* the bill: headline, one line, the actions */}      <div className="relative z-10 flex shrink-0 flex-col items-center px-4 pt-6 text-center @[768px]:px-8 @[768px]:pt-8">        {eyebrow && (          <p className="ch-fade mb-3 text-[13px] font-medium text-[var(--ch-ink-2)] @[768px]:text-[14px]" style={{ animationDelay: "80ms" }}>            {eyebrow}          </p>        )}        <h1          className="max-w-[18ch] text-[40px] font-semibold uppercase leading-[0.95] tracking-[0.005em] @[480px]:text-[50px] @[768px]:max-w-none @[768px]:text-[62px] @[1400px]:text-[74px]"          style={display}        >          {headline.map((line, i) => (            <span key={i} className={`block overflow-clip pb-[0.04em] @[1100px]:inline-block ${i > 0 ? "@[1100px]:ml-[0.24em]" : ""}`}>              <span className="ch-rise block" style={{ animationDelay: `${60 + i * 80}ms` }}>                <HeadlineLine line={line} highlight={highlight} marker={tone === "light"} />              </span>            </span>          ))}        </h1>        <p className="ch-fade mt-4 max-w-[52ch] text-[15px] @[1100px]:max-w-[66ch] leading-[1.55] text-[var(--ch-ink-2)] @[768px]:text-[16px]" style={{ animationDelay: "260ms" }}>          {subheadline}        </p>        <div className="ch-fade mt-6 flex w-full flex-col items-center gap-2 @[480px]:w-auto @[480px]:flex-row" style={{ animationDelay: "340ms" }}>          <SignalButton action={primaryAction} className="w-full @[480px]:w-auto" />          <button            type="button"            onClick={() => playWithSound(0)}            className={`group inline-flex h-12 w-full cursor-pointer touch-manipulation items-center justify-center gap-2.5 whitespace-nowrap rounded-[6px] px-4 text-[15px] font-medium text-[var(--ch-ink)] transition-colors hover:bg-[var(--ch-hover)] @[480px]:w-auto ${FOCUS}`}          >            <span className="grid size-6 place-items-center rounded-full bg-[var(--ch-ink)] text-[var(--ch-room)]">              <Play className="size-3 translate-x-px fill-current" strokeWidth={0} />            </span>            {watchLabel}            <span className="tabular-nums text-[var(--ch-ink-3)]">{clock(total)}</span>          </button>        </div>      </div>      {/* the screen */}      <div className="relative z-10 mt-8 flex shrink-0 flex-col items-center px-4 @[768px]:mt-10 @[768px]:px-8">        <div className="relative w-full max-w-[980px] @container/screen @[1100px]:max-w-[clamp(720px,calc((100svh-400px)*16/9),980px)]">          <div            className="relative aspect-video w-full overflow-hidden rounded-[4px] bg-[var(--ch-mask)] ring-1 ring-black/40"            style={{ cursor: "pointer" }}            onClick={onScreenClick}          >            <video              ref={videoRef}              src={video.src}              poster={video.poster}              muted              playsInline              preload="metadata"              className="absolute inset-0 size-full object-cover"              aria-label={`${brand} film`}            />            {/* a dragged frame shows in the gate before the jump */}            {scrubbing !== null && active && (              // eslint-disable-next-line @next/next/no-img-element              <img src={active.still} alt="" className="absolute inset-0 size-full object-cover" />            )}            {countdown && <Leader ref={leaderRef} />}            {/* burned-in subtitles */}            {caption && phase !== "leader" && scrubbing === null && (              <p                key={caption}                className="ch-sub pointer-events-none absolute inset-x-[6%] bottom-[7%] z-10 text-center text-[clamp(13px,3.4cqw,26px)] font-semibold leading-[1.2] text-white [text-shadow:0_1px_0_rgba(0,0,0,0.9),0_0_6px_rgba(0,0,0,0.75)]"                style={display}              >                {caption}              </p>            )}            {/* paused / blocked autoplay: one play mark */}            {(phase === "paused" || phase === "still") && (              <span className="pointer-events-none absolute left-1/2 top-1/2 z-10 grid size-16 -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full bg-[var(--ch-signal)] text-[var(--ch-on-signal)] @[600px]/screen:size-20">                <Play className="size-7 translate-x-0.5 fill-current" strokeWidth={0} />              </span>            )}            {/* sound, bottom right */}            {phase !== "leader" && (              <button                type="button"                onClick={toggleMute}                aria-label={phase === "sound" ? "Mute" : "Play with sound"}                className={`absolute bottom-2.5 right-2.5 z-10 inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-[6px] bg-black/55 px-2.5 text-[12px] font-medium text-white transition-colors hover:bg-black/70 ${FOCUS}`}              >                {phase === "sound" ? <Volume2 className="size-4" strokeWidth={2} /> : <VolumeX className="size-4" strokeWidth={2} />}                <span className="hidden @[520px]/screen:inline">{phase === "sound" ? "Sound on" : "Tap for sound"}</span>              </button>            )}            {/* how far through the film */}            <span              aria-hidden="true"              className="absolute bottom-0 left-0 z-10 h-[3px] bg-[var(--ch-signal)]"              style={{ width: `${progress * 100}%`, transition: playing ? "width 1s linear" : "none" }}            />          </div>                    {/* samples the playing frame for the room's light */}          <canvas ref={reflectRef} width={32} height={18} aria-hidden="true" className="hidden" />          {/* the slate: chapter and time */}          <div className="relative mt-3 flex items-baseline justify-between gap-4 text-[12px] font-medium uppercase tracking-[0.06em] text-[var(--ch-ink-2)] @[768px]:text-[13px]" style={display}>            <span className="truncate">              <span className="text-[var(--ch-signal-text)] tabular-nums">CH {String(shownChapter + 1).padStart(2, "0")}</span>              <span className="mx-2 text-[var(--ch-ink-3)]">/</span>              {active?.title}            </span>            <span className="shrink-0 tabular-nums">              {clock(now)} <span className="text-[var(--ch-ink-3)]">/ {clock(total)}</span>            </span>          </div>        </div>      </div>      {/* the strip: one frame per chapter, edge to edge */}      <div        className="relative z-10 mt-4 mb-6 shrink-0 h-[calc(var(--ch-fw)*0.5625+52px)] select-none overflow-hidden [--ch-fw:150px] @[600px]:[--ch-fw:190px] @[1100px]:[--ch-fw:224px] @[768px]:mb-8"        style={{ touchAction: "pan-y" }}        onPointerDown={onStripDown}        onPointerMove={onStripMove}        onPointerUp={onStripUp}        onPointerCancel={onStripUp}        role="group"        aria-label="Chapters"      >        <div          ref={trackRef}          className="absolute left-1/2 top-0 flex h-full"          style={{            transform: `translate3d(calc((var(--ch-pos, ${chapter}) + ${LEADER_FRAMES} + 0.5) * var(--ch-fw) * -1), 0, 0)`,            transition: scrubbing !== null || reduced ? "none" : `transform 560ms ${PULLDOWN}`,          }}        >          {leaderTail.map((i) => (            <FilmFrame key={`h${i}`} kind="leader" label={`${LEADER_FRAMES - i + 4}`} />          ))}          {chapters.map((c, i) => (            <FilmFrame              key={c.time}              kind="chapter"              index={i}              chapter={c}              active={i === shownChapter}              onSelect={() => {                if (!dragRef.current?.moved) jumpTo(i);              }}              onKeyDown={(e) => onStripKey(e, i)}            />          ))}          {leaderTail.map((i) => (            <FilmFrame key={`t${i}`} kind="leader" label={i === 0 ? "END" : ""} />          ))}        </div>      </div>    </section>  );}function FilmFrame({  kind,  index = 0,  chapter,  active = false,  label,  onSelect,  onKeyDown,}: {  kind: "chapter" | "leader";  index?: number;  chapter?: CinemaHeroChapter;  active?: boolean;  label?: string;  onSelect?: () => void;  onKeyDown?: (e: React.KeyboardEvent) => void;}) {  const holes: React.CSSProperties = {    backgroundImage:      "linear-gradient(90deg, var(--ch-hole) 0 9px, transparent 9px), linear-gradient(90deg, var(--ch-hole) 0 9px, transparent 9px)",    backgroundSize: "calc(var(--ch-fw) / 8) 7px, calc(var(--ch-fw) / 8) 7px",    backgroundPosition: "4px 4px, 4px calc(100% - 4px)",    backgroundRepeat: "repeat-x, repeat-x",  };  const print = "text-[9.5px] font-semibold uppercase leading-none tracking-[0.12em] @[600px]:text-[10.5px]";  if (kind === "leader") {    return (      <div aria-hidden="true" className="relative h-full w-[var(--ch-fw)] shrink-0 bg-[var(--ch-film)]" style={holes}>        <div className="absolute inset-x-[7px] bottom-[26px] top-[26px] grid place-items-center rounded-[3px] bg-[var(--ch-film-edge)]">          {label && (            <span className="text-[22px] font-semibold text-white/25" style={{ fontFamily: "var(--ch-display, inherit)" }}>              {label}            </span>          )}        </div>      </div>    );  }  const c = chapter!;  return (    <div className="relative h-full w-[var(--ch-fw)] shrink-0 bg-[var(--ch-film)]" style={holes}>      <button        type="button"        data-frame={index}        onClick={onSelect}        onKeyDown={onKeyDown}        aria-label={`Chapter ${index + 1}: ${c.title}, ${clock(c.time)}`}        aria-current={active ? "true" : undefined}        className={`group absolute inset-0 cursor-pointer touch-manipulation ${FOCUS}`}      >        <span          className={`absolute inset-x-[9px] top-[14px] flex justify-between ${print} ${active ? "text-[var(--ch-signal)]" : "text-[#8b7a5a]"}`}          style={{ fontFamily: "var(--ch-display, inherit)" }}        >          <span className="tabular-nums">CH {String(index + 1).padStart(2, "0")}</span>          <span className="tabular-nums">{clock(c.time)}</span>        </span>        <span className="absolute inset-x-[7px] bottom-[26px] top-[26px] overflow-hidden rounded-[3px] bg-black">          {/* eslint-disable-next-line @next/next/no-img-element */}          <img            src={c.still}            alt=""            draggable={false}            loading="lazy"            className="size-full object-cover transition-[filter] duration-300"            style={{ filter: active ? "none" : "brightness(0.5) saturate(0.7)" }}          />        </span>        <span          className={`absolute inset-x-[9px] bottom-[14px] truncate text-left ${print} ${active ? "text-[var(--ch-signal)]" : "text-[#8b7a5a] group-hover:text-[#b9a57c]"}`}          style={{ fontFamily: "var(--ch-display, inherit)" }}        >          {c.title}        </span>      </button>    </div>  );}export default CinemaHero;

Registry item: /r/cinema-hero.json