/* Hero — the signal wall (mechanics in hero.js).
   The whole opening is one split-flap wall. Its modules are windows onto the
   client's real street footage, graded to the page's monochrome; the headline
   is spelled by modules of the same wall, so the letters sit on the grid and
   the word gaps show the city through. hero.js sizes the cell (--hero-c) from
   the viewport and builds the tiles; this file is the look.

   Planes, back to front:
     plate   the footage, its own drift and zoom
     board   tiles + headline + copy, one rigid plane, tilts with the cursor
     light   the wall's spill and the text scrim */

.bp-hero {
  --hero-c: 60px;              /* cell size, set by hero.js */
  --hero-anchor: 46%;          /* headline centre, from the stage top */
  --hero-copy-top: 60%;        /* set by hero.js from the cell size */
  background: var(--sc-canvas);
  text-align: center;
}
/* Per-frame motion (plate drift, board tilt) is written straight onto the
   elements' transform by hero.js, never through a custom property on the
   section: a property change up here restyles every module below it. */
.bp-hero__stage {
  /* sticky + height come from the engine's .sc-stage */
  background: var(--sc-canvas);
  perspective: 1600px;
}

/* ---- plate: the footage ---- */
.bp-hero__plate {
  position: absolute;
  inset: -4% -3%;             /* bleed so the drift never shows an edge */
  z-index: 0;
  opacity: 0;
  transition: opacity 600ms var(--sc-ease-out);
  will-change: transform, opacity;
}
.bp-hero.is-ready .bp-hero__plate { opacity: 1; }
.bp-hero__plate video,
.bp-hero__plate img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* the dusk grade is baked into the clip (see hero.js header): CSS filters
     on video are unreliable on iOS and a blur on a viewport-sized layer can
     drop the whole layer on some GPUs */
}
.bp-hero__plate img { display: none; }
.bp-hero.is-still .bp-hero__plate video { display: none; }
.bp-hero.is-still .bp-hero__plate img { display: block; }
/* the wall lights its own edges less than its centre */
.bp-hero__plate::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(70% 60% at 50% 48%, transparent 30%, rgba(11,11,12,.55) 100%),
    linear-gradient(to bottom, rgba(11,11,12,.7), transparent 22%, transparent 70%, rgba(11,11,12,.85));
}

/* ---- board: the wall, the headline and the copy ---- */
.bp-hero__board {
  position: absolute; inset: 0;
  z-index: 1;
  will-change: transform;
}

.bp-hero__wall {
  position: absolute;
  left: 50%; top: var(--hero-anchor);
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; gap: .09em;
  font-size: var(--hero-c);
  pointer-events: none;
  will-change: transform;   /* own layer: a blackout step repaints the wall, not the headline */
}
.hw-row { display: flex; gap: .09em; flex: none; }
/* on the phone the wall is laid in brick bond: every other row sits half a
   module over, so a three-letter row can centre on a module while the rows
   above and below centre on a gap */
.hw-row.is-shift { margin-left: .545em; }
/* one module. Transparent = a window onto the plate; off = a dark flap.
   The spread shadow paints the mullion around every tile, so the gaps in
   the grid are ink rather than footage; the small radius and the wide spread
   keep the four-corner meeting points closed too. Shading is a gradient, not
   a blurred shadow: the wall repaints on every blackout step and on every
   blink, and 260 blurred shadows made each of those repaints a dropped
   frame. */
.hw-tile {
  position: relative; flex: none;
  width: 1em; height: 1.32em;
  border-radius: .04em;
  background-color: transparent;
  background-image: linear-gradient(to bottom,
    rgba(255,255,255,.05), rgba(255,255,255,0) 18%,
    rgba(0,0,0,0) 62%, rgba(0,0,0,.5));
  box-shadow:
    0 0 0 .1em var(--sc-canvas),
    inset 0 0 0 1px rgba(255,255,255,.045);
  transition: background-color 0s linear var(--d, 0s);
}
/* a module flicking for a beat: the wall updating itself */
.hw-tile.is-blink { background: var(--flap-bg); transition-delay: 0s; }
.hw-tile::after {
  content: "";
  position: absolute; left: 0; right: 0; top: calc(50% - .4px); height: .8px;
  background: rgba(0,0,0,.72);
}
.hw-tile.is-off { background: var(--flap-bg); }
.bp-hero__wall.is-live .hw-tile { transition-delay: 0s; }

/* headline: two flap rows sized in the same cell, so the letters ARE tiles */
.bp-hero__title {
  position: absolute; left: 0; right: 0; top: var(--hero-anchor);
  margin: 0;
  transform: translateY(-50%);
  font-size: var(--hero-c);
}
.bp-hero__title [data-flap] { display: flex; justify-content: center; width: 100%; flex-wrap: nowrap; }
.bp-hero__title [data-flap][hidden] { display: none; }
.bp-hero__title [data-flap] + [data-flap]:not([hidden]) { margin-top: .09em; }
/* the gap between words is one whole module wide, so the row stays on the
   grid and the city shows through the gap */
.bp-hero__title .flap-space { width: 1.09em; }
.bp-hero__title .flap-cell {
  box-shadow:
    0 0 0 .06em var(--sc-canvas),
    inset 0 0 0 1px rgba(255,255,255,.12),
    0 .3em 1.2em rgba(0,0,0,.55);
}

.bp-hero__copy {
  position: absolute; left: 0; right: 0; top: var(--hero-copy-top);
  padding: 0 clamp(20px, 5vw, 48px);
  opacity: 0; transform: translateY(10px);
  transition: opacity 700ms var(--sc-ease-out), transform 700ms var(--sc-ease-out);
}
.bp-hero.is-set .bp-hero__copy { opacity: 1; transform: none; }
/* scrim only where the text sits */
.bp-hero__copy::before {
  content: "";
  position: absolute; left: 50%; top: 50%; z-index: -1;
  width: min(92vw, 720px); height: 150%;
  transform: translate(-50%, -50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(11,11,12,.92), rgba(11,11,12,.6) 55%, transparent 100%);
}
.bp-hero__sub {
  margin: 0 auto;
  max-width: 44ch;
  font: 400 clamp(1rem, 1.35vw, 1.2rem)/1.5 var(--sc-font-text);
  color: var(--sc-ink);
}
.bp-hero__sub span { color: var(--sc-ink-soft); }
.bp-hero__ctas { display: flex; gap: 14px; justify-content: center; margin-top: 30px; }

/* light: the wall's spill and a slow specular pass over the flaps, in front
   of everything. Plain alpha, no blend mode: a blend over a video layer
   re-composites the whole stage every frame. Opacity is set by hero.js as
   the city goes dark. */
.bp-hero__light {
  position: absolute; inset: 0; z-index: 2;
  pointer-events: none;
  background: radial-gradient(60% 50% at 50% var(--hero-anchor), rgba(255,255,255,.05), transparent 70%);
  overflow: hidden;
}
.bp-hero__light::before {
  content: "";
  position: absolute; top: -20%; bottom: -20%; left: 0; width: 38%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.065) 50%, transparent);
  transform: translateX(-120%) skewX(-8deg);
  will-change: transform;
  animation: heroSweep 14s cubic-bezier(.4, 0, .2, 1) 2.4s infinite;
  animation-play-state: paused;
}
.bp-hero.is-near .bp-hero__light::before { animation-play-state: running; }
@keyframes heroSweep {
  0%   { transform: translateX(-120%) skewX(-8deg); }
  38%  { transform: translateX(340%) skewX(-8deg); }
  100% { transform: translateX(340%) skewX(-8deg); }
}

@media (max-width: 720px) {
  .bp-hero { --hero-anchor: 43%; }
  .bp-hero__sub { font-size: 15px; max-width: 30ch; }
  .bp-hero__ctas { margin-top: 24px; gap: 10px; }
  .bp-hero__ctas .bp-pill { padding: 13px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  /* no pin, no scrub: the finished frame, city on, message on */
  .bp-hero { height: auto !important; }
  .bp-hero .sc-stage { position: relative; height: 100svh; }
  .bp-hero__plate, .bp-hero__copy { transition: none; }
  .hw-tile { transition: none; }
  .bp-hero__light::before { animation: none; }
}
