/**
 * @file
 * Video list + modal player.
 *
 * The same block renders in two very different places: a full-width band on the
 * home page, and a ~300px rail in sidebar_right on /topic, /popular and
 * /campaign. Viewport media queries cannot tell those apart -- they would turn
 * the sidebar rails into 4-up grids in a 300px column -- so the layout is
 * driven by container queries and follows whatever width the block is given.
 */

.rn-video-modal-grid {
  container-type: inline-size;
  container-name: rn-video-grid;
}

/* List ------------------------------------------------------------------ */

.rn-video-modal-grid__heading {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
}

.rn-video-modal-grid__items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1rem;
  /* Narrow containers (sidebar rails, mobile) stay one-up. */
  grid-template-columns: 1fr;
}

@container rn-video-grid (min-width: 620px) {
  .rn-video-modal-grid__items {
    grid-template-columns: repeat(2, 1fr);
  }
}

@container rn-video-grid (min-width: 1000px) {
  .rn-video-modal-grid__items {
    grid-template-columns: repeat(4, 1fr);
  }
}

/*
 * Fallback for browsers without container query support: auto-fit gets the
 * band to 4-up and keeps the sidebar at 1-up, at the cost of a ragged 3+1 at
 * some intermediate widths.
 */
@supports not (container-type: inline-size) {
  .rn-video-modal-grid__items {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

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

/* "View all" ------------------------------------------------------------ */

.rn-video-modal-grid__footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.rn-video-modal-grid__view-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: Poppins, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  color: #232323;
  text-decoration: none;
}

.rn-video-modal-grid__view-all span {
  transition: transform 150ms ease;
}

.rn-video-modal-grid__view-all:hover,
.rn-video-modal-grid__view-all:focus-visible {
  color: #d32f2f;
  text-decoration: underline;
}

.rn-video-modal-grid__view-all:hover span {
  transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
  .rn-video-modal-grid__view-all span {
    transition: none;
  }
}

/* Thumbnail: the shared video-thumbnail component; the tile is its host. */

/* Matches the previous .video-block .post-content .title treatment. */
.rn-video-modal-grid__title {
  display: block;
  margin-top: 0.625rem;
  font-family: Poppins, sans-serif;
  font-size: 16px;
  line-height: 20px;
  font-weight: 500;
  color: #232323;
}

/* Dialog ---------------------------------------------------------------- */

.rn-video-dialog {
  width: min(1100px, 92vw);
  max-width: none;
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: #14161a;
  color: #fff;
  overflow: hidden;
}

.rn-video-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.rn-video-dialog__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  max-height: 90vh;
}

.rn-video-dialog__main {
  min-width: 0;
  padding: 0 0 1rem;
}

.rn-video-dialog__stage {
  aspect-ratio: 16 / 9;
  background: #000;
  width: 100%;
}

.rn-video-dialog__stage iframe,
.rn-video-dialog__stage .plyr {
  width: 100%;
  height: 100%;
  border: 0;
}

.rn-video-dialog__title {
  margin: 0.75rem 1rem 0;
  font-size: 1.0625rem;
  line-height: 1.35;
  font-weight: 600;
}

.rn-video-dialog__close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.rn-video-dialog__close:hover,
.rn-video-dialog__close:focus-visible {
  background: #d32f2f;
}

/* Playlist -------------------------------------------------------------- */

.rn-video-dialog__playlist {
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  overflow-y: auto;
  max-height: 90vh;
}

.rn-video-dialog__playlist-heading {
  margin: 0;
  padding: 0.875rem 1rem;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.6);
}

.rn-video-dialog__playlist-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rn-video-dialog__playlist-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 1rem;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.3;
}

.rn-video-dialog__playlist-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.rn-video-dialog__playlist-item:hover,
.rn-video-dialog__playlist-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.rn-video-dialog__playlist-item.is-active {
  background: rgba(211, 47, 47, 0.22);
  font-weight: 600;
}

/* Stack the playlist under the player on narrow viewports. */
@media (max-width: 860px) {
  .rn-video-dialog__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .rn-video-dialog__playlist {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    max-height: 34vh;
  }
}
