/*
 * Video fullscreen button (hyd-video-fullscreen.js). A small button in the corner of the player screen that
 * sends only the video stage to fullscreen; the player window and media session are untouched. This file styles
 * the button and the fullscreen stage itself: the screen fills the viewport on black, the video is contained
 * (never cropped), everything except the video, this button and the play button is hidden, and the existing
 * play button is reused so there is no second video element or native seek bar.
 */

/* A separate, video-only fullscreen control inside the picture. */
html[data-theme] #world #cinema #big-screen #video-fullscreen {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  inset: auto 8px 8px auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  margin: 0;
  padding: 7px;
  border: 1px solid #ffffff70;
  border-radius: 4px;
  background: #080b10b8;
  color: #fff;
  box-shadow: 0 1px 3px #0006;
  text-shadow: none;
  line-height: 0;
  z-index: 6;
  touch-action: manipulation;
  transform: none;
  translate: none;
  opacity: 1;
}

html[data-theme] #world #cinema #big-screen #video-fullscreen svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0;
  pointer-events: none;
}

html[data-theme] #world #cinema #big-screen #video-fullscreen:hover {
  background: #080b10ed;
}

html[data-theme] #world #cinema #big-screen #video-fullscreen:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Photos have no video to show, so the button is hidden in photo mode. */
html[data-theme] #world #cinema.photo-mode #big-screen #video-fullscreen {
  display: none;
}

/* Touch screens get a 44px target. */
@media (pointer: coarse) {
  html[data-theme] #world #cinema #big-screen #video-fullscreen {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
}

/* The fullscreen top layer ignores the surrounding draggable window's dimensions.
   Contain keeps the whole frame visible; unused space is deliberately black. */
html[data-theme] #world #cinema #big-screen:is(:fullscreen, :-webkit-full-screen) {
  position: fixed;
  inset: 0;
  display: block;
  /*
   * The !important declarations on the stage (width, height, background, transform) make the fullscreen stage
   * ignore the sizing the player window gives the screen (--media-width and --media-height in
   * hyd-player-layout.css) and any transform from other rules, so the frame always fills the viewport.
   */
  width: 100vw !important;
  height: 100vh !important;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  aspect-ratio: auto;
  background: #000 !important;
  transform: none !important;
  overflow: hidden;
  isolation: isolate;
}

html[data-theme] #world #cinema #big-screen:is(:fullscreen, :-webkit-full-screen)::backdrop {
  background: #000;
}

html[data-theme] #world #cinema #big-screen:is(:fullscreen, :-webkit-full-screen) #journey-video {
  position: absolute;
  inset: 0;
  /*
   * !important: the video fills the stage whatever size, fit or transform other rules give it; contain keeps
   * the whole frame visible.
   */
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  max-height: none;
  object-fit: contain !important;
  object-position: center;
  background: #000 !important;
  transform: none !important;
}

html[data-theme]
  #world
  #cinema
  #big-screen:is(:fullscreen, :-webkit-full-screen)
  > :not(#journey-video):not(#video-fullscreen):not(#play-preview) {
  /*
   * !important: hides every child of the screen except the video, the fullscreen button and the play button
   * (titles, shade, corner marks, date, disclaimer), even where their own rules set a display value.
   */
  display: none !important;
}

html[data-theme]
  #world
  #cinema
  #big-screen:is(:fullscreen, :-webkit-full-screen)
  #video-fullscreen {
  /* In fullscreen the button keeps clear of device safe areas such as notches and home bars. */
  right: max(12px,env(safe-area-inset-right));
  bottom: max(12px,env(safe-area-inset-bottom));
}

/* Reuse the existing play action: no second video element or native seek bar. */
html[data-theme] #world #cinema #big-screen:is(:fullscreen, :-webkit-full-screen) #play-preview {
  position: absolute;
  inset: auto auto max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid #ffffff70;
  border-radius: 4px;
  background: #080b10b8;
  color: #fff;
  box-shadow: none;
  transform: none;
  translate: none;
  scale: 1;
  opacity: 1;
  pointer-events: auto;
}
