/* =========================================================
   WEDDING PHOTO GALLERY

   Expected HTML structure:
   .photo-gallery__track
     .gallery-column.gallery-column--short-top
       .gallery-tile
       .gallery-tile
     .gallery-column.gallery-column--tall-top
       .gallery-tile
       .gallery-tile

   Desktop layout:
   - Four columns span the full page width.
   - Columns 1 and 3: short top / tall bottom.
   - Columns 2 and 4: tall top / short bottom.
   - Gallery section has zero top and bottom padding.
   ========================================================= */

.photo-gallery {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #2d4a3e, #21382f);
  border-top: 2px solid rgb(139 91 28);
  border-bottom: 2px solid rgb(139 91 28);
}

.photo-gallery__header {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  text-align: center;
}

.photo-gallery__kicker {
  margin-top: 0.25rem;
  margin-bottom: 0rem;
  color: var(--gold-light);
  font-family: var(--caps);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.photo-gallery__title {
  margin: 0;
  color: var(--ivory);
  font-family: var(--caps);
  font-size: 2.5rem;
  line-height: 1;
}

.photo-gallery__viewport {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Horizontal strip containing four alternating photo columns. */
.photo-gallery__track {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: none;
  height: 67vh;
  margin: 0;
  padding: 0;
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.photo-gallery__track::-webkit-scrollbar {
  display: none;
}

/*
 * Four columns fill the track exactly.
 * Three gaps at 2px each use 6px total.
 */
.gallery-column {
  display: grid;
  flex: 0 0 calc((100% - 6px) / 4);
  height: 100%;
  min-width: 0;
  gap: 2px;
  scroll-snap-align: start;
}

/* Columns 1 and 3: short photo above tall photo. */
.gallery-column--short-top {
  grid-template-rows: 2fr 3fr;
}

/* Columns 2 and 4: tall photo above short photo. */
.gallery-column--tall-top {
  grid-template-rows: 3fr 2fr;
}

.gallery-tile {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #071226;
  cursor: pointer;
}

.gallery-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.6s ease, filter 0.6s ease;
}

.gallery-tile::after {
  content: "View photo";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ivory);
  background: rgba(5, 13, 31, 0.38);
  font-family: var(--caps);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.gallery-tile:hover img,
.gallery-tile:focus-visible img {
  transform: scale(1.045);
  filter: saturate(0.82);
}

.gallery-tile:hover::after,
.gallery-tile:focus-visible::after {
  opacity: 1;
}

.gallery-tile:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: -4px;
}

/* Gallery scrolling arrows. */
.gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 52px;
  height: 70px;
  transform: translateY(-50%);
  border: 1px solid rgba(228, 201, 122, 0.75);
  color: var(--gold-light);
  background: rgba(5, 13, 31, 0.72);
  backdrop-filter: blur(6px);
  font-size: 1.8rem;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.gallery-arrow:hover:not(:disabled) {
  color: var(--midnight-deep);
  background: var(--gold-light);
}

.gallery-arrow:focus-visible {
  outline: 2px solid var(--ivory);
  outline-offset: 2px;
}

.gallery-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

.gallery-arrow--prev {
  left: 1rem;
}

.gallery-arrow--next {
  right: 1rem;
}

/* =========================================================
   LIGHTBOX
   ========================================================= */

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

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  place-items: center;
  background: rgba(5, 13, 31, 0.97);
  color: var(--ivory);
}

.lightbox-figure {
  grid-column: 2;
  max-width: 100%;
  margin: 0;
  text-align: center;
}

.lightbox-image {
  display: block;
  max-width: min(90vw, 1500px);
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-counter {
  margin-top: 0.75rem;
  color: var(--ivory-dim);
  font-family: var(--caps);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
}

.lightbox-control {
  position: absolute;
  z-index: 2;
  padding: 0;
  border: 0;
  color: var(--ivory);
  background: transparent;
  cursor: pointer;
}

.lightbox-control:hover,
.lightbox-control:focus-visible {
  color: var(--gold-light);
}

.lightbox-control:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 4px;
}

.lightbox-close {
  top: 1rem;
  right: 1.25rem;
  font-size: 2rem;
}

.lightbox-fullscreen {
  top: 1.2rem;
  left: 1.25rem;
  font-size: 1.8rem;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  padding: 2rem 1rem;
  transform: translateY(-50%);
  font-size: 2.4rem;
}

.lightbox-prev {
  left: 0.75rem;
}

.lightbox-next {
  right: 0.75rem;
}

body.gallery-open {
  overflow: hidden;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 700px) {
  .photo-gallery__track {
    height: 460px;
  }

  /* Mobile keeps horizontal scrolling instead of squeezing four columns. */
  .gallery-column {
    flex: 0 0 82vw;
  }

  .gallery-arrow {
    width: 42px;
    height: 58px;
  }

  .gallery-arrow--prev {
    left: 0.4rem;
  }

  .gallery-arrow--next {
    right: 0.4rem;
  }

  .gallery-lightbox {
    grid-template-columns: 45px minmax(0, 1fr) 45px;
  }

  .lightbox-image {
    max-width: 100%;
    max-height: 80vh;
  }

  .lightbox-prev,
  .lightbox-next {
    padding: 1rem 0.5rem;
    font-size: 1.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo-gallery__track {
    scroll-behavior: auto;
  }

  .gallery-tile img,
  .gallery-tile::after,
  .gallery-arrow {
    transition: none;
  }
}

@media (hover: none) {
  .gallery-tile::after {
    display: none;
  }

  .gallery-tile:hover img {
    transform: none;
    filter: none;
  }
}
