/* ==========================================================================
   Il Poggiolino d'Oro — Design system "Toscana contemporanea"
   Classico: cotto, travi di castagno, oro antico, intonaco a calce, archi.
   Contemporaneo: tipografia editoriale, numeri grandi, griglie asimmetriche,
   timeline, dark mode, motion leggero e rispettoso di prefers-reduced-motion.
   ========================================================================== */

:root {
  /* Colori — light */
  --calce: #F7F1E7;        /* intonaco a calce: sfondo */
  --calce-2: #EFE5D4;      /* superficie alternata */
  --pietra: #D9CCB6;       /* bordi, linee */
  --castagno: #2B1A12;     /* testo principale, travi */
  --castagno-2: #5A4436;   /* testo secondario */
  --cotto: #A9472A;        /* accento primario (AA su calce) */
  --cotto-2: #C4643F;
  --oro: #B8902F;          /* oro antico: decorazione, mai testo piccolo su chiaro */
  --oro-chiaro: #E3C77A;
  --salvia: #5F6B4E;       /* oliveto: tag e info */
  --bg: var(--calce);
  --surface: #FFFDF8;
  --text: var(--castagno);
  --muted: var(--castagno-2);
  --line: var(--pietra);
  --accent: var(--cotto);
  --on-dark: #F7F1E7;

  /* Tipografia */
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-0: clamp(.86rem, .82rem + .15vw, .94rem);
  --fs-1: clamp(1rem, .96rem + .2vw, 1.09rem);
  --fs-2: clamp(1.2rem, 1.1rem + .45vw, 1.45rem);
  --fs-3: clamp(1.5rem, 1.25rem + 1vw, 2.1rem);
  --fs-4: clamp(2.1rem, 1.6rem + 2.4vw, 3.6rem);
  --fs-5: clamp(2.6rem, 1.8rem + 4vw, 5.2rem);

  /* Spaziature (scala 4/8) */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem;
  --s6: 2rem; --s7: 3rem; --s8: 4.5rem; --s9: 7rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --maxw: 1180px;
  --measure: 68ch;

  /* Forme */
  --r-sm: 6px; --r-md: 14px; --r-lg: 28px;
  --arch: 999px 999px var(--r-md) var(--r-md);  /* arco toscano */
  --shadow: 0 1px 2px rgb(43 26 18 / .06), 0 12px 32px -12px rgb(43 26 18 / .22);
  --ease: cubic-bezier(.2,.7,.2,1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17100C; --surface: #211812; --text: #F3EADB; --muted: #C9B9A4;
    --line: #3B2C22; --accent: #E0855E; --calce-2: #1D1510; --oro: #D9B65C;
  }
}
:root[data-theme="dark"] {
  --bg: #17100C; --surface: #211812; --text: #F3EADB; --muted: #C9B9A4;
  --line: #3B2C22; --accent: #E0855E; --calce-2: #1D1510; --oro: #D9B65C;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs-1)/1.65 var(--sans); overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.12; letter-spacing: -.01em; margin: 0 0 var(--s4); font-variation-settings: "SOFT" 50, "opsz" 96; }
h1 { font-size: var(--fs-5); }
h2 { font-size: var(--fs-4); margin-top: var(--s8); }
h3 { font-size: var(--fs-2); margin-top: var(--s6); font-family: var(--sans); font-weight: 700; letter-spacing: 0; }
p, ul, ol { margin: 0 0 var(--s4); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--s4); top: var(--s4); z-index: 99; background: var(--surface); padding: var(--s2) var(--s4); }
.small { font-size: var(--fs-0); color: var(--muted); }

/* Header */
.top {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4); padding: var(--s3) var(--gutter);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { font-family: var(--serif); font-size: 1.25rem; color: var(--text); text-decoration: none; line-height: 1.1; }
.brand span { display: block; font: 700 .68rem/1.4 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--oro); }
.nav { display: flex; align-items: center; gap: var(--s5); }
.nav a { color: var(--text); text-decoration: none; font-size: var(--fs-0); font-weight: 600; }
.nav a[aria-current="page"] { color: var(--accent); }
.nav a:not(.btn):hover { color: var(--accent); }
.nav .lang { border: 1px solid var(--line); padding: .2rem .55rem; border-radius: 99px; font-size: .75rem; letter-spacing: .08em; }
.menu-btn { display: none; font: 700 var(--fs-0) var(--sans); background: none; border: 1px solid var(--line); color: var(--text); padding: .45rem .9rem; border-radius: 99px; }
@media (max-width: 960px) {
  .menu-btn { display: inline-block; }
  .nav { display: none; position: absolute; inset: 100% 0 auto; flex-direction: column; align-items: flex-start; gap: var(--s4);
         padding: var(--s5) var(--gutter) var(--s6); background: var(--bg); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .nav a { font-size: var(--fs-1); }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 48px; padding: .8rem 1.5rem;
       border-radius: 99px; font: 700 var(--fs-0)/1 var(--sans); letter-spacing: .04em; text-decoration: none;
       transition: transform .25s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease); }
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn-gold { background: var(--cotto); color: #FFF8EE; box-shadow: 0 8px 24px -10px rgb(169 71 42 / .7); }
.btn-gold:hover { background: #8F3A21; }
.btn-ghost { border: 1.5px solid currentColor; color: var(--text); }
.btn-ghost-light { border: 1.5px solid rgb(255 248 238 / .7); color: #FFF8EE; }
.btn-sm { min-height: 40px; padding: .55rem 1.1rem; color: #FFF8EE !important; }
.cta-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* Hero: foto piena, velatura castagno, titolo editoriale */
.hero {
  position: relative; isolation: isolate; display: grid; align-items: end;
  min-height: min(62vh, 620px); padding: var(--s9) var(--gutter) var(--s7);
  color: #FFF8EE; background: var(--castagno);
}
.hero::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--hero) center/cover no-repeat; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgb(23 16 12 / .25) 0%, rgb(23 16 12 / .45) 45%, rgb(23 16 12 / .88) 100%); }
.hero-home { min-height: min(88vh, 860px); }
.hero-inner { width: 100%; max-width: var(--maxw); margin: 0 auto; }
.hero h1 { max-width: 18ch; color: #FFF8EE; text-wrap: balance; }
.hero .lead { max-width: 56ch; font-size: var(--fs-2); line-height: 1.5; color: rgb(255 248 238 / .92); margin-bottom: var(--s5); }
.eyebrow { font: 700 .74rem/1.4 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--oro-chiaro); margin-bottom: var(--s3); }
.crumbs { font-size: var(--fs-0); margin-bottom: var(--s4); color: rgb(255 248 238 / .8); }
.crumbs a { color: inherit; }

/* Layout pagina: contenuto + scheda "In breve" sticky */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: var(--s7) var(--gutter) var(--s8);
        display: grid; gap: var(--s7); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) {
  .wrap { grid-template-columns: minmax(0, 1fr) 340px; column-gap: var(--s8); }
  .facts { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 96px; align-self: start; }
  .content, .faq { grid-column: 1; }
}
.content { max-width: var(--measure); }
.content > h2:first-child { margin-top: 0; }
.content ul { padding-left: 1.1em; }
.content li { margin-bottom: .4em; }
.content li::marker { color: var(--oro); }
.updated { margin-top: var(--s7); font-size: var(--fs-0); color: var(--muted); border-top: 1px solid var(--line); padding-top: var(--s4); }

/* Facts card: la "risposta" per Google e AI */
.facts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5) var(--s5) var(--s4); box-shadow: var(--shadow); }
.facts h2 { font: 700 .74rem/1.4 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--accent); margin: 0 0 var(--s3); }
.facts dl { margin: 0; }
.facts dl > div { display: grid; grid-template-columns: 9.5em 1fr; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); font-size: var(--fs-0); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

/* Numeri editoriali (distanze) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s4); margin: var(--s6) 0; padding: 0; list-style: none; }
.stats li { border-top: 2px solid var(--oro); padding-top: var(--s3); margin: 0; }
.stats b { display: block; font: 500 var(--fs-4)/1 var(--serif); color: var(--accent); }
.stats span { font-size: var(--fs-0); color: var(--muted); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); margin: var(--s5) 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s5); transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.tag { display: inline-block; font: 700 .7rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--salvia); background: color-mix(in srgb, var(--salvia) 12%, transparent); padding: .4em .7em; border-radius: 99px; margin-bottom: var(--s3); }

/* Gallery ad archi toscani, scroll-snap su mobile */
.gallery { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 30%); gap: var(--s4); overflow-x: auto; scroll-snap-type: x mandatory; padding: var(--s2) 0 var(--s4); margin: var(--s5) 0; scrollbar-width: thin; }
.gallery figure { margin: 0; scroll-snap-align: start; }
.gallery img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: var(--arch); background: var(--calce-2); }
.gallery figcaption { font-size: var(--fs-0); color: var(--muted); margin-top: var(--s2); text-align: center; }
.arch { border-radius: var(--arch); overflow: hidden; }
.split { display: grid; gap: var(--s6); align-items: center; margin: var(--s7) 0; }
@media (min-width: 760px) { .split { grid-template-columns: 1fr 1fr; } }
.split img { border-radius: var(--arch); aspect-ratio: 4/5; object-fit: cover; width: 100%; }

/* Timeline eventi */
.timeline { list-style: none; padding: 0; margin: var(--s5) 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 var(--s5) var(--s5); margin: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .45em; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--oro); }
.timeline time { display: block; font: 700 var(--fs-0)/1.4 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.timeline strong { font-family: var(--serif); font-weight: 500; font-size: var(--fs-2); display: block; }
.timeline .meta { font-size: var(--fs-0); color: var(--muted); }
.badge { display: inline-block; font: 700 .66rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; padding: .35em .6em; border-radius: 99px; vertical-align: middle; margin-left: .4em; }
.badge-ok { background: color-mix(in srgb, var(--salvia) 16%, transparent); color: var(--salvia); }
.badge-est { background: color-mix(in srgb, var(--oro) 20%, transparent); color: var(--castagno-2); }

/* Tabelle */
.table-wrap { overflow-x: auto; margin: var(--s5) 0; border: 1px solid var(--line); border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-0); background: var(--surface); }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; background: var(--calce-2); }
tr:last-child td { border-bottom: 0; }

/* Callout / risposta diretta */
.answer { border-left: 4px solid var(--oro); background: var(--surface); padding: var(--s4) var(--s5); border-radius: 0 var(--r-md) var(--r-md) 0; font-size: var(--fs-2); line-height: 1.5; font-family: var(--serif); margin: 0 0 var(--s6); }

/* Recensioni */
.reviews { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); margin: var(--s5) 0; }
.review { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s5); }
.review blockquote { margin: 0 0 var(--s3); font-family: var(--serif); font-size: 1.08rem; line-height: 1.5; }
.review figcaption { font-size: var(--fs-0); color: var(--muted); }
.score { display: flex; flex-wrap: wrap; gap: var(--s5); margin: var(--s5) 0; }
.score a { text-decoration: none; color: var(--text); }
.score b { font: 500 var(--fs-4)/1 var(--serif); color: var(--accent); display: block; }

/* FAQ */
.faq h2 { margin-top: 0; }
.faq details { border-top: 1px solid var(--line); padding: var(--s4) 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: var(--s4); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 1.4rem/1 var(--serif); color: var(--accent); transition: transform .25s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: var(--s3) 0 0; color: var(--muted); max-width: var(--measure); }

/* Banda CTA: il "cotto" */
.cta-band { background: var(--castagno); color: var(--on-dark); text-align: center; padding: var(--s8) var(--gutter);
  background-image: radial-gradient(circle at 20% 0%, rgb(184 144 47 / .22), transparent 55%), radial-gradient(circle at 90% 100%, rgb(169 71 42 / .35), transparent 50%); }
.cta-kicker { font-family: var(--serif); font-size: var(--fs-3); max-width: 30ch; margin: 0 auto var(--s5); line-height: 1.25; }
.cta-band .cta-actions { justify-content: center; }
.cta-band .btn-ghost { color: var(--on-dark); }

/* Footer */
.foot { background: #1E130D; color: #D8C9B5; padding: var(--s8) var(--gutter) var(--s7); font-size: var(--fs-0); }
.foot a { color: var(--oro-chiaro); }
.foot-grid { max-width: var(--maxw); margin: 0 auto; display: grid; gap: var(--s6); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.brand-foot { font-family: var(--serif); font-size: 1.5rem; color: #FFF8EE; }
.foot address { font-style: normal; margin-bottom: var(--s3); }
.foot .small { color: #B8A68F; }
.foot-links { list-style: none; padding: 0; columns: 2; }
.foot-links li { margin-bottom: .5em; }

/* Bottone flottante su mobile */
.fab { display: none; }
@media (max-width: 760px) {
  .fab { display: flex; position: fixed; right: 16px; bottom: 16px; z-index: 60; min-height: 52px; padding: 0 1.4rem; align-items: center;
         border-radius: 99px; background: var(--cotto); color: #FFF8EE; font-weight: 700; text-decoration: none; box-shadow: 0 10px 30px -8px rgb(0 0 0 / .45); }
  .foot { padding-bottom: 6rem; }
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  .hero-inner > * { animation: rise .6s var(--ease) both; }
  .hero-inner > *:nth-child(2) { animation-delay: .08s; }
  .hero-inner > *:nth-child(3) { animation-delay: .16s; }
  .hero-inner > *:nth-child(4) { animation-delay: .24s; }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
  @supports (animation-timeline: view()) {
    .card, .review, .stats li, .gallery figure { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
  }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

/* Stampa */
@media print { .top, .fab, .cta-band, .hero::before, .hero::after { display: none; } .hero { color: #000; background: none; min-height: 0; padding: 0; } }

/* Mobile: hero più compatto, la scheda "In breve" resta vicina al titolo */
@media (max-width: 760px) {
  .hero, .hero-home { min-height: 0; padding-top: var(--s8); padding-bottom: var(--s6); }
  .hero .lead { font-size: var(--fs-1); }
  .facts dl > div { grid-template-columns: 8em 1fr; }
}

/* Video tour */
.video { margin: var(--s5) 0; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); background: var(--castagno); }
.video video { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; }

/* Hero: foto più leggera su mobile */
@media (max-width: 760px) { .hero::before { background-image: var(--hero-sm, var(--hero)); } }

/* Banner consenso statistiche */
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 80; max-width: 560px; margin: 0 auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: var(--s4) var(--s5); font-size: var(--fs-0); }
.consent[hidden] { display: none; }
.consent p { margin: 0 0 var(--s3); }
.consent div { display: flex; gap: var(--s2); justify-content: flex-end; }
.consent .btn-ghost { color: var(--text); }
@media (max-width: 760px) { .consent { bottom: 84px; } }

/* Riquadro stagionale (Natale) in home */
.season { display: grid; gap: var(--s2); margin: 0 0 var(--s6); padding: var(--s5); border-radius: var(--r-lg); text-decoration: none;
  color: #FFF8EE; background: linear-gradient(135deg, #7A2E1A 0%, #A9472A 55%, #B8902F 130%); box-shadow: var(--shadow); }
.season .tag { color: #FFF8EE; background: rgb(255 248 238 / .18); justify-self: start; margin: 0; }
.season strong { font: 500 var(--fs-3)/1.2 var(--serif); }
.season span:last-child { opacity: .92; }
.season:hover { transform: translateY(-2px); transition: transform .25s var(--ease); }
