/* Film title blocks: shared by films.html and the film-*.html pages.
   Each block is one link. Every title line is scaled by film-blocks.js so it fills the
   block's full width. On hover, or when the block is centred on a phone, a silent clip
   plays inside the letters and a thin white outline traces them.

   How the knockout works: .fb-stage is an isolated group that blends onto the page with
   "lighten". Inside it the title has a pure-black box and light letters and multiplies
   over the clip, so the clip survives only inside the letters and the black box
   disappears into the page. Never put transform/opacity/filter on an ancestor of
   .fb-stage: that would isolate the blend and show the black box. */

@property --fade { syntax: "<number>"; inherits: false; initial-value: 0; }

.fb {
  --fit-max: 460px;
  display: block; text-decoration: none; color: var(--fg);
  border-bottom: 1px solid var(--border);
  --fade: 0;
  --glow: color-mix(in oklab, var(--surface) 93.7%, white);
  background: linear-gradient(to bottom, transparent 0%,
    color-mix(in oklab, var(--glow) calc(var(--fade) * 100%), transparent) 26%,
    color-mix(in oklab, var(--glow) calc(var(--fade) * 100%), transparent) 74%, transparent 100%);
  transition: --fade 320ms ease;
}
.fb-inner {
  max-width: 1680px; margin: 0 auto;
  padding: clamp(26px, 3.4vw, 48px) clamp(20px, 4vw, 56px) clamp(30px, 4vw, 56px);
}
.fb:hover { --fade: 1; }
@media (hover: none) { .fb.is-live { --fade: 1; } }
.fb:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.fb-meta {
  display: flex; align-items: baseline; gap: 10px 22px; flex-wrap: wrap;
  font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}
.fb-num { color: var(--fg); font-variant-numeric: tabular-nums; }
.fb-tag { color: var(--fg); border: 1px solid var(--border); padding: 3px 8px; font-size: 10px; font-weight: 600; }
.fb-go {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  color: var(--fg); border-bottom: 1px solid currentColor; padding-bottom: 2px;
}
.fb-go svg { transition: transform 240ms cubic-bezier(0.23, 1, 0.32, 1); }
.fb:hover .fb-go svg { transform: translateX(4px); }
@media (hover: none) { .fb.is-live .fb-go svg { transform: translateX(4px); } }

/* title art */
.fb-art { position: relative; margin-top: clamp(14px, 1.6vw, 22px); }
.fb-stage { position: relative; isolation: isolate; mix-blend-mode: lighten; overflow: hidden; }
.fb-stage video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 50%;
  opacity: 0; transition: opacity 280ms ease;
}
.fb-title, .fb-outline {
  margin: 0;
  font-family: "Barlow Semi Condensed", "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 900; text-transform: uppercase;
  line-height: 0.84; letter-spacing: 0.005em;
  padding: 0.05em 0 0.04em;
}
.fb-title { position: relative; display: block; text-align: center; background: var(--knock); color: var(--fg); mix-blend-mode: multiply; }
.fb-title .ln, .fb-outline .ln { display: block; width: fit-content; margin-left: auto; margin-right: auto; font-size: clamp(56px, 11vw, 180px); }
.fb.is-fit .ln { white-space: nowrap; }
.fb-outline {
  position: absolute; inset: 0; pointer-events: none;
  text-align: center; color: transparent; -webkit-text-stroke: 1.5px oklch(100% 0 0 / 0.42);
  opacity: 0; transition: opacity 280ms ease;
}
.fb.is-live .fb-stage video, .fb.is-live .fb-outline { opacity: 1; } /* set by a direct hover on the title, and kept */

/* The site turns linked text red on hover. Inside a block, only the "go" label and
   Hush's letters take the red; clip titles stay light so the film shows true colour. */
.fb:hover .fb-title, .fb:hover .fb-title .ln, .fb:focus-visible .fb-title, .fb:focus-visible .fb-title .ln { color: var(--fg) !important; }
.fb .fb-outline, .fb .fb-outline .ln { color: transparent !important; }
.fb:hover .fb-meta > span:not(.fb-go):not(.fb-num):not(.fb-tag), .fb:focus-visible .fb-meta > span:not(.fb-go):not(.fb-num):not(.fb-tag) { color: var(--muted) !important; }
.fb:hover .fb-num, .fb:hover .fb-tag, .fb:focus-visible .fb-num, .fb:focus-visible .fb-tag { color: var(--fg) !important; }
.fb--script:hover .fb-title, .fb--script:hover .fb-title .ln,
.fb--script:focus-visible .fb-title, .fb--script:focus-visible .fb-title .ln,
.fb--script.is-live .fb-title, .fb--script.is-live .fb-title .ln { color: var(--accent-hover) !important; }

.fb-logline {
  margin: clamp(16px, 1.8vw, 26px) auto 0; max-width: 84ch; text-align: center;
  font-size: clamp(16px, 1.3vw, 18px); color: var(--muted);
  text-wrap: pretty; transition: color 200ms ease;
}
.fb:hover .fb-logline, .fb:focus-visible .fb-logline { color: var(--fg) !important; }
@media (hover: none) { .fb.is-live .fb-logline { color: var(--fg) !important; } }

/* compact list on film pages: plain bold white titles, one uniform size, no clip */
.fb--compact .fb-inner { padding-top: clamp(22px, 2.6vw, 34px); padding-bottom: clamp(24px, 2.8vw, 38px); }
.fb--compact .fb-title {
  background: none; mix-blend-mode: normal;
  font-size: clamp(34px, 8.03vw, 119px); text-wrap: balance; text-align: center;
}
.fb--compact .fb-logline { display: none; } /* the other films are plain titles: no loglines */
.fb--compact.fb--script:hover .fb-title, .fb--compact.fb--script:hover .fb-title .ln,
.fb--compact.fb--script:focus-visible .fb-title, .fb--compact.fb--script.is-live .fb-title { color: var(--fg) !important; }

/* red bars between films on films.html; each flickers on once as it scrolls in */
.fb-bar { height: 2px; background: var(--accent); margin: clamp(45px, 6.4vw, 102px) 0; }

/* fold-in on scroll (films.html): each block swings in from alternating sides.
   Applied to the parts, never to .fb-art or .fb-inner (that would break the knockout). */
html.js-fold .fb[data-side] .fb-meta,
html.js-fold .fb[data-side] .fb-stage,
html.js-fold .fb[data-side] .fb-outline,
html.js-fold .fb[data-side] .fb-logline {
  transform: perspective(1600px) translateX(var(--fx)) rotateY(var(--fr));
  transform-origin: var(--fo) 50%;
  transition: transform 1100ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 800ms ease;
}
html.js-fold .fb[data-side] .fb-meta,
html.js-fold .fb[data-side] .fb-stage,
html.js-fold .fb[data-side] .fb-logline { opacity: 0; }
.fb[data-side="left"]  { --fx: -14vw; --fr: 22deg;  --fo: 0%; }
.fb[data-side="right"] { --fx: 14vw;  --fr: -22deg; --fo: 100%; }
html.js-fold .fb[data-side] .fb-logline { transition-delay: 180ms; }
html.js-fold .fb[data-side] .fb-outline { transition: transform 1100ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 280ms ease; }
html.js-fold .fb.is-folded .fb-meta,
html.js-fold .fb.is-folded .fb-stage,
html.js-fold .fb.is-folded .fb-outline,
html.js-fold .fb.is-folded .fb-logline { transform: none; }
html.js-fold .fb.is-folded .fb-meta,
html.js-fold .fb.is-folded .fb-stage,
html.js-fold .fb.is-folded .fb-logline { opacity: 1; }
html.js-fade .fb[data-side] .fb-meta,
html.js-fade .fb[data-side] .fb-stage,
html.js-fade .fb[data-side] .fb-logline { opacity: 0; transition: opacity 900ms ease; }
html.js-fade .fb.is-folded .fb-meta,
html.js-fade .fb.is-folded .fb-stage,
html.js-fade .fb.is-folded .fb-logline { opacity: 1; }
/* the first block lands on load with plain CSS, so it needs no scroll trigger */
@keyframes fb-land {
  from { opacity: 0; transform: perspective(1600px) translateX(-16vw) rotateY(24deg); }
  to   { opacity: 1; transform: none; }
}
@keyframes fb-land-fade { from { opacity: 0; } to { opacity: 1; } }
.films a.fb:first-of-type .fb-meta, .films a.fb:first-of-type .fb-stage, .films a.fb:first-of-type .fb-logline {
  transform-origin: 0% 50%; animation: fb-land 1.3s cubic-bezier(0.2, 0.8, 0.2, 1) 120ms backwards;
}
.films a.fb:first-of-type .fb-logline { animation-delay: 300ms; }
@media (prefers-reduced-motion: reduce) {
  .films a.fb:first-of-type .fb-meta, .films a.fb:first-of-type .fb-stage, .films a.fb:first-of-type .fb-logline { animation: fb-land-fade 900ms ease 120ms backwards; }
}
html.js-bars .fb-bar { opacity: 0; }
html.js-bars .fb-bar.is-lit { opacity: 1; animation: fb-flicker 620ms steps(1, end); }
@keyframes fb-flicker {
  0% { opacity: 0; } 12% { opacity: 0.85; } 22% { opacity: 0.1; } 34% { opacity: 1; }
  46% { opacity: 0.35; } 58% { opacity: 1; } 100% { opacity: 1; }
}

@media (max-width: 680px) {
  .fb-go { margin-left: 0; }
  .fb-outline { -webkit-text-stroke-width: 1px; }
}
@media (prefers-reduced-motion: reduce) {
  .fb-stage video, .fb-outline { transition: none; }
  html.js-bars .fb-bar { opacity: 1; }
  html.js-bars .fb-bar.is-lit { animation: none; }
}
