/* Carousel block (spec/04-design/carousel.md). Linked only by pages that have a carousel, after site.css.
   Without carousel.js it is a plain scrolling strip: slide 1 shown, every slide reachable by scrolling. */

.carousel { --ratio: 4 / 3; }

/* Same reading column as a photo; the same air around it (layout.md). */
.band > * + .carousel,
.band > .carousel + * { margin-top: clamp(2rem, 4vw, 2.75rem); }

/* ------------------------------------------------------------------ controls (shown once carousel.js is ready) */

.carousel__controls { display: none; }

.carousel.is-ready .carousel__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.carousel__toggle,
.carousel__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1.5px solid var(--brown);
  border-radius: 999px;
  background: transparent;
  color: var(--brown);
  font: 700 0.9375rem/1 var(--font);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.carousel__toggle { padding: 0 18px 0 14px; }

.carousel__toggle:hover,
.carousel__btn:hover {
  background: var(--brown);
  color: var(--paper);
}

.carousel__icon { flex: none; }

/* One icon per state: Pause while it rotates, Play once stopped (the label swaps with it). */
.carousel__icon--play { display: none; }
.carousel.is-paused .carousel__icon--play { display: block; }
.carousel.is-paused .carousel__icon--pause { display: none; }

.carousel__count {
  margin-left: auto;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* ------------------------------------------------------------------ strip */

.carousel__viewport { border-radius: var(--radius); }

@media (prefers-reduced-motion: no-preference) {
  .carousel__viewport { transition: opacity 0.16s ease; }
  .carousel__viewport.is-fading { opacity: 0; }
}

/* A scroll-snap strip: swipe, drag and trackpad work natively; without JS the (thin) scrollbar and the tab stop
   are the way to the other slides. One fixed frame ratio for every slide (--ratio, set by the engine). */
.carousel__track {
  position: relative;
  display: flex;
  aspect-ratio: var(--ratio);
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: var(--radius);
  background: var(--card-bg);
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--taupe) transparent;
}

.carousel.is-ready .carousel__track { scrollbar-width: none; }
.carousel.is-ready .carousel__track::-webkit-scrollbar { display: none; }

.carousel__slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.carousel__img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* Never cropped (the architectural drawing): letterboxed on the card colour. */
.carousel__slide--contain .carousel__img { object-fit: contain; }

/* ------------------------------------------------------------------ print: every slide, one under the other */

@media print {
  .carousel__controls { display: none !important; }

  .carousel__track {
    display: block;
    aspect-ratio: auto;
    overflow: visible;
    background: none;
  }

  .carousel__slide { break-inside: avoid; }
  .carousel__slide + .carousel__slide { margin-top: 8pt; }

  .carousel__img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 7cm;
  }
}
