/* ==========================================================================
   Casa PièTorri — design tokens
   Palette allineata al logo: oro mimosa e verde oliva del ramo, bruno
   caldo del lettering "PièTorri", terracotta dei coppi, pietra e intonaco
   della villetta anni '50.
   ========================================================================== */

:root {
  --bg: #FBF8F0;
  --bg-card: #FFFFFF;
  --ink: #221C12;
  --ink-soft: #5A5142;
  --hill: #5F7A32;
  --hill-dark: #34290F;
  --stone: #DCD3BE;
  --stone-dark: #C7BB9E;
  --mimosa: #F0C22E;
  --mimosa-dark: #B3830D;
  --mimosa-soft: #FBEACB;
  --terracotta: #A8543E;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: 3rem;
  --space-5: 5rem;
  --space-6: 8rem;

  --radius: 6px;
  --max-width: 1180px;
  --border: 1px solid var(--stone-dark);
}

@media (prefers-color-scheme: dark) {
  /* Il sito è pensato per restare chiaro anche in dark mode di sistema:
     una villetta di campagna comunica meglio con luce naturale. */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

/* ---------- Lingua ---------- */
body.lang-en .it { display: none !important; }
body.lang-en .en { display: initial !important; }
body:not(.lang-en) .en { display: none !important; }

/* ---------- Tipografia ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; color: var(--mimosa-dark); }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); font-style: italic; font-weight: 500; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
h3 { font-size: 1.25rem; }

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--mimosa-dark);
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 0.6em;
  vertical-align: middle;
}

.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 46ch; }

/* Chip dato/distanza: l'elemento firma del sito, riusato nella scheda
   tecnica e nella sezione dintorni per ancorare tutto a numeri concreti. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  background: var(--mimosa);
  color: var(--hill-dark);
  padding: 0.3em 0.7em;
  border-radius: 999px;
  white-space: nowrap;
}
/* Un solo stile per tutte le chip: il beige su fondo chiaro aveva un contrasto
   troppo basso. Oro mimosa + bruno scuro ≈ 8:1, ben oltre la soglia WCAG AA. */

/* ---------- Header ---------- */
header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 245, 237, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: var(--border);
}
header.site .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  max-width: var(--max-width);
  margin: 0 auto;
  gap: var(--space-2);
}
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.brand-logo {
  height: 64px;
  width: auto;
  display: block;
}
.footer-logo {
  height: 84px;
}
nav.site-nav { display: flex; gap: var(--space-3); align-items: center; }
nav.site-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}
nav.site-nav a:hover { color: var(--mimosa-dark); border-color: var(--mimosa); }

.lang-switch {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  display: flex;
  border: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.lang-switch button {
  border: none;
  background: transparent;
  padding: 0.35em 0.8em;
  cursor: pointer;
  color: var(--ink-soft);
  font-family: inherit;
}
.lang-switch button[aria-pressed="true"] { background: var(--mimosa); color: var(--hill-dark); }

.nav-toggle { display: none; }

@media (max-width: 780px) {
  nav.site-nav { position: fixed; inset: 60px var(--space-3) auto var(--space-3);
    background: var(--bg-card); border: var(--border); border-radius: var(--radius);
    flex-direction: column; align-items: flex-start; padding: var(--space-2);
    box-shadow: 0 10px 30px rgba(32,41,29,0.12); display: none; }
  nav.site-nav.open { display: flex; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: var(--border); border-radius: var(--radius);
    background: var(--bg-card); cursor: pointer;
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 86vh;
  display: flex;
  align-items: flex-start;
  color: #fff;
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; }
.hero-bg img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.4s ease;
}
.hero-bg img.active { opacity: 1; }
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 55% 42% at 50% 32%, rgba(32,41,29,0.55) 0%, rgba(32,41,29,0.18) 60%, rgba(32,41,29,0) 100%);
}
.hero .content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--space-5) var(--space-3) var(--space-4);
  max-width: var(--max-width); margin: 0 auto; width: 100%;
}
.hero h1 { margin: 0; line-height: 0; }
.hero-logo {
  height: clamp(90px, 14vw, 170px); width: auto;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.55)) drop-shadow(0 10px 26px rgba(0,0,0,0.4));
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.hero .lede { color: #EDEAE0; max-width: 46ch; }
.hero .cues { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; justify-content: center; }

/* ---------- Sezioni ---------- */
section { padding: var(--space-6) 0; }
section.alt { background: var(--bg-card); }
.section-head { max-width: 62ch; margin-bottom: var(--space-4); }
.section-head .eyebrow { margin-bottom: var(--space-1); display: block; }

/* ---------- La casa ---------- */
.casa-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
.casa-grid p { margin: 0 0 var(--space-2); color: var(--ink-soft); }
.casa-grid p:first-of-type { color: var(--ink); font-size: 1.08rem; }

.spec-sheet {
  background: var(--bg-card);
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.spec-sheet .spec-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
  background: var(--mimosa);
  color: var(--hill-dark);
}
.spec-sheet dl { margin: 0; }
.spec-sheet .row {
  display: flex; justify-content: space-between; gap: var(--space-2);
  padding: 0.85em var(--space-3);
  border-top: 1px solid var(--stone);
  font-size: 0.94rem;
}
.spec-sheet .row dt { color: var(--ink-soft); }
.spec-sheet .row dd { margin: 0; font-family: var(--font-mono); font-size: 0.86rem; text-align: right; color: var(--hill-dark); }

/* ---------- Dintorni ---------- */
.dintorni-groups { display: grid; gap: var(--space-3); }
.dintorni-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-3);
  background: var(--bg-card);
  border: var(--border);
  border-left: 3px solid var(--mimosa);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.dintorni-card .chips { margin-top: var(--space-2); display: flex; gap: 0.5em; flex-wrap: wrap; }
.dintorni-card p { margin: 0.4em 0 0; color: var(--ink-soft); }

@media (max-width: 700px) {
  .dintorni-card { grid-template-columns: 1fr; }
  .casa-grid { grid-template-columns: 1fr; }
}

/* ---------- Galleria ---------- */
/* Filmstrip orizzontale: mostra solo una manciata di foto per volta e
   lascia intravedere la successiva (+ sfumatura) per segnalare che se ne
   può scorrere altre — resta leggera anche aggiungendo molte foto, perché
   quelle fuori vista si caricano solo quando servono (loading="lazy"). */
.gallery-wrap { position: relative; }
.gallery-grid {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  padding-bottom: var(--space-1);
  scrollbar-width: thin;
  scrollbar-color: var(--stone-dark) transparent;
}
.gallery-grid button {
  flex: 0 0 auto;
  width: 240px;
  height: 280px;
  scroll-snap-align: start;
  padding: 0; border: 2px solid transparent; cursor: pointer; overflow: hidden; border-radius: var(--radius);
  position: relative; background: var(--stone);
  transition: border-color .25s ease;
}
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.gallery-grid button:hover { border-color: var(--mimosa); }
.gallery-grid button:hover img { transform: scale(1.05); }

.gallery-fade {
  position: absolute; top: 0; bottom: var(--space-1); width: 70px;
  pointer-events: none; transition: opacity .2s ease;
}
.gallery-fade.right { right: 0; background: linear-gradient(90deg, transparent, var(--bg) 88%); }
.gallery-fade.left { left: 0; background: linear-gradient(270deg, transparent, var(--bg) 88%); opacity: 0; }
.gallery-fade.left.show { opacity: 1; }
.gallery-fade.right.hide { opacity: 0; }

.gallery-nav-btn {
  position: absolute; top: calc(50% - var(--space-1) / 2); transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-card); border: var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: var(--hill-dark);
  box-shadow: 0 4px 14px rgba(32,41,29,0.15);
  transition: opacity .2s ease, background .2s ease, color .2s ease;
}
.gallery-nav-btn:hover { background: var(--mimosa); border-color: var(--mimosa); color: var(--hill-dark); }
.gallery-nav-btn.prev { left: 4px; }
.gallery-nav-btn.next { right: 4px; }
.gallery-nav-btn.hide { opacity: 0; pointer-events: none; }

@media (max-width: 780px) {
  .gallery-grid button { width: 190px; height: 220px; }
  .gallery-nav-btn { display: none; }
}

.lightbox {
  position: fixed; inset: 0; background: rgba(32,41,29,0.92);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: var(--space-3);
  touch-action: pan-y;
}
.lightbox.open { display: flex; }
.lightbox .stage { position: relative; display: flex; align-items: center; justify-content: center; max-width: 100%; }
.lightbox img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; border-radius: var(--radius); user-select: none; }
.lightbox button.close {
  position: absolute; top: var(--space-3); right: var(--space-3);
  background: none; border: 1px solid rgba(255,255,255,0.5); color: #fff;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 1.1rem;
}
.lightbox button.nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.5); color: #fff;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
}
.lightbox button.nav:hover { background: var(--mimosa); border-color: var(--mimosa); color: var(--hill-dark); }
.lightbox button.prev { left: -60px; }
.lightbox button.next { right: -60px; }
@media (max-width: 900px) {
  .lightbox button.prev { left: var(--space-1); }
  .lightbox button.next { right: var(--space-1); }
}
.lightbox .cap { position: absolute; bottom: var(--space-3); left: 0; right: 0; text-align: center; color: var(--stone); font-family: var(--font-mono); font-size: 0.85rem; }

/* ---------- Recensioni ---------- */
.reviews-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin-bottom: var(--space-4); }
.review-card { background: var(--bg-card); border: var(--border); border-top: 3px solid var(--mimosa); border-radius: var(--radius); padding: var(--space-3); }
.review-card .stars { color: var(--mimosa-dark); letter-spacing: 2px; font-size: 0.95rem; }
.review-card .who { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); margin-top: var(--space-2); }
.review-card p.text { margin: 0.6em 0 0; }
.reviews-empty { font-family: var(--font-mono); font-size: 0.9rem; color: var(--ink-soft); padding: var(--space-3); border: 1px dashed var(--stone-dark); border-radius: var(--radius); }

@media (max-width: 900px) { .reviews-grid { grid-template-columns: 1fr; } }

.review-form, .contact-form { max-width: 560px; }
.field { margin-bottom: var(--space-2); }
.field label { display: block; font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.4em; }
.field input, .field textarea {
  width: 100%; padding: 0.7em 0.85em; border: var(--border); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 0.98rem; background: #fff; color: var(--ink);
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--mimosa);
  box-shadow: 0 0 0 3px rgba(239,180,41,0.25);
}

.star-input { display: flex; gap: 0.3em; font-size: 1.6rem; }
.star-input button { background: none; border: none; cursor: pointer; color: var(--stone-dark); padding: 0; line-height: 1; }
.star-input button.active, .star-input button:hover { color: var(--mimosa-dark); }

.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  background: var(--mimosa); color: var(--hill-dark); border: none;
  padding: 0.85em 1.6em; border-radius: 999px; font-family: var(--font-body); font-weight: 600;
  font-size: 0.95rem; cursor: pointer; text-decoration: none;
  transition: background .2s ease, transform .2s ease;
}
.btn:hover { background: var(--mimosa-dark); }
.btn.secondary { background: transparent; color: var(--hill-dark); border: 1px solid var(--hill); }
.btn.secondary:hover { background: var(--hill); color: #fff; }

.form-msg { font-family: var(--font-mono); font-size: 0.85rem; margin-top: var(--space-2); display: none; }
.form-msg.show { display: block; }
.form-msg.ok { color: var(--hill-dark); }
.form-msg.err { color: var(--terracotta); }

/* ---------- Come arrivare ---------- */
.arrivo-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
.map-frame {
  border: var(--border);
  border-top: 3px solid var(--mimosa);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--stone);
}
.map-frame iframe { display: block; width: 100%; height: 380px; border: 0; }
.arrivo-row { margin-bottom: var(--space-3); }
.arrivo-row .eyebrow { display: block; margin-bottom: var(--space-1); }
.arrivo-row p { margin: 0 0 var(--space-2); color: var(--ink-soft); }
.arrivo-row .chips { display: flex; gap: 0.5em; flex-wrap: wrap; }

@media (max-width: 900px) {
  .arrivo-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .map-frame iframe { height: 280px; }
}

/* ---------- Contatti ---------- */
/* Colonna singola: le indicazioni stradali vivono nella sezione "Come arrivare". */
.contatti-grid { max-width: 620px; }
.contatti-info { margin-bottom: var(--space-4); }

/* ---------- Footer ---------- */
footer.site {
  background: var(--hill-dark); color: var(--stone);
  border-top: 3px solid var(--mimosa);
  padding: var(--space-4) 0 var(--space-3);
}
footer.site .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
footer.site a { color: var(--stone); text-decoration: none; }
footer.site nav a:hover { color: var(--mimosa); }
footer.site nav a { margin-right: var(--space-2); font-size: 0.9rem; }
footer.site .credit { width: 100%; margin-top: var(--space-3); font-family: var(--font-mono); font-size: 0.75rem; color: var(--stone-dark); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
