/* === Global Reset & Base Styles === */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f4f6fb, #e9ecf5);
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

h1 {
  margin: 2rem 0 1rem;
  font-size: 2.5rem;
  text-align: center;
  color: #2c3e50;
  letter-spacing: 1px;
}

/* === Utility === */
.lightbox.hidden {
  display: none !important;
  pointer-events: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* === Gallery Grid === */
.gallery {
  display: grid;
  gap: 1rem;
  width: min(90%, 1200px);
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.image {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: 0.75rem;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  background: #fff;
}

.image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.image:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.image:hover img {
  transform: scale(1.1);
}

.image:hover::after {
  opacity: 1;
}

/* === Lightbox Overlay === */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  width: 100vw;
  height: 100vh;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.lightbox.show {
  opacity: 1;
  visibility: visible;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 0.5rem;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.4s ease;
}

/* === Lightbox Controls === */
.lightbox button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.8);
  border: none;
  font-size: 2rem;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  border-radius: 0.4rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.lightbox button:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.08);
}

.lightbox .prev {
  left: 1.5rem;
}

.lightbox .next {
  right: 1.5rem;
}

.lightbox .close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2.8rem;
  color: #fff;
  cursor: pointer;
  transition: transform 0.3s ease, color 0.3s ease;
}

.lightbox .close:hover {
  transform: scale(1.15);
  color: #f1c40f;
}

/* === Filters === */
.filters {
  margin: 2rem 0 1.5rem;
  text-align: center;
}

.filters button {
  background: #ffffff;
  border: 1px solid #ddd;
  padding: 0.5rem 1.2rem;
  margin: 0 0.4rem;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  color: #555;
}

.filters button:hover {
  background: #3498db;
  color: #fff;
  border-color: #3498db;
}

.filters button.active {
  background: #2980b9;
  color: #fff;
  border-color: #2980b9;
}

/* === Animations === */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* === Responsive Tweaks === */
@media (max-width: 600px) {
  h1 {
    font-size: 1.8rem;
  }

  .lightbox button {
    font-size: 1.5rem;
  }

  .lightbox .close {
    font-size: 2.2rem;
  }
}
