:root {
  --warm-white: #f8f5ee;
  --warm-white-deep: #f8f5ee;
  --sand: #d8c7aa;
  --stone: #a79880;
  --olive: #283426;
  --ink: #24221d;
  --veil: rgba(25, 24, 18, 0.38);
  --display: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Manrope", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body.samia-photogallery-page {
  margin: 0;
  overflow-x: hidden;
  background: var(--warm-white);
  color: var(--ink);
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
}

.samia-photogallery-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.samia-photogallery-page a {
  color: inherit;
  text-decoration: none;
}

.hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: var(--olive);
  color: var(--warm-white);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10, 12, 9, 0.05), rgba(10, 12, 9, 0.12) 52%, rgba(10, 12, 9, 0.28)),
    radial-gradient(circle at 50% 28%, rgba(250, 247, 239, 0.05), transparent 36%);
}

.hero__image {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__image img {
  height: 100% !important;
  object-position: center 42%;
  filter: saturate(0.92) contrast(0.98);
  transform: scale(1.12);
  transform-origin: center;
  will-change: transform;
}

.hero__copy {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  padding: 0;
  text-shadow: 0 10px 38px rgba(12, 14, 10, 0.28);
  pointer-events: none;
}

.hero__brand {
  position: absolute;
  top: clamp(28px, 4.5vh, 52px);
  left: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 1.8vh, 20px);
  pointer-events: none;
  transform: translateX(-50%);
}

.samia-photogallery-page .hero .hero__logo {
  width: clamp(150px, 18vw, 260px) !important;
  max-width: 260px !important;
  max-height: 34vh !important;
  height: auto !important;
  margin: 0 !important;
  object-fit: contain !important;
  filter: drop-shadow(0 12px 34px rgba(12, 14, 10, 0.25));
  will-change: opacity, transform, filter;
}

.hero__lang-switch {
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
  text-shadow: none;
}

.hero__lang-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 8px;
  color: rgba(250, 247, 239, 0.92);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-decoration: none;
  text-shadow: none;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.hero__lang-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 1.5px;
  background: rgba(250, 247, 239, 0.95);
  transition: width 0.3s ease, left 0.3s ease;
}

.hero__lang-link:hover,
.hero__lang-link:focus-visible {
  color: rgba(250, 247, 239, 1);
}

.hero__lang-link.is-active {
  color: #ffffff;
  font-weight: 600;
}

.hero__lang-link.is-active::after {
  left: 0;
  width: 100%;
}

.hero__lang-switch a + a {
  position: relative;
}

.hero__lang-switch a + a::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 2px;
  width: 1px;
  height: 11px;
  background: rgba(250, 247, 239, 0.32);
}

@media (max-width: 680px) {
  .hero__brand {
    top: 18px;
    gap: 10px;
  }

  .hero__lang-switch {
    gap: 12px;
  }

  .hero__lang-link {
    font-size: 0.7rem;
    letter-spacing: 0.16em;
  }
}

.hero__title {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  margin: 0;
  color: rgba(250, 247, 239, 0.92);
  font-family: var(--display);
  font-size: clamp(2.85rem, 6.7vw, 6.4rem);
  font-weight: 400;
  letter-spacing: 0.015em;
  line-height: 1.08;
  text-align: center;
  text-transform: none;
  transform: translate(-50%, -50%);
  will-change: opacity, transform, filter;
}

.hero__title::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: min(96vw, 980px);
  height: clamp(260px, 34vw, 520px);
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(18, 22, 18, 0.16) 0%, rgba(18, 22, 18, 0.09) 30%, rgba(18, 22, 18, 0.04) 52%, transparent 78%);
  filter: blur(34px);
  transform: translate(-50%, -50%);
}

.scroll-cue {
  position: absolute;
  bottom: 26px;
  left: 50%;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 12px;
  color: rgba(250, 247, 239, 0.82);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  outline: none;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.scroll-cue:hover,
.scroll-cue:focus,
.scroll-cue:focus-visible,
.scroll-cue:active {
  color: rgba(250, 247, 239, 1);
  outline: none;
}

.scroll-cue i {
  width: 1px;
  height: 44px;
  overflow: hidden;
  background: rgba(250, 247, 239, 0.28);
}

.scroll-cue i::after {
  content: "";
  display: block;
  width: 1px;
  height: 18px;
  background: var(--warm-white);
  animation: cue 1.8s ease-in-out infinite;
}

@keyframes cue {
  from { transform: translateY(-18px); }
  to { transform: translateY(50px); }
}

main,
.gallery-overview,
.gallery-section,
.gallery-section__pin,
.gallery-section__track {
  background-color: var(--warm-white);
}

.gallery-overview {
  padding: clamp(58px, 7vw, 92px) 18px clamp(92px, 11vw, 154px);
  background: var(--warm-white);
}

.gallery-overview__inner {
  width: min(900px, 100%);
  margin: 0 auto;
  text-align: center;
}

.gallery-overview__inner p {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.4vw, 2.05rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.52;
  text-wrap: balance;
}

.gallery-section {
  position: relative;
  min-height: auto;
  padding: 0 0 clamp(82px, 10vw, 142px);
  background: var(--warm-white);
  scroll-margin-top: 0;
}


.gallery-section--empty {
  min-height: auto;
  padding: clamp(42px, 6vw, 78px) 0 clamp(72px, 8vw, 112px);
}

.gallery-section--empty .gallery-section__header {
  margin-bottom: 0;
}

.gallery-section__empty-note {
  width: min(1180px, calc(100vw - 36px));
  margin: clamp(24px, 3vw, 38px) auto 0;
  padding: 18px 20px;
  border: 1px dashed rgba(36, 34, 29, 0.24);
  color: rgba(36, 34, 29, 0.58);
  font-size: 0.88rem;
  line-height: 1.5;
}

.gallery-section--masseria,
.gallery-section--trulli {
  background: var(--warm-white);
}

.gallery-section__header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(18px, 3vw, 44px);
  align-items: start;
  width: min(1360px, 84vw);
  margin: 0 auto clamp(24px, 3vh, 36px);
}

.gallery-section__number {
  padding-top: clamp(8px, 1vw, 14px);
  color: rgba(36, 34, 29, 0.46);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  line-height: 1;
}

.gallery-section__copy {
  max-width: 870px;
}

.gallery-section__copy h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(2.75rem, 5vw, 5rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 0.98;
  text-transform: none;
}

.gallery-section__text {
  max-width: 700px;
  margin-top: clamp(16px, 2vw, 24px);
}

.gallery-section__text p {
  margin: 0;
  color: rgba(36, 34, 29, 0.72);
  font-size: clamp(1rem, 1.45vw, 1.18rem);
  font-weight: 300;
  letter-spacing: 0;
  line-height: 1.75;
  text-wrap: pretty;
}

.gallery-section__pin {
  width: 100%;
}

.gallery-section__viewport {
  width: 100%;
  overflow: hidden;
}

.gallery-section__track {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: min(1440px, calc(100vw - 24px));
  margin: 0 auto;
}

.gallery-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 340px;
  overflow: hidden;
  aspect-ratio: var(--image-ratio, 4 / 3);
  background: var(--sand);
  contain: layout paint;
  cursor: zoom-in;
  transform: translateZ(0);
}

.gallery-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 48%, var(--veil));
  opacity: 0;
  transition: opacity 0.45s ease;
}

.gallery-card img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover !important;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0) scale(1.04);
  transform-origin: center;
  transition: transform 0.45s ease;
}

.gallery-card:hover::after {
  opacity: 1;
}

.gallery-card:hover img {
  transform: translate3d(0, 0, 0) scale(1.055);
}

.glightbox-open .gprev,
.glightbox-open .gnext,
.glightbox-mobile .gprev,
.glightbox-mobile .gnext {
  position: fixed !important;
  top: 50% !important;
  z-index: 99999 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  min-height: 54px !important;
  padding: 0 !important;
  margin-top: -27px !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  background: rgba(18, 22, 18, 0.66) !important;
  border: 1px solid rgba(250, 247, 239, 0.36) !important;
  border-radius: 999px !important;
  color: var(--warm-white) !important;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.32) !important;
  backdrop-filter: blur(12px);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease !important;
}

.glightbox-open .gprev:hover,
.glightbox-open .gnext:hover,
.glightbox-open .gclose:hover,
.glightbox-mobile .gprev:hover,
.glightbox-mobile .gnext:hover,
.glightbox-mobile .gclose:hover {
  background: rgba(18, 22, 18, 0.88) !important;
  border-color: rgba(250, 247, 239, 0.58) !important;
  color: var(--warm-white) !important;
  transform: scale(1.04) !important;
}

.glightbox-open .gprev,
.glightbox-mobile .gprev {
  left: max(14px, env(safe-area-inset-left)) !important;
}

.glightbox-open .gnext,
.glightbox-mobile .gnext {
  right: max(14px, env(safe-area-inset-right)) !important;
}

.glightbox-open .gprev svg,
.glightbox-open .gnext svg,
.glightbox-mobile .gprev svg,
.glightbox-mobile .gnext svg {
  display: block !important;
  width: 22px !important;
  height: 22px !important;
  fill: currentColor !important;
  stroke: currentColor !important;
}

.glightbox-open .gprev svg *,
.glightbox-open .gnext svg *,
.glightbox-open .gclose svg *,
.glightbox-mobile .gprev svg *,
.glightbox-mobile .gnext svg *,
.glightbox-mobile .gclose svg * {
  stroke: currentColor !important;
  fill: currentColor !important;
}

.glightbox-open .gclose,
.glightbox-mobile .gclose {
  position: fixed !important;
  top: max(18px, env(safe-area-inset-top)) !important;
  right: max(18px, env(safe-area-inset-right)) !important;
  z-index: 100000 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 50px !important;
  height: 50px !important;
  min-width: 50px !important;
  min-height: 50px !important;
  padding: 0 !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  background: rgba(18, 22, 18, 0.72) !important;
  border: 1px solid rgba(250, 247, 239, 0.38) !important;
  border-radius: 999px !important;
  color: var(--warm-white) !important;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.34) !important;
  backdrop-filter: blur(12px);
}

.glightbox-open .gclose svg,
.glightbox-mobile .gclose svg {
  display: block !important;
  width: 20px !important;
  height: 20px !important;
  fill: currentColor !important;
  stroke: currentColor !important;
}

@media (min-width: 680px) {
  .gallery-section__track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .gallery-card--wide {
    grid-column: span 2;
    aspect-ratio: 16 / 9;
  }
}

@media (min-width: 1024px) {
  .gallery-section {
    padding-bottom: 0;
  }

  .gallery-section__pin {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    height: 88svh;
    min-height: 620px;
    overflow: hidden;
    padding: clamp(28px, 3.8vh, 46px) 0;
  }

  /*
   * Mantiene i due ambienti vicini, ma evita la sovrapposizione aggressiva
   * che rendeva brusco lo sgancio del pin precedente.
   */
  .gallery-section--trulli {
    position: relative;
    z-index: 2;
    margin-top: clamp(-24px, -1.4vw, -14px);
  }

  .gallery-section__pin .gallery-section__header {
    flex: 0 0 auto;
    margin-bottom: clamp(24px, 3vh, 34px);
  }

  .gallery-section__viewport {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-start;
    min-height: 0;
    overflow: hidden;
  }

  .gallery-section__track {
    display: flex;
    align-items: flex-start;
    gap: clamp(22px, 1.7vw, 32px);
    width: max-content;
    margin: 0;
    padding: 0 max(8vw, calc((100vw - 1360px) / 2));
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
    will-change: transform;
  }

  .gallery-card {
    flex: 0 0 auto;
    --card-height: min(53svh, 540px);
    width: clamp(320px, calc(var(--card-height) * var(--image-ratio, 1.45)), 900px);
    height: var(--card-height);
    min-height: 0;
    aspect-ratio: auto;
  }

  .gallery-card--wide {
    --card-height: min(51svh, 520px);
    width: clamp(430px, calc(var(--card-height) * var(--image-ratio, 1.65)), 980px);
    height: var(--card-height);
  }

  .gallery-card--portrait {
    --card-height: min(58svh, 590px);
    width: clamp(260px, calc(var(--card-height) * var(--image-ratio, 0.72)), 540px);
    height: var(--card-height);
  }
}

@media (max-width: 679px) {
  .hero {
    min-height: 70svh;
  }

  .hero::after {
    background:
      linear-gradient(180deg, rgba(10, 12, 9, 0.02), rgba(10, 12, 9, 0.04) 54%, rgba(10, 12, 9, 0.16)),
      radial-gradient(circle at 50% 30%, rgba(250, 247, 239, 0.04), transparent 34%);
  }

  .hero__image img {
    height: 100% !important;
    object-position: center center;
  }

  .hero__brand {
    top: 22px;
  }

  .samia-photogallery-page .hero .hero__logo {
    width: clamp(120px, 38vw, 180px) !important;
    max-width: 180px !important;
    max-height: 28vh !important;
  }

  .hero__title {
    top: 50%;
    font-size: clamp(2.55rem, 13vw, 4.1rem);
    line-height: 1.08;
  }

  .hero__title::before {
    width: 96vw;
    height: 150px;
    background: radial-gradient(ellipse at center, rgba(18, 22, 18, 0.07) 0%, rgba(18, 22, 18, 0.025) 46%, transparent 80%);
    filter: blur(28px);
  }

  .scroll-cue {
    bottom: 18px;
    gap: 8px;
    font-size: 0.64rem;
  }

  .scroll-cue i {
    height: 30px;
  }

  .gallery-overview {
    padding: 48px 18px 72px;
  }

  .gallery-overview__inner p {
    font-size: 1.5rem;
    line-height: 1.48;
  }

  .gallery-section {
    min-height: 0;
    padding: 0 0 72px;
  }

  .gallery-section__header {
    grid-template-columns: 1fr;
    gap: 14px;
    width: calc(100vw - 36px);
    margin-bottom: 24px;
  }

  .gallery-section__number {
    padding-top: 0;
  }

  .gallery-section__copy h2 {
    font-size: clamp(2.65rem, 14vw, 4.25rem);
    line-height: 0.98;
  }

  .gallery-section__text {
    margin-top: 16px;
  }

  .gallery-section__text p {
    font-size: 1rem;
    line-height: 1.65;
  }

  .gallery-section__track {
    width: 100%;
    max-width: 100%;
    gap: 20px;
  }

  .gallery-card,
  .gallery-card--wide,
  .gallery-card--portrait {
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0;
    aspect-ratio: var(--image-ratio, 4 / 3);
    background: transparent;
  }

  .gallery-card img {
    display: block;
    width: 100% !important;
    height: 100% !important;
  }
}

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

  .hero__image img,
  .gallery-card img {
    transform: none !important;
  }
}
