.product-detail__video .product-detail__video-trigger {
  align-items: center;
}

.product-detail__video .product-detail__video-content {
  padding-inline: 0;
}

.product-detail__video-content::after {
  height: 22px;
}

.product-detail__video-carousel {
  display: block;
}

.product-detail__video-controls {
  display: none;
  justify-content: flex-end;
  gap: 12px;
  margin: 0 0 14px;
}

.product-detail__video-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: rgb(var(--color-text));
  background: transparent;
  border: 1px solid rgb(var(--color-text));
  border-radius: 50%;
  cursor: pointer;
  transition: opacity 160ms ease, background-color 160ms ease;
}

.product-detail__video-carousel.has-controls .product-detail__video-controls {
  display: none;
}

.product-detail__video-arrow svg {
  width: 22px;
  height: 22px;
}

.product-detail__video-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.product-detail__video-arrow:not(:disabled):hover {
  background: rgba(var(--color-text), 0.06);
}

.product-detail__video-arrow:focus-visible,
.product-detail__video-track:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.product-detail__video-track {
  display: flex;
  gap: 12px;
  width: 100%;
  overflow: auto hidden;
  overscroll-behavior-inline: contain;
  scroll-behavior: smooth;
  scroll-snap-type: inline mandatory;
  scrollbar-width: none;
  cursor: grab;
  user-select: none;
  -webkit-overflow-scrolling: touch;
}

.product-detail__video-track.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.product-detail__video-track::-webkit-scrollbar {
  display: none;
}

.product-detail__video-card {
  position: relative;
  flex: 0 0 calc((100% - 48px) / 4.5);
  width: calc((100% - 48px) / 4.5);
  aspect-ratio: 9 / 14.5;
  overflow: hidden;
  color: #fff;
  background: rgba(var(--color-text), 0.08);
  border-radius: 6px;
  cursor: pointer;
  scroll-snap-align: start;
}

.product-detail__video-card::after {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.34) 100%);
}

.product-detail__video-card:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.product-detail__video-card iframe,
.product-detail__video-card video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  border: 0;
  object-fit: cover;
}

.product-detail__video-card video {
  pointer-events: none;
}

.product-detail__video-card iframe {
  pointer-events: none;
  object-fit: initial;
}

.product-detail__video-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 14px;
  color: currentColor;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  background: rgba(var(--color-text), 0.72);
}

.product-detail__video-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  transition: opacity 180ms ease;
}

.product-detail__video-modal.is-open {
  opacity: 1;
}

.product-detail__video-modal-dialog {
  position: relative;
  width: min(420px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
}

.product-detail__video-modal-frame {
  overflow: hidden;
  background: #000;
  border-radius: 2px;
}

.product-detail__video-modal-frame video,
.product-detail__video-modal-frame iframe {
  display: block;
  width: 100%;
  max-height: calc(100vh - 48px);
  aspect-ratio: 9 / 16;
  background: #000;
  border: 0;
}

.product-detail__video-modal-frame video {
  height: auto;
  object-fit: contain;
}

.product-detail__video-modal-close {
  position: absolute;
  top: -24px;
  right: -24px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  color: #fff;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  cursor: pointer;
}

.product-detail__video-modal-close svg {
  width: 22px;
  height: 22px;
}

.product-video-modal-open {
  overflow: hidden;
}

@media (max-width: 959px) {
  .product-detail__video-carousel.has-controls .product-detail__video-controls,
  .product-detail__video-controls {
    display: none;
  }

  .product-detail__video-track {
    gap: 10px;
    padding-inline-end: 16px;
  }

  .product-detail__video-card {
    flex-basis: calc((100% - 30px) / 3.2);
    width: calc((100% - 30px) / 3.2);
  }

  .product-detail__video-modal {
    padding: 18px;
  }

  .product-detail__video-modal-dialog {
    width: min(390px, calc(100vw - 36px));
  }

  .product-detail__video-modal-close {
    top: -18px;
    right: -10px;
  }
}
