/* The launch film under the hero actions: a glass-framed video that starts once scrolled into view (hero-film.js). */
body.home-page .hero-film {
  --film-ink: #0a0a0a;
  --film-bezel: clamp(6px, 0.6vw, 10px);
  --film-radius: clamp(18px, 2vw, 30px);
  --film-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 2 * var(--ac-pad-x)));
  margin: clamp(44px, 5vw, 76px) auto auto;
  padding: var(--film-bezel);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--film-radius);
  background: rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 44px 100px -34px rgba(14, 38, 24, 0.6),
    0 18px 40px -20px rgba(0, 0, 0, 0.35);
  animation: hero-film-in 1.1s var(--film-ease) 0.5s both;
}

@keyframes hero-film-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.985);
  }
}

@media (max-width: 767px) {
  body.home-page .hero-film {
    width: calc(100% - 2 * var(--ac-pad-x));
    margin-top: 36px;
  }
}

.hero-film__stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--film-radius) - var(--film-bezel));
  background: #cfe2ee;
  isolation: isolate;
}

.hero-film__video,
.hero-film__poster,
.hero-film__poster img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The poster holds the frame until the film plays, and comes back when it ends. */
.hero-film__poster {
  z-index: 1;
  transition: opacity 0.6s var(--film-ease), visibility 0.6s;
}

.hero-film.is-started:not(.is-ended) .hero-film__poster {
  opacity: 0;
  visibility: hidden;
}

/* Before the first play the poster is the bare sky; after the film ends it is the final lockup. */
.hero-film__poster--end,
.hero-film.is-ended .hero-film__poster--start {
  opacity: 0;
  visibility: hidden;
}

.hero-film.is-ended .hero-film__poster--end {
  opacity: 1;
  visibility: visible;
}

/* ── Play button: centred on the poster before the film plays and after it ends ─
   Ported from Magic UI's Hero Video Dialog on 21st.dev: a frosted ring around a gradient disc,
   which grows on hover while the poster dims. Primary colour is Nudge blue. */
.hero-film {
  --film-primary: 42, 104, 204;
}

.hero-film__start {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.hero-film.is-started:not(.is-ended) .hero-film__start {
  display: none;
}

/* On the lockup the replay button sits below the tagline, where it does not cover the logo. */
.hero-film.is-ended .hero-film__start {
  align-items: end;
  padding-bottom: clamp(10px, 5%, 52px);
}

.hero-film__play {
  display: grid;
  place-items: center;
  width: clamp(64px, 9vw, 112px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(var(--film-primary), 0.1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transform: scale(0.9);
  transition: transform 0.2s ease-out;
}

.hero-film.is-ended .hero-film__play {
  width: clamp(44px, 5vw, 72px);
}

.hero-film__play-core {
  display: grid;
  place-items: center;
  width: 71.43%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(to bottom, rgba(var(--film-primary), 0.3), rgb(var(--film-primary)));
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-out;
}

.hero-film__play-core svg {
  width: 40%;
  height: 40%;
  fill: #fff;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.07)) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.06));
  transition: transform 0.2s ease-out;
}

.hero-film__poster img {
  transition: filter 0.2s ease-out;
}

@media (hover: hover) {
  .hero-film__start:hover .hero-film__play {
    transform: scale(1);
  }
  .hero-film__start:hover .hero-film__play-core {
    transform: scale(1.2);
  }
  .hero-film__start:hover .hero-film__play-core svg {
    transform: scale(1.05);
  }
  .hero-film__stage:has(.hero-film__start:hover) .hero-film__poster img {
    filter: brightness(0.8);
  }
}

.hero-film__start:focus-visible {
  outline: none;
}

.hero-film__start:focus-visible .hero-film__play {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

/* ── Pause and sound, in the corner while the film plays ─ */
.hero-film__buttons {
  position: absolute;
  right: clamp(10px, 1.4vw, 18px);
  bottom: clamp(10px, 1.4vw, 18px);
  z-index: 4;
  display: flex;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity 0.4s var(--film-ease),
    transform 0.4s var(--film-ease),
    visibility 0.4s;
}

.hero-film.is-started:not(.is-ended) .hero-film__buttons {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.hero-film__btn {
  display: grid;
  place-items: center;
  width: clamp(38px, 3vw, 46px);
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(16, 18, 22, 0.45);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  box-shadow: 0 10px 26px -12px rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s var(--film-ease);
}

.hero-film__btn svg {
  width: 44%;
  height: 44%;
  fill: currentColor;
}

/* One button, two icons: the state class on the player picks which shows. */
.hero-film__btn .icon-play,
.hero-film.is-paused .hero-film__btn .icon-pause,
.hero-film__btn .icon-sound,
.hero-film.has-sound .hero-film__btn .icon-muted {
  display: none;
}

.hero-film.is-paused .hero-film__btn .icon-play,
.hero-film.has-sound .hero-film__btn .icon-sound {
  display: block;
}

.hero-film__btn .icon-play {
  margin-left: 6%;
}

.hero-film__btn:hover {
  background: rgba(16, 18, 22, 0.62);
}

.hero-film__btn:active {
  transform: scale(0.92);
}

.hero-film__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  body.home-page .hero-film {
    animation: none;
  }
  .hero-film__poster,
  .hero-film__play,
  .hero-film__play-core,
  .hero-film__play-core svg,
  .hero-film__poster img,
  .hero-film__buttons {
    transition: none;
  }
}
