/* Hero video cycle: video -> fade to black -> wordmark -> video */
/* Never show the old hero Audi while the video is loading. */
.hero-photo {
  background-color: #050505 !important;
  background-image: url('/media/hero-solid-ppf-poster.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.hero-photo > img:not(.hero-cycle-logo) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.hero-photo .hero-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 2;
  opacity: 1;
  transition: opacity .55s ease;
  animation: hero-zoom 12s ease-out forwards;
  background: #050505;
}

.hero-photo .hero-cycle-dark {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #050505;
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s ease;
}

.hero-photo.is-dark .hero-cycle-dark {
  opacity: 1;
}

/* End card sits ABOVE the whole hero, so mobile text can never remain over the logo. */
.hero .hero-end-card {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(28px, 7vw, 92px);
  background: #050505;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .7s ease, visibility 0s linear .7s;
}

.hero .hero-end-card.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity .7s ease, visibility 0s linear 0s;
}

.hero .hero-end-card img {
  width: min(82vw, 980px);
  height: auto;
  max-height: 62vh;
  object-fit: contain;
  filter: brightness(1.22) saturate(1.12) contrast(1.04);
  transform: scale(.965);
  transition: transform .7s ease;
  animation: none !important;
}

.hero .hero-end-card.is-visible img {
  transform: scale(1);
}

.hero .hero-content,
.hero .hero-mark,
.hero .scroll-note {
  transition: opacity .5s ease, visibility .5s ease;
}

/* Force all hero copy away during the outro, including on mobile Safari. */
.hero.hero-media-transition .hero-content,
.hero.hero-media-transition .hero-mark,
.hero.hero-media-transition .scroll-note {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Guard: the year badge is intentionally removed from the hero. */
.hero .since-badge { display: none !important; }

@media (max-width: 768px) {
  .hero-photo {
    background-image: url('/media/hero-solid-ppf-poster-mobile.jpg');
    background-position: center;
  }
  .hero-photo .hero-bg-video {
    object-position: 50% 50%;
    animation-duration: 10s;
  }

  /* Match the desktop outro on phones: the copy fades smoothly instead of
     disappearing abruptly because of Safari's discrete visibility handling. */
  .hero .hero-content,
  .hero .hero-mark,
  .hero .scroll-note {
    opacity: 1;
    visibility: visible !important;
    transition: opacity .5s ease !important;
    will-change: opacity;
  }

  .hero.hero-media-transition .hero-content,
  .hero.hero-media-transition .hero-mark,
  .hero.hero-media-transition .scroll-note {
    opacity: 0 !important;
    visibility: visible !important;
    pointer-events: none !important;
  }

  .hero .hero-end-card {
    padding: 24px 16px;
  }
  .hero .hero-end-card img {
    width: min(94vw, 720px);
    max-height: 52svh;
    filter: brightness(1.36) saturate(1.12) contrast(1.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-photo .hero-bg-video,
  .hero .hero-end-card img {
    animation: none !important;
    transition: none !important;
  }
}


/* Sound control for the hero video. */
.hero .hero-sound-toggle {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 45;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 999px;
  background: rgba(5,5,5,.56);
  color: #fff;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  padding: 0;
  opacity: .92;
  transition: transform .2s ease, background-color .2s ease, border-color .2s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.hero .hero-sound-toggle:hover {
  transform: scale(1.06);
  background: rgba(5,5,5,.76);
  border-color: rgba(146,255,0,.72);
}

.hero .hero-sound-toggle:active { transform: scale(.96); }
.hero .hero-sound-toggle:focus-visible {
  outline: 2px solid #92ff00;
  outline-offset: 3px;
}
.hero .hero-sound-toggle svg {
  width: 23px;
  height: 23px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero .hero-sound-toggle .icon-sound-off { display: none; }
.hero .hero-sound-toggle.is-muted .icon-sound-on { display: none; }
.hero .hero-sound-toggle.is-muted .icon-sound-off { display: block; }

@media (max-width: 768px) {
  .hero .hero-sound-toggle {
    width: 46px;
    height: 46px;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(5,5,5,.66);
  }
}
