/* Photo Carousel (frontend) */
.tv3-photo-carousel {
  position: relative;
  --tv3-carousel-width: 670px;
  --tv3-carousel-height: 372px;
  width: min(100%, var(--tv3-carousel-width));
  margin: 24px auto;
}

.tv3-photo-carousel__viewport {
  overflow: hidden;
  border-radius: 2px;
  width: 100%;
  aspect-ratio: 670 / 372;
  height: auto;
}

.tv3-photo-carousel__slides {
  display: flex;
  transition: transform 300ms ease;
  will-change: transform;
  height: 100%;
}

.tv3-photo-carousel__slide {
  flex: 0 0 100%;
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wp--preset--color--contrast, #000);
}

.tv3-photo-carousel__img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center;
  cursor: zoom-in;
}

.tv3-photo-carousel__slide.is-portrait .tv3-photo-carousel__img {
  object-fit: contain;
}

.tv3-photo-carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.tv3-photo-carousel__nav--prev {
  left: 10px;
}

.tv3-photo-carousel__nav--next {
  right: 10px;
}

.tv3-photo-carousel__nav svg {
  width: 14px;
  height: 10px;
  display: block;
}

.tv3-photo-carousel__dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  z-index: 2;
  position: relative;
}

.tv3-photo-carousel__dot,
.tv3-photo-carousel__overlay-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 0;
}

.tv3-photo-carousel__dot.is-active,
.tv3-photo-carousel__overlay-dot.is-active {
  width: 8px;
  height: 8px;
  background: var(--wp--preset--color--white, #fff);
}

/* Hide controls when only one slide */
.tv3-photo-carousel[data-count="1"] .tv3-photo-carousel__nav,
.tv3-photo-carousel[data-count="1"] .tv3-photo-carousel__dots {
  display: none;
}

/* Overlay */
.tv3-photo-carousel__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.tv3-photo-carousel__overlay.is-open {
  display: flex;
}

.tv3-photo-carousel__overlay-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
}

.tv3-photo-carousel__overlay-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tv3-photo-carousel__overlay-prev {
  left: 16px;
}

.tv3-photo-carousel__overlay-next {
  right: 16px;
}

.tv3-photo-carousel__overlay-nav svg {
  width: 14px;
  height: 10px;
  display: block;
}

.tv3-photo-carousel__overlay-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tv3-photo-carousel__overlay-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

.tv3-photo-carousel__overlay-close::before,
.tv3-photo-carousel__overlay-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  background: #fff;
}

.tv3-photo-carousel__overlay-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.tv3-photo-carousel__overlay-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

html.tv3-photo-carousel--overlay-open,
body.tv3-photo-carousel--overlay-open {
  overflow: hidden;
  height: 100%;
}

body.tv3-photo-carousel--overlay-open {
  touch-action: none;
}
