/* ==========================================================================
   Appartamenti Aprica — design tokens
   ========================================================================== */
:root {
  --color-bg: oklch(97% 0.012 75);
  --color-bg-alt: oklch(93% 0.012 75);
  --color-cream: oklch(91% 0.025 65);
  --color-cream-solid: oklch(98% 0.008 65);

  --color-text: oklch(24% 0.012 75);
  --color-text-body: oklch(32% 0.012 75);
  --color-text-body-2: oklch(24% 0.012 75 / 0.85);
  --color-text-muted: oklch(45% 0.012 75);
  --color-text-warm-dark: oklch(26% 0.02 50);
  --color-text-light: oklch(98% 0.01 75);

  --color-terracotta: oklch(50% 0.11 40);
  --color-terracotta-hover: oklch(42% 0.11 40);
  --color-terracotta-border: oklch(36% 0.1 40);
  --color-forest: oklch(30% 0.06 150);
  --color-forest-border: oklch(20% 0.06 150);
  --color-forest-eyebrow: oklch(50% 0.11 150);
  --color-mint-bg: oklch(93% 0.03 150);
  --color-mint-text: oklch(30% 0.06 150);

  --color-overlay: oklch(10% 0.01 75 / 0.93);
  --color-hero-gradient: oklch(15% 0.02 75 / 0.35);

  --radius-pill: 999px;
  --radius-card: 12px;

  --font-display: 'Bellefair', serif;
  --font-serif: 'Source Serif 4', serif;
  --font-body: 'Work Sans', Helvetica, Arial, sans-serif;

  --max-width: 1400px;
  --max-width-narrow: 720px;
  --max-width-apt: 1100px;

  --sticky-nav-height: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}

a { color: var(--color-terracotta); text-decoration: none; }
a:hover { color: var(--color-terracotta-hover); }

img { display: block; max-width: 100%; }

button { font-family: inherit; }

main { max-width: var(--max-width); margin: 0 auto; }

.heading-display {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  margin: 10px 0 16px;
}

.heading-serif {
  font-family: var(--font-serif);
  font-weight: 600;
  margin: 10px 0 14px;
}

.eyebrow {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-forest-eyebrow);
  font-weight: 600;
}

.body-text {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text-body);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 13px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--color-terracotta); color: var(--color-text-light); border: 1.5px solid var(--color-terracotta-border); }
.btn-primary:hover { background: var(--color-terracotta-hover); color: var(--color-text-light); }

.btn-forest { background: var(--color-forest); color: var(--color-text-light); border: 1.5px solid var(--color-forest-border); }
.btn-forest:hover { opacity: 0.9; color: var(--color-text-light); }

.btn-outline-dark {
  background: transparent;
  border: 1.5px solid var(--color-text-warm-dark);
  color: var(--color-text-warm-dark);
}
.btn-outline-dark:hover { background: oklch(26% 0.02 50 / 0.06); color: var(--color-text-warm-dark); }

.btn-outline-muted {
  background: transparent;
  border: 1.5px solid var(--color-text-muted);
  color: var(--color-text-body);
}
.btn-outline-muted:hover { background: oklch(24% 0.012 75 / 0.05); color: var(--color-text-body); }

.btn-pill-outline {
  background: transparent;
  border: 1px solid var(--color-text-muted);
  color: var(--color-text-body);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  min-height: 40px;
  cursor: pointer;
}
.btn-pill-outline:hover { background: oklch(24% 0.012 75 / 0.05); }

.cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
}
.cta-row-center { justify-content: center; }

/* ==========================================================================
   Language switcher
   ========================================================================== */
.lang-switcher {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 50;
  display: flex;
  gap: 4px;
  background: oklch(97% 0.012 75 / 0.92);
  backdrop-filter: blur(6px);
  padding: 4px;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 10px oklch(24% 0.012 75 / 0.15);
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text);
  min-height: 36px;
}
.lang-btn:hover { background: oklch(91% 0.012 75); }
.lang-btn.active { background: oklch(91% 0.012 75); color: var(--color-terracotta); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-bg-alt);
}

.hero-image-wrap { position: absolute; inset: 0; }

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--color-hero-gradient) 0%, oklch(15% 0.02 75 / 0) 30%);
  pointer-events: none;
}

.hero-panel {
  background: var(--color-cream);
  color: var(--color-text-warm-dark);
  padding: 36px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 36px;
  line-height: 1;
  margin: 0;
  letter-spacing: 0.01em;
}

.hero-tag {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.75;
}

.hero-sub {
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.7;
}

/* ==========================================================================
   Intro / house section
   ========================================================================== */
.intro {
  padding: 56px 24px 40px;
  background: var(--color-bg-alt);
}

.intro-inner {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  text-align: center;
}

.intro-inner .body-text { margin: 0 0 28px; }

.map-wrap {
  margin-top: 24px;
  border-radius: var(--radius-card);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid oklch(85% 0.012 75);
}

.map-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ==========================================================================
   Photo grid + thumbnails
   ========================================================================== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.photo-thumb {
  position: relative;
  width: 100%;
  height: 240px;
  cursor: pointer;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--color-bg-alt);
  border: none;
  padding: 0;
  display: block;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb .photo-placeholder {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 12px;
  background: var(--color-bg-alt);
  border: 1px dashed oklch(60% 0.012 75 / 0.5);
  border-radius: var(--radius-card);
}

.photo-thumb.missing .photo-placeholder { display: flex; }
.photo-thumb.missing img { display: none; }

.photo-placeholder-icon {
  width: 28px;
  height: 28px;
  opacity: 0.45;
}

.photo-placeholder-label {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   Sticky apartment nav
   ========================================================================== */
.apt-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: oklch(91% 0.025 65 / 0.97);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid oklch(82% 0.025 65);
}

.apt-nav-link {
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--color-cream-solid);
  border: 1.5px solid oklch(70% 0.025 65);
  color: var(--color-text-warm-dark);
  font-weight: 600;
  font-size: 14px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.apt-nav-link:hover { background: oklch(94% 0.02 65); color: var(--color-text-warm-dark); }


/* ==========================================================================
   Apartments header + sections
   ========================================================================== */
.apts-header {
  padding: 32px 24px 8px;
  text-align: center;
}

.apt-section {
  padding: 36px 24px 48px;
  border-bottom: 1px solid oklch(88% 0.012 75);
  scroll-margin-top: var(--sticky-nav-live-height, var(--sticky-nav-height));
}

.apt-section-inner { max-width: var(--max-width-apt); margin: 0 auto; }

.apt-heading-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.apt-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 26px;
  margin: 0;
}

.apt-type-floor {
  font-size: 17px;
  color: var(--color-text-body);
}

.apt-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 16px 0 22px;
}

.apt-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.apt-stat-value { font-size: 20px; font-weight: 600; }
.apt-stat-label { font-size: 12px; color: var(--color-text-muted); }

.apt-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.apt-feature-pill {
  font-size: 13px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-mint-bg);
  color: var(--color-mint-text);
}

.apt-cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.apt-price-note {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 12px 0 0;
}

/* ==========================================================================
   Contact / footer band
   ========================================================================== */
.contact {
  padding: 56px 24px 32px;
  text-align: center;
  background: var(--color-bg-alt);
}

.contact .heading-serif { font-size: 30px; }

.contact .body-text {
  max-width: 480px;
  margin: 0 auto 24px;
  font-size: 15px;
}

.site-footer {
  padding: 20px 24px 40px;
  text-align: center;
  background: var(--color-bg-alt);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-logo { height: 26px; width: auto; }

.footer-credit {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox[hidden] { display: none; }

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  background: transparent;
  border: none;
  color: var(--color-text-light);
  font-size: 30px;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  line-height: 1;
}

.lightbox-content {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lightbox-arrow {
  background: oklch(30% 0.012 75 / 0.6);
  border: none;
  color: var(--color-text-light);
  border-radius: var(--radius-pill);
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.lightbox-arrow:hover { background: oklch(30% 0.012 75 / 0.8); }

.lightbox-image-wrap {
  flex: 1;
  aspect-ratio: 4 / 3;
  position: relative;
  background: oklch(20% 0.012 75);
  border-radius: 4px;
  overflow: hidden;
}

.lightbox-img { width: 100%; height: 100%; object-fit: contain; }

.lightbox-image-wrap .photo-placeholder {
  border: 1px dashed oklch(70% 0.012 75 / 0.4);
}
.lightbox-image-wrap .photo-placeholder-label { color: oklch(80% 0.012 75); }

.lightbox-caption {
  color: var(--color-text-light);
  margin-top: 14px;
  font-size: 14px;
  opacity: 0.85;
  text-align: center;
}

/* ==========================================================================
   Responsive tweaks
   ========================================================================== */
@media (min-width: 640px) {
  .hero-title { font-size: 44px; }
  .apt-name { font-size: 26px; }
}

@media (max-width: 600px) {
  /* "Appartamento C/D/E" per intero non ci sta su una riga sola su
     schermi stretti e va a capo — è voluto (il cliente non vuole
     l'abbreviazione "App."). Il margine di sicurezza sopra ogni sezione
     appartamento (per non finire tagliata sotto la barra sticky, qualunque
     sia la sua altezza reale una volta andata a capo) è calcolato in
     automatico da JS in updateStickyNavOffset(), non un numero fisso qui.

     Margine di sicurezza separato: la barra sticky deve comunque iniziare
     abbastanza in basso da non finire mai sotto il selettore lingua fisso
     in alto, indipendentemente da quante righe occupa. */
  .apt-nav { padding-top: 56px; }

  /* Lightbox: su schermi stretti le frecce a fianco della foto le
     lasciavano pochissima larghezza, e con l'aspect-ratio 4:3 fisso la
     foto risultava piccola con tanto nero sopra/sotto. Le frecce diventano
     overlay sopra la foto, che così può usare quasi tutto lo schermo. */
  .lightbox-content {
    position: relative;
    flex: 1;
    min-height: 0;
    max-width: 100%;
  }
  .lightbox-image-wrap {
    aspect-ratio: auto;
    width: 100%;
    height: 100%;
  }
  .lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
  }
  .lightbox-prev { left: 6px; }
  .lightbox-next { right: 6px; }
  .lightbox-caption { margin-top: 8px; font-size: 13px; }
}

@media (max-width: 480px) {
  .apts-header { padding: 28px 16px 8px; }
  .apt-section { padding: 28px 16px 36px; }
  .contact, .intro { padding-left: 16px; padding-right: 16px; }
  .lang-switcher { top: 10px; right: 10px; }
  .lang-btn { padding: 7px 9px; font-size: 12px; }
}
