/**
 * Gallery carousel.
 * Your images mix 2:1 and 3:2 ratios; all slides are cropped to one ratio
 * (object-fit: cover) so the height never jumps. Change --gc-ratio to suit.
 */
.gallery-carousel {
  --gc-ratio: 2 / 1;
  --gc-accent: #fff;
  --gc-btn-bg: rgba(0, 0, 0, 0.45);
  --gc-btn-bg-hover: rgba(0, 0, 0, 0.7);
  position: relative;
}

.gallery-carousel__viewport {
  position: relative; /* makes slide.offsetLeft relative to the viewport */
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.gallery-carousel__viewport::-webkit-scrollbar {
  display: none;
}
.gallery-carousel__viewport:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

.gallery-carousel__track {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery-carousel__slide {
  flex: 0 0 100%;
  aspect-ratio: var(--gc-ratio);
  scroll-snap-align: start;
}

/* Drupal's field wrappers need to pass the height through to the image. */
.gallery-carousel__slide :is(.views-field, .field-content) {
  height: 100%;
}
.gallery-carousel__slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- Controls (added by JS) ---- */
.gallery-carousel button {
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--gc-accent);
}
.gallery-carousel button:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}
.gallery-carousel svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gallery-carousel svg .fill {
  fill: currentColor;
  stroke: none;
}

.gallery-carousel__arrow {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gc-btn-bg);
  transition: background-color 0.2s;
}
.gallery-carousel__arrow:hover {
  background: var(--gc-btn-bg-hover);
}
.gallery-carousel__arrow--prev { left: 12px; }
.gallery-carousel__arrow--next { right: 12px; }

.gallery-carousel__footer {
  position: absolute;
  inset: auto 12px 12px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.gallery-carousel__footer > * {
  pointer-events: auto;
}

.gallery-carousel__dots {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--gc-btn-bg);
}
.gallery-carousel__dot {
  width: 24px;  /* 24px hit area… */
  height: 24px;
  background: transparent;
}
.gallery-carousel__dot::before { /* …10px visible dot */
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--gc-accent);
  box-sizing: border-box;
  transition: background-color 0.2s;
}
.gallery-carousel__dot[aria-current="true"]::before {
  background: var(--gc-accent);
}

.gallery-carousel__toggle {
  position: absolute;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gc-btn-bg);
}
.gallery-carousel__toggle svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 600px) {
  .gallery-carousel__arrow {
    width: 36px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-carousel * {
    transition: none !important;
  }
}
