/* ============================================================
   GALLERY – Grid Layout
   ============================================================ */

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 1200px;
  margin: auto;
  padding: 10px;
}

figure {
  margin: 0;
  text-align: center;
  max-width: 300px;
  width: 100%;
  justify-self: center;
}

.gallery img {
  width: 100%;
  height: auto;
  cursor: pointer;
  border-radius: 15px;
  transition: transform 0.2s;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.gallery img:hover,
.gallery img:focus {
  transform: scale(1.03);
}

figcaption {
  margin-top: 10px;
  font-style: italic;
  color: #111;
}

/* Responsive Grid */
@media (max-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 667px) {
  .gallery {
    grid-template-columns: 1fr;
  }
}

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

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);

  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 20px;

  overflow-y: auto;
  color: white;
  z-index: 999999;
}

.lightbox img {
  max-width: 92%;
  max-height: 75vh;
  object-fit: contain;
  margin-bottom: 15px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.lightbox p {
  max-width: 90%;
  font-size: 18px;
  line-height: 1.45;
  text-align: center;
}

/* ============================================================
   CLOSE BUTTON (X)
   ============================================================ */

.close {
  position: absolute;
  top: 15px;
  right: 15px;

  font-size: 38px;
  font-weight: bold;
  color: #fff;

  background: rgba(0,0,0,0.35);
  padding: 6px 14px;
  border-radius: 10px;

  cursor: pointer;
  z-index: 999999;
}

/* ============================================================
   iOS / INSTAGRAM STYLE NAV BUTTONS
   ============================================================ */

.ios-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  
  width: 48px;
  height: 48px;

  display: flex;
  justify-content: center;
  align-items: center;

  font-size: 32px;
  font-weight: 600;
  color: #fff;

  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border: none;
  border-radius: 50%;
  cursor: pointer;

  box-shadow: 0 4px 25px rgba(0,0,0,0.4);

  transition: background 0.2s ease, transform 0.15s ease;
}

.ios-prev { left: 20px; }
.ios-next { right: 20px; }

.ios-nav:hover {
  background: rgba(0,0,0,0.55);
  transform: translateY(-50%) scale(1.1);
}

/* Mobile iPhone Buttons */
@media (max-width: 768px) {
  .ios-nav {
    width: 42px;
    height: 42px;
    font-size: 28px;
  }
  .ios-prev { left: 10px; }
  .ios-next { right: 10px; }
}

@media (max-width: 480px) {
  .ios-nav {
    width: 36px;
    height: 36px;
    font-size: 24px;
  }
  .ios-prev { left: 6px; }
  .ios-next { right: 6px; }
}

/* ============================================================
   THUMBNAILS
   ============================================================ */

.lightbox-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 0;
  margin-top: 15px;
  max-width: 90%;
}

.lightbox-thumbs img {
  width: 90px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  opacity: 0.6;
  cursor: pointer;
  transition: 0.2s;
}

.lightbox-thumbs img:hover {
  opacity: 1;
  transform: scale(1.05);
}

.lightbox-thumbs img.active-thumb {
  border: 3px solid white;
  opacity: 1;
  transform: scale(1.05);
}
