/* Mobile carousel for format-page galleries — desktop grid unchanged */
.gallery-carousel {
  display: none;
  position: relative;
  --gallery-carousel-h: min(144vw, 640px);
}

.gallery-carousel__viewport {
  overflow: hidden;
  border-radius: 1.15rem;
  touch-action: pan-y;
  cursor: grab;
}

.gallery-carousel__viewport.is-dragging {
  cursor: grabbing;
}

.gallery-carousel__track {
  display: flex;
  will-change: transform;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-carousel__slide {
  flex: 0 0 100%;
  display: flex;
  gap: 0.55rem;
  height: var(--gallery-carousel-h);
  min-width: 0;
}

.gallery-carousel__slide--single img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1.15rem;
}

.gallery-carousel__slide--pair {
  flex-direction: column;
}

.gallery-carousel__slide--pair img {
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  object-fit: cover;
  border-radius: 0.85rem;
}

.gallery-carousel__btn {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--pine);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(31, 42, 36, 0.1);
  transform: translateY(-50%);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.gallery-carousel__btn:hover {
  background: #fff;
  box-shadow: 0 10px 28px rgba(31, 42, 36, 0.14);
}

.gallery-carousel__btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-carousel__btn--prev {
  left: 0.65rem;
}

.gallery-carousel__btn--next {
  right: 0.65rem;
}

@media (max-width: 820px) {
  .gallery-grid {
    display: none !important;
  }

  .gallery-carousel {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-carousel__track {
    transition: none;
  }
}
