/* Native scrolling keeps the gallery usable before JavaScript loads. */
#project {
  padding: clamp(56px, 7vw, 96px) 0;
  margin: clamp(48px, 6vw, 90px) 0;
}

#project .section-title { margin-bottom: 36px; }

.home-gallery {
  width: min(1440px, 100%);
  margin-inline: auto;
  padding-inline: clamp(16px, 3vw, 40px);
}

.gallery-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: #009cff #25313b;
  padding-block: 6px 16px;
}

.gallery-track .gallery-item {
  flex: 0 0 88%;
  aspect-ratio: auto;
  overflow: visible;
  scroll-snap-align: start;
  background: transparent;
}

.gallery-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px;
  background: #25313b;
}

.gallery-track .img-gal {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition: transform 350ms ease;
}

.gallery-track .gallery-photo:hover img,
.gallery-track .gallery-photo:focus-within img { transform: scale(1.06); }

.gallery-track .gallery-item a {
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 1;
  background: transparent;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 18px;
}

.gallery-track .gallery-item a:hover,
.gallery-track .gallery-item a:focus,
.gallery-track .gallery-item a:active { background: transparent; }

.gallery-track .gallery-item a i { font-size: 22px; filter: drop-shadow(0 1px 3px #000); }

.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 18px;
}

.gallery-controls[hidden] { display: none; }

.gallery-controls button {
  min-width: 46px;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 8px;
  background: rgba(0, 0, 0, .25);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.gallery-controls button:hover:not(:disabled) { background: #007ac7; }
.gallery-controls button:disabled { opacity: .4; cursor: default; }
.gallery-caption {
  display: block;
  padding-top: 8px;
  color: rgba(255, 255, 255, .8);
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.gallery-track:focus-visible,
.gallery-track a:focus-visible,
.gallery-controls button:focus-visible { outline: 3px solid #009cff; outline-offset: -3px; }

@media (min-width: 576px) {
  .gallery-track .gallery-item { flex-basis: calc((100% - 20px) / 2); }
}

@media (min-width: 1100px) {
  .gallery-track .gallery-item { flex-basis: calc((100% - 40px) / 3); }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-track .img-gal,
  .gallery-track .gallery-item a { transition: none; }
  .gallery-track .gallery-photo:hover img,
  .gallery-track .gallery-photo:focus-within img { transform: none; }
}
