@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600&family=Poppins:wght@300;400;500;600&display=swap");

:root {
  --gallery-gold: #d8b46a;
  --gallery-gold-dark: #b88a33;
  --gallery-dark: #1e1e1e;
  --gallery-text: #666;
}

/* =========================
   GALLERY SECTION
========================= */

.gallery-section {
  position: relative;
  padding: 100px 0;
  overflow: hidden;
  background:
    radial-gradient(
      circle at 10% 10%,
      rgba(216, 180, 106, 0.08),
      transparent 28%
    ),
    radial-gradient(
      circle at 90% 90%,
      rgba(216, 180, 106, 0.07),
      transparent 30%
    ),
    linear-gradient(180deg, #fff 0%, #fcfaf6 100%);
}

.gallery-container {
  width: min(1280px, calc(100% - 40px));
  margin: auto;
}

/* =========================
   HEADER
========================= */

.gallery-header {
  max-width: 760px;
  margin: 0 auto 55px;
  text-align: center;
}

.gallery-header span {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
  color: var(--gallery-gold-dark);
  font: 600 11px "Poppins", sans-serif;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.gallery-header span::before,
.gallery-header span::after {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--gallery-gold);
}

.gallery-header h2 {
  margin: 0;
  color: #202020;
  font: 500 clamp(34px, 5vw, 58px) / 1.15 "Cinzel", serif;
  letter-spacing: -1px;
}

.gallery-header p {
  max-width: 650px;
  margin: 20px auto 0;
  color: var(--gallery-text);
  font: 400 15px / 1.9 "Poppins", sans-serif;
}

/* =========================
   GALLERY GRID
========================= */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 180px;
  gap: 18px;
}

/* =========================
   GALLERY ITEM
========================= */

.gallery-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: 24px;
  background: #eee;
  cursor: pointer;
  isolation: isolate;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.07);

  opacity: 0;
  transform: translateY(25px);
  animation: galleryReveal 0.8s ease forwards;
}

.gallery-item:nth-child(1) {
  animation-delay: 0.05s;
}

.gallery-item:nth-child(2) {
  animation-delay: 0.1s;
}

.gallery-item:nth-child(3) {
  animation-delay: 0.15s;
}

.gallery-item:nth-child(4) {
  animation-delay: 0.2s;
}

.gallery-item:nth-child(5) {
  animation-delay: 0.25s;
}

.gallery-item:nth-child(6) {
  animation-delay: 0.3s;
}

.gallery-item:nth-child(7) {
  animation-delay: 0.35s;
}

.gallery-item:nth-child(8) {
  animation-delay: 0.4s;
}

@keyframes galleryReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Image */

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;

  transform: scale(1.01);
  transition:
    transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1),
    filter 0.6s ease;
}

/* Dark gradient */

.gallery-item::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;

  background:
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.02) 20%,
      rgba(0, 0, 0, 0.72) 100%
    );

  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Hover */

.gallery-item:hover img {
  transform: scale(1.1);
  filter: saturate(1.08);
}

.gallery-item:hover::before {
  opacity: 1;
}

/* =========================
   SIZES
========================= */

.gallery-item.tall {
  grid-row: span 2;
}

.gallery-item.wide {
  grid-column: span 2;
}

/* =========================
   OVERLAY
========================= */

.gallery-overlay {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;

  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  padding: 25px;

  color: white;

  transform: translateY(15px);
  opacity: 0;

  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-overlay small {
  display: block;
  margin-bottom: 5px;

  color: var(--gallery-gold);
  font: 500 10px "Poppins", sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.gallery-overlay h3 {
  margin: 0;

  color: #fff;
  font: 500 20px "Cinzel", serif;
}

/* View Button */

.gallery-view {
  display: grid;
  width: 44px;
  height: 44px;

  place-items: center;

  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;

  color: white;
  background: rgba(255, 255, 255, 0.1);

  font-size: 20px;

  cursor: pointer;

  backdrop-filter: blur(8px);

  transition:
    background 0.3s ease,
    color 0.3s ease,
    transform 0.3s ease;
}

.gallery-view:hover {
  color: #222;
  background: var(--gallery-gold);
  border-color: var(--gallery-gold);
  transform: rotate(45deg);
}

/* =========================
   LIGHTBOX
========================= */

.gallery-lightbox {
  position: fixed;
  z-index: 99999;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 30px;

  background: rgba(10, 10, 10, 0.94);

  visibility: hidden;
  opacity: 0;

  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.gallery-lightbox.active {
  visibility: visible;
  opacity: 1;
}

.lightbox-content {
  position: relative;

  width: min(1000px, 90vw);
  max-height: 90vh;

  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  display: block;

  max-width: 100%;
  max-height: 75vh;

  object-fit: contain;

  border-radius: 12px;

  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.45);

  transform: scale(0.92);
  transition: transform 0.4s ease;
}

.gallery-lightbox.active .lightbox-content img {
  transform: scale(1);
}

/* Caption */

.lightbox-caption {
  width: 100%;
  padding-top: 18px;
  text-align: center;
}

.lightbox-caption span {
  color: var(--gallery-gold);
  font: 500 10px "Poppins", sans-serif;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.lightbox-caption h3 {
  margin: 5px 0 0;
  color: #fff;
  font: 500 23px "Cinzel", serif;
}

/* Buttons */

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  z-index: 5;

  display: grid;
  place-items: center;

  width: 48px;
  height: 48px;

  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;

  color: white;
  background: rgba(255, 255, 255, 0.08);

  cursor: pointer;

  backdrop-filter: blur(8px);

  transition:
    background 0.3s ease,
    color 0.3s ease,
    transform 0.3s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  color: #222;
  background: var(--gallery-gold);
}

.lightbox-close {
  top: 25px;
  right: 25px;

  font-size: 30px;
  line-height: 1;
}

.lightbox-prev {
  left: 25px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 25px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev:hover {
  transform: translateY(-50%) translateX(-3px);
}

.lightbox-next:hover {
  transform: translateY(-50%) translateX(3px);
}

/* =========================
   TABLET
========================= */

@media (max-width: 992px) {

  .gallery-section {
    padding: 80px 0;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 200px;
    gap: 16px;
  }

  .gallery-item.wide {
    grid-column: span 2;
  }

  .gallery-item.tall {
    grid-row: span 2;
  }

  .gallery-overlay {
    padding: 20px;
  }
}

/* =========================
   MOBILE
========================= */

@media (max-width: 576px) {

  .gallery-section {
    padding: 65px 0;
  }

  .gallery-container {
    width: calc(100% - 24px);
  }

  .gallery-header {
    margin-bottom: 35px;
  }

  .gallery-header span {
    gap: 8px;
    font-size: 9px;
    letter-spacing: 2.5px;
  }

  .gallery-header span::before,
  .gallery-header span::after {
    width: 18px;
  }

  .gallery-header h2 {
    font-size: 32px;
    line-height: 1.25;
  }

  .gallery-header p {
    margin-top: 15px;
    font-size: 13px;
    line-height: 1.8;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 260px;
    gap: 14px;
  }

  .gallery-item,
  .gallery-item.wide,
  .gallery-item.tall {
    grid-column: span 1;
    grid-row: span 1;

    border-radius: 18px;
  }

  /* Keep overlay visible on touch devices */

  .gallery-item::before {
    opacity: 0.55;
  }

  .gallery-overlay {
    padding: 18px;
    opacity: 1;
    transform: translateY(0);
  }

  .gallery-overlay h3 {
    font-size: 17px;
  }

  .gallery-view {
    width: 38px;
    height: 38px;
    font-size: 17px;
  }

  /* Lightbox */

  .gallery-lightbox {
    padding: 15px;
  }

  .lightbox-content {
    width: 100%;
  }

  .lightbox-content img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
  }

  .lightbox-close {
    top: 15px;
    right: 15px;
  }

  .lightbox-prev,
  .lightbox-next {
    top: auto;
    bottom: 25px;

    width: 42px;
    height: 42px;
  }

  .lightbox-prev {
    left: 25px;
  }

  .lightbox-next {
    right: 25px;
  }

  .lightbox-caption {
    padding-top: 12px;
  }

  .lightbox-caption h3 {
    font-size: 18px;
  }
}

/* =========================
   REDUCED MOTION
========================= */

@media (prefers-reduced-motion: reduce) {

  .gallery-item,
  .gallery-item img,
  .gallery-overlay,
  .gallery-lightbox,
  .lightbox-content img {
    animation: none;
    transition: none;
  }
}