.alt-video { background: var(--alt-vd-bg); }

/* Nothing attached yet: take up no room rather than leaving a gap. */
.alt-video:not(:has(.alt-video__item)) { padding-top: 0; padding-bottom: 0; }
.alt-video:not(:has(.alt-video__item)) .alt-video__header { display: none; }

.alt-video__header { margin-bottom: 34px; text-align: center; }
.alt-video__heading {
  margin: 0;
  color: var(--alt-vd-heading);
  font-family: var(--alt-font-heading);
  font-size: var(--alt-h2);
  font-weight: var(--alt-fw-heading);
  line-height: var(--alt-lh-h2);
}
.alt-video__sub { margin-top: 12px; }
.alt-video__empty { text-align: center; }

.alt-video__grid {
  display: grid;
  grid-template-columns: repeat(var(--alt-vd-cols-d), minmax(0, 1fr));
  gap: var(--alt-vd-gap);
}

.alt-video__frame {
  position: relative;
  aspect-ratio: var(--alt-vd-ratio);
  border-radius: var(--alt-vd-radius, var(--alt-radius-media));
  overflow: hidden;
}

/* The reference lays the quote and its stars over the foot of the video, on a
   scrim dark enough to keep white type legible over any frame. */
.alt-video__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 20px;
  color: #fff;
  text-align: center;
  background: linear-gradient(to top, rgba(18, 18, 18, calc(var(--alt-vd-scrim, 0.2) + 0.35)), rgba(18, 18, 18, 0) 55%);
  pointer-events: none;
}

.alt-video__quote {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.alt-video__stars { display: flex; align-items: center; justify-content: center; gap: 3px; }
.alt-video__stars svg { display: block; width: 16px; height: 16px; }
.alt-video__frame video,
.alt-video__frame iframe,
.alt-video__poster { width: 100%; height: 100%; object-fit: cover; border: 0; }

.alt-video__caption { margin-top: 12px; }
.alt-video__title {
  margin: 0 0 4px;
  color: var(--alt-vd-heading);
  font-family: var(--alt-font-heading);
  font-size: calc(var(--alt-body-size) * 1.0625);
  font-weight: var(--alt-fw-heading);
}
.alt-video__text { margin: 0; color: var(--alt-muted); font-size: calc(var(--alt-body-size) * 0.9375); }

@media (max-width: 1279px) {
  .alt-video__grid { grid-template-columns: repeat(var(--alt-vd-cols-t), minmax(0, 1fr)); }
  .alt-video__header { margin-bottom: 26px; }
}

@media (max-width: 767px) {
  .alt-video__grid { grid-template-columns: 1fr; }
  .alt-video__grid--scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin-inline: calc(var(--alt-gutter) * -1);
    padding-inline: var(--alt-gutter);
  }
  .alt-video__grid--scroll::-webkit-scrollbar { display: none; }
  .alt-video__grid--scroll > * { flex: 0 0 68%; scroll-snap-align: start; }
}

/* ===== carousel ===== */

.alt-video__carousel { position: relative; }

.alt-video__viewport { overflow: hidden; }

.alt-video .alt-video__grid {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--alt-vd-gap, 24px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-block: 4px;
}
.alt-video .alt-video__grid::-webkit-scrollbar { width: 0; height: 0; }

.alt-video .alt-video__item {
  flex: 0 0 calc((100% - (var(--alt-vd-cols-d, 3) - 1) * var(--alt-vd-gap, 24px)) / var(--alt-vd-cols-d, 3));
  max-width: none;
  scroll-snap-align: start;
}

/* ---------------------------------------------------------- arrows */
/* The reference puts them outside the row, vertically centred. */

.alt-video__controls {
  position: static;
  display: contents;
}

.alt-video__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  background: #ffffff;
  color: #282828;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.alt-video__arrow:hover {
  background: var(--alt-brand, #c0541b);
  border-color: var(--alt-brand, #c0541b);
  color: #ffffff;
}

.alt-video__arrow[data-alt-video-prev] { left: -22px; }
.alt-video__arrow[data-alt-video-next] { right: -22px; }

@media (max-width: 1439px) {
  .alt-video__arrow[data-alt-video-prev] { left: 8px; }
  .alt-video__arrow[data-alt-video-next] { right: 8px; }
}

@media (max-width: 1023px) {
  .alt-video .alt-video__item {
    flex: 0 0 calc((100% - (var(--alt-vd-cols-t, 2) - 1) * var(--alt-vd-gap, 24px)) / var(--alt-vd-cols-t, 2));
  }
}

@media (max-width: 640px) {
  .alt-video .alt-video__item { flex: 0 0 82%; }
  .alt-video__arrow { width: 38px; height: 38px; }
}
