.photo-carousel {
  --max-photo-height: 510px;
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}

.compact-carousel { --max-photo-height: 415px; }

.carousel-track {
  position: relative;
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: #a5b4a8 var(--sand);
}

[data-carousel-ready] .carousel-track { scrollbar-width: none; }
.carousel-track:focus-visible { z-index: 1; }
.carousel-track:focus-visible { outline-offset: -4px; }
.carousel-slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; }

.carousel-photo, .carousel-controls {
  width: 100%;
  max-height: var(--max-photo-height);
  aspect-ratio: 3 / 2;
}

.carousel-photo {
  position: relative;
  overflow: hidden;
  background: var(--sand);
}

.carousel-photo[data-portrait]::before {
  position: absolute;
  inset: 0;
  background: var(--photo-background) center / cover no-repeat;
  filter: blur(22px) brightness(.76);
  transform: scale(1.17);
  content: "";
}

.carousel-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.carousel-slide figcaption {
  min-height: 51px;
  padding: 12px 17px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.carousel-controls {
  display: none;
  position: absolute;
  z-index: 1;
  inset: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  padding-inline: clamp(9px, 2vw, 16px);
  pointer-events: none;
}

[data-carousel-ready] .carousel-controls { display: flex; }

.carousel-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ffffff9c;
  border-radius: 50%;
  background: #142a21e8;
  color: #fffdf9;
  pointer-events: auto;
}

.carousel-button::after {
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: translateX(-2px) rotate(45deg);
  content: "";
}

.carousel-button[data-carousel-prev]::after { transform: translateX(2px) rotate(-135deg); }
.carousel-button:hover:enabled { background: var(--white); color: var(--ink); }
.carousel-button:focus-visible { outline-color: #fffdf9; outline-offset: 2px; box-shadow: 0 0 0 6px var(--ink); }
.carousel-button:disabled { background: #142a218c; color: #fffdf9c2; cursor: default; pointer-events: none; }

[data-carousel-count] {
  position: absolute;
  inset: auto auto 10px 50%;
  transform: translateX(-50%);
  padding: 2px 9px;
  border-radius: 999px;
  background: #142a21e8;
  color: #fffdf9;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.carousel-hint { margin-top: 9px; color: var(--muted); font-size: 12px; }

@media (max-width: 620px) {
  .carousel-slide figcaption { min-height: 56px; padding: 10px 13px; }
}
