/* Structure only — brand colors (duration pill, text) live in the theme. */

/* heading row: the "View All" link sits inline after the heading, with the
   video layout wrapping to its own full-width line below */
main .section:has(.video-library) > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 16px;
}

main .section:has(.video-library) > div > h2 {
  margin: 0;
}

main .section:has(.video-library) > div > p {
  margin: 0;
}

main .section:has(.video-library) > div > p a:any-link {
  font-size: var(--body-font-size-m);
  font-weight: 700;
  text-decoration: underline;
}

main .section:has(.video-library) .video-library {
  flex-basis: 100%;
  margin-top: 16px;
}

.video-library .video-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* shared 16:9 media box with a centered play glyph and a duration pill */
.video-library .video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 4px;
  background: var(--light-color);
}

.video-library .video-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-library .video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  padding: 10px;
  border-radius: 50%;
  background: rgb(0 0 0 / 55%);
  fill: #fff;
}

.video-library .video-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgb(0 0 0 / 75%);
  color: #fff;
  font-size: var(--body-font-size-xs);
  font-weight: 700;
  line-height: 1.2;
}

/* "Now Playing" pill, centered on the active thumbnail (hidden otherwise) */
.video-library .video-now-playing {
  position: absolute;
  top: 50%;
  left: 50%;
  display: none;
  padding: 6px 14px;
  border-radius: 100vmax;
  background: #fff;
  color: #070a0d;
  font-size: var(--body-font-size-xs);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
}

/* active thumbnail: a light wash over the poster with the pill centered */
.video-library .video-item.now-playing .video-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgb(255 255 255 / 25%);
}

.video-library .video-item.now-playing .video-now-playing {
  display: block;
  z-index: 1;
}

/* ===== Featured player (plays inline) ===== */
.video-library .video-featured-media .video-player {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-library .video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.video-library .video-play-btn .video-play {
  position: static;
  width: 64px;
  height: 64px;
  transform: none;
}

/* once playing, hide the play button + duration overlay and letterbox the clip */
.video-library .video-featured-media.playing .video-play-btn,
.video-library .video-featured-media.playing .video-duration {
  display: none;
}

.video-library .video-featured-media.playing .video-player {
  object-fit: contain;
  background: #000;
}

/* ===== End-of-clip overlay: countdown to next + replay ===== */
.video-library .video-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: rgb(0 0 0 / 55%);
  color: #fff;
  text-align: center;
}

/* while a clip has ended, show the overlay and hide the poster play button */
.video-library .video-featured-media.ended .video-overlay {
  display: flex;
}

.video-library .video-featured-media.ended .video-play-btn,
.video-library .video-featured-media.ended .video-duration {
  display: none;
}

.video-library .video-next-label {
  margin: 0;
  font-size: var(--body-font-size-s);
}

.video-library .video-next-title {
  margin: 0;
  font-size: var(--heading-font-size-m);
  font-weight: 700;
  line-height: 1.3;
}

.video-library .video-replay {
  margin-top: 8px;
  padding: 8px 20px;
  border: 0;
  border-radius: 100vmax;
  background: #fff;
  color: #070a0d;
  font-size: var(--body-font-size-s);
  font-weight: 700;
  cursor: pointer;
}

.video-library .video-featured-meta {
  padding-top: 16px;
}

.video-library .video-title {
  margin: 0;
  font-size: var(--heading-font-size-l);
  font-weight: 700;
  line-height: 1.25;
}

/* only the featured title links to the detail page */
main .section:has(.video-library) .video-title a:any-link {
  color: inherit;
  text-decoration: none;
}

main .section:has(.video-library) .video-title a:hover {
  text-decoration: underline;
}

/* date: uppercase, letter-spaced, muted (matches the source caption style) */
main .section .video-library .video-date {
  display: block;
  margin-top: 10px;
  font-size: var(--body-font-size-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--video-date-color, var(--dark-color));
}

/* ===== Playlist rail =====
   Mobile: a horizontal row of poster-on-top cards. The native scrollbar is
   hidden and a custom always-visible scrollbar sits below the rail. */
.video-library .video-playlist-wrap {
  position: relative;
  min-width: 0; /* keep the scrolling rail from expanding the grid */
}

.video-library .video-playlist {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.video-library .video-playlist::-webkit-scrollbar {
  display: none;
}

.video-library .video-playlist > li {
  flex: 0 0 44%;
}

.video-library .video-item {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.video-library .video-item .video-play {
  width: 36px;
  height: 36px;
  padding: 7px;
}

/* the active item hides its play glyph + duration, showing the pill instead */
.video-library .video-item.now-playing .video-play,
.video-library .video-item.now-playing .video-duration {
  display: none;
}

.video-library .video-item-info {
  padding-top: 8px;
}

.video-library .video-item-title {
  display: block;
  font-size: var(--body-font-size-m);
  font-weight: 700;
  line-height: 1.3;
}

/* ===== Custom always-visible scrollbar ===== */
.video-library .video-scrollbar {
  position: absolute;
  right: 0;
  bottom: -14px;
  left: 0;
  height: 4px;
  border-radius: 100vmax;
  background: rgb(255 255 255 / 20%);
}

.video-library .video-scrollbar[hidden] {
  display: none;
}

.video-library .video-scrollbar-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 100%;
  border-radius: 100vmax;
  background: #fff;
  cursor: grab;
}

.video-library .video-scrollbar-thumb:active {
  cursor: grabbing;
}

/* ===== Desktop: featured left, vertical playlist right ===== */
@media (width >= 900px) {
  .video-library .video-layout {
    grid-template-columns: 2fr minmax(0, 1fr);
    align-items: start;
  }

  .video-library .video-playlist {
    flex-direction: column;
    gap: 20px;
    max-height: 620px;
    padding-right: 16px;
    overflow: hidden auto;
  }

  .video-library .video-playlist > li {
    flex: 0 0 auto;
  }

  /* compact horizontal cards in the vertical rail */
  .video-library .video-item {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 14px;
    align-items: start;
  }

  .video-library .video-item .video-thumb {
    margin: 0;
  }

  .video-library .video-item-info {
    padding-top: 0;
  }

  /* vertical scrollbar pinned to the right of the rail */
  .video-library .video-scrollbar {
    inset: 0 0 0 auto;
    width: 4px;
    height: auto;
  }

  .video-library .video-scrollbar-thumb {
    width: 100%;
    height: 40px;
  }
}
