/* Preview-only video category hierarchy pass.
   Closed shelves are substantial, image-first destinations; expanded shelf
   behavior remains the same. */

/* The intro already establishes the transition into the category list. Keep
   only the separators between categories, not an extra rule before the first
   shelf or after the last one. */
.rv-shelf:first-of-type {
  border-top: 0;
}

.rv-shelf:last-of-type {
  border-bottom: 0;
}

.rv-shelf-toggle {
  --rv-preview-gap: clamp(28px, 3.2vw, 48px);
  --rv-preview-cover-width: clamp(360px, 34vw, 520px);
  min-height: 244px;
  grid-template-columns: var(--rv-preview-cover-width) minmax(0, 1fr) auto !important;
  gap: var(--rv-preview-gap);
  /* Keep the media and + control inset before hover so the black hover field
     appears around them without causing any positional change. */
  padding: 28px 20px;
  transition:
    background 180ms ease,
    color 180ms ease,
    min-height 420ms cubic-bezier(.2, .72, .2, 1),
    grid-template-columns 520ms cubic-bezier(.2, .72, .2, 1);
}

.rv-shelf-index {
  display: none;
}

/* Transparent backing avoids the old gray antialiasing peeking through
   rounded image corners. */
.rv-shelf-cover {
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: transparent;
}

.rv-shelf-cover img {
  display: block;
  border-radius: inherit;
}

.rv-shelf-copy h2 {
  max-width: 720px;
  margin: 0 0 12px;
  font-size: clamp(36px, 3vw, 46px);
  line-height: .98;
}

.rv-shelf-copy p {
  max-width: 620px;
  font-size: 16px;
  line-height: 1.5;
}

.rv-shelf-meta {
  min-width: 110px;
  gap: 16px;
}

.rv-shelf-icon {
  width: 44px;
  height: 44px;
  font-size: 24px;
}

/* Match YouTube's friendly thumbnail treatment throughout the expanded video
   grids. Use a transparent backing so the rounded corners reveal the actual
   page/stage color rather than a gray placeholder. */
.rv-video-thumb {
  overflow: hidden;
  border-radius: 12px;
  background: transparent;
}

.rv-video-thumb img {
  display: block;
  border-radius: inherit;
}

/* Portrait work is genuinely vertical: three equal cards across, true 9:16
   thumbnails, and no artificial inset or reduced card width at either edge. */
#short-form .rv-video-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 12px;
}

#short-form .rv-video-card--portrait {
  width: 100%;
  max-width: none;
}

#short-form .rv-video-card--portrait .rv-video-thumb {
  aspect-ratio: 9 / 16;
}

#short-form:has(> .rv-shelf-toggle[aria-expanded="true"]) .rv-video-grid {
  padding-left: 0;
  padding-right: 0;
}

/* Once open, collapse the category art and return the heading to a compact
   black stage so the videos—not an oversized category card—remain primary. */
.rv-shelf-toggle[aria-expanded="true"] {
  min-height: 150px;
  grid-template-columns: 0 minmax(0, 1fr) auto !important;
}

.rv-shelf-toggle[aria-expanded="true"] .rv-shelf-cover {
  width: 0 !important;
}

.rv-shelf-toggle[aria-expanded="true"] .rv-shelf-copy {
  margin-left: calc(-1 * var(--rv-preview-gap)) !important;
}

/* Keep category art substantial through the awkward tablet/narrow-desktop
   range instead of letting it collapse back into a small navigation thumbnail. */
@media (max-width: 980px) and (min-width: 761px) {
  .rv-shelf-toggle {
    --rv-preview-gap: 18px;
    --rv-preview-cover-width: clamp(320px, 40vw, 380px);
    min-height: 214px;
    padding: 24px 18px;
  }

  .rv-shelf-copy h2 {
    font-size: clamp(34px, 4.5vw, 40px);
  }

  .rv-shelf-copy p {
    font-size: 15px;
  }

  .rv-shelf-toggle[aria-expanded="true"] {
    min-height: 136px;
  }
}

/* Keep the visual cue on phones. The category art remains full-width rather
   than disappearing and turning the page into a text accordion. */
@media (max-width: 760px) {
  .rv-shelf-toggle {
    --rv-preview-gap: 18px;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "cover cover"
      "copy meta";
    gap: 18px 16px;
    padding: 20px 12px 24px;
  }

  .rv-shelf-cover {
    grid-area: cover;
    display: block !important;
    width: 100% !important;
    aspect-ratio: 16 / 9;
    opacity: 1;
    transform: none;
  }

  .rv-shelf-copy {
    grid-area: copy;
    margin: 0 !important;
  }

  .rv-shelf-meta {
    grid-area: meta;
    align-self: start;
    min-width: auto;
    margin-top: 2px;
  }

  .rv-shelf-copy h2 {
    margin-bottom: 8px;
    font-size: clamp(30px, 8vw, 38px);
    line-height: 1;
  }

  .rv-shelf-copy p {
    font-size: 14px;
    line-height: 1.45;
  }

  .rv-shelf-icon {
    width: 42px;
    height: 42px;
  }

  .rv-shelf-toggle[aria-expanded="true"] {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas: "copy meta";
    padding-top: 22px;
    padding-bottom: 20px;
  }

  .rv-shelf-toggle[aria-expanded="true"] .rv-shelf-cover {
    display: none !important;
    width: 0 !important;
  }

  .rv-shelf-toggle[aria-expanded="true"] .rv-shelf-copy {
    margin-left: 0 !important;
  }

  #short-form .rv-video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 8px;
  }

  #short-form .rv-video-copy {
    padding-left: 0;
    padding-right: 0;
  }

  #short-form .rv-video-title {
    font-size: clamp(12px, 3.2vw, 16px);
    line-height: 1.18;
  }

  #short-form .rv-video-kicker {
    font-size: 9px;
  }
}

@media (max-width: 500px) {
  /* Base video CSS reduces portrait cards on phones; undo that for the
     deliberate three-across short-form layout. */
  #short-form .rv-video-card--portrait {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-shelf-toggle {
    transition: none !important;
  }
}
