/* Video Slider — hero video player + horizontally scrolling episode rail.
   Mobile-first. Four Figma frames map to: base (375) → 768 → 1280 (1440 frame)
   → 1920 (2500 frame). `--edge` drives both the content container and the rail
   viewport so the hero, the meta block and the cards share one left edge —
   same mechanism as people-slider.
   Values are token-sourced. The only literals are the ones the spec explicitly
   declined to tokenise: chip/badge text (10/11/12px), chip radii (3/4px),
   line-heights and letter-spacings.
*/

.video-slider {
  --edge: 16px;
  background-color: var(--color-white);
  color: var(--color-text-base);
  padding-block: 40px;
}

.video-slider__container {
  padding-inline: var(--edge);
}

/* The hero play button, duration chip and description are always present in
   the markup and are shown/hidden with the `hidden` attribute as module.js
   swaps episodes. Any author `display` rule outranks the UA stylesheet's
   `[hidden] { display: none }` — .video-slider__play sets `inline-flex`, so
   without this the attribute would be silently inert. */
.video-slider [hidden] {
  display: none !important;
}

/* ---- Hero ----
   Fixed 16:9 box with no height anywhere: the poster→iframe swap happens
   inside it, so CLS stays 0. Mobile carries the 8/16 hero container pad as
   margin (padding would sit inside the aspect box). */
.video-slider__hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-media-lg, 12px);
  background-color: var(--color-gray-lite);
  margin-block: 8px 16px;
}

.video-slider__hero-placeholder,
.video-slider__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.video-slider__hero-placeholder {
  background-color: var(--color-gray-lite);
  display: none;
}

.video-slider__poster {
  object-fit: cover;
  transition: opacity var(--duration-base) ease-out;
}

/* No usable poster → flat gray block from the design. */
.video-slider__hero--no-poster .video-slider__hero-placeholder { display: block; }
.video-slider__hero--no-poster .video-slider__poster { display: none; }

/* Injected by module.js on play — same box, so nothing moves. */
.video-slider__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-slider__hero.is-embedded .video-slider__poster,
.video-slider__hero.is-embedded .video-slider__hero-placeholder,
.video-slider__hero.is-embedded .video-slider__play,
.video-slider__hero.is-embedded .video-slider__hero-chip {
  display: none;
}

/* ---- Play control ----
   One treatment scaled across three sizes — glass at every breakpoint. Figma
   nodes: mobile 1089:2522 (54px circle / 18px glyph / blur 6),
   tablet 1069:2450 (64 / 24 / 8.59), desktop 1100:2786 (120 / 45 / 16).
   The 1440 instance hides its play control, so desktop values come from the
   component and the 2500 frame. */
.video-slider__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  /* ACCESSIBILITY SHORTFALL — WCAG 1.4.11 (3:1 non-text contrast). NOT met.
     Measured worst case across the full colour cube, white glyph:
       rgba(255,255,255,0.30)  1.03:1   <- the Figma spec itself
       rgba(144,144,144,0.48)  1.71:1   <- current, requested 2026-08-12
       rgba(18,18,18,0.48)     3.45:1   <- the only variant that passes
     144 cannot be tuned into compliance: reaching 3:1 needs alpha 0.96, at
     which point no blur is visible at all. The mid-grey is a deliberate step
     back toward the comp, accepting the shortfall. The drop-shadow on the
     glyph below is the mitigation — it materially improves legibility on light
     frames without changing the treatment, but it does NOT make the measured
     ratio compliant. PENDING DESIGNER SIGN-OFF.
     The fill applies at all breakpoints; blur does NOT — Figma specifies
     6 / 8.59 / 16px for the 54 / 64 / 120px circles, so it scales with the
     control and the 768/1280 blocks override it. */
  background: rgba(144, 144, 144, 0.48);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--color-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Glyph sizes are 75% of Figma's container box (24 / 32 / 60), because the
   vector sits inset 12.5% top and bottom inside it. Our viewBox is the
   triangle's own bounds, so using the box values renders it a third too big. */
.video-slider__play svg {
  width: 18px;
  height: 18px;
  /* Optical centring — a play triangle with a flat left edge reads as
     left-shifted when geometrically centred. Figma offsets it +4.19px on a
     120px circle; 3.5% reproduces that at every size. */
  transform: translateX(3.5%);
  /* Legibility mitigation for the low-contrast fill above. Does not make the
     measured ratio compliant; it stops the white stroke disappearing entirely
     against a bright poster frame. */
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.video-slider__play:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* No @supports fallback for backdrop-filter. Blur averages the backdrop
   without changing its mean, so losing it changes the look but not the
   measured contrast — which the comment above already records as failing
   either way. */

/* ---- Duration chips ----
   Hero and card chips are the same treatment at two scales; only the offsets,
   padding, radius, opacity and text size differ per the spec's chip table. */
.video-slider__hero-chip,
.video-slider__card-chip {
  position: absolute;
  background-color: var(--color-black);
  color: var(--color-white);
  font-family: var(--font-body);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

.video-slider__hero-chip {
  right: 12px;
  bottom: 12px;
  padding: 3px 6px;
  border-radius: 4px;
  opacity: 0.85;
  font-size: 11px;
}

/* ---- Meta ---- */
.video-slider__meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-block: 0 24px;
}

.video-slider__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  line-height: 1.16;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-base);
}

.video-slider__description {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--font-size-base-alt);
  font-weight: var(--font-weight-regular);
  line-height: 1.48;
  letter-spacing: 0;
  color: var(--color-text-base);
}

/* aria-live announcement target. No sr-only utility exists in this theme, so
   the clip pattern is declared locally. */
.video-slider__status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Decorative divider — absent on mobile, where the rail gap replaces it. */
.video-slider__rule {
  display: none;
  height: 1px;
  background-color: var(--color-gray-lite);
}

/* ---- Rail header ---- */
.video-slider__rail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: 0 16px;
}

.video-slider__rail-label {
  /* Baseline-aligned with the arrows, matching the Figma rail header's
     `items-end`. The row is center-aligned for the wrapped case, so this is
     set on the label rather than on the container. */
  align-self: flex-end;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-gray);
}

/* ---- Nav arrows ----
   64px at every breakpoint and visible on mobile too — deliberate divergence
   from people-slider, per §Layout & spacing "Arrow size / Arrow gap". */
.video-slider__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-slider__nav {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-gray-lite);
  background: var(--color-white);
  color: var(--color-text-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--duration-base) var(--ease-smooth),
              border-color var(--duration-base) var(--ease-smooth),
              color var(--duration-base) var(--ease-smooth);
}

.video-slider__nav:hover:not(.swiper-button-disabled),
.video-slider__nav:focus-visible:not(.swiper-button-disabled) {
  border-color: transparent;
  background:
    linear-gradient(var(--color-white), var(--color-white)) padding-box,
    var(--gradient-blend-mark) border-box;
}

.video-slider__nav:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.video-slider__nav.swiper-button-disabled {
  color: var(--color-gray-lite);
  border-color: var(--color-gray-lite);
  cursor: not-allowed;
  opacity: 1;
}

/* Swiper `watchOverflow` puts `is-locked` on the root when the cards fit. */
.video-slider.is-locked .video-slider__controls {
  display: none;
}

/* ---- Rail viewport — bleeds to the right edge, left edge matches --edge ---- */
.video-slider__viewport {
  padding-inline: var(--edge);
  overflow: hidden;
}

.video-slider__swiper { overflow: visible; }

/* Card width lives on the slide root: Swiper's `slidesPerView: 'auto'` measures
   the slide, not the button. Inter-card spacing is Swiper's `spaceBetween`. */
.video-slider__slide {
  width: 280px;
  height: auto;
}

/* ---- Card (the button itself) ---- */
.video-slider__card {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.video-slider__card:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* Thumb. The inactive/selected border is an inset shadow rather than a real
   border so the 1px→2px change on select cannot shift layout. */
.video-slider__thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-card);
  background-color: var(--color-gray-lite);
}

/* Ring overlays — selected card, and the play control.
   Not `border`, `inset box-shadow` or `outline`: border shifts layout on a
   width change, an inset shadow paints below children (.thumb-img covers the
   whole box and buried it), and outline proved unreliable here. A positioned
   pseudo-element above every child cannot be buried by paint order, and
   `padding` + this mask is what allows a *gradient* ring at all — `border`
   cannot take one and `border-image` ignores border-radius. */
.video-slider__thumb::before,
.video-slider__play::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* Thickness is the padding. Inactive card = flat 1px grey. */
.video-slider__thumb::before {
  z-index: 3;
  padding: 1px;
  background: var(--color-gray-lite);
  transition: background var(--duration-base) ease-out;
}

.video-slider__card.is-selected .video-slider__thumb::before {
  padding: 2px;
  background: var(--gradient-blend-mark);
}

/* Same brand ramp on the play control, so it reads as part of the module. */
.video-slider__play::before {
  padding: 2px;
  background: var(--gradient-blend-mark);
}

.video-slider__thumb-img,
.video-slider__thumb-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.video-slider__thumb-img { object-fit: cover; }
.video-slider__thumb-placeholder { background-color: var(--color-gray-lite); }

/* Selected overlay — Figma alpha composite, no token equivalent. */
.video-slider__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity var(--duration-base) ease-out;
}


.video-slider__card.is-selected .video-slider__thumb::after { opacity: 1; }

/* ---- PLAYING badge — marks the *selected* card, from first render ---- */
.video-slider__badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  display: none;
  padding: 4px 8px;
  border-radius: 4px;
  background-color: var(--color-white);
  color: var(--color-black);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

.video-slider__card.is-selected .video-slider__badge { display: block; }

/* ---- Card duration chip ---- */
.video-slider__card-chip {
  right: 6px;
  bottom: 6px;
  z-index: 2;
  padding: 2px 4px;
  border-radius: 3px;
  opacity: 0.8;
  font-size: 10px;
}

/* ---- Card text ----
   Margins rather than flex `gap` so an absent short description leaves no
   residual space below the title. */
.video-slider__card-title {
  margin: 10px 0 0;
  font-family: var(--font-heading);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  line-height: 1.16;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-base);
}

.video-slider__card-desc {
  margin: 4px 0 0;
  font-family: var(--font-body);
  font-size: var(--font-size-base-alt);
  font-weight: var(--font-weight-regular);
  line-height: 1.48;
  letter-spacing: 0;
  color: var(--color-text-base);
}

/* Mobile only — the design's fixed 46/44px text rows, 2 lines + ellipsis. */
.video-slider__card-title,
.video-slider__card-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.video-slider__card-title { height: 46px; }
.video-slider__card-desc { height: 44px; }

.video-slider__empty {
  color: var(--color-text-muted);
  font-style: italic;
  padding: var(--space-12) 0;
  text-align: center;
}

/* =========================================================
   Tablet — Figma 768
   ========================================================= */
@media (min-width: 768px) {
  .video-slider {
    --edge: 48px;
    padding-block: 72px 80px;
  }

  .video-slider__hero {
    border-radius: var(--radius-media, 6px);
    margin-block: 0;
  }

  /* Size only. The tint and blur come from the base rule at every breakpoint —
     this block used to override them to a solid white circle, which put a white
     glyph on a white fill at 1:1 contrast and made the button invisible above
     768. Do not reintroduce a background here. */
  .video-slider__play {
    width: 64px;
    height: 64px;
    -webkit-backdrop-filter: blur(8.59px);
    backdrop-filter: blur(8.59px);
  }

  .video-slider__play svg {
    width: 24px;
    height: 24px;
  }

  .video-slider__hero-chip {
    right: 11px;
    bottom: 11px;
    border-radius: 3px;
    opacity: 0.78;
    font-size: 12px;
  }

  .video-slider__meta {
    gap: 10px;
    padding-block: 24px 40px;
  }

  .video-slider__title { font-size: var(--font-size-2xl-alt); }

  .video-slider__description {
    font-size: var(--font-size-base);
    line-height: 1.6;
    letter-spacing: 0.01em;
  }

  .video-slider__rule { display: block; }

  .video-slider__rail-header { padding: 26px 0 16px; }

  .video-slider__controls { gap: 12px; }

  .video-slider__slide { width: 552px; }

  .video-slider__thumb { border-radius: var(--radius-media, 6px); }

  .video-slider__badge {
    top: 10px;
    left: 10px;
  }

  .video-slider__card-chip {
    right: 7px;
    bottom: 7px;
    padding: 3px 6px;
    opacity: 0.78;
    font-size: 12px;
  }

  .video-slider__card-title {
    margin-top: 12px;
    font-size: var(--font-size-md-alt);
  }

  .video-slider__card-desc {
    margin-top: 7px;
    font-size: var(--font-size-base);
    line-height: 1.6;
    letter-spacing: 0.01em;
  }

  /* Clamps are a mobile-only device — release them from 768 up. */
  .video-slider__card-title,
  .video-slider__card-desc {
    display: block;
    height: auto;
    overflow: visible;
    -webkit-line-clamp: none;
  }
}

/* =========================================================
   Desktop — Figma 1440 (content caps at 1274px and centres)
   ========================================================= */
@media (min-width: 1280px) {
  .video-slider { --edge: max(83px, calc((100vw - 1274px) / 2)); }

  .video-slider__play {
    width: 120px;
    height: 120px;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }

  .video-slider__play svg {
    width: 45px;
    height: 45px;
  }

  .video-slider__title {
    font-size: var(--font-size-2xl);
    max-width: 1055px;
  }

  .video-slider__description {
    font-size: var(--font-size-lg);
    max-width: 1046px;
  }

  .video-slider__rail-label {
    font-size: var(--font-size-base);
    letter-spacing: 0.01em;
  }

  .video-slider__controls { gap: 24px; }

  .video-slider__card-title { font-size: var(--font-size-xl-alt); }

  .video-slider__card-desc { line-height: 1.4; }
}

/* =========================================================
   Xtra-wide — Figma 2500 (content caps at 1949px and centres).
   Everything not listed here is inherited from the 1280 block: hero, arrows,
   chips, badge, card width, thumb, radii and card text padding are identical.
   ========================================================= */
@media (min-width: 1920px) {
  .video-slider {
    --edge: max(274px, calc((100vw - 1949px) / 2));
    padding-block: 80px;
  }

  .video-slider__title {
    font-size: var(--font-size-3xl-alt);
    max-width: 1613px;
  }

  .video-slider__description {
    font-size: var(--font-size-md);
    line-height: 1.48;
    letter-spacing: 0;
    max-width: 1613px;
  }

  .video-slider__rail-header { padding: 32px 0; }

  /* Steps DOWN from desktop's 16px, matching tablet and mobile. Intentional. */
  .video-slider__rail-label {
    font-size: var(--font-size-sm);
    letter-spacing: 0;
  }

  .video-slider__card-title { font-size: var(--font-size-2xl); }

  .video-slider__card-desc {
    font-size: var(--font-size-lg);
    line-height: 1.4;
    letter-spacing: 0;
  }
}

/* =========================================================
   Reduced motion — kills every transition declared in this file. The rail's
   scroll-into-view is handled JS-side (slideTo speed 0).
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .video-slider__poster,
  .video-slider__nav,
  .video-slider__thumb,
  .video-slider__thumb::before,
  .video-slider__thumb::after {
    transition: none;
  }
}
