/* =========================================================================
   Reusable vertical video slider (see video_slider.php)
   -------------------------------------------------------------------------
   The active (centred) video is shown full size/opacity with a white frame and
   an overlaid control bar. The neighbouring videos peek above/below at reduced
   scale + opacity. The slider fills the height of its container and shows as
   many videos as fit (ideally three); the rest are cropped by the viewport.
   Mobile-first; tablet/desktop overrides at the end.
   ========================================================================= */

.video-slider {
  /* Tunables ------------------------------------------------------------- */
  --vs-width: 76vw;                 /* width of the video frames            */
  --vs-gap: 12px;                   /* layout gap between stacked slides     */
  --vs-inactive-scale: 0.88;
  --vs-inactive-opacity: 0.45;
  --vs-arrow-gap: 10vw;             /* how far the arrows sit to the right   */
  --vs-frame-bg: #0c0c14;

  position: relative;
  width: var(--vs-width);
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

/* ---- Viewport (clips the track to the visible window) -------------------- */
.video-slider .vs-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.video-slider .vs-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--vs-gap);
  will-change: transform;
  /* the translate transition is applied/cleared from JS so re-homing the
     ring can happen without animation */
}

/* ---- A single slide is just the (16:9) video frame ---------------------- */
.video-slider .vs-slide {
  position: relative;     /* anchors the overlaid control bar to the frame */
  width: 100%;
  flex: 0 0 auto;
  transform: scale(var(--vs-inactive-scale));
  opacity: var(--vs-inactive-opacity);
  transition: transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.9s ease;
  cursor: pointer;
}

.video-slider .vs-slide.is-active {
  transform: scale(1);
  opacity: 1;
  cursor: default;
}

/* ---- The video frame ---------------------------------------------------- */
.video-slider .vs-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--vs-frame-bg);
  overflow: hidden;
}

.video-slider .vs-video {
  width: 100%;
  height: 100%;
  object-fit: cover;          /* no letterbox / white bands */
  display: block;
  background: var(--vs-frame-bg);
}

/* White card framing + lift for the active video */
.video-slider .vs-slide.is-active .vs-frame {
  /* box-shadow: 0 0 0 6px #fff, 0 10px 26px rgba(0, 0, 0, 0.35); */
}

/* ---- Control bar: in normal flow, directly below the video frame --------- */
/* Reserved on every slide via `visibility` (not `display`) so all slides keep
   the same height and the slider geometry/transitions stay uniform; only the
   active slide actually reveals it. */
.video-slider .vs-controls {
  height: 24px;
  display: flex;
  visibility: hidden;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  box-sizing: border-box;
  background: rgba(217, 217, 217, 0.92);
  z-index: 3;
}

.video-slider .vs-slide.is-active .vs-controls {
  visibility: visible;
}

.video-slider .vs-btn {
  background: transparent;
  border: 0;
  color: #222;
  font-size: 12px;
  line-height: 1;
  width: 22px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}

.video-slider .vs-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.video-slider .vs-timeline {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 4px;
  background: #9a9a9a;
  flex: 1 1 auto;
  min-width: 30px;
  cursor: pointer;
}

.video-slider .vs-timeline::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #444;
  cursor: pointer;
}

.video-slider .vs-timeline::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #444;
  cursor: pointer;
}

/* ---- Up / down navigation arrows (tall triangles) ----------------------- */
.video-slider .vs-nav {
  position: absolute;
  right: calc(-1 * var(--vs-arrow-gap));
  width: 9vw;
  max-width: 54px;
  min-width: 30px;
  height: 16%;
  background: transparent;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
}

.video-slider .vs-nav--up { top: 5%; }
.video-slider .vs-nav--down { bottom: 5%; }

.video-slider .vs-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.video-slider .vs-arrow {
  width: 0;
  height: 0;
  border-style: solid;
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.25));
  transition: transform 0.15s ease;
}

/* Stretched vertically: base ~26px wide, ~40px tall */
.video-slider .vs-arrow--up {
  border-width: 0 13px 40px 13px;
  border-color: transparent transparent #9e1414 transparent;
}

.video-slider .vs-arrow--down {
  border-width: 40px 13px 0 13px;
  border-color: #9e1414 transparent transparent transparent;
}

.video-slider .vs-nav:not(:disabled):hover .vs-arrow {
  transform: scaleX(1.12);
}

/* =========================================================================
   Tablet
   ========================================================================= */
@media (min-width: 600px) {
  .video-slider {
    --vs-width: min(60vw, 440px);
    --vs-arrow-gap: 72px;
  }

  .video-slider .vs-nav { width: 46px; }
  .video-slider .vs-arrow--up { border-width: 0 14px 46px 14px; }
  .video-slider .vs-arrow--down { border-width: 46px 14px 0 14px; }
}

/* =========================================================================
   Desktop
   ========================================================================= */
@media (min-width: 1024px) {
  .video-slider {
    --vs-width: 500px;
    --vs-arrow-gap: 88px;
  }

  .video-slider .vs-controls { height: 28px; }
  .video-slider .vs-btn { font-size: 14px; width: 26px; height: 24px; }
}

/* =========================================================================
   Expand (full-width) mode
   -------------------------------------------------------------------------
   The active video is lifted out to a fixed, centred overlay that spans the
   full width of the screen (capped so it never exceeds the viewport in either
   dimension). A backdrop sits behind it and swallows all interaction with the
   rest of the page until the video is un-expanded.
   ========================================================================= */
/* Full-screen overlay that also serves as the dim backdrop. It is appended to
   <body> (see video_slider.js) so it sits at the top of the root stacking
   context — above the `position: fixed` .bg-content and the header — and the
   very high z-index keeps it over everything else on the page. */
.vs-expand-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 2147483000;
}

body.vs-expand-lock {
  overflow: hidden;
}

/* The active slide is reparented into a `.video-slider.is-expanded` stage
   inside the overlay so the slider's own `.vs-*` rules keep applying. The stage
   fills the overlay; the slide + frame are sized/centred with absolute
   positioning so `flex-shrink` can't collapse the (rotated) frame. */
.vs-expand-overlay .video-slider {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  display: block;
}

.video-slider.is-expanded .vs-slide.is-active {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  transform: none;
  opacity: 1;
  cursor: default;
  transition: none;
}

/* Default (portrait clip): the video fills the screen upright, contained. */
.video-slider.is-expanded .vs-slide.is-active .vs-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  box-shadow: none;
  background: #000;
}

/* Landscape clip: rotate the frame 90deg so it shows large on a portrait
   screen; the control bar stays upright at the bottom. object-fit:contain keeps
   the whole frame inside the viewport (letterboxed if it isn't exactly 16:9). */
.video-slider.is-expanded.vs-landscape .vs-slide.is-active .vs-frame {
  width: 100vh;            /* after rotate(90deg): spans the viewport HEIGHT */
  height: 100vw;           /* after rotate(90deg): spans the viewport WIDTH  */
  transform: translate(-50%, -50%) rotate(90deg);
}

.video-slider.is-expanded .vs-slide.is-active .vs-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* In expand mode the controls overlay the full-screen video: translucent, and
   hidden until the screen is tapped (JS shows them for 3s, then they fade). */
.video-slider.is-expanded .vs-slide.is-active .vs-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  visibility: visible;
  z-index: 3;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 2s ease;
}

/* A screen tap fades the controls in over 0.5s; JS holds them 3s, then they
   fade out over 2s (base rule above). */
.video-slider.is-expanded.controls-shown .vs-slide.is-active .vs-controls {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.5s ease;
}

/* White controls so they read over the video. */
.video-slider.is-expanded .vs-slide.is-active .vs-btn {
  color: #fff;
}

/* Landscape: the video is rotated 90deg, so its bottom edge runs down the LEFT
   of the screen. Move the controls there and rotate them 90deg to match. */
.video-slider.is-expanded.vs-landscape .vs-slide.is-active .vs-controls {
  top: 0;
  bottom: auto;
  left: 0;
  right: auto;
  width: 100vh;        /* spans the screen height after rotation */
  height: 24px;        /* bar thickness */
  transform-origin: top left;
  transform: translateX(24px) rotate(90deg);
}

/* Top-right close (X) button. Rests at 10% opacity (90% transparent); a touch
   anywhere on the video snaps it to full opacity (.is-awake) and it then fades
   back out over 2s. It opens fully visible (JS wakes it on expand). */
.vs-expand-overlay .vs-expand-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  opacity: 0.1;
  transition: opacity 1s ease; /* JS holds it visible 2s, then this fades it */
}

.vs-expand-overlay .vs-expand-close.is-awake {
  opacity: 1;
  transition: opacity 0s;
}
