.gallery-page {
  background:
    radial-gradient(circle at top left, rgba(185, 146, 81, 0.12), transparent 26%),
    radial-gradient(circle at bottom right, rgba(35, 65, 49, 0.08), transparent 24%),
    linear-gradient(180deg, #f8f4ed 0%, #f2ece3 52%, #ede5da 100%);
}

/* =========================
   HERO
========================= */

.gallery-hero {
  position: relative;
  min-height: 64vh;
  display: grid;
  place-items: center;
  padding: 10rem 1rem 4.8rem;
  overflow: hidden;
  isolation: isolate;
}

.gallery-hero-bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1.07);
  transition:
    opacity 1.2s ease,
    transform 7s ease,
    filter 1.2s ease;
  filter: saturate(1.03) contrast(1.03);
  z-index: -3;
}

.gallery-hero-bg.active {
  opacity: 1;
  transform: scale(1);
}

.gallery-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,0.18), transparent 22%),
    linear-gradient(180deg, rgba(255,255,255,0.05), transparent 28%);
  pointer-events: none;
}

.gallery-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 10, 8, 0.12), rgba(7, 10, 8, 0.52)),
    linear-gradient(135deg, rgba(11, 18, 14, 0.16), rgba(23, 45, 33, 0.30));
  z-index: -2;
}

.gallery-hero-content {
  position: relative;
  z-index: 2;
  width: min(100%, 960px);
  text-align: center;
  color: #fff;
}

.gallery-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  padding: 0.62rem 1.08rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 14px 30px rgba(0,0,0,0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.gallery-hero-content h1 {
  margin: 0 0 1.1rem;
  font-family: var(--font-serif);
  font-size: clamp(3.2rem, 5.5vw, 5.5rem);
  line-height: 0.9;
  font-weight: 600;
  letter-spacing: -0.035em;
  text-shadow: 0 10px 34px rgba(0,0,0,0.24);
}

.gallery-hero-content p {
  width: min(100%, 730px);
  margin: 0 auto;
  padding: 1.15rem 1.3rem;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0.10));
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 18px 48px rgba(0,0,0,0.16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: rgba(255,255,255,0.96);
  font-size: 1.04rem;
  line-height: 1.7;
}

.gallery-hero-video{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  z-index:-3;
}



/* =========================
   MAIN
========================= */

.gallery-main {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 4.6rem 0 5.8rem;
}

.gallery-controls {
  margin-bottom: 2.6rem;
}

.gallery-intro {
  max-width: 820px;
  margin: 0 auto 1.7rem;
  text-align: center;
}

.gallery-intro h2 {
  margin: 0 0 0.85rem;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 4vw, 3.7rem);
  line-height: 0.94;
  letter-spacing: -0.03em;
  color: var(--primary);
}

.gallery-intro p {
  margin: 0;
  color: var(--text-soft);
  font-size: 1.02rem;
  line-height: 1.75;
  max-width: 720px;
  margin-inline: auto;
}

/* =========================
   FILTERS
========================= */

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.filter-btn {
  min-height: 46px;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(24, 32, 25, 0.08);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.64));
  color: var(--primary);
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow:
    0 8px 20px rgba(19, 28, 22, 0.05),
    inset 0 1px 0 rgba(255,255,255,0.55);
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    border-color 0.28s ease,
    color 0.28s ease,
    background 0.28s ease;
}

.filter-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(185, 146, 81, 0.34);
  box-shadow:
    0 14px 28px rgba(19, 28, 22, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.68);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
  box-shadow:
    0 16px 34px rgba(35, 65, 49, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.10);
}

/* =========================
   GRID
========================= */

.gallery-grid-section {
  margin-top: 1.2rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1.1rem;
}

.gallery-card {
  position: relative;
  grid-column: span 4;
  display: block;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.42);
  border-radius: 28px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  background: rgba(255,255,255,0.72);
  box-shadow:
    0 12px 32px rgba(20, 24, 22, 0.06),
    0 2px 12px rgba(20, 24, 22, 0.04);
  isolation: isolate;
  transition:
    transform 0.42s cubic-bezier(.2,.8,.2,1),
    box-shadow 0.42s cubic-bezier(.2,.8,.2,1),
    border-color 0.32s ease,
    opacity var(--transition);
}

.gallery-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), transparent 26%);
  pointer-events: none;
}

.gallery-card:hover {
  transform: translateY(-8px) scale(1.01);
  border-color: rgba(185, 146, 81, 0.24);
  box-shadow:
    0 24px 56px rgba(20, 24, 22, 0.12),
    0 10px 26px rgba(20, 24, 22, 0.08);
}

.gallery-card.hidden {
  display: none;
}

.gallery-card img {
  display: block;
    width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transform: scale(1);
  transition: transform 0.8s ease, filter 0.35s ease;
}

.gallery-card:hover img {
  transform: scale(1.045);
  filter: saturate(1.03) contrast(1.02);
}

.gallery-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 32%, rgba(8, 14, 10, 0.12) 58%, rgba(8, 14, 10, 0.78) 100%);
  opacity: 1;
  transition: opacity 0.35s ease;
}

.gallery-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 0.78rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.gallery-card-caption {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 2;
  color: #fff;
  padding: 0.8rem 0.95rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17,17,17,0.14), rgba(17,17,17,0.36));
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  letter-spacing: 0.01em;
  display: none;
  transform: translateY(8px);
  opacity: 0.94;
  transition:
    transform 0.35s ease,
    opacity 0.35s ease,
    background 0.35s ease;
}

.gallery-card:hover .gallery-card-caption {
  transform: translateY(0);
  opacity: 1;
  background: linear-gradient(180deg, rgba(17,17,17,0.18), rgba(17,17,17,0.46));
}

/* Varianti editoriali */
.gallery-card.featured {
  grid-column: span 8;
}

.gallery-card.featured img {
  aspect-ratio: 16 / 9;
}

.gallery-card.tall img {
  aspect-ratio: 4 / 5;
}

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.05), transparent 22%),
    rgba(8, 10, 9, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

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

.lightbox-content {
  width: min(100%, 1260px);
  max-width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 28px;
  box-shadow:
    0 28px 70px rgba(0,0,0,0.34),
    0 10px 26px rgba(0,0,0,0.22);
  background: #111;
}

.lightbox-content p {
  margin: 1rem 0 0;
  color: rgba(255,255,255,0.92);
  font-size: 0.98rem;
  line-height: 1.6;
}

.lightbox-close,
.lightbox-nav {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    transform 0.25s ease,
    background 0.25s ease,
    border-color 0.25s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.22);
  transform: scale(1.05);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.2rem;
}

.lightbox-nav {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-size: 1.05rem;
  flex: 0 0 auto;
}

.lightbox-counter {
  position: absolute;
  top: 1rem;
  left: 1rem;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.9rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#lightboxImage {
  transition: opacity 0.25s ease;
}

/* =========================
   TABLET LARGE
========================= */

@media (max-width: 1080px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-card,
  .gallery-card.featured {
    grid-column: auto;
  }
}

/* =========================
   TABLET / MOBILE
========================= */

@media (max-width: 768px) {
  .gallery-main {
    width: min(100% - 1.2rem, var(--max));
    padding: 3rem 0 4rem;
  }

  .gallery-hero {
    min-height: 50vh;
    padding: 8.1rem 1rem 3rem;
  }

  .gallery-kicker {
    font-size: 0.72rem;
    padding: 0.5rem 0.8rem;
    margin-bottom: 0.95rem;
  }

  .gallery-hero-content h1 {
    font-size: clamp(2.4rem, 8vw, 4rem);
  }

  .gallery-hero-content p {
    font-size: 0.97rem;
    padding: 1rem;
    border-radius: 18px;
  }

  .gallery-controls {
    margin-bottom: 1.6rem;
  }

  .gallery-intro {
    margin-bottom: 1.2rem;
  }

  .gallery-intro h2 {
    font-size: clamp(2rem, 7vw, 2.9rem);
  }

  .gallery-intro p {
    font-size: 0.96rem;
  }

  .gallery-filters {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    gap: 0.55rem;
    scrollbar-width: none;
  }

  .gallery-filters::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    min-height: 40px;
    padding: 0.62rem 0.9rem;
    font-size: 0.88rem;
    flex: 0 0 auto;
  }

  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
  }

  .gallery-card {
    border-radius: 20px;
  }

  .gallery-badge {
    top: 0.8rem;
    left: 0.8rem;
    min-height: 30px;
    padding: 0 0.68rem;
    font-size: 0.66rem;
  }

  .gallery-card-caption {
    left: 0.8rem;
    right: 0.8rem;
    bottom: 0.8rem;
    padding: 0.7rem 0.8rem;
    font-size: 0.84rem;
    border-radius: 16px;
  }

  .lightbox {
    padding: 0.4rem;
    gap: 0.35rem;
  }

  .lightbox-content {
    width: 100%;
  }

  .lightbox-content img {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px;
  }

  .lightbox-content p {
    font-size: 0.94rem;
    margin-top: 0.65rem;
    padding: 0 0.4rem;
  }

  .lightbox-nav {
    width: 42px;
    height: 42px;
    font-size: 0.95rem;
  }

  .lightbox-close {
    width: 42px;
    height: 42px;
    top: 0.6rem;
    right: 0.6rem;
    font-size: 1rem;
  }

  .lightbox-counter {
    top: 0.75rem;
    left: 0.75rem;
    min-height: 38px;
    padding: 0 0.75rem;
    font-size: 0.82rem;
  }
}

/* =========================
   SMALL MOBILE
========================= */

@media (max-width: 480px) {
  .gallery-main {
    width: min(100% - 1rem, var(--max));
    padding: 2.4rem 0 3.2rem;
  }

  .gallery-hero {
    min-height: 44vh;
    padding: 7rem 0.75rem 2.4rem;
  }

  .gallery-kicker {
    font-size: 0.7rem;
    padding: 0.45rem 0.72rem;
  }

  .gallery-hero-content h1 {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  .gallery-hero-content p {
    font-size: 0.92rem;
    line-height: 1.55;
    padding: 0.9rem 0.85rem;
  }

  .gallery-intro h2 {
    font-size: 1.95rem;
    line-height: 1;
  }

  .gallery-intro p {
    font-size: 0.93rem;
  }

  .gallery-filters {
    gap: 0.5rem;
  }

  .filter-btn {
    min-height: 38px;
    padding: 0.58rem 0.8rem;
    font-size: 0.84rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .gallery-card {
    border-radius: 18px;
  }

  .gallery-card img,
  .gallery-card.featured img,
  .gallery-card.tall img {
    aspect-ratio: 5 / 4;
  }

  .gallery-badge {
    top: 0.75rem;
    left: 0.75rem;
  }

  .gallery-card-caption {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    font-size: 0.84rem;
  }

  .lightbox {
    padding: 0;
    gap: 0;
    align-items: center;
    justify-content: center;
  }

  .lightbox-content {
    width: 100vw;
    max-width: 100vw;
    padding: 0;
  }

  .lightbox-content img {
    display: block;
    width: 100vw;
    max-width: 100vw;
    height: auto;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 0;
    margin: 0 auto;
  }

  .lightbox-content p {
    font-size: 0.88rem;
    margin-top: 0.45rem;
    padding: 0 0.8rem 0.75rem;
  }

  .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    font-size: 0.92rem;
    z-index: 5;
  }

  .lightbox-prev {
    left: 0.45rem;
  }

  .lightbox-next {
    right: 0.45rem;
  }

  .lightbox-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    z-index: 6;
  }
}

@media (max-width: 360px) {
  .gallery-hero-content h1 {
    font-size: 1.8rem;
  }

  .gallery-hero-content p {
    font-size: 0.88rem;
  }

  .gallery-intro h2 {
    font-size: 1.72rem;
  }

  .filter-btn {
    font-size: 0.8rem;
  }

  .gallery-card-caption {
    font-size: 0.8rem;
  } 
}