* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #fdfdfd;
  font-family: "Segoe UI", sans-serif;
  color: #222;
  padding: 2rem;
  animation: fadeIn 1.2s ease-in;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2.5rem;
  color: #222;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  max-width: 1100px;
  margin: auto;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.3s ease;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.3s ease;
  display: block;
}

.gallery-item:hover img {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.gallery-item::after {
  content: attr(data-title);
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 0.7rem;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1rem;
  opacity: 0;
  transition: 0.3s;
}

.gallery-item:hover::after {
  opacity: 1;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(20, 20, 20, 0.95);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  flex-direction: column;
  animation: fadeIn 0.4s ease-in-out;
}

.lightbox-img {
  max-width: 90%;
  max-height: 80%;
  border-radius: 10px;
}

.caption {
  color: #fff;
  margin-top: 1rem;
  font-size: 1.1rem;
}

.close {
  position: absolute;
  top: 25px;
  right: 40px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
}

.nav {
  position: absolute;
  top: 50%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 50px;
  color: #fff;
  font-size: 2rem;
  user-select: none;
}

.nav span {
  cursor: pointer;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
