.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-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-card:focus-visible,
.product-detail__video-modal-close:focus-visible,
.product-detail__video-fallback-link:focus-visible {
  outline: 3px solid rgb(var(--color-text));
  outline-offset: 3px;
}

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

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

.product-detail__video-card {
  position: relative;
  flex: 0 0 clamp(160px, calc((100% - 36px) / 4), 190px);
  width: clamp(160px, calc((100% - 36px) / 4), 190px);
  aspect-ratio: 9 / 14.5;
  padding: 0;
  overflow: hidden;
  color: #fff;
  font: inherit;
  text-align: inherit;
  appearance: none;
  background: rgba(var(--color-text), 0.09);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

.product-detail__video-carousel[data-video-layout="single"] .product-detail__video-card {
  flex-basis: clamp(220px, 42%, 260px);
  width: clamp(220px, 42%, 260px);
}

.product-detail__video-carousel[data-video-layout="pair"] .product-detail__video-card {
  flex-basis: clamp(190px, calc((100% - 12px) / 2), 240px);
  width: clamp(190px, calc((100% - 12px) / 2), 240px);
}

.product-detail__video-carousel[data-video-count="3"] .product-detail__video-card {
  flex-basis: clamp(170px, calc((100% - 24px) / 3), 200px);
  width: clamp(170px, calc((100% - 24px) / 3), 200px);
}

.product-detail__video-carousel[data-video-count="4"] .product-detail__video-card {
  flex-basis: clamp(155px, calc((100% - 36px) / 4), 180px);
  width: clamp(155px, calc((100% - 36px) / 4), 180px);
}

.product-detail__video-carousel[data-video-layout="many"] .product-detail__video-card {
  flex-basis: clamp(148px, 17vw, 176px);
  width: clamp(148px, 17vw, 176px);
}

.product-detail__video-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(var(--color-text), 0.16), rgba(var(--color-text), 0.52)),
    rgb(var(--color-text));
}

.product-detail__video-preview::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 45%, rgba(0, 0, 0, 0.42) 100%);
}

.product-detail__video-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail__video-provider {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  padding: 4px 7px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  background: rgba(0, 0, 0, 0.58);
  border-radius: 3px;
}

.product-detail__video-provider:empty {
  display: none;
}

.product-detail__video-play {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: #111;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.24);
  transition: background-color 140ms ease, transform 140ms ease;
}

.product-detail__video-play-icon {
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid currentColor;
}

.product-detail__video-card:hover .product-detail__video-play,
.product-detail__video-card:focus-visible .product-detail__video-play {
  background: #fff;
  transform: scale(1.04);
}

.product-detail__video-unavailable {
  position: relative;
  z-index: 1;
  max-width: calc(100% - 28px);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.product-detail__video-external-action {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 1;
  padding: 9px 10px;
  color: #111;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 4px;
}

.product-detail__video-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.58);
  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: 4px;
}

.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.44);
  border-radius: 50%;
  cursor: pointer;
}

.product-detail__video-modal-close:focus-visible,
.product-detail__video-fallback-link:focus-visible {
  outline-color: #fff;
}

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

.product-detail__video-modal-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(520px, calc(100vh - 48px));
  padding: 36px 24px;
  color: rgb(var(--color-text));
  text-align: center;
  background: rgb(var(--color-background, 255, 255, 255));
}

.product-detail__video-modal-fallback p {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 700;
}

.product-detail__video-fallback-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  background: rgb(var(--color-text));
  border-radius: 4px;
}

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

@media (min-width: 960px) {
  .product-detail__video-carousel.has-controls .product-detail__video-controls {
    display: flex;
  }
}

@media (min-width: 600px) and (max-width: 959px) {
  .product-detail__video-track {
    gap: 12px;
    padding-inline-end: 18px;
  }

  .product-detail__video-carousel[data-video-layout="single"] .product-detail__video-card {
    flex-basis: 260px;
    width: 260px;
  }

  .product-detail__video-carousel[data-video-layout="pair"] .product-detail__video-card {
    flex-basis: clamp(180px, calc((100% - 12px) / 2), 230px);
    width: clamp(180px, calc((100% - 12px) / 2), 230px);
  }

  .product-detail__video-carousel[data-video-layout="few"] .product-detail__video-card,
  .product-detail__video-carousel[data-video-layout="many"] .product-detail__video-card {
    flex-basis: clamp(150px, 25vw, 180px);
    width: clamp(150px, 25vw, 180px);
  }
}

@media (max-width: 599px) {
  .product-detail__video-track {
    gap: 10px;
    padding-inline-end: 16px;
  }

  .product-detail__video-carousel[data-video-layout="single"] .product-detail__video-card {
    flex-basis: clamp(220px, 70vw, 260px);
    width: clamp(220px, 70vw, 260px);
  }

  .product-detail__video-carousel[data-video-layout="pair"] .product-detail__video-card {
    flex-basis: clamp(145px, calc((100% - 10px) / 2), 165px);
    width: clamp(145px, calc((100% - 10px) / 2), 165px);
  }

  .product-detail__video-carousel[data-video-layout="few"] .product-detail__video-card,
  .product-detail__video-carousel[data-video-layout="many"] .product-detail__video-card {
    flex-basis: clamp(125px, 38vw, 145px);
    width: clamp(125px, 38vw, 145px);
  }

  .product-detail__video-play {
    width: 50px;
    height: 50px;
  }

  .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;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-detail__video-track {
    scroll-behavior: auto;
  }

  .product-detail__video-arrow,
  .product-detail__video-play,
  .product-detail__video-modal {
    transition: none;
  }

  .product-detail__video-card:hover .product-detail__video-play,
  .product-detail__video-card:focus-visible .product-detail__video-play {
    transform: none;
  }
}

