/* ───────────────────────────────────────────────────────────────
   Apartment detail page
   ─────────────────────────────────────────────────────────────── */

.apt-hero {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  color: var(--cream);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--nav-h) + 24px) clamp(24px, 3.5vw, 56px) clamp(40px, 5vw, 64px);
}
.apt-hero__bg {
  position: absolute; inset: 0; z-index: -1; overflow: hidden;
}
.apt-hero__bg img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.08);
}
.apt-hero__veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(43,22,15,0.35) 0%, rgba(43,22,15,0.1) 30%, rgba(43,22,15,0.55) 100%);
}
.apt-hero__top {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between;
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.9;
}
.apt-hero__inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  justify-content: flex-end; flex: 1;
  padding-bottom: clamp(24px, 5vw, 80px);
}
.apt-hero__title {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: var(--fs-hero);
  line-height: 1.0;
  letter-spacing: -0.02em;
}
.apt-hero__title em { font-style: italic; }
.apt-hero__meta {
  position: relative; z-index: 2;
  display: flex;
  gap: 48px;
  align-items: end;
  justify-content: space-between;
  border-top: 1px solid var(--rule-light);
  padding-top: 24px;
}
.apt-hero__meta-item {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.6875rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--greige-soft);
}
.apt-hero__meta-item strong {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 1.5rem;
  color: var(--cream);
  letter-spacing: -0.01em;
  text-transform: none;
}

/* ─── Intro 2-col under hero ─── */
.apt-intro {
  padding: clamp(96px, 12vw, 160px) clamp(24px, 3.5vw, 56px);
  background: var(--cream);
}
.apt-intro__inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(48px, 6vw, 96px);
  align-items: end;
}
.apt-intro__title {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: var(--fs-hero);
  line-height: 1.02;
  letter-spacing: -0.02em;
  max-width: 16ch;
}
.apt-intro__title em { font-style: italic; }
.apt-intro__right {
  display: flex; flex-direction: column; gap: 24px;
  max-width: 460px; padding-bottom: 12px;
}
.apt-intro__right p {
  font-size: var(--fs-body); line-height: 1.65;
}

/* ─── Gallery ─── */
.apt-gallery {
  padding: 0 clamp(24px, 3.5vw, 56px) clamp(96px, 12vw, 160px);
  background: var(--cream);
}
/* Masonry columns: every photo keeps its NATURAL aspect ratio — landscape
   stays landscape, portrait stays portrait, never cropped (Highstay-style). */
.apt-gallery__grid {
  column-count: 2;
  column-gap: 16px;
}
.apt-gallery__item {
  break-inside: avoid;
  margin: 0 0 16px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--cream-2);
}
.apt-gallery__item img {
  width: 100%;
  height: auto;            /* natural ratio — no crop */
  display: block;
  transition: transform 1.2s var(--ease-out);
}
.apt-gallery__item:hover img { transform: scale(1.04); }
/* Legacy size hints no longer force a crop; kept harmless. */
.apt-gallery__item--lg,
.apt-gallery__item--md,
.apt-gallery__item--sm,
.apt-gallery__item--tall { aspect-ratio: auto; }

/* ─── Amenities ─── */
.apt-amenities {
  padding: clamp(96px, 12vw, 160px) clamp(24px, 3.5vw, 56px);
  background: var(--cream-2);
}
.apt-amenities__head {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 64px;
  margin-bottom: clamp(48px, 6vw, 80px);
  align-items: end;
}
.apt-amenities__head h2 {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: var(--fs-hero);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.apt-amenities__head h2 em { font-style: italic; }
.apt-amenities__head p {
  font-size: var(--fs-body); line-height: 1.65;
  max-width: 420px; align-self: end; padding-bottom: 12px;
}
.apt-amenities__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.apt-amenities__group {
  border-top: 1px solid var(--rule);
  padding: 32px 0;
}
.apt-amenities__group:not(:nth-child(3n)) { padding-right: 32px; }
.apt-amenities__group h3 {
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--greige);
  margin-bottom: 20px;
}
.apt-amenities__group ul {
  display: flex; flex-direction: column;
  gap: 10px;
  font-size: var(--fs-body);
  line-height: 1.5;
}

/* ─── Apartment location ─── */
.apt-location {
  padding: clamp(96px, 12vw, 160px) clamp(24px, 3.5vw, 56px);
  background: var(--cream);
}
.apt-location__head {
  display: grid; grid-template-columns: 1fr 1fr; gap: 64px;
  margin-bottom: clamp(40px, 5vw, 64px);
  align-items: end;
}
.apt-location__head h2 {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: var(--fs-hero);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.apt-location__head h2 em { font-style: italic; }
.apt-location__head p {
  font-size: var(--fs-body); line-height: 1.65;
  max-width: 420px; align-self: end; padding-bottom: 12px;
}
.apt-location__map {
  width: 100%; height: 480px;
  background: var(--cream-2);
}

/* ─── Booking CTA strip ─── */
.apt-cta {
  background: var(--dark); color: var(--cream);
  padding: clamp(96px, 12vw, 160px) clamp(24px, 3.5vw, 56px);
}
.apt-cta__inner {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 64px;
  align-items: end;
}
.apt-cta__title {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: var(--fs-mega);
  line-height: 0.95;
  letter-spacing: -0.025em;
}
.apt-cta__title em { font-style: italic; }
.apt-cta__right {
  display: flex; flex-direction: column; gap: 20px;
  max-width: 380px; padding-bottom: 12px;
}
.apt-cta__price {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  line-height: 1;
}
.apt-cta__price em { font-style: italic; color: var(--greige-soft); font-size: 0.6em; }
.apt-cta__sub {
  font-size: var(--fs-body); color: var(--greige-soft);
}

/* ─── Other residences strip ─── */
.apt-other {
  padding: clamp(96px, 12vw, 160px) clamp(24px, 3.5vw, 56px);
  background: var(--cream);
}
.apt-other__head {
  display: flex; justify-content: space-between; align-items: end;
  gap: 32px;
  margin-bottom: clamp(40px, 5vw, 64px);
}
.apt-other__head h2 {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: var(--fs-hero);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.apt-other__head h2 em { font-style: italic; }
.apt-other__grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.apt-other__card {
  display: block; color: inherit;
}
.apt-other__media {
  aspect-ratio: 4/3; overflow: hidden; background: var(--cream-2);
}
.apt-other__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.2s var(--ease-out);
}
.apt-other__card:hover .apt-other__media img { transform: scale(1.04); }
.apt-other__info {
  display: flex; justify-content: space-between; align-items: end;
  padding-top: 20px; gap: 16px;
}
.apt-other__info h3 {
  font-family: var(--font-display);
  font-weight: 200; font-size: 2rem; line-height: 1.05;
  letter-spacing: -0.01em;
}
.apt-other__info h3 em { font-style: italic; }
.apt-other__info .meta {
  text-align: right;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--greige);
  line-height: 1.6;
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .apt-intro__inner { grid-template-columns: 1fr; gap: 24px; align-items: start; }
  .apt-amenities__head { grid-template-columns: 1fr; gap: 24px; }
  .apt-amenities__grid { grid-template-columns: 1fr 1fr; }
  .apt-amenities__group:not(:nth-child(3n)) { padding-right: 0; }
  .apt-amenities__group:not(:nth-child(2n)) { padding-right: 32px; }
  .apt-location__head { grid-template-columns: 1fr; gap: 24px; }
  .apt-cta__inner { grid-template-columns: 1fr; gap: 32px; align-items: start; }
  .apt-other__grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .apt-hero__meta { flex-wrap: wrap; gap: 24px; }
  .apt-hero__meta-item { flex: 1 1 40%; }
  .apt-amenities__grid { grid-template-columns: 1fr; }
  .apt-amenities__group:not(:nth-child(2n)) { padding-right: 0; }
  /* Gallery → single column on mobile: each photo full-width, natural
     ratio, never cropped (Highstay mobile style). */
  .apt-gallery__grid { column-count: 1; }
  .apt-other__head { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* ═══════════════════════════════════════════════════════════════
   GALLERY LIGHTBOX — Highstay-style minimal viewer
   ═══════════════════════════════════════════════════════════════ */

/* "Vedi tutte le foto" button */
.apt-gallery__all {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: clamp(28px, 4vw, 44px) auto 0;
  font-family: var(--font-body);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dark);
  background: transparent;
  border: 1px solid var(--rule-dark, rgba(43,22,15,0.2));
  border-radius: 999px;
  padding: 14px 26px;
  cursor: pointer;
  transition: background 0.4s var(--ease-out), color 0.4s var(--ease-out), border-color 0.4s var(--ease-out);
}
.apt-gallery__all:hover {
  background: var(--dark);
  color: var(--cream);
  border-color: var(--dark);
}
.apt-gallery__all-count {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.7;
}
.apt-gallery__all .arrow { transition: transform 0.4s var(--ease-out); }
.apt-gallery__all:hover .arrow { transform: translateX(5px); }

/* Overlay */
.lb {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(20, 10, 7, 0.96);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}
.lb.is-open { opacity: 1; visibility: visible; }

/* Close */
.lb__close {
  position: absolute;
  top: clamp(18px, 3vw, 32px);
  right: clamp(18px, 3vw, 32px);
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 3;
}
.lb__close span {
  position: absolute;
  width: 20px; height: 1px;
  background: var(--cream);
  transition: background 0.3s;
}
.lb__close span:first-child { transform: rotate(45deg); }
.lb__close span:last-child { transform: rotate(-45deg); }
.lb__close:hover span { background: var(--greige-soft, #c2bbb0); }

/* Counter */
.lb__counter {
  position: absolute;
  top: clamp(22px, 3vw, 38px);
  left: clamp(20px, 3.5vw, 40px);
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: rgba(247, 245, 240, 0.7);
  z-index: 3;
}
.lb__counter .lb__index { color: var(--cream); }

/* Stage */
.lb__stage {
  position: relative;
  width: min(92vw, 1400px);
  height: min(74vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb__img {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(1.012);
  transition: opacity 0.55s var(--ease-out), transform 0.7s var(--ease-out);
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
.lb__img.is-front { opacity: 1; transform: scale(1); }

/* Arrows */
.lb__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 56px; height: 56px;
  display: grid;
  place-items: center;
  font-size: 30px;
  line-height: 1;
  color: var(--cream);
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s;
}
.lb__arrow:hover { opacity: 1; }
.lb__arrow--prev { left: clamp(8px, 2vw, 28px); }
.lb__arrow--next { right: clamp(8px, 2vw, 28px); }

/* Thumbnail strip */
.lb__thumbs {
  position: absolute;
  bottom: clamp(16px, 2.5vw, 28px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  max-width: 92vw;
  overflow-x: auto;
  padding: 6px 4px;
  scrollbar-width: none;
  z-index: 3;
}
.lb__thumbs::-webkit-scrollbar { display: none; }
.lb__thumb {
  flex: 0 0 auto;
  width: 56px; height: 40px;
  padding: 0;
  border: 1px solid transparent;
  background: rgba(247,245,240,0.06);
  cursor: pointer;
  overflow: hidden;
  opacity: 0.5;
  transition: opacity 0.3s, border-color 0.3s;
}
.lb__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb__thumb:hover { opacity: 0.85; }
.lb__thumb.is-active { opacity: 1; border-color: var(--cream); }

@media (max-width: 768px) {
  /* Taller stage so PORTRAIT photos display large; object-fit:contain
     keeps both orientations fully visible (never cropped). Leave room
     for the thumbnail strip + counter. */
  .lb__stage { width: 94vw; height: 78vh; margin-top: -4vh; }
  .lb__arrow { display: none; }          /* finger-swipe instead of arrows */
  .lb__thumbs { bottom: 10px; }
  .lb__thumb { width: 46px; height: 34px; }
  /* Hint that the gallery is swipeable */
  .lb__img { touch-action: pan-y; }
}

/* ── Map pin (apartment detail) — teardrop, tip on the exact spot ── */
.tcs-pin-wrap { background: transparent !important; border: none !important; }
.tcs-pin {
  position: relative;
  width: 30px;
  height: 30px;
  background: var(--dark);
  border: 2px solid var(--cream);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 6px 16px rgba(43, 22, 15, 0.35);
  cursor: pointer;
  transition: transform 0.35s var(--ease-out);
}
.tcs-pin::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px;
  background: var(--cream);
  border-radius: 50%;
}
.tcs-pin:hover { transform: rotate(-45deg) scale(1.12); }
/* Leaflet zoom/attribution refinement (apartment map) */
#aptMap .leaflet-control-zoom { border: none !important; box-shadow: none !important; }
#aptMap .leaflet-control-zoom a {
  background: var(--cream) !important;
  color: var(--dark) !important;
  border: 1px solid var(--rule) !important;
  font-family: var(--font-display) !important;
  font-weight: 200 !important;
}
#aptMap .leaflet-control-attribution { font-size: 9px; opacity: 0.5; }

/* CIN — codice identificativo nazionale (obbligo di legge) */
.apt-cta__cin {
  margin-top: 26px;
  font-family: var(--font-body);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  color: rgba(247, 245, 240, 0.4);
}
