/* Desktop uses an immersive hero; mobile preserves the complete trailer frame. */
body.has-home-film .site-header--glass {
  position: fixed;
  inset-inline: 0;
  margin: 0 auto;
}

body.has-home-film .page-main {
  padding-bottom: 0;
}

.home-hero-film {
  position: relative;
  height: 100vh;
  height: 100svh;
  background: #080a0d;
}

.home-hero-film__frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.home-hero-film__media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.home-hero-film__controls {
  position: absolute;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 1;
  display: flex;
  gap: 8px;
}

.home-hero-film__controls[hidden] {
  display: none;
}

.home-hero-film__control {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0;
  background: rgba(8, 10, 13, 0.42);
  color: #fff;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.home-hero-film__control:hover {
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(8, 10, 13, 0.7);
}

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

.home-hero-film__control svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-hero-film__control [hidden] {
  display: none;
}

@media (max-width: 1024px) {
  .home-hero-film {
    --home-film-top: var(--jd-page-header-height, 88px);
    --home-film-max-height: calc(100svh - var(--home-film-top) - 57px);
    height: auto;
    padding-top: var(--home-film-top);
  }

  .home-hero-film__frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: var(--home-film-max-height);
  }

  .home-hero-film__media {
    object-fit: contain;
  }

  .home-hero-film > .home-hero-film__controls {
    position: relative;
    inset: auto;
    justify-content: flex-end;
    padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #080a0d;
  }
}

@media (max-width: 640px) {
  .home-hero-film {
    --home-film-top: var(--jd-page-header-height, 76px);
  }
}

/* Keep the film still while the page moves across it. The scrolling hero clips
   the fixed frame, so it cannot cover later content or intercept its links. */
@supports (clip-path: inset(0)) {
  @media (prefers-reduced-motion: no-preference) {
    .home-hero-film {
      clip-path: inset(0);
    }

    .home-hero-film__frame {
      position: fixed;
      height: 100vh;
      height: 100svh;
    }
  }

  @media (max-width: 1024px) and (prefers-reduced-motion: no-preference) {
    /* Reserve the compact frame's space while the actual film stays fixed. */
    .home-hero-film::before {
      content: "";
      display: block;
      aspect-ratio: 16 / 9;
      max-height: var(--home-film-max-height);
    }

    .home-hero-film__frame {
      top: var(--home-film-top);
      bottom: auto;
      height: auto;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero-film__control {
    transition: none;
  }
}
