:root {
  --gold: #c5a059;
  --gold-dark: #a78343;
  --dark: #1f1a12;
  --text-soft: #5d574d;
  --bg-cream: #faf9f6;
  --white: #ffffff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.9) 0%, rgba(250, 249, 246, 0) 360px),
    var(--bg-cream);
  color: var(--dark);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.gallery-page {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 118px 0 72px;
}

.gallery-header {
  margin: 0 auto 54px;
  max-width: 760px;
  text-align: center;
}

.eyebrow,
.section-kicker {
  color: var(--gold);
  font-family: "Ysabeau SC", sans-serif;
  font-weight: 700;
  letter-spacing: 4px;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.gallery-header h1,
.section-copy h2 {
  font-family: "Ysabeau SC", sans-serif;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1;
  margin: 0;
}

.gallery-header h1 {
  font-size: clamp(3.2rem, 9vw, 5.4rem);
}

.gallery-header p:last-child {
  color: var(--text-soft);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.8;
  margin: 18px auto 0;
}

.gallery-section {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(197, 160, 89, 0.18);
  border-radius: 18px;
  box-shadow: 0 18px 46px rgba(31, 26, 18, 0.07);
  margin: 0 0 34px;
  overflow: hidden;
}

.section-copy {
  display: grid;
  grid-template-columns: minmax(220px, 0.58fr) minmax(0, 1fr);
  gap: 24px;
  align-items: end;
  padding: 34px 36px 24px;
}

.gallery-section:first-of-type .section-copy {
  position: relative;
}

.section-kicker {
  grid-column: 1 / -1;
  font-size: 0.9rem;
}

.tour-360-button {
  background: var(--gold);
  border: 1px solid var(--gold-dark);
  border-radius: 999px;
  color: var(--white);
  display: inline-flex;
  font-family: "Montserrat", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  left: 36px;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 10px 16px;
  position: absolute;
  text-decoration: none;
  text-transform: uppercase;
  top: 76px;
  transition: background 0.25s ease, transform 0.25s ease;
}

.tour-360-button:hover {
  background: var(--gold-dark);
  transform: translateY(-2px);
}

.section-copy h2 {
  font-size: clamp(1.7rem, 3.3vw, 2.55rem);
  text-transform: uppercase;
}

.section-description {
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.75;
  margin: 0;
}

.galleria {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}

.galleria img {
  aspect-ratio: 4 / 3;
  background: #eee6d8;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(31, 26, 18, 0.09);
  cursor: pointer;
  display: block;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, box-shadow 0.35s ease, filter 0.35s ease;
  width: 100%;
}

.galleria img:hover {
  box-shadow: 0 18px 36px rgba(31, 26, 18, 0.18);
  filter: saturate(1.08) contrast(1.03);
  transform: translateY(-5px);
}

.gallery-header,
.gallery-section {
  opacity: 0;
  transform: translateY(24px);
}

.gallery-header.is-visible,
.gallery-section.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.gallery-section.is-visible .galleria img {
  animation: photoReveal 0.65s ease both;
}

.gallery-section.is-visible .galleria img:nth-child(2) {
  animation-delay: 0.08s;
}

.gallery-section.is-visible .galleria img:nth-child(3) {
  animation-delay: 0.16s;
}

.gallery-section.is-visible .galleria img:nth-child(4) {
  animation-delay: 0.24s;
}

.lightbox {
  align-items: center;
  background: rgba(15, 18, 20, 0.92);
  cursor: pointer;
  display: none;
  height: 100%;
  inset: 0;
  justify-content: center;
  padding: 32px;
  position: fixed;
  width: 100%;
  z-index: 2000;
}

.lightbox.is-open {
  animation: lightboxFade 0.22s ease both;
  display: flex;
}

.lightbox img {
  animation: zoom 0.28s ease;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  max-height: min(86vh, 920px);
  max-width: min(94vw, 1180px);
  object-fit: contain;
}

.chiudi {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  font-size: 2rem;
  height: 48px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 28px;
  top: 24px;
  transition: background 0.25s, transform 0.25s;
  width: 48px;
}

.chiudi:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.04);
}

.tour-360-modal {
  align-items: center;
  background: rgba(15, 18, 20, 0.92);
  display: none;
  height: 100%;
  inset: 0;
  justify-content: center;
  padding: 32px;
  position: fixed;
  width: 100%;
  z-index: 2100;
}

.tour-360-modal.is-open {
  animation: lightboxFade 0.22s ease both;
  display: flex;
}

.tour-360-modal__viewer {
  background: #111111;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  height: min(78vh, 760px);
  overflow: hidden;
  position: relative;
  width: min(94vw, 1180px);
}

#tour-360-viewer {
  height: 100%;
  width: 100%;
}

.tour-360-modal__close {
  align-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  font-size: 2rem;
  height: 48px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 16px;
  top: 16px;
  transition: background 0.25s, transform 0.25s;
  width: 48px;
  z-index: 5;
}

.tour-360-modal__close:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: scale(1.04);
}

@keyframes zoom {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes photoReveal {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes lightboxFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 760px) {
  .gallery-page {
    width: min(100% - 28px, 1180px);
    padding: 100px 0 44px;
  }

  .gallery-header {
    margin-bottom: 34px;
  }

  .eyebrow,
  .section-kicker {
    letter-spacing: 3px;
  }

  .gallery-section {
    border-radius: 14px;
    margin-bottom: 24px;
  }

  .section-copy {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 26px 20px 18px;
  }

  .tour-360-button {
    justify-self: start;
    position: static;
  }

  .galleria {
    grid-template-columns: 1fr;
    padding: 0 10px 10px;
  }

  .lightbox {
    padding: 18px;
  }

  .tour-360-modal {
    padding: 18px;
  }

  .tour-360-modal__viewer {
    border-radius: 12px;
    height: 74vh;
    width: 100%;
  }

  .chiudi {
    height: 42px;
    right: 16px;
    top: 16px;
    width: 42px;
  }

  .tour-360-modal__close {
    height: 42px;
    width: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .gallery-header,
  .gallery-section {
    opacity: 1;
    transform: none;
  }
}
