/* =========================
   Gallery Styles (MOBILE-FIRST)
========================= */

/* Gallery container — MOBILE: 1 column */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: 24px auto;
  width: 100%;
  max-width: 1200px;
  padding: 0 1rem;
}

/* Gallery items */
.gallery-item {
  margin: 0;
  text-align: center;
}

/* Remove default button styling */
.gallery-photo-trigger,
.photo-trigger {
  all: unset;
  display: inline-block;
  cursor: url('../images/paw-cursor.png'), pointer;
}

/* Thumbnail images */
.gallery-photo-trigger img,
.photo-trigger img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin: 0;                 /* kills “mystery box” spacing */
  background: transparent;   /* safety */
}

/* Hover effect (mostly desktop) */
.gallery-photo-trigger:hover img {
  transform: scale(1.08);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

/* Caption under thumbnails (keep, but don’t hide on mobile) */
.gallery-photo-trigger figcaption {
  font-size: 0.95rem;
  font-style: italic;
  color: #333;
  text-align: center;
  margin-top: 10px;
  line-height: 1.3;
  opacity: 1;                /* MOBILE: show by default */
  transform: none;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

/* Desktop-only hover reveal for captions */
@media (hover: hover) and (pointer: fine) {
  .gallery-photo-trigger figcaption {
    opacity: 0;
    transform: translateY(8px);
  }
  .gallery-photo-trigger:hover figcaption {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   Gallery Modal Styles (MOBILE-FIRST)
========================= */

/* Modal container — MOBILE: nearly full screen */
#gallery-modal {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: calc(100vw - 2rem);
  max-width: 100vw;
  max-height: calc(100vh - 2rem);
  background: rgba(0,0,0,0.85);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 9999;
}

/* Modal inner */
.gallery-modal-content {
  background: rgba(0, 0, 0, 0.95);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;                 /* MOBILE: small padding */
  height: 100%;
  max-height: calc(100vh - 2rem);
  overflow: hidden;
}

/* Backdrop */
#gallery-modal::backdrop {
  background: rgba(0, 0, 0, 0.8);
}

/* Main image */
#gallery-modal .gallery-modal-image {
  max-width: 92vw;
  max-height: 75vh;
  object-fit: contain;
  margin: 0;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
  cursor: zoom-in;
  border: 2px solid #CD7F32;
}

/* Caption — MOBILE: place below image to avoid overlap */
#gallery-modal figcaption {
  position: static;
  transform: none;
  margin-top: 0.75rem;
  color: #fff8e7;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: "Montserrat", sans-serif;
  font-style: italic;
  max-width: 92%;
  text-align: center;
  z-index: 10;
}

/* Close & nav buttons */
#gallery-modal .close,
#gallery-modal .prev,
#gallery-modal .next {
  position: absolute;
  background: rgba(0,0,0,0.15);
  color: #fff8e7;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.8rem;
  cursor: url(../images/paw-cursor.png), pointer;
  z-index: 10;
  transition: background 0.3s ease, box-shadow 0.3s ease;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  outline: none;
}

#gallery-modal .close:hover,
#gallery-modal .prev:hover,
#gallery-modal .next:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Positioning */
#gallery-modal .prev { top: 50%; left: 10px; transform: translateY(-50%); }
#gallery-modal .next { top: 50%; right: 10px; transform: translateY(-50%); }
#gallery-modal .close { top: 10px; right: 10px; font-size: 2.4rem; line-height: 1; }

/* Keyboard focus */
#gallery-modal button:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}
#gallery-modal button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.7);
  outline-offset: 4px;
  border-radius: 50%;
}

/* Smooth open */
#gallery-modal[open] img {
  animation: zoomIn 0.4s ease;
}
@keyframes zoomIn {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* =========================
   Progressive Enhancements
========================= */

/* Tablet+ — allow multiple columns */
@media (min-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem 1rem;
    padding: 0 1.25rem;
  }
}

/* Desktop — restore your original roomy modal look */
@media (min-width: 900px) {
  #gallery-modal {
    width: 60vw;
    height: 100%;
    max-height: 100vh;
  }

  .gallery-modal-content {
    padding: 30px 60px;
  }

  #gallery-modal .gallery-modal-image {
    max-width: 90vw;
    max-height: 90vh;
  }

  #gallery-modal figcaption {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0;
  }

  #gallery-modal .close {
    top: 18px;
    right: 12px;
    font-size: 2.8rem;
  }
}
