/* ============================================================
   Impresa Edile Sagradin — landing one-page
   Stack: HTML5 + CSS (token) + JS vanilla. Mobile-first, dark.
   ============================================================ */

/* ---------- Reset minimale ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  background: var(--bg);
  color: var(--fg);
  font: var(--step-0)/1.65 var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overflow-wrap: break-word;
}
img, picture, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--gold-bright); text-decoration: none; }
ul { list-style: none; padding: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

/* ---------- Tipografia ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.12; text-wrap: balance; overflow-wrap: break-word; }
h1 { font-size: var(--step-4); letter-spacing: .005em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }
p { max-width: 62ch; }
strong { color: var(--fg); font-weight: 600; }

.kicker {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-body);
  font-size: var(--step--1); font-weight: 600;
  letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-2);
}
.kicker::before {
  content: ""; width: 28px; height: 1px; background: var(--gold-line);
}
.lead { font-size: var(--step-1); color: var(--muted); max-width: 56ch; }
.gold { color: var(--gold); }

/* ---------- Layout ---------- */
.container { width: min(100% - 2 * var(--space-3), var(--container)); margin-inline: auto; }
.container--narrow { max-width: var(--container-narrow); }
.section { padding-block: clamp(var(--space-8), 11vw, var(--space-10)); }
.section--alt { background: var(--bg-2); }
.section__head { max-width: 60ch; margin-bottom: var(--space-6); }
.section__head.center { margin-inline: auto; text-align: center; }
.section__head.center .kicker::before { display: none; }
.section__head .lead { margin-top: var(--space-2); }

.skip-link {
  position: fixed; top: 0; left: 0; z-index: 100;
  background: var(--gold); color: var(--gold-contrast);
  padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
  transform: translateY(-120%); transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- Bottoni ---------- */
.btn {
  --_bg: transparent; --_fg: var(--fg); --_bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 48px; padding: .8rem 1.6rem;
  font: 600 var(--step-0)/1 var(--font-body);
  background: var(--_bg); color: var(--_fg);
  border: 1px solid var(--_bd); border-radius: var(--radius-sm);
  cursor: pointer; transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
  text-align: center;
}
.btn--primary {
  --_bg: var(--gold); --_fg: var(--gold-contrast); --_bd: var(--gold);
}
.btn--primary:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
.btn--ghost { --_fg: var(--fg); }
.btn--ghost:hover { border-color: var(--gold); color: var(--gold-bright); }
.btn--lg { min-height: 54px; padding: 1rem 2rem; font-size: var(--step-1); }
.btn--block { width: 100%; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom: 1px solid transparent;
  transition: background-color .3s var(--ease), border-color .3s var(--ease);
}
/* Blur solo dove supportato e senza menu mobile aperto: evita di intrappolare
   il pannello fixed dentro l'header (backdrop-filter crea un containing block). */
@supports (backdrop-filter: blur(12px)) {
  @media (min-width: 60.01em) {
    .site-header { backdrop-filter: blur(12px); background: color-mix(in srgb, var(--bg) 70%, transparent); }
  }
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  border-bottom-color: var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-block: .85rem; }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand img { width: 44px; height: 44px; border-radius: 2px; }
.brand__name { display: flex; flex-direction: column; line-height: 1.05; }
.brand__name b { font-family: var(--font-display); font-size: 1.12rem; font-weight: 400; letter-spacing: .03em; color: var(--fg); }
.brand__name span { font-size: .62rem; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--gold); }

.nav__menu { display: flex; align-items: center; gap: var(--space-4); }
.nav__menu a:not(.btn) { color: var(--muted); font-size: var(--step-0); font-weight: 500; transition: color .2s var(--ease); }
.nav__menu a:not(.btn):hover { color: var(--fg); }

/* Azioni compatte in barra (solo mobile): chiama + hamburger */
.nav__actions { display: none; align-items: center; gap: .5rem; }
.nav__call {
  display: grid; place-items: center; width: 46px; height: 46px;
  border: 1px solid var(--gold-line); border-radius: 2px; color: var(--gold);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.nav__call svg { width: 20px; height: 20px; stroke: currentColor; fill: none; }
.nav__call:hover { border-color: var(--gold); color: var(--gold-bright); }
/* a menu aperto basta il CTA grande dentro il pannello */
.nav__actions:has(.nav-toggle[aria-expanded="true"]) .nav__call { display: none; }

.nav-toggle {
  display: none; width: 46px; height: 46px;
  background: transparent; border: 1px solid var(--line); border-radius: 2px;
  color: var(--fg); cursor: pointer; padding: 0;
}
.nav-toggle svg { width: 22px; height: 22px; margin: auto; stroke: currentColor; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: clamp(var(--space-8), 14vw, 9rem) var(--space-10); overflow: hidden; border-bottom: 1px solid var(--line); }
.hero__grid { position: relative; z-index: 1; display: grid; gap: var(--space-6); align-items: center; }
.hero__title { margin-bottom: var(--space-3); }
.hero__title em { font-style: normal; color: var(--gold); }
.hero__trust {
  display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5);
  margin-top: var(--space-6); padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}
.hero__trust div { display: flex; flex-direction: column; }
.hero__trust b { font-family: var(--font-display); font-size: var(--step-2); color: var(--gold); line-height: 1; }
.hero__trust span { font-size: var(--step--1); color: var(--muted); margin-top: .35rem; }

.hero__visual {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  min-height: 340px; display: grid; place-items: center;
}
/* filo d'oro strutturale, come una guida di progetto */
.hero__visual::after {
  content: ""; position: absolute; inset: 12px;
  border: 1px solid var(--gold-line); pointer-events: none;
}
.hero__emblem { position: relative; z-index: 1; width: min(58%, 260px); border-radius: 2px; }

/* ---------- Servizi ---------- */
.grid { display: grid; gap: var(--space-3); }
.grid--services { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }

.card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--space-4);
  transition: border-color .25s var(--ease), background-color .25s var(--ease);
}
.card:hover { border-color: var(--gold-line); background: var(--surface-2); }
.card__icon {
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 2px; margin-bottom: var(--space-3);
  background: transparent; border: 1px solid var(--gold-line); color: var(--gold);
}
.card__icon svg { width: 26px; height: 26px; stroke: currentColor; fill: none; }
.card h3 { margin-bottom: .5rem; }
.card p { color: var(--muted); font-size: var(--step-0); max-width: none; }

/* ---------- Perché noi / valori ---------- */
.feature-list { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.feature { display: flex; gap: var(--space-3); }
.feature__num { font-family: var(--font-display); font-size: var(--step-2); color: var(--gold-line); line-height: 1; flex: none; }
.feature h3 { font-size: var(--step-1); margin-bottom: .4rem; }
.feature p { color: var(--muted); font-size: var(--step-0); max-width: 40ch; }

/* ---------- Progetto / case study ---------- */
.project { display: grid; gap: var(--space-6); align-items: center; }
.project__media {
  border-radius: var(--radius-lg); border: 1px solid var(--line); overflow: hidden;
  background: var(--surface);
  min-height: 320px; display: grid; place-items: center; position: relative;
}
.project__media::after { content: ""; position: absolute; inset: 12px; border: 1px solid var(--gold-line); pointer-events: none; }
.project__placeholder { position: relative; z-index: 1; text-align: center; color: var(--muted-2); padding: var(--space-4); }
.project__placeholder svg { width: 46px; height: 46px; stroke: var(--gold-line); margin: 0 auto var(--space-2); fill: none; }
.project__list { margin-top: var(--space-3); display: grid; gap: .6rem; }
.project__list li { display: flex; gap: .65rem; color: var(--muted); }
.project__list svg { width: 20px; height: 20px; stroke: var(--gold); flex: none; margin-top: 3px; fill: none; }

/* ---------- Galleria ---------- */
.gallery {
  display: grid; gap: var(--space-2); margin-top: var(--space-5);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}
.gallery__btn {
  position: relative; display: block; width: 100%; padding: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: border-color .25s var(--ease);
}
.gallery__btn img { aspect-ratio: 4 / 3; width: 100%; height: 100%; object-fit: cover; transition: opacity .25s var(--ease); }
.gallery__btn:hover, .gallery__btn:focus-visible { border-color: var(--gold-line); }
.gallery__btn:hover img, .gallery__btn:focus-visible img { opacity: .82; }
/* tab "+" da disegno tecnico: appare all'hover/focus */
.gallery__btn::after {
  content: "+"; position: absolute; right: 0; bottom: 0;
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--gold); color: var(--gold-contrast);
  font: 400 24px/1 var(--font-body);
  opacity: 0; transform: translateY(8px); transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.gallery__btn:hover::after, .gallery__btn:focus-visible::after { opacity: 1; transform: none; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--space-3); }
.lightbox[hidden] { display: none; }
.lightbox__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .88); }
.lightbox__dialog { position: relative; z-index: 1; width: min(100%, 62rem); }
.lightbox__figure { margin: 0; background: var(--bg-2); border: 1px solid var(--gold-line); }
.lightbox__img { display: block; width: 100%; max-height: 76vh; object-fit: contain; background: var(--bg); }
.lightbox__cap { padding: .9rem var(--space-3); color: var(--muted); font-size: var(--step--1); text-align: center; border-top: 1px solid var(--line); }
.lightbox__close, .lightbox__nav {
  position: absolute; z-index: 2; display: grid; place-items: center;
  width: 46px; height: 46px; padding: 0; cursor: pointer;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--fg);
  transition: border-color .2s var(--ease), color .2s var(--ease), background-color .2s var(--ease);
}
.lightbox__close:hover, .lightbox__nav:hover { border-color: var(--gold); color: var(--gold-bright); }
.lightbox__close svg, .lightbox__nav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; }
.lightbox__close { top: 8px; right: 8px; }
.lightbox__nav { top: 50%; transform: translateY(-50%); }
.lightbox__prev { left: 8px; }
.lightbox__next { right: 8px; }

/* ---------- Zona servita ---------- */
.area { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
.area__towns { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: var(--space-3); }
.pill {
  display: inline-block; padding: .5rem 1rem; border-radius: 2px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: var(--step--1); color: var(--muted);
}
.pill--accent { border-color: var(--gold-line); color: var(--gold); }

/* ---------- Partner ---------- */
.partners { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: center; margin-top: var(--space-4); }
.partners li {
  font-family: var(--font-display); font-size: var(--step-1); color: var(--muted-2);
  letter-spacing: .03em; transition: color .25s var(--ease);
}
.partners li:not(.dot):hover { color: var(--gold); }
.partners .dot { color: var(--gold-line); font-size: 1rem; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: var(--space-2); max-width: var(--container-narrow); margin-inline: auto; }
.faq__item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.faq__q {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: 1.15rem var(--space-3); background: none; border: 0; cursor: pointer;
  font: 600 var(--step-1)/1.3 var(--font-body); color: var(--fg); text-align: left;
}
.faq__q:hover { color: var(--gold-bright); }
.faq__q svg { width: 22px; height: 22px; stroke: var(--gold); flex: none; transition: transform .3s var(--ease); fill: none; }
.faq__q[aria-expanded="true"] svg { transform: rotate(45deg); }
.faq__a { max-width: none; padding: 0 var(--space-3); color: var(--muted); overflow: hidden; }
.faq__a > div { padding-bottom: 1.15rem; }

/* ---------- Contatti ---------- */
.contact { display: grid; gap: var(--space-6); align-items: start; }
.contact__info { display: grid; gap: var(--space-3); align-content: start; }
.contact__row { display: flex; gap: var(--space-2); align-items: flex-start; min-width: 0; }
.contact__row svg { width: 22px; height: 22px; stroke: var(--gold); flex: none; margin-top: 3px; fill: none; }
.contact__row > span { min-width: 0; }
.contact__row a, .footer__col a { color: var(--fg); font-weight: 500; overflow-wrap: anywhere; }
/* area di tocco confortevole su mobile per i link testuali */
.contact__row a, .footer__col a { display: inline-block; padding-block: .25rem; }
.footer__col a { color: var(--muted); font-weight: 400; }
.contact__row a:hover { color: var(--gold-bright); }
.contact__row span small { display: block; color: var(--muted-2); font-size: var(--step--1); margin-top: .1rem; }

/* pannello contatto diretto (in luogo del form) */
.contact-cta {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  border-top: 2px solid var(--gold);
  padding: var(--space-5); display: grid; gap: var(--space-3); align-content: start;
  position: relative; overflow: hidden;
}
.contact-cta h3 { font-size: var(--step-2); }
.contact-cta p { color: var(--muted); max-width: none; margin: 0; position: relative; }
.contact-cta__actions { display: grid; gap: var(--space-2); margin-top: var(--space-2); position: relative; }
.contact-cta__note { font-size: var(--step--1); color: var(--muted-2); text-align: center; margin-top: var(--space-1) !important; }

/* form */
.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); display: grid; gap: var(--space-3); }
.field { display: grid; gap: .4rem; }
.field label { font-size: var(--step--1); font-weight: 600; color: var(--muted); }
.field label .req { color: var(--gold); }
.field input, .field textarea {
  width: 100%; padding: .85rem 1rem; font: inherit; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.field textarea { resize: vertical; min-height: 120px; }
.field--invalid input, .field--invalid textarea { border-color: #e06a5a; }
.field__error { font-size: var(--step--1); color: #f0907f; min-height: 0; }
.form__consent { display: flex; gap: .65rem; align-items: flex-start; font-size: var(--step--1); color: var(--muted); }
.form__consent input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--gold); flex: none; }
.form__consent a { text-decoration: underline; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__status { font-size: var(--step-0); border-radius: var(--radius-sm); padding: 0; }
.form__status.is-success { padding: .85rem 1rem; background: rgba(120,200,120,.12); border: 1px solid rgba(120,200,120,.4); color: #bfe6bf; }
.form__status.is-error { padding: .85rem 1rem; background: rgba(224,106,90,.12); border: 1px solid rgba(224,106,90,.4); color: #f0a99d; }

/* ---------- Footer ---------- */
.site-footer { background: #0a0a0b; border-top: 1px solid var(--line); padding-block: var(--space-6) var(--space-4); }
.footer__grid { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
.footer__about { max-width: 40ch; }
.footer__about p { color: var(--muted); font-size: var(--step-0); margin-top: var(--space-2); }
.footer__col h4 { font-family: var(--font-body); font-size: var(--step--1); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--gold); margin-bottom: var(--space-2); }
.footer__col li { margin-bottom: .25rem; }
.footer__col a, .footer__col address { color: var(--muted); font-style: normal; }
.footer__col a:hover { color: var(--fg); }
.socials { display: flex; gap: .8rem; margin-top: var(--space-2); }
.socials a { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); transition: border-color .25s var(--ease), color .25s var(--ease); }
.socials a:hover { border-color: var(--gold-line); color: var(--gold); }
.socials svg { width: 19px; height: 19px; fill: currentColor; }
.footer__bottom { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: space-between; align-items: center; margin-top: var(--space-6); padding-top: var(--space-3); border-top: 1px solid var(--line); color: var(--muted-2); font-size: var(--step--1); }
.footer__bottom a { color: var(--muted-2); display: inline-block; padding-block: .2rem; }
.footer__bottom a:hover { color: var(--gold); }

/* ---------- Animazioni reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }

/* ---------- Responsive: ≥720 ---------- */
@media (min-width: 45em) {
  .hero__grid { grid-template-columns: 1.15fr .85fr; }
  .hero__visual { min-height: 420px; }
  .project { grid-template-columns: 1fr 1fr; }
  .area { grid-template-columns: .9fr 1.1fr; align-items: center; }
  .contact { grid-template-columns: .85fr 1.15fr; }
  .footer__grid { grid-template-columns: 1.4fr 1fr 1.2fr; }
  .form__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
}

/* ---------- Responsive: menu mobile ---------- */
@media (max-width: 60em) {
  .nav__actions { display: flex; position: relative; z-index: 60; }
  .nav-toggle { display: grid; place-items: center; position: relative; z-index: 60; }
  .nav__menu {
    position: fixed; inset: 0 0 0 auto; width: min(82vw, 340px);
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: var(--space-2);
    background: var(--bg-2); border-left: 1px solid var(--line);
    padding: 5.5rem var(--space-3) var(--space-3); z-index: 40;
    transform: translateX(100%); visibility: hidden;
    transition: transform .35s var(--ease), visibility .35s var(--ease);
    overflow-y: auto; max-width: 100vw;
  }
  .nav__menu.is-open { transform: translateX(0); visibility: visible; box-shadow: var(--shadow); }
  .nav__menu a:not(.btn) { padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: var(--step-1); }
  .nav__menu .btn { margin-top: var(--space-2); }
  .nav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); opacity: 0; visibility: hidden; transition: opacity .3s var(--ease); z-index: 35; }
  .nav-backdrop.is-open { opacity: 1; visibility: visible; }
}

/* ---------- Responsive: telefoni stretti ---------- */
@media (max-width: 30em) {
  /* con l'icona chiama in barra, la tagline toglie spazio: basta il wordmark */
  .brand__name span { display: none; }
  .brand__name b { font-size: 1.2rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .nav-toggle, .hero__visual, .form, .socials { display: none; }
  body { background: #fff; color: #000; }
}
