@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../assets/fonts/Barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("../assets/fonts/Barlow-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("../assets/fonts/Barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../assets/fonts/BarlowCondensed-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../assets/fonts/BarlowCondensed-700.woff2") format("woff2"); }

/* Tre temi colore, scelti dal visitatore con il selettore nell'header (attributo data-theme su <html>):
   scuro (predefinito: fondo grafite, testo calce, accento arancio), chiaro, acciaio corten.
   Tutti i colori passano da queste variabili; ogni combinazione supera i contrasti WCAG AA.
   Angoli vivi ovunque (radius 0). */
:root {
  color-scheme: dark;
  --bg: #151618;
  --surface: #1d1f22;
  --surface-2: #26292d;
  --text: #ebe9e4;
  --muted: #a4a39d;
  --line: color-mix(in srgb, var(--text) 14%, transparent);
  --accent: #d47a2f;
  --accent-hover: #e08a41;
  --line-strong: color-mix(in srgb, var(--text) 45%, transparent); /* bordi dei pulsanti secondari, almeno 3:1 */
  --gutter: 16px;
  --head-h: 68px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --display: "Barlow Condensed", "Barlow", "Arial Narrow", sans-serif;
}
/* Tema chiaro: grigio acciaio, non bianco, per non abbagliare */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #d9dad7;
  --surface: #cccdc9;
  --surface-2: #bfc0bb;
  --text: #141517;
  --muted: #43443f;
  --accent: #7f3a0f;
  --accent-hover: #67300c;
  --line-strong: color-mix(in srgb, var(--text) 60%, transparent);
}
/* Tema acciaio corten: superficie di acciaio patinato, bruno scuro con macchie di ruggine e grana fine.
   La texture è un unico pannello SVG generato (feTurbulence), senza ripetizioni, su uno strato fisso dietro i contenuti.
   Intensità scelta misurando la macchia più chiara: testi almeno 4,5:1 anche lì. */
:root[data-theme="corten"] {
  color-scheme: dark;
  --bg: #2a140a;
  --surface: #371b0e;
  --surface-2: #462313;
  --text: #f7ebe0;
  --muted: #ecd6c3;
  --accent: #f6b27a;
  --accent-hover: #fbc596;
  --corten-texture: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1600'%20height='1000'%20viewBox='0%200%201600%201000'%20preserveAspectRatio='xMidYMid%20slice'%3E%3Cfilter%20id='m'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.0045'%20numOctaves='5'%20seed='11'/%3E%3CfeColorMatrix%20values='0%200%200%200%200.58%20%200%200%200%200%200.24%20%200%200%200%200%200.08%20%200%200%200%201.5%20-0.5'/%3E%3C/filter%3E%3Cfilter%20id='g'%20x='0'%20y='0'%20width='100%25'%20height='100%25'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.8'%20numOctaves='2'%20seed='3'/%3E%3CfeColorMatrix%20values='0%200%200%200%200.08%20%200%200%200%200%200.03%20%200%200%200%200%200.01%20%200%200%200%201.5%20-0.62'/%3E%3C/filter%3E%3Crect%20width='1600'%20height='1000'%20filter='url(%23m)'/%3E%3Crect%20width='1600'%20height='1000'%20filter='url(%23g)'/%3E%3C/svg%3E");
}
:root[data-theme="corten"] body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--corten-texture) center / cover no-repeat; opacity: 0.5;
}
@media (min-width: 768px) { :root { --gutter: 40px; --head-h: 80px; } }
@media (min-width: 1280px) { :root { --gutter: 64px; } }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--head-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Barlow", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
picture { display: contents; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 0.95; letter-spacing: -0.005em; text-transform: uppercase; margin: 0 0 0.4em; text-wrap: balance; }
h1 { font-size: clamp(44px, 7vw, 92px); }
h2 { font-size: clamp(32px, 4.2vw, 56px); }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.lead { font-size: clamp(19px, 1.6vw, 22px); color: var(--muted); max-width: 52ch; }

.wrap { width: 100%; max-width: 1440px; margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--accent); color: var(--bg); padding: 8px 12px; }

/* ---------- Pulsanti e link ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  background: var(--accent); color: var(--bg);
  border: 1px solid var(--accent);
  font: 600 16px/1 "Barlow", sans-serif; letter-spacing: 0.02em;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease), color 0.2s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.link { font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: 2px; transition: color 0.2s; }
.link:hover { color: var(--accent); }

/* ---------- Header ---------- */
.site-head { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-head__in { height: var(--head-h); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.logo { margin: 0; font: 700 30px/1 var(--display); letter-spacing: 0.02em; text-decoration: none; }
.logo small { font: 500 14px/1 "Barlow", sans-serif; color: var(--muted); letter-spacing: 0; }
.site-head .logo { font-size: clamp(36px, 4vw, 46px); }
.site-head .logo small { font-size: clamp(15px, 1.4vw, 18px); }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 36px; }
.nav a { font-weight: 500; text-decoration: none; padding: 8px 0; border-bottom: 2px solid transparent; transition: border-color 0.2s; }
.nav a:hover { border-color: var(--line); }
.nav a[aria-current="page"] { border-color: var(--accent); }
.menu-btn { display: none; }
.site-head .logo { margin-right: auto; }

/* Selettore del tema: tre campioni colore, quello attivo con il contorno arancione */
.theme { display: flex; gap: 6px; margin-left: 28px; order: 1; }
.menu-btn { order: 2; }
html:not(.js) .theme { display: none; }
/* Selettore nascosto (attributo hidden): per ora è attivo solo il tema scuro.
   Per riattivarlo: togliere hidden dal gruppo, disabled dai pulsanti e ripristinare lo script del tema in <head>. */
.theme[hidden] { display: none; }
.theme__btn { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line-strong); cursor: pointer; transition: transform 0.2s var(--ease); }
.theme__btn:hover { transform: translateY(-1px); }
.theme__btn[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme__btn--dark { background: linear-gradient(135deg, #151618 50%, #d47a2f 50%); }
.theme__btn--light { background: linear-gradient(135deg, #d9dad7 50%, #7f3a0f 50%); }
.theme__btn--corten { background: radial-gradient(circle at 30% 30%, #b9581f 0 22%, transparent 40%), radial-gradient(circle at 75% 70%, #8e3e14 0 25%, transparent 45%), #4a2210; }
.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; }

@media (max-width: 767px) {
  /* Logo, selettore del tema e pulsante Menu su una riga anche a 320px */
  .site-head__in { gap: 12px; }
  .site-head .logo { font-size: 30px; white-space: nowrap; }
  .theme { margin-left: 0; gap: 4px; }
  .theme__btn { width: 24px; height: 24px; }
  .js .menu-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; background: transparent; color: var(--text); border: 1px solid var(--line-strong); font: 600 16px "Barlow", sans-serif; cursor: pointer; }
  .js .nav { position: fixed; inset: var(--head-h) 0 auto 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 24px; transform: translateY(-8px); opacity: 0; visibility: hidden; transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s; }
  .js .site-head[data-open] .nav { opacity: 1; transform: none; visibility: visible; }
  .nav ul { flex-direction: column; gap: 0; }
  .nav a { display: block; padding: 14px 0; font: 700 28px/1 var(--display); text-transform: uppercase; border-bottom: 1px solid var(--line); }
  .nav a[aria-current="page"] { color: var(--accent); border-color: var(--line); }
  html:not(.js) .site-head__in { height: auto; flex-wrap: wrap; padding-block: 12px; }
  html:not(.js) .nav ul { flex-direction: row; gap: 16px; }
  html:not(.js) .nav a { font: 500 16px "Barlow", sans-serif; text-transform: none; border: 0; padding: 4px 0; }
}

/* ---------- Sezioni generiche ---------- */
main { display: block; }
.page-head { padding-top: clamp(40px, 7vw, 96px); padding-bottom: clamp(24px, 4vw, 48px); }
.section { padding-block: clamp(40px, 6vw, 80px); }
.prose { max-width: calc(68ch + 2 * var(--gutter)); margin-left: 0; margin-inline: auto; }
.prose p { max-width: 68ch; }
@media (min-width: 1024px) { .prose { margin-left: max(0px, calc((100vw - 1440px) / 2)); } }

.crumbs { padding-top: 20px; font-size: 14px; color: var(--muted); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; opacity: 0.5; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.back { display: flex; flex-wrap: wrap; gap: 4px 28px; padding-top: 12px; }
.back a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; text-decoration: none; transition: color 0.2s; }
.back a span { color: var(--accent); transition: transform 0.2s var(--ease); }
.back a:hover { color: var(--accent); }
.back a:hover span { transform: translateX(-3px); }
.back + .page-head { padding-top: clamp(16px, 3vw, 32px); }
.back + .detail { padding-top: 12px; }
.crumbs + .page-head { padding-top: clamp(24px, 4vw, 48px); }

/* ---------- Home: hero ---------- */
.hero { display: grid; gap: 32px; padding-top: 32px; padding-bottom: clamp(48px, 8vw, 112px); }
/* Riquadro orizzontale: la foto della home (una recinzione) deve vedersi per tutta la larghezza. */
.hero__media { margin: 0; overflow: hidden; background: var(--surface); aspect-ratio: 16 / 9; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; }
.hero__text h1 { font-size: clamp(40px, 3.9vw, 60px); color: var(--accent); }
@media (min-width: 1024px) {
  .hero { grid-template-columns: 5fr 7fr; align-items: center; gap: 56px; min-height: min(calc(100dvh - var(--head-h) - 120px), 640px); padding-top: 48px; }
  .hero__text { padding-bottom: 8px; }
}

/* ---------- Home: servizi a bento ---------- */
.home-services { padding-bottom: clamp(64px, 9vw, 128px); }
.bento { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; }
.bento__cell a { position: relative; display: block; height: 100%; min-height: 280px; overflow: hidden; background: var(--surface); text-decoration: none; }
.bento__cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); transition: transform 0.8s var(--ease), opacity 0.6s; }
.bento__cell a::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, color-mix(in srgb, var(--bg) 92%, transparent) 100%); }
.bento__cell a:hover img { transform: scale(1.04); }
/* Fondo scuro proprio sotto il testo (WCAG 1.4.3): il contrasto non dipende dalla foto.
   Opacità 90% sotto le righe di testo, sfumata verso l'alto. */
.bento__body { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 56px 24px 24px; display: grid; gap: 6px;
  background: linear-gradient(180deg, transparent 0, color-mix(in srgb, var(--bg) 90%, transparent) 48px, color-mix(in srgb, var(--bg) 94%, transparent) 100%); }
.bento__body strong { font: 700 clamp(26px, 2.6vw, 36px)/1 var(--display); text-transform: uppercase; }
.bento__body span { color: var(--muted); font-size: 16px; max-width: 42ch; }
.bento__cell a:hover strong { color: var(--accent); }
@media (min-width: 768px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento__cell:first-child { grid-column: span 2; }
  .bento__cell:first-child a { min-height: 420px; }
  /* 4 servizi su 2 colonne: il primo e l'ultimo occupano tutta la riga, niente buchi */
  .bento__cell:last-child { grid-column: span 2; }
}
@media (min-width: 1024px) {
  .bento { grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 300px 300px; }
  .bento__cell:first-child { grid-column: 1; grid-row: span 2; }
  .bento__cell:nth-child(2) { grid-column: span 2; }
  .bento__cell:last-child { grid-column: auto; }
  .bento__cell a, .bento__cell:first-child a { min-height: 0; }
}

/* ---------- Home: azienda ---------- */
.home-about { display: grid; gap: 16px; padding-block: clamp(56px, 8vw, 112px); border-top: 1px solid var(--line); }
.home-about__num { margin: 0; font: 700 clamp(140px, 22vw, 320px)/0.8 var(--display); color: var(--accent); letter-spacing: -0.03em; }
.home-about__num span { font-size: 0.45em; vertical-align: top; }
.home-about__text p { max-width: 56ch; color: var(--muted); }
.home-about__text h2 { max-width: 16ch; }
@media (min-width: 1024px) { .home-about { grid-template-columns: 5fr 7fr; align-items: end; gap: 56px; } }

/* ---------- Tile (galleria e striscia) ---------- */
.tile { display: grid; gap: 12px; text-decoration: none; }
.tile__img { display: block; overflow: hidden; background: var(--surface); aspect-ratio: 4 / 3; }
.tile__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease), opacity 0.6s; }
.tile:hover .tile__img img { transform: scale(1.04); }
.tile__title { font-weight: 600; font-size: 18px; line-height: 1.3; }
.tile:hover .tile__title { color: var(--accent); }
.tile__meta { font-size: 14px; color: var(--muted); margin-top: -8px; }

/* Caricamento progressivo: le immagini compaiono quando sono pronte. */
.js img[loading="lazy"] { opacity: 0; }
.js img[loading="lazy"].is-loaded { opacity: 1; }

/* ---------- Home: striscia lavori ---------- */
.home-work { padding-block: clamp(56px, 8vw, 112px); background: var(--surface); }
.home-work__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 24px; }
.home-work__head h2 { margin: 0; }
.home-work__head p { margin: 0; }
.strip { list-style: none; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: 80%; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent; }
.strip li { scroll-snap-align: start; }
.strip .tile__img { background: var(--surface-2); }
@media (min-width: 768px) { .strip { grid-auto-columns: 42%; } }
@media (min-width: 1024px) { .strip { grid-auto-columns: calc((100% - 32px) / 3.2); } }

/* ---------- Home: contatti ---------- */
.home-contact { padding-block: clamp(64px, 10vw, 140px); }
.home-contact h2 { color: var(--accent); }
.big-contacts { display: grid; gap: 4px; font-style: normal; }
.big-contacts a { font: 700 clamp(34px, 6vw, 80px)/1.05 var(--display); text-decoration: none; width: fit-content; font-variant-numeric: tabular-nums; transition: color 0.2s; overflow-wrap: anywhere; }
.big-contacts a:hover { color: var(--accent); }
.big-contacts span { margin-top: 16px; color: var(--muted); }

/* ---------- Azienda ---------- */
.story { display: grid; gap: 32px; padding-bottom: clamp(56px, 8vw, 112px); }
.story__media { margin: 0; background: var(--surface); aspect-ratio: 3 / 2; overflow: hidden; }
.story__media img { width: 100%; height: 100%; object-fit: cover; }
.story__text p { max-width: 60ch; color: var(--muted); }
@media (min-width: 1024px) { .story { grid-template-columns: 7fr 5fr; gap: 56px; align-items: center; } }

.values { padding-block: clamp(56px, 8vw, 112px); border-top: 1px solid var(--line); }
.page-head--accent h1, .values h2 { color: var(--accent); }
.values dl { margin: 32px 0 0; display: grid; gap: 32px; }
.values dt { font: 700 clamp(26px, 2.4vw, 32px)/1 var(--display); text-transform: uppercase; margin-bottom: 12px; padding-top: 16px; border-top: 2px solid var(--accent); }
.values dd { margin: 0; color: var(--muted); max-width: 40ch; }
@media (min-width: 768px) { .values dl { grid-template-columns: 1.3fr 1fr 1fr; gap: 40px; } }

/* Certificazioni (pagina Azienda) */
/* Testo introduttivo a sinistra, schede delle norme impilate a destra (da 1024px) */
.certs { display: grid; gap: 32px; padding-block: clamp(56px, 8vw, 112px); border-top: 1px solid var(--line); }
.certs h2 { color: var(--accent); }
.certs__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.certs__list li { display: grid; gap: 12px; padding: clamp(20px, 2.6vw, 32px); background: var(--surface); border-left: 3px solid var(--accent); }
.certs__code { font: 700 clamp(26px, 2.6vw, 34px)/1.05 var(--display); text-transform: uppercase; }
.certs__name { display: block; margin-bottom: 6px; font-weight: 600; font-size: 19px; }
.certs__body p { margin: 0; color: var(--muted); max-width: 52ch; }
@media (min-width: 640px) { .certs__list li { grid-template-columns: minmax(170px, 0.8fr) 1.2fr; gap: 32px; align-items: start; } }
@media (min-width: 1024px) { .certs { grid-template-columns: 5fr 7fr; gap: 64px; align-items: start; } }

.equip { display: grid; gap: 40px; padding-block: clamp(56px, 8vw, 112px); background: var(--surface); max-width: none; padding-inline: max(var(--gutter), calc((100vw - 1440px) / 2 + var(--gutter))); }
.equip__list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 20px; }
.equip__list strong { display: block; font-size: 19px; }
.equip__list li { color: var(--muted); max-width: 48ch; }
.equip__list li strong { color: var(--text); }
.equip__media { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.equip__media figure { margin: 0; background: var(--surface-2); aspect-ratio: 3 / 4; overflow: hidden; }
.equip__media figure:last-child { margin-top: 48px; }
.equip__media img { width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 1024px) { .equip { grid-template-columns: 5fr 7fr; gap: 64px; align-items: center; } .equip__list { grid-template-columns: 1fr 1fr; gap: 28px 32px; } }

.org { padding-block: clamp(64px, 10vw, 140px); }
.org .lead { color: var(--text); font-size: clamp(22px, 2.4vw, 32px); line-height: 1.35; max-width: 34ch; }

/* ---------- Servizi ---------- */
.services { display: grid; gap: clamp(56px, 8vw, 104px); padding-bottom: clamp(64px, 10vw, 140px); }
.service { display: grid; gap: 24px; padding-top: 32px; border-top: 1px solid var(--line); }
.service h2 a { text-decoration: none; }
.service h2 a:hover { color: var(--accent); }
.service__text p { color: var(--muted); max-width: 44ch; }
@media (min-width: 1024px) { .service { grid-template-columns: 4fr 8fr; gap: 48px; } }

.gallery { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 28px 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) {
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .gallery--lead > li:first-child { grid-column: span 2; grid-row: span 2; }
  .gallery--lead > li:first-child .tile { height: 100%; grid-template-rows: 1fr auto; }
  .gallery--lead > li:first-child .tile__img { aspect-ratio: auto; }
  /* Griglia sempre piena: se l'ultima riga resta incompleta, l'ultimo lavoro si allarga sullo spazio vuoto
     (il primo occupa 2x2, quindi dal quarto in poi le righe sono da 3). */
  .gallery--lead > li:nth-child(3n+2):last-child { grid-column: span 2; }
  .gallery--lead > li:nth-child(3n+2):last-child .tile__img { aspect-ratio: 8 / 3; }
  .gallery--lead > li:nth-child(3n+1):last-child:not(:first-child) { grid-column: span 3; }
  .gallery--lead > li:nth-child(3n+1):last-child:not(:first-child) .tile__img { aspect-ratio: 4 / 1; }
}
.service .gallery { margin-top: 0; }
@media (min-width: 640px) and (max-width: 1023px) { .gallery--row > li:first-child { grid-column: span 2; } }

.others { padding-bottom: clamp(64px, 10vw, 140px); }
.others ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.others a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 20px; border: 1px solid var(--line); text-decoration: none; font-weight: 600; transition: border-color 0.2s, color 0.2s; }
.others a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Portfolio ---------- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); position: sticky; top: var(--head-h); z-index: 10; background: var(--bg); }
.tabs a { padding: 16px 0; margin-right: 32px; font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: border-color 0.2s, color 0.2s; }
.tabs a:hover, .tabs a.is-active { border-color: var(--accent); }
.area h2 { margin-bottom: 8px; }

/* ---------- Pagina di dettaglio ---------- */
.detail { display: grid; gap: 32px; padding-top: 24px; padding-bottom: clamp(64px, 10vw, 140px); }
.detail__media { margin: 0; background: var(--surface); }
.detail__zoom { display: block; cursor: zoom-in; }
.detail__zoom:focus-visible { outline-offset: -3px; }
.detail__media img { width: 100%; max-height: calc(100dvh - var(--head-h) - 48px); object-fit: contain; background: var(--surface); }
.detail__text h1 { font-size: clamp(38px, 4.4vw, 64px); color: var(--accent); }
.detail__text > p { color: var(--muted); max-width: 46ch; }
.detail__ctx { list-style: none; margin: 0 0 1em; padding: 0; display: grid; gap: 10px; }
.detail__count { color: var(--muted); font-size: 16px; margin-top: -0.4em; }
.detail__ctx a { font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--accent); }
.detail__ctx a:hover { color: var(--accent); }
@media (min-width: 1024px) { .detail { grid-template-columns: 8fr 4fr; gap: 48px; align-items: start; } .detail__text { position: sticky; top: calc(var(--head-h) + 32px); } }

/* Foto ingrandita (finestra modale) */
.no-scroll { overflow: hidden; }
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--text); }
.lightbox::backdrop { background: color-mix(in srgb, var(--bg) 94%, transparent); }
.lightbox__fig { margin: 0; height: 100%; display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 56px var(--gutter) 16px; gap: 12px; cursor: zoom-out; }
.lightbox__fig img { max-width: 100%; max-height: calc(100dvh - 120px); width: auto; height: auto; object-fit: contain; box-shadow: 0 20px 60px color-mix(in srgb, var(--bg) 70%, transparent); }
.lightbox__fig figcaption { font-weight: 600; color: var(--muted); text-align: center; cursor: default; }
.lightbox__close { position: fixed; top: 12px; right: 12px; width: 48px; height: 48px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); font-size: 30px; line-height: 1; cursor: pointer; transition: color 0.2s, border-color 0.2s; }
.lightbox__close:hover { color: var(--accent); border-color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] { animation: lb-in 0.3s var(--ease); }
  .lightbox[open]::backdrop { animation: lb-fade 0.3s var(--ease); }
  @keyframes lb-in { from { opacity: 0; transform: scale(0.98); } }
  @keyframes lb-fade { from { opacity: 0; } }
}

.share { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.share__label { font-weight: 600; margin-bottom: 12px; }
.share__row { display: flex; flex-wrap: wrap; gap: 8px; }
.share__row .btn { min-height: 44px; padding: 0 16px; font-size: 15px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 32px; }
.pager a { display: grid; gap: 4px; padding: 16px; background: var(--surface); text-decoration: none; font-weight: 600; line-height: 1.25; transition: background-color 0.2s; }
.pager a:hover { background: var(--surface-2); }
.pager span { font-weight: 400; font-size: 14px; color: var(--muted); }
.pager a[rel="next"] { text-align: right; }

/* ---------- Contatti ---------- */
.contact { display: grid; gap: 40px; padding-bottom: clamp(64px, 10vw, 140px); }
.contact__list { margin: 0; display: grid; gap: 28px; }
.contact__list dt { font-size: 15px; color: var(--muted); margin-bottom: 4px; }
.contact__list dd { margin: 0; font-size: 20px; font-weight: 500; }
.contact__list dd a { font: 700 clamp(30px, 3.6vw, 44px)/1.05 var(--display); text-decoration: none; overflow-wrap: anywhere; }
.contact__list dd a:hover { color: var(--accent); }
.map { position: relative; min-height: 420px; background: var(--surface); border: 1px solid var(--line); }
.map__facade { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(24px, 4vw, 48px);
  background: repeating-linear-gradient(0deg, transparent 0 47px, var(--line) 47px 48px), repeating-linear-gradient(90deg, transparent 0 47px, var(--line) 47px 48px), var(--surface); }
.map__title { font: 700 clamp(28px, 3vw, 40px)/1 var(--display); text-transform: uppercase; }
.map__facade .muted { max-width: 44ch; font-size: 16px; }
.map__zoom { position: absolute; z-index: 1; right: 12px; top: 12px; display: grid; gap: 1px; background: var(--line); box-shadow: 0 6px 20px color-mix(in srgb, var(--bg) 50%, transparent); }
.map__zoom button { width: 44px; height: 44px; background: var(--bg); color: var(--text); border: 0; font: 600 24px/1 "Barlow", sans-serif; cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.map__zoom button:hover:not(:disabled) { background: var(--surface-2); color: var(--accent); }
.map__zoom button:disabled { color: var(--muted); opacity: 0.5; cursor: default; }
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; filter: grayscale(0.4) contrast(1.05); }
@media (min-width: 1024px) { .contact { grid-template-columns: 4fr 8fr; gap: 56px; } .map { min-height: 560px; } }

.contact { padding-bottom: clamp(48px, 7vw, 96px); }
.directions { padding-top: clamp(40px, 6vw, 72px); padding-bottom: clamp(64px, 10vw, 140px); border-top: 1px solid var(--line); }
.directions h2 { color: var(--accent); }
.directions dl { margin: 24px 0 0; display: grid; gap: 28px; }
.directions dt { font-weight: 600; font-size: 19px; margin-bottom: 6px; }
.directions dd { margin: 0; color: var(--muted); max-width: 44ch; }
@media (min-width: 768px) { .directions dl { grid-template-columns: repeat(3, 1fr); gap: 40px; } }

/* ---------- Banner consenso cookie ---------- */
/* Accetta e Rifiuta hanno lo stesso peso visivo: il Garante chiede di non spingere verso una scelta. */
.consent { position: fixed; z-index: 30; left: var(--gutter); right: var(--gutter); bottom: var(--gutter); max-width: 560px; padding: 24px; padding-right: 56px; background: var(--surface-2); border: 1px solid var(--line); border-top: 3px solid var(--accent); box-shadow: 0 20px 60px color-mix(in srgb, var(--bg) 80%, transparent); font-size: 16px; }
/* Con poco spazio in altezza (telefono in orizzontale) il banner scorre al suo interno: i pulsanti restano raggiungibili. */
.consent { max-height: calc(100dvh - 2 * var(--gutter)); overflow-y: auto; }
.consent[hidden] { display: none; }
.consent__title { font: 700 24px/1 var(--display); text-transform: uppercase; margin-bottom: 10px; }
.consent p { color: var(--muted); }
.consent a { color: var(--text); }
.consent__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 0; }
.consent__x { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; background: transparent; border: 0; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; }
.consent__x:hover { color: var(--text); }

/* ---------- Pagine legali ---------- */
.legal { max-width: calc(72ch + 2 * var(--gutter)); margin-left: 0; padding-bottom: clamp(64px, 10vw, 140px); }
@media (min-width: 1024px) { .legal { margin-left: max(0px, calc((100vw - 1440px) / 2)); } }
.legal h2 { font-size: clamp(24px, 2.4vw, 32px); margin-top: 1.6em; }
.legal p, .legal li { color: var(--muted); }
.legal strong, .legal a { color: var(--text); }
.legal ul { padding-left: 1.2em; margin: 0 0 1em; }
.legal li { margin-bottom: 0.4em; }
.legal code { font-size: 0.9em; color: var(--text); }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); padding-top: 48px; font-size: 16px; }
.site-foot__in { display: grid; gap: 32px; }
.site-foot .logo { margin-bottom: 12px; }
.site-foot address { font-style: normal; display: grid; gap: 8px; align-content: start; }
.site-foot address a, .site-foot__nav a { text-decoration: none; }
.site-foot address a:hover, .site-foot__nav a:hover { color: var(--accent); }
.site-foot__nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; align-content: start; }
.site-foot__legal { margin-top: 40px; padding-block: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.site-foot__legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.site-foot__legal p { margin: 0; }
.site-foot__legal ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-foot__legal a, .linkish { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.site-foot__legal a:hover, .linkish:hover { color: var(--text); }
.map__facade a { color: var(--text); }
@media (min-width: 768px) { .site-foot__in { grid-template-columns: 2fr 1fr 1fr; } }

/* ---------- Movimento: entrate in sequenza, solo se l'utente non ha chiesto di ridurlo ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); transition-delay: var(--d, 0ms); }
  .js .reveal.is-in { opacity: 1; transform: none; }
  /* Un blocco che contiene l'elemento attivo da tastiera è sempre visibile (WCAG 2.4.7). */
  .js .reveal:focus-within, .js .reveal:focus { opacity: 1; transform: none; transition-delay: 0ms; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
