/* Homepage film: as the visitor scrolls past the hero, a play button
   opens up into the full video frame. */

/* Scroll scene */
.film-reveal {
  --film-progress: 0;
  position: relative; height: 210vh; height: 210svh;
  color: #fff; background:
    radial-gradient(ellipse 60% 42% at 50% 55%, rgba(35, 199, 244, calc(.04 + var(--film-progress) * .08)), transparent 72%),
    #050a12;
}
.film-reveal-sticky {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(1rem, 2.6vh, 1.75rem); padding: 72px 16px 24px; box-sizing: border-box;
}

.film-frame {
  position: relative; flex: 0 0 auto;
  width: min(1200px, 100%, calc((100svh - 230px) * 16 / 9));
  aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: #0b1a27;
  box-shadow: 0 30px 80px #000a, 0 0 0 1px #9eeeff2e;
  /* Set by script: the clip starts as the button's own pill shape. */
  clip-path: var(--film-clip, none);
  will-change: clip-path;
}
.film-frame video { display: block; width: 100%; height: 100%; object-fit: cover; background: #0b1a27; }
/* Before the button has opened, the frame looks exactly like the button. */
.film-frame::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: #0a1c2b;
  opacity: clamp(0, calc(1.25 - var(--film-progress) * 2.2), 1);
}
.film-frame.is-playing { clip-path: none; transition: clip-path 600ms cubic-bezier(.16,1,.3,1); }
.film-frame.is-playing::before { opacity: 0; }

/* Once fully open, the cover drifts very slowly until the film starts. */
.film-frame.is-open:not(.is-playing) video { animation: film-drift 14s ease-in-out infinite alternate; }
@keyframes film-drift { from { transform: scale(1); } to { transform: scale(1.045) translateY(-0.6%); } }
.film-frame.is-open { box-shadow: 0 30px 80px #000a, 0 0 0 1px #9eeeff3d, 0 0 60px #23c7f414; transition: box-shadow 900ms ease; }

.film-play {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0; border: 0; cursor: pointer; font: inherit; color: #fff;
  background: radial-gradient(ellipse 55% 45% at 50% 60%, #050a1238, #050a1200 75%);
}
.film-play[hidden] { display: none; }
.film-play-pill {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; gap: .85rem;
  height: 60px; padding: 0 1.5rem 0 .5rem; box-sizing: border-box; border-radius: 999px;
  border: 1px solid transparent;
  background:
    linear-gradient(#0a1c2bc7, #0a1c2bc7) padding-box,
    linear-gradient(115deg, #8fe9ffaa, #ffffff1f 38%, #ffffff12 62%, #3d8bff88) border-box;
  -webkit-backdrop-filter: blur(12px) saturate(140%); backdrop-filter: blur(12px) saturate(140%);
  box-shadow: 0 12px 34px #0006;
  /* In a centered column, a top margin of 2x moves the pill's center by x. */
  margin-top: calc(var(--film-shift, 0px) * 2);
  transition: transform 320ms cubic-bezier(.2,.8,.2,1), box-shadow 320ms ease;
}
/* One soft light sweep when the frame finishes opening. */
.film-play-pill::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, #bff3ff2e 48%, transparent 66%);
  transform: translateX(-120%);
}
.film-frame.is-open .film-play-pill::after { animation: film-sheen 1400ms cubic-bezier(.4,0,.2,1) 250ms both; }
@keyframes film-sheen { to { transform: translateX(120%); } }

.film-play-icon {
  position: relative; display: grid; place-items: center; flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 50%; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ffffff1f, #ffffff05 70%);
  transition: background 260ms ease, color 260ms ease, transform 320ms cubic-bezier(.2,.8,.2,1);
}
/* A thin light ring that turns slowly around the play symbol. */
.film-play-icon::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, #9eeeff, #ffffff33 30%, #ffffff14 55%, #3d8bffaa 80%, #9eeeff);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1px));
  animation: film-ring-turn 7s linear infinite;
}
@keyframes film-ring-turn { to { transform: rotate(1turn); } }
.film-play-icon svg { position: relative; margin-left: 3px; transition: transform 320ms cubic-bezier(.2,.8,.2,1); }
.film-play-label {
  font: 500 .96rem var(--home-body); letter-spacing: .015em; white-space: nowrap;
  transition: transform 320ms cubic-bezier(.2,.8,.2,1), letter-spacing 320ms ease;
}

.film-play:hover .film-play-pill, .film-play:focus-visible .film-play-pill { transform: translateY(-2px) scale(1.03); box-shadow: 0 16px 40px #0007, 0 0 34px #41c8f72e; }
.film-play:hover .film-play-icon, .film-play:focus-visible .film-play-icon { background: #fff; color: #0b2234; transform: scale(1.06); }
.film-play:hover .film-play-icon svg, .film-play:focus-visible .film-play-icon svg { transform: translateX(1px); }
.film-play:hover .film-play-label, .film-play:focus-visible .film-play-label { transform: translateX(2px); }
.film-play:active .film-play-pill { transform: scale(.98); transition-duration: 120ms; }
.film-play:focus-visible { outline: none; }
.film-play:focus-visible .film-play-pill { outline: 2px solid #b4f1ff; outline-offset: 4px; }

@media (max-width: 600px) {
  .film-reveal { height: 170vh; height: 170svh; }
  .film-reveal-sticky { padding-inline: 12px; }
  .film-frame { width: 100%; border-radius: 12px; }
  .film-play-pill { height: 46px; gap: .6rem; padding: 0 1.05rem 0 .35rem; }
  .film-play-icon { width: 34px; height: 34px; }
  .film-play-icon svg { width: 15px; height: 17px; margin-left: 2px; }
  .film-play-label { font-size: .86rem; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .film-reveal-sticky { padding-top: 60px; gap: .5rem; }
    .film-frame { width: min(100%, calc((100svh - 130px) * 16 / 9)); }
}
@media (prefers-reduced-motion: reduce) {
  .film-reveal { --film-progress: 1 !important; height: auto; }
  .film-reveal-sticky { position: static; height: auto; min-height: 0; padding-block: 4.5rem; }
  .film-frame { clip-path: none !important; }
  .film-frame video, .film-play-pill::after, .film-play-icon::before { animation: none !important; }
  .film-play-pill, .film-play-icon, .film-play-icon svg, .film-play-label { transition: none; }
}
