/*
 * Gallery page (resources/views/pages/gallery.blade.php).
 * Builds on about.css: the hero, buttons, wrap and colour tokens come from there.
 */
.gallery-hero {
  padding-bottom: 6rem;
}

/* Bento grid: the first photo is large, the sixth is wide. */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 210px;
  gap: 12px;
}
.about .gallery-item:nth-child(1) {
  grid-column: span 2;
  grid-row: span 2;
}
.about .gallery-item:nth-child(6) {
  grid-column: span 2;
}
.gallery-open {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  cursor: zoom-in;
  background: #2c0000;
  box-shadow: 0 20px 34px -26px rgba(44, 0, 0, 0.6);
}
.gallery-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}
.gallery-open:hover img,
.gallery-open:focus-visible img {
  transform: scale(1.05);
}
.gallery-open:focus-visible {
  outline: 3px solid var(--ab-gold);
  outline-offset: 3px;
}
.gallery-cap {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  gap: 0.2rem;
  padding: 2.5rem 1rem 0.9rem;
  text-align: left;
  color: #ffffff;
  background: linear-gradient(180deg, transparent, rgba(30, 0, 0, 0.88));
}
.gallery-cap b {
  font-size: 1rem;
}
.gallery-cap span {
  font-size: 0.82rem;
  color: #f1dede;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.about .gallery-item:nth-child(1) .gallery-cap {
  padding: 3rem 1.4rem 1.2rem;
}
.about .gallery-item:nth-child(1) .gallery-cap b {
  font-size: 1.35rem;
}
.about .gallery-item:nth-child(1) .gallery-cap span {
  font-size: 0.95rem;
}

/* Full-screen viewer */
.gallery-viewer {
  margin: auto;
  width: min(1100px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #140406;
  color: #ffffff;
  overflow: hidden;
}
.gallery-viewer::backdrop {
  background: rgba(10, 2, 3, 0.85);
}
.gallery-viewer figure {
  margin: 0;
}
.gallery-viewer img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  background: #000000;
}
.gallery-viewer figcaption {
  display: grid;
  gap: 0.2rem;
  padding: 1rem 1.3rem 1.2rem;
}
.gallery-viewer figcaption b {
  font-size: 1.1rem;
}
.gallery-viewer figcaption span {
  color: #e8d3d6;
  font-size: 0.92rem;
}
.gallery-viewer .gallery-viewer__count {
  color: var(--ab-gold);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.gallery-viewer form {
  margin: 0;
}
.gallery-viewer__btn,
.gallery-viewer__close {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #2b1a1c;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.gallery-viewer__btn {
  top: calc((100vh - 170px) / 2 - 22px);
  top: min(calc((100vh - 170px) / 2 - 22px), 40%);
}
.gallery-viewer__prev { left: 14px; }
.gallery-viewer__next { right: 14px; }
.gallery-viewer__close {
  top: 14px;
  right: 14px;
  font-size: 1.4rem;
}
.gallery-viewer button:focus-visible {
  outline: 3px solid var(--ab-gold);
  outline-offset: 2px;
}

@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 200px;
  }
  .about .gallery-item:nth-child(6) {
    grid-column: span 2;
  }
}
@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: 220px;
  }
  .about .gallery-item:nth-child(1),
  .about .gallery-item:nth-child(6) {
    grid-column: auto;
    grid-row: auto;
  }
  .about .gallery-item:nth-child(1) .gallery-cap b {
    font-size: 1.1rem;
  }
  .gallery-viewer__btn {
    width: 38px;
    height: 38px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-open img {
    transition: none;
  }
  .gallery-open:hover img {
    transform: none;
  }
}
