/* OPERATOR — cinematic hero + film modal
   Additive layer on top of operator.css. Tokens inherited from :root there. */

:root {
  --film-ease: cubic-bezier(.32, .72, 0, 1);
}

/* ---------------- hero ---------------- */

.hero-film {
  position: relative;
  overflow: hidden;
  padding: 96px 0 104px;
  background: var(--bg-page);
  isolation: isolate;
}

/* ambient light — pure CSS, zero bytes, drifts slowly */
.hero-film .ambient {
  position: absolute;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
}
.hero-film .ambient span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
  will-change: transform;
}
.hero-film .ambient span:nth-child(1) {
  width: 46vw; height: 46vw; top: 2%; left: 46%;
  background: radial-gradient(circle at 30% 30%, rgba(0,113,227,.30), rgba(0,113,227,0) 68%);
  animation: drift-a 26s var(--film-ease) infinite alternate;
}
.hero-film .ambient span:nth-child(2) {
  width: 38vw; height: 38vw; top: 34%; left: 4%;
  background: radial-gradient(circle at 60% 40%, rgba(88,86,214,.22), rgba(88,86,214,0) 70%);
  animation: drift-b 32s var(--film-ease) infinite alternate;
}
.hero-film .ambient span:nth-child(3) {
  width: 30vw; height: 30vw; top: 58%; left: 58%;
  background: radial-gradient(circle at 40% 60%, rgba(29,157,95,.14), rgba(29,157,95,0) 70%);
  animation: drift-c 38s var(--film-ease) infinite alternate;
}
@keyframes drift-a { to { transform: translate3d(-6%, 7%, 0) scale(1.12); } }
@keyframes drift-b { to { transform: translate3d(8%, -5%, 0) scale(1.08); } }
@keyframes drift-c { to { transform: translate3d(-5%, -8%, 0) scale(1.15); } }

.hero-film .grid {
  display: grid;
  grid-template-columns: 1.08fr minmax(0, 460px);
  gap: 56px;
  align-items: center;
}

.hero-film .display { font-size: clamp(2.2rem, 4.4vw, 3.4rem); }
.hero-film .subhead { margin-top: 20px; max-width: 34ch; font-size: clamp(1.05rem, 1.5vw, 1.24rem); }
.hero-film .btn-row { justify-content: flex-start; }
.hero-film .fine {
  margin-top: 18px;
  font-size: .8em;
  color: var(--ink-3);
}

/* ---------------- film tile ---------------- */

.film-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: block;
  border-radius: var(--r-big);
  overflow: hidden;
  background: #f2f2f5;
  font-family: var(--font);
  box-shadow:
    0 1px 2px rgba(0,0,0,.04),
    0 18px 40px -12px rgba(0,0,0,.16),
    0 40px 90px -30px rgba(0,113,227,.28);
  transition: transform .5s var(--film-ease), box-shadow .5s var(--film-ease);
  -webkit-tap-highlight-color: transparent;
}
.film-tile:hover,
.film-tile:focus-visible {
  transform: translateY(-4px) scale(1.006);
  box-shadow:
    0 1px 2px rgba(0,0,0,.05),
    0 26px 54px -14px rgba(0,0,0,.20),
    0 54px 110px -34px rgba(0,113,227,.34);
}
.film-tile:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.film-tile:active { transform: translateY(-1px) scale(.997); }

.film-tile video,
.film-tile img.poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* soft top-light so the frosted bar has something to sit on, never muddy */
.film-tile .scrim {
  position: absolute;
  inset: auto 0 0 0;
  height: 34%;
  background: linear-gradient(to top, rgba(0,0,0,.10), rgba(0,0,0,0));
  transition: opacity .4s var(--film-ease);
}

/* frosted chrome bar — light film stays light, dark scenes get a clean white strip */
.film-tile .label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  text-align: left;
  background: rgba(255,255,255,.74);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255,255,255,.55);
  transition: background .35s var(--film-ease);
}
.film-tile:hover .label { background: rgba(255,255,255,.84); }

/* play button */
.film-tile .play {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue);
  box-shadow: 0 4px 14px rgba(0,113,227,.36);
  transition: background .3s var(--film-ease), transform .5s var(--film-ease);
}
.film-tile .play svg { width: 14px; height: 14px; fill: #fff; margin-left: 2px; position: relative; z-index: 1; }
.film-tile:hover .play { background: var(--blue-hover); transform: scale(1.06); }

/* pulse ring on the play button */
.film-tile .play::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--blue);
  animation: pulse 3s var(--film-ease) infinite;
}
@keyframes pulse {
  0%   { transform: scale(1); opacity: .55; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

.film-tile .txt { color: var(--ink); line-height: 1.25; }
.film-tile .txt b {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
.film-tile .txt span {
  display: block;
  margin-top: 2px;
  font-size: .78rem;
  color: var(--ink-2);
  letter-spacing: .01em;
}

/* ---------------- modal ---------------- */

.film-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(8,8,10,.84);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  opacity: 0;
  visibility: hidden;
  transition: opacity .42s var(--film-ease), visibility .42s;
}
.film-modal.open { opacity: 1; visibility: visible; }

.film-modal .stage {
  position: relative;
  width: min(92vw, calc((100vh - 132px) * 1), 860px);
  aspect-ratio: 1 / 1;
  max-height: calc(100vh - 132px);
  border-radius: 22px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 40px 120px -20px rgba(0,0,0,.7);
  transform: scale(.94) translateY(14px);
  opacity: 0;
  transition: transform .5s var(--film-ease), opacity .42s var(--film-ease);
}
.film-modal.open .stage { transform: none; opacity: 1; }

.film-modal video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

/* close */
.film-modal .close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: rgba(22,22,24,.52);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  transition: background .25s, opacity .35s var(--film-ease);
  z-index: 3;
}
.film-modal .close:hover { background: rgba(22,22,24,.74); }
.film-modal .close svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 2; }
.film-modal .close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------------- auto-hide controls ---------------- */

/* floating glass bar — legible over both the white and the black scenes of the film */
.film-modal .controls {
  position: absolute;
  left: 14px; right: 14px; bottom: 14px;
  padding: 9px 14px;
  border-radius: 17px;
  background: rgba(22,22,24,.58);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 8px 30px -8px rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity .35s var(--film-ease), transform .35s var(--film-ease);
  z-index: 2;
}
.film-modal.idle .controls,
.film-modal.idle .close {
  opacity: 0;
  pointer-events: none;
}
.film-modal.idle .stage { cursor: none; }
.film-modal.idle .controls { transform: translateY(6px); }

.film-modal .ctl {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border: 0; padding: 0; cursor: pointer;
  border-radius: 50%;
  background: transparent;
  display: grid; place-items: center;
  transition: background .2s;
}
.film-modal .ctl:hover { background: rgba(255,255,255,.16); }
.film-modal .ctl:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.film-modal .ctl svg { width: 15px; height: 15px; fill: #fff; stroke: none; }
.film-modal .ctl .ic-pause,
.film-modal.playing .ctl .ic-play { display: none; }
.film-modal.playing .ctl .ic-pause { display: block; }
.film-modal .ctl .ic-unmuted { display: none; }
.film-modal.muted .ctl .ic-unmuted { display: block; }
.film-modal.muted .ctl .ic-muted { display: none; }

.film-modal .time {
  font-size: .72rem;
  color: rgba(255,255,255,.82);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  flex: 0 0 auto;
  min-width: 74px;
  text-align: center;
}

.film-modal .track {
  flex: 1 1 auto;
  position: relative;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.film-modal .track .rail {
  position: relative;
  width: 100%;
  height: 3px;
  border-radius: 3px;
  background: rgba(255,255,255,.26);
  transition: height .2s var(--film-ease);
  overflow: hidden;
}
.film-modal .track:hover .rail,
.film-modal .track.scrubbing .rail { height: 6px; }
.film-modal .track .buffered,
.film-modal .track .played {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 3px;
  transform-origin: left center;
}
.film-modal .track .buffered { width: 100%; background: rgba(255,255,255,.24); transform: scaleX(0); }
.film-modal .track .played  { width: 100%; background: #fff; transform: scaleX(0); }
.film-modal .track .knob {
  position: absolute;
  top: 50%;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) scale(0);
  transition: transform .2s var(--film-ease);
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.film-modal .track:hover .knob,
.film-modal .track.scrubbing .knob { transform: translate(-50%, -50%) scale(1); }

/* first-frame "tap to unmute" fallback chip */
.film-modal .unmute {
  position: absolute;
  top: 14px; left: 14px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 11px;
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-family: var(--font);
  font-size: .78rem;
  color: #fff;
  background: rgba(22,22,24,.58);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  z-index: 3;
}
.film-modal.blocked .unmute { display: flex; }
.film-modal .unmute svg { width: 13px; height: 13px; fill: #fff; }

/* ---------------- responsive ---------------- */

@media (max-width: 900px) {
  .hero-film { padding: 44px 0 64px; }
  .hero-film .grid { grid-template-columns: 1fr; gap: 30px; text-align: center; }
  .hero-film .subhead {
    margin: 14px auto 0;
    max-width: 40ch;
    font-size: 1.04rem;
  }
  .hero-film .btn-row { justify-content: center; margin-top: 24px; }
  /* the tile is the film CTA on mobile - drop the duplicate button */
  .hero-film .btn-row .btn.secondary { display: none; }
  .hero-film .fine { margin-top: 14px; }
  .film-tile { max-width: 400px; margin: 0 auto; }
  .film-modal .stage { border-radius: 18px; max-height: calc(100vh - 96px); }
  .film-modal .time { min-width: 68px; font-size: .68rem; }
  .film-modal .controls { gap: 9px; padding: 8px 11px; }
}

@media (max-width: 420px) {
  .hero-film .display { font-size: 2.05rem; }
  .hero-film .subhead { font-size: .99rem; }
  .film-tile { max-width: 330px; }
  .film-tile .label { padding: 13px 15px; gap: 12px; }
  .film-tile .play { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-film .ambient span { animation: none; }
  .film-tile .play::after { animation: none; }
  .film-tile, .film-modal, .film-modal .stage,
  .film-modal .controls, .film-modal .close { transition-duration: .01ms; }
}
