.image-gallery {
  padding: 72px var(--container-padding);
  font-family: var(--font-body);
}

.image-gallery__inner {
  width: min(100%, var(--container-max));
  margin: 0 auto;
}

.image-gallery__heading {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(2rem, 3vw, 2.5rem);
  color: var(--color-text-primary);
  margin: 0 0 12px;
  text-align: center;
}

.image-gallery__description {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin: 0 0 32px;
  text-align: center;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Grid layout ── */

.image-gallery__grid {
  display: grid;
  gap: 16px;
}

.image-gallery__grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.image-gallery__grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.image-gallery__grid--cols-4 { grid-template-columns: repeat(4, 1fr); }

.image-gallery__item {
  margin: 0;
}

.image-gallery__image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  object-fit: cover;
}

/* ── Modern carousel layout ── */

.image-gallery__carousel {
  position: relative;
  padding: 0 60px;
}

.image-gallery__viewport {
  overflow: hidden;
  border-radius: 16px;
}

.image-gallery__strip {
  display: flex;
  align-items: center;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.image-gallery__card {
  flex: 0 0 60%;
  margin: 0 1%;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.5s ease,
              filter 0.5s ease;
  transform: scale(0.82);
  opacity: 0.4;
  filter: brightness(0.7);
  border-radius: 16px;
  overflow: hidden;
}

.image-gallery__card--active {
  transform: scale(1);
  opacity: 1;
  filter: brightness(1);
  z-index: 1;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.image-gallery__card .image-gallery__image {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 0;
  display: block;
}

.image-gallery__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  z-index: 3;
}

.image-gallery__arrow:hover {
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-50%) scale(1.08);
}

.image-gallery__arrow--prev { left: 0; }
.image-gallery__arrow--next { right: 0; }

.image-gallery__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 20px 0 4px;
}

.image-gallery__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: var(--color-border-subtle);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, transform 0.2s ease, width 0.2s ease;
}

.image-gallery__dot--active {
  background: var(--color-brand-green);
  width: 24px;
  border-radius: 5px;
}

/* ── Dual scroll layout ── */

.image-gallery__scroll {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.image-gallery__scroll-row {
  overflow: hidden;
}

.image-gallery__scroll-track {
  display: flex;
  gap: 16px;
  width: max-content;
}

.image-gallery__scroll-row--left .image-gallery__scroll-track {
  animation: scrollRowLeft 25s linear infinite;
}

.image-gallery__scroll-row--right .image-gallery__scroll-track {
  animation: scrollRowRight 25s linear infinite;
}

@keyframes scrollRowLeft {
  0% { transform: translateX(0); }
  100% { transform: translateX(-33.33%); }
}

@keyframes scrollRowRight {
  0% { transform: translateX(-33.33%); }
  100% { transform: translateX(0); }
}

.image-gallery__scroll-item {
  flex-shrink: 0;
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
}

.image-gallery__scroll-item .image-gallery__image {
  height: 240px;
  width: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 0;
  display: block;
}

/* ── Grid responsive ── */

@media (max-width: 767px) {
  .image-gallery {
    padding: 56px var(--container-padding);
  }

  .image-gallery__grid--cols-3,
  .image-gallery__grid--cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .image-gallery__scroll-item .image-gallery__image {
    height: 200px;
  }

  .image-gallery__carousel {
    padding: 0 40px;
  }

  .image-gallery__card {
    flex: 0 0 70%;
    margin: 0 1%;
  }
}

@media (max-width: 479px) {
  .image-gallery__grid--cols-2,
  .image-gallery__grid--cols-3,
  .image-gallery__grid--cols-4 {
    grid-template-columns: 1fr;
  }

  .image-gallery__scroll-item .image-gallery__image {
    height: 160px;
  }

  .image-gallery__carousel {
    padding: 0 32px;
  }

  .image-gallery__card {
    flex: 0 0 80%;
  }

  .image-gallery__arrow {
    width: 36px;
    height: 36px;
  }

  .image-gallery__arrow--prev { left: 0; }
  .image-gallery__arrow--next { right: 0; }
}
