/* Caratteri Barlow e Barlow Condensed salvati nella cartella fonts (licenza in fonts/OFL.txt):
   il sito non contatta Google quando qualcuno lo apre. */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/barlow-400.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/barlow-500.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/barlow-600.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/barlow-condensed-500.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-600.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-700.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 800; font-display: swap; src: url(fonts/barlow-condensed-800.woff2) format('woff2'); }

/* Impostazione a pannelli larghi e riquadri colorati affiancati.
   Colori: blu e giallo del logo, più un blu elettrico e un verde per dare varietà ai servizi. */
:root {
  color-scheme: light;
  --blu: #101d2c;
  --blu-2: #1c2f45;
  --giallo: #ffb000;
  --giallo-chiaro: #ffe7ad;
  --crema: #fff6e0;
  --elettrico: #1d4ed8;
  --blu-medio: #1e3f66;
  --bianco: #ffffff;
  --fondo: #f3f5f8;
  --grigio: #4a5868;
  --grigio-chiaro: #c9d1db;
  --titoli: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --testo: 'Barlow', Arial, sans-serif;
  --raggio: 28px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --margine: max(20px, env(safe-area-inset-left, 0px));
  --margine-dx: max(20px, env(safe-area-inset-right, 0px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; touch-action: manipulation; -webkit-tap-highlight-color: rgba(255, 176, 0, .3); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Link "Vai al contenuto": compare solo con il tasto Tab */
.skip {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 20;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--giallo);
  color: var(--blu);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus-visible { top: calc(12px + env(safe-area-inset-top, 0px)); outline-color: var(--blu); }
main:focus { outline: none; }

body {
  margin: 0;
  background: var(--bianco);
  color: var(--blu);
  font-family: var(--testo);
  font-size: 1.125rem;
  line-height: 1.5;
}
img { max-width: 100%; height: auto; display: block; }
::selection { background: var(--giallo); color: var(--blu); }
input, textarea, button { font: inherit; caret-color: var(--blu); accent-color: var(--blu); }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--elettrico); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--titoli); line-height: 1; text-wrap: balance; }
section[id] { scroll-margin-top: 60px; }

/* Pulsanti arrotondati */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 26px;
  border-radius: 999px;
  font-family: var(--titoli);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}
.pill:active { transform: scale(0.97); }
.pill--small { min-height: 44px; padding: 6px 20px; font-size: 1.0625rem; }
.pill--dark { background: var(--blu); color: var(--bianco); }
.pill--outline { box-shadow: inset 0 0 0 2px var(--blu); color: var(--blu); }
.pill--yellow { background: var(--giallo); color: var(--blu); }
/* Effetti del mouse solo dove c'è un mouse: sul telefono resterebbero attaccati dopo il tocco */
@media (hover: hover) and (pointer: fine) {
  .pill:hover { transform: translateY(-1px); }
  .pill:active { transform: scale(0.97); }
  .pill--dark:hover { background: var(--blu-2); }
  .pill--outline:hover { background: rgba(16, 29, 44, .08); }
  .pill--yellow:hover { background: var(--giallo-chiaro); }
}

/* Barra in alto: scura e semitrasparente */
.nav {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: rgba(16, 29, 44, .92);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  color: var(--bianco);
}
.nav__inner {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding-left: var(--margine);
  padding-right: var(--margine-dx);
}
.nav__brand { display: flex; min-height: 44px; align-items: center; gap: 10px; text-decoration: none; font-family: var(--titoli); font-size: 1.25rem; font-weight: 700; letter-spacing: .5px; }
.nav__brand img { width: 36px; height: 36px; border-radius: 50%; background: var(--bianco); }
.nav__links { display: flex; gap: 28px; margin-left: auto; }
.nav__links a { font-size: 1rem; text-decoration: none; color: var(--grigio-chiaro); padding: 10px 0; min-height: 44px; display: inline-flex; align-items: center; }
@media (hover: hover) and (pointer: fine) { .nav__links a:hover { color: var(--bianco); } }
.nav a:focus-visible { outline-color: var(--giallo); }

/* Apertura gialla, centrata */
.hero { background: var(--giallo); text-align: center; overflow: hidden; }
.hero__inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px var(--margine-dx) 0 var(--margine);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.hero__logo { width: min(300px, 70vw); border-radius: 50%; background: var(--bianco); box-shadow: 0 24px 60px rgba(16, 29, 44, .18); }
.hero h1 { font-size: clamp(3rem, 9vw, 6.5rem); font-weight: 800; letter-spacing: -.5px; margin-top: 12px; }
.hero__lead { font-size: clamp(1.25rem, 2.4vw, 1.625rem); max-width: 30em; }
.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 8px; }
.cable { display: block; width: 100%; height: 48px; margin-top: 56px; }

/* Titoli di sezione centrati */
.section-title { font-size: clamp(2.75rem, 7vw, 5rem); font-weight: 800; text-align: center; letter-spacing: -.5px; }
.section-lead { font-size: clamp(1.2rem, 2.2vw, 1.5rem); text-align: center; color: var(--grigio); max-width: 34em; margin: 14px auto 0; }

/* Servizi: riquadri colorati affiancati */
.services { padding: 96px 0 24px; }
.bento {
  max-width: 1440px;
  margin: 48px auto 0;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.tile {
  grid-column: span 2;
  position: relative;
  min-width: 0;
  min-height: 460px;
  border-radius: var(--raggio);
  padding: 44px 36px 180px;
  text-align: center;
  overflow: hidden;
}
.tile--wide { grid-column: span 3; min-height: 520px; }
.tile h3 { font-size: clamp(2.25rem, 4vw, 3.25rem); font-weight: 800; }
.tile__lead { font-size: 1.25rem; margin-top: 10px; }
.chips { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chips li { padding: 6px 14px; border-radius: 999px; font-size: 1.0625rem; font-weight: 500; }
.tile__art {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 140px;
  height: 140px;
  transform: translateX(-50%);
}

.tile--civili { background: var(--crema); color: var(--blu); }
.tile--civili .chips li { background: var(--bianco); }
.tile--industriali { background: var(--blu); color: var(--bianco); }
.tile--industriali .chips li { background: rgba(255, 255, 255, .12); }
.tile--industriali h3 { color: var(--giallo); }
/* Seconda fila: solo toni del marchio (giallo, blu medio, giallo chiaro) */
.tile--sicurezza { background: var(--giallo); color: var(--blu); }
.tile--sicurezza .chips li { background: rgba(255, 255, 255, .55); }
.tile--sicurezza .tile__art [fill="#ffb000"] { fill: var(--blu); }
.tile--energia { background: var(--blu-medio); color: var(--bianco); }
.tile--energia .chips li { background: rgba(255, 255, 255, .14); }
.tile--automazioni { background: var(--giallo-chiaro); color: var(--blu); }
.tile--automazioni .chips li { background: rgba(255, 255, 255, .7); }
.tile--automazioni .tile__art [fill="#ffb000"] { fill: var(--blu); }

/* Su computer i titoli delle tre colonne hanno sempre lo spazio di due righe,
   così le etichette sotto partono alla stessa altezza */
@media (min-width: 1001px) {
  .tile:not(.tile--wide) h3 { min-height: 2em; display: flex; align-items: flex-end; justify-content: center; }
  .tile:not(.tile--wide) .tile__lead { min-height: 3em; }
}

/* Lavori: foto vere, stessa larghezza e angoli dei riquadri dei servizi */
.works { padding: 84px 0 0; }
.work {
  max-width: 1440px;
  margin: 48px auto 0;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: 1fr 2fr;
  grid-template-rows: auto 1fr;
  gap: 12px;
}
/* Foto intere, mai ritagliate */
.work__photo { width: 100%; height: auto; border-radius: var(--raggio); background: var(--fondo); }
.work__photo--tall { grid-row: 1 / 3; }
.work__text {
  min-width: 0;
  border-radius: var(--raggio);
  background: var(--crema);
  color: var(--blu);
  padding: 44px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.work__place { color: var(--grigio); font-size: 1rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.work__text h3 { font-size: clamp(2.25rem, 4vw, 3.25rem); font-weight: 800; }
.work__text p:last-child { font-size: 1.25rem; }

/* Recensioni: per ora solo l'invito a lasciarle su Google */
.reviews { padding: 96px var(--margine-dx) 84px var(--margine); text-align: center; }
.reviews__action { margin-top: 28px; }

/* Chi siamo: pannello scuro con tre fatti dalla visura */
.about {
  margin: 12px max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
  border-radius: var(--raggio);
  background: var(--blu);
  color: var(--bianco);
  padding: 88px 24px;
}
.about .section-lead { color: var(--grigio-chiaro); }
.facts {
  max-width: 1100px;
  margin: 48px auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  text-align: center;
}
.fact { display: grid; gap: 8px; min-width: 0; }
.fact__big { font-family: var(--titoli); font-size: clamp(1.75rem, 3vw, 2.25rem); font-weight: 800; color: var(--giallo); }
.fact p:not(.fact__big) { color: var(--grigio-chiaro); }

/* Contatti */
.contact { padding: 104px var(--margine-dx) 104px var(--margine); text-align: center; }
.contact__mail { margin-top: 36px; font-family: var(--titoli); font-size: clamp(1.6rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.1; overflow-wrap: break-word; }
.contact__mail { margin-top: 8px; }
.contact__mail a { text-decoration-color: var(--giallo); text-decoration-thickness: 4px; text-underline-offset: 8px; transition: color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .contact__mail a:hover { color: var(--elettrico); } }
.contact__or { margin-top: 56px; color: var(--grigio); font-size: 1.125rem; }

/* Email sotto i pulsanti dell'apertura */
.hero__mail { font-size: 1.0625rem; overflow-wrap: break-word; }
.hero__mail a { font-weight: 600; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* Modulo contatti */
.form {
  max-width: 720px;
  margin: 44px auto 0;
  padding: 36px;
  border-radius: var(--raggio);
  background: var(--fondo);
  text-align: left;
  display: grid;
  gap: 20px;
}
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field label { font-weight: 600; font-size: 1.0625rem; }
.field__opt { font-weight: 400; color: var(--grigio); }
.field input, .field textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 2px solid #8a96a3;
  border-radius: 14px;
  background: var(--bianco);
  color: var(--blu);
  font-size: 1.0625rem;
  transition: border-color 150ms ease;
}
.field textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: #6b7684; }
@media (hover: hover) and (pointer: fine) { .field input:hover, .field textarea:hover { border-color: #5f6b78; } }
.field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--giallo); outline-offset: 1px; border-color: var(--blu); }
.form__trap { position: absolute; left: -9999px; }
.form__send { display: flex; justify-content: flex-start; }
.form__note { font-size: .9375rem; color: var(--grigio); }
.form__note a { color: var(--blu); }

/* Pagine semplici (grazie, privacy) */
.page { max-width: 760px; margin: 0 auto; padding: 72px var(--margine-dx) 96px var(--margine); }
.page h1 { font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 800; }
.page h2 { font-size: 1.75rem; font-weight: 700; margin-top: 40px; }
.page p, .page ul { margin-top: 14px; }
.page li + li { margin-top: 6px; }
.page .pill { margin-top: 32px; }
.page__logo { width: 96px; height: 96px; margin-bottom: 28px; }
.contact__place { margin-top: 28px; font-size: 1.25rem; color: var(--grigio); }
.copy { margin-top: 24px; border: 0; cursor: pointer; }

/* Piede */
.foot { background: var(--fondo); color: var(--grigio); font-size: .9375rem; }
.foot__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px var(--margine-dx) 32px var(--margine);
  display: grid;
  gap: 6px;
}
.foot__name { font-family: var(--titoli); font-size: 1.25rem; font-weight: 700; color: var(--blu); }
.foot__legal span + span::before { content: "|"; color: var(--grigio-chiaro); margin: 0 8px; }

/* Leggero movimento dei disegni quando entrano nello schermo (solo browser che lo supportano) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .tile__art { animation: sale linear both; animation-timeline: view(); animation-range: entry 0% cover 35%; }
    @keyframes sale { from { translate: 0 16px; scale: .96; } to { translate: 0 0; scale: 1; } }
  }
}

/* Tablet */
@media (max-width: 1000px) {
  .bento { grid-template-columns: 1fr 1fr; }
  .tile, .tile--wide { grid-column: span 1; min-height: 460px; }
  .tile--automazioni { grid-column: 1 / -1; }
  .facts { grid-template-columns: 1fr; max-width: 520px; }
  .work { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
  .work__photo--wide { grid-column: 1 / -1; grid-row: 1; }
  .work__photo--tall { grid-row: 2; }
}
/* Telefono */
@media (max-width: 680px) {
  .nav__links { display: none; }
  .nav__inner .pill { margin-left: auto; }
  .bento { grid-template-columns: 1fr; }
  .tile, .tile--wide, .tile--automazioni { grid-column: auto; min-height: 0; padding: 36px 22px 170px; }
  .services { padding-top: 72px; }
  .works { padding-top: 64px; }
  .reviews { padding-block: 72px 64px; }
  .reviews__action .pill { width: 100%; }
  .work { grid-template-columns: 1fr; grid-template-rows: none; }
  .work__photo--tall { grid-row: auto; order: 3; }
  .work__photo--wide { aspect-ratio: 5 / 2; object-fit: cover; }
  .work__text { padding: 32px 22px; text-align: center; }
  .about { padding: 64px 20px; }
  .contact { padding-block: 80px; }
  .form { padding: 24px 18px; }
  .form__row { grid-template-columns: 1fr; }
  .form__send .pill { width: 100%; }
  .foot__legal span { display: block; }
  .foot__legal span + span::before { content: none; }
}
@media (max-width: 420px) {
  .nav__brand span { display: none; }
  .hero__actions .pill { width: 100%; }
}

/* Chi ha chiesto al sistema meno animazioni: niente movimenti al passaggio del mouse */
@media (prefers-reduced-motion: reduce) {
  .pill { transition: background-color 150ms ease; }
  .pill:hover, .pill:active { transform: none; }
}

/* Telefono e WhatsApp */
.pill .ico { width: 1.15em; height: 1.15em; margin-right: 8px; flex: none; }
.contact__phone { margin-top: 8px; font-family: var(--titoli); font-size: clamp(2rem, 7vw, 4rem); font-weight: 800; line-height: 1.1; }
.contact__phone a { text-decoration-color: var(--giallo); text-decoration-thickness: 4px; text-underline-offset: 8px; }
.contact__wa { margin-top: 20px; }
.wa-fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 50; width: 58px; height: 58px; border-radius: 50%; background: #25d366; color: #fff; display: grid; place-items: center; box-shadow: 0 8px 22px rgba(16, 29, 44, .3); opacity: 0; pointer-events: none; transition: opacity 200ms ease; }
.wa-fab svg { width: 30px; height: 30px; }
body.scrolled .wa-fab { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .wa-fab { transition: none; } }
.form__error { margin-top: 16px; padding: 14px 18px; border-radius: 16px; background: #fdecea; color: #8a1c12; font-weight: 600; }
