/* ========================================
   GALLERY PAGE LAYOUT
   ======================================== */

.gallery-page {
  min-height: 100svh;
  padding: 120px 24px 100px;
}

.gallery-container {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.gallery-header {
  position: relative;
  max-width: 620px;
  margin: 0 auto 64px;
  text-align: center;
}

.gallery-botanical {
  position: absolute;
  top: -60px;
  right: -40px;
  width: 130px;
  opacity: 0.4;
  transform: rotate(18deg);
}

.gallery-header .section-label {
  display: block;
}

.gallery-header h1 {
  margin: 0 0 18px;
}

.gallery-header p {
  margin: 0 auto;
  color: var(--ink);
  font-family: "Bodoni Moda", serif;
  font-size: 17px;
  line-height: 1.7;
  font-variation-settings: "opsz" 5;
}

/* ========================================
   STATE (loading / empty / error)
   ======================================== */

.gallery-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink);
  font-family: "Bodoni Moda", serif;
  font-size: 17px;
  line-height: 1.6;
  font-variation-settings: "opsz" 5;
}

.gallery-state:empty {
  display: none;
}

.gallery-state-label {
  display: block;
  margin-bottom: 14px;
  font-family: "Montserrat", sans-serif;
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.55;
}

.gallery-state p {
  margin: 0 auto;
  max-width: 380px;
}

.gallery-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 22px;
  border: 1px solid rgba(130, 22, 22, 0.2);
  border-top-color: var(--burgundy);
  border-radius: 50%;
  animation: gallery-spin 1s linear infinite;
}

@keyframes gallery-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   GRID
   ======================================== */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(14px, 2vw, 24px);
}

.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 4 / 5;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-item:hover img {
  transform: scale(1.04);
}

.gallery-item-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 16px 14px;
  background: linear-gradient(
    to top,
    rgba(76, 32, 32, 0.78),
    rgba(76, 32, 32, 0)
  );
  color: var(--cream);
  font-family: "Montserrat", sans-serif;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.gallery-item:hover .gallery-item-caption,
.gallery-item:focus-visible .gallery-item-caption {
  opacity: 1;
  transform: translateY(0);
}

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

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  background: rgba(76, 32, 32, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.gallery-lightbox-figure {
  margin: 0;
  max-width: min(900px, 90vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gallery-lightbox-figure img {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  width: auto;
  height: auto;
  border: 1px solid rgba(231, 212, 200, 0.3);
}

.gallery-lightbox-figure figcaption {
  margin-top: 18px;
  color: var(--cream);
  font-family: "Bodoni Moda", serif;
  font-size: 16px;
  font-variation-settings: "opsz" 5;
  text-align: center;
}

.gallery-lightbox-figure figcaption:empty {
  display: none;
}

.gallery-lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(231, 212, 200, 0.4);
  background: transparent;
  color: var(--cream);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.gallery-lightbox-close:hover {
  background: rgba(231, 212, 200, 0.15);
}

.gallery-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(231, 212, 200, 0.4);
  background: transparent;
  color: var(--cream);
  font-family: "Bodoni Moda", serif;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.gallery-lightbox-nav:hover {
  background: rgba(231, 212, 200, 0.15);
}

.gallery-lightbox-prev {
  left: 20px;
}

.gallery-lightbox-next {
  right: 20px;
}

/* ========================================
   MOBILE
   ======================================== */

@media (max-width: 760px) {
  .gallery-page {
    padding: 100px 16px 70px;
  }

  .gallery-header {
    margin-bottom: 44px;
  }

  .gallery-botanical {
    width: 90px;
    top: -46px;
    right: -10px;
    opacity: 0.3;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .gallery-item-caption {
    opacity: 1;
    transform: translateY(0);
    padding: 14px 10px 8px;
  }

  .gallery-lightbox {
    padding: 80px 16px 40px;
  }

  .gallery-lightbox-nav {
    width: 38px;
    height: 38px;
    font-size: 17px;
  }

  .gallery-lightbox-prev {
    left: 6px;
  }

  .gallery-lightbox-next {
    right: 6px;
  }

  .gallery-lightbox-close {
    top: 16px;
    right: 16px;
  }
}
