/*
 * Xbox WebView2 renders the <video> element via the OS MediaFoundation
 * compositor, which on this platform does not upscale an intrinsic-smaller
 * frame to the CSS box size (it effectively treats object-fit: contain like
 * scale-down). The Media Engine intentionally starts playback at a
 * low-resolution representation on Xbox for fast startup, which makes this
 * visible as a "video starts small, grows to full over a few seconds" scale
 * animation.
 *
 * Adding transform: translateZ(0) on the <video> forces Chromium to composite
 * it itself (bypassing the OS overlay that ignores CSS sizing) so CSS layout
 * and object-fit are respected during ABR ramp-up. That transform creates a
 * new stacking context and would paint the video above the Lightning canvas
 * by default, so we pin both layers explicitly with z-index to keep the
 * canvas (player UI, hole-punch) on top.
 */
canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
}

video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  transform: translateZ(0);
  will-change: transform;
}

/* Position subtitles between the PSDK video element and the canvas */
body > #SubtitlesContainer {
  z-index: 2;
}

/*
 * Bootstrap splash elements sit above the Lightning canvas so they remain
 * visible until splashDismissal removes them when the app is ready. Without
 * this, the canvas (z-index: 3) obscures the splash video / static splash.
 * Only the container divs need positioning; #spinner has its own centering
 * (left/top/margin) and #splash-video inherits position from the global
 * video rule above — both just need the z-index bump.
 */
body > #splash-video-container,
body > #splash {
  position: absolute;
  inset: 0;
  z-index: 4;
}

body > #splash-video,
body > #spinner {
  z-index: 4;
}

/* Copyright text placeholder, Warner Bros. Discovery, Inc. */

/* Shared Spinner Animation Styles */

#spinner {
  width: 80px;
  height: 80px;
  position: absolute;
  left: 50%;
  top: 70%;
  margin-left: -40px;
  opacity: 1;
  background-image: url(spinner-80x80-row.53860d0bca85d9ca.sha.png);
  background-repeat: no-repeat; /* 15fps */
  animation: spinner 1.667s steps(25) infinite;
}

@keyframes spinner {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -2000px 0;
  }
}

@media (max-width: 1280px) {
  /* Fallback for older browsers */
  #spinner {
    width: 64px;
    height: 64px;
    margin-left: -32px;
    background-size: 1600px 64px;
  }

  @keyframes spinner {
    from {
      background-position: 0 0;
    }
    to {
      background-position: -1600px 0;
    }
  }
}

#spinner.hide {
  opacity: 0;
  transition: opacity 600ms ease-in-out;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background-color: #000000;
}

body > canvas {
  position: absolute;
}

body > input {
  position: absolute;
  left: -1000px;
}

#a11y-button {
  opacity: 0;
  position: absolute;
  top: -1px;
  left: -1px;
  height: 0;
  width: 0;
  margin: 0;
  padding: 0;
}

#webpack-dev-server-client-overlay {
  display: none;
}

#splash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 1;
}

/* hide background */
#splash.hide {
  opacity: 0;
  transition: opacity 600ms ease-in-out;
}

#splash-video-container {
  position: absolute;
}

