/* cs-video-gallery — category band of click-to-play video cards.
   One instance per topic category; heading names the category.
   All rem values follow BB Theme's html { font-size: 10px } base. */

/* Strip BB's default row chrome — both axes, so __inner's own gutter is the
   single source of the side edge (84px at 1440, 24px on mobile, matching the
   site standard; BB's 20px row padding + 20px module margin had inset this
   module to 124/44). */
.fl-row-content-wrap:has(.cs-video-gallery) {
  padding-block: 0;
  padding-inline: 0;
}
.fl-module-content:has(.cs-video-gallery) {
  margin-block: 0;
  margin-inline: 0;
}

.cs-video-gallery {
  position: relative;
  padding-block: var(--cs-space-2xl);
  font-family: var(--cs-font-body);
  color: var(--cs-ink);
}

.cs-video-gallery__inner {
  max-width: var(--cs-container);
  margin: 0 auto;
  padding-inline: var(--cs-gutter);
  position: relative;
  z-index: 1;
}

/* ---------- Header ---------- */
/* Doubled classes + font-style so BB Global h2 rules lose. */
.cs-video-gallery .cs-video-gallery__heading {
  margin: 0 0 var(--cs-space-md);
  font-family: var(--cs-font-display);
  font-size: clamp(3.2rem, 2.5vw + 1rem, 4rem); /* 32px → 40px */
  font-style: normal;
  font-weight: 800;
  line-height: 1.212;
  letter-spacing: var(--cs-tracking-tight);
  color: var(--cs-ink);
  text-wrap: balance;
}

/* Explicit span color — BB Global Styles' `h2 span` rule recolors bare spans. */
.cs-video-gallery .cs-video-gallery__heading .cs-video-gallery__heading-accent {
  color: var(--cs-blue);
}

.cs-video-gallery__subtitle {
  margin: 0 0 var(--cs-space-lg);
  max-width: 72rem;
  font-size: 1.8rem;
  line-height: 1.6;
  color: var(--cs-ink-soft);
}

/* Heading with no subtitle still needs breathing room above the grid. */
.cs-video-gallery .cs-video-gallery__heading:has(+ .cs-video-gallery__grid) {
  margin-bottom: var(--cs-space-lg);
}

/* ---------- Grid ---------- */
.cs-video-gallery__grid {
  display: grid;
  gap: 4rem 3.2rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cs-video-gallery--cols-2 .cs-video-gallery__grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ---------- Card ---------- */
.cs-video-gallery__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 1rem;
  overflow: hidden;
  background: #383840;
}

.cs-video-gallery__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Facade — real button, whole thumbnail clickable. */
.cs-video-gallery__facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.cs-video-gallery__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* hqdefault.jpg is 4:3 with letterbox bars — cover crops them out. */
  object-fit: cover;
  transition: transform 0.3s ease;
}

.cs-video-gallery__facade:hover .cs-video-gallery__thumb,
.cs-video-gallery__facade:focus-visible .cs-video-gallery__thumb {
  transform: scale(1.04);
}

.cs-video-gallery__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background: rgba(26, 32, 44, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--cs-white);
  font-size: 2rem;
  padding-left: 0.4rem;
  transition: background 0.2s ease;
}

.cs-video-gallery__facade:hover .cs-video-gallery__play,
.cs-video-gallery__facade:focus-visible .cs-video-gallery__play {
  background: var(--cs-orange);
  border-color: var(--cs-orange);
}

.cs-video-gallery__facade:focus-visible {
  outline: 3px solid var(--cs-blue);
  outline-offset: 3px;
}

/* Once playing, the injected iframe replaces the facade. */
.cs-video-gallery__item--playing .cs-video-gallery__facade {
  display: none;
}

/* ---------- Card text ---------- */
/* Doubled classes so BB Global h3/span rules lose (Customizer leaks #683326). */
.cs-video-gallery .cs-video-gallery__title {
  margin: 1.6rem 0 0;
  font-family: var(--cs-font-body);
  font-size: 1.8rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.4;
  color: var(--cs-ink);
}

.cs-video-gallery__description {
  margin: 0.6rem 0 0;
  font-size: 1.8rem;
  line-height: 1.6;
  color: var(--cs-ink-soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .cs-video-gallery__grid,
  .cs-video-gallery--cols-2 .cs-video-gallery__grid,
  .cs-video-gallery--cols-3 .cs-video-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  /* Mobile section rhythm: 52px per side so adjacent sections meet at
     104px (client 2026-09-15). */
  .cs-video-gallery {
    padding-block: var(--cs-space-section-sm);
  }
  .cs-video-gallery__grid,
  .cs-video-gallery--cols-2 .cs-video-gallery__grid,
  .cs-video-gallery--cols-3 .cs-video-gallery__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Shorts variant (vertical 9:16 cards) ---------- */
/* Same specificity as the cols/responsive rules above — must stay below them. */
.cs-video-gallery--shorts .cs-video-gallery__grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3.2rem 2.4rem;
}

.cs-video-gallery--shorts .cs-video-gallery__frame {
  aspect-ratio: 9 / 16;
}

.cs-video-gallery--shorts .cs-video-gallery__play {
  width: 4.8rem;
  height: 4.8rem;
  font-size: 1.8rem;
}

.cs-video-gallery--shorts .cs-video-gallery__title {
  margin-top: 1.2rem;
  font-size: 1.8rem;
  font-weight: 600;
}

@media (max-width: 992px) {
  .cs-video-gallery--shorts .cs-video-gallery__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .cs-video-gallery--shorts .cs-video-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
