body {
  background: url("../img/h27.jpg") no-repeat center center fixed;
  background-size: cover;
}

/* Ẩn/hiện mượt mà */
.byebye {
  opacity: 0;
  transform: scale(0.95);
  filter: blur(4px);
  transition: opacity 1.2s ease-in-out, transform 1.2s ease, filter 1.2s ease;
}
.byebye:not(.full) {
  pointer-events: none;
}
img:not(.byebye) {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
  transition: opacity 1.2s ease-out, transform 1.2s ease, filter 1.2s ease;
}

/* Lưới gallery */
.gallery {
  display: grid;
  grid-column-gap: 8px;
  grid-row-gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  grid-auto-rows: 8px;
}

/* Ảnh bình thường */
.gallery img {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 0 16px #333;
  transition: all 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.gallery img:hover {
  box-shadow: 0 0 32px #222;
  transform: scale(1.05);
}

/* Item */
.gallery .content {
  padding: 4px;
}
.gallery .gallery-item {
  transition: all 0.6s ease;
  cursor: pointer;
}
.gallery .gallery-item:hover {
  transform: scale(1.03);
}

/* Hiệu ứng phóng to */
.full {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
}
.full .content {
  background-color: rgba(0, 0, 0, 0.8);
  height: 100%;
  width: 100%;
  display: grid;
}
.full .content img {
  animation: zoomin 1.3s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 100%;
  max-height: 100vh;
  margin: auto;
}

/* Keyframes phóng to */
@keyframes zoomin {
  0% {
    opacity: 0;
    max-width: 40%;
    transform: rotate(-25deg) scale(0.6);
    filter: blur(5px);
  }
  30% {
    opacity: 0.6;
    transform: rotate(-80deg) scale(0.8);
    filter: blur(3px);
  }
  70% {
    opacity: 0.9;
    transform: rotate(20deg) scale(1.05);
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    max-width: 100%;
    transform: rotate(0deg) scale(1);
    filter: blur(0);
  }
}

/* Responsive */
@media (max-width: 600px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(30%, 1fr));
  }
}
@media (max-width: 400px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(50%, 1fr));
  }
}
/* --- Memories Intro (chỉ áp dụng khi #gallery có class .mem-intro) --- */
#gallery.mem-intro .byebye {
  /* Ẩn ban đầu để tạo cảm giác “vừa mở” */
  opacity: 0;
  transform: scale(0.96);
  filter: blur(4px);
}

#gallery.mem-intro img.revealed {
  /* Ảnh vừa được “bóc” ra trong intro */
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
  transition: opacity 900ms ease, transform 900ms ease, filter 900ms ease; /* mượt & nhanh hơn 1 chút */
}
