/*
Theme Name: Caola Engineering
Theme URI: https://www.caolaengineering.it
Author: Rozalda Studio
Description: Tema personalizzato per Caola Engineering S.r.l. — Ingegneria Strutturale, Pinzolo (TN)
Version: 1.4.2
Text Domain: caola-engineering
*/

/* ══════════════════════════════════════════════════════
   CSS RESET + VARIABILI
══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --forest:  #1E522B;
  --mint:    #3A7A42;
  --accent:  #C8622A;
  --white:   #ffffff;
  --off:     #F4F4F2;
  --text:    #2A2A2A;
  --muted:   #888888;
  --border:  #E2E0DC;
}

/* overflow-x:clip non crea scroll container → position:sticky funziona su Safari/iPad */
/* Fallback per Safari <16 con @supports: usa hidden su html solo se clip non è supportato */
html { scrollbar-gutter: stable; scroll-behavior: smooth; }
body { overflow-x: clip; }
@supports not (overflow-x: clip) {
  html { overflow-x: hidden; }
}
img  { max-width: 100%; height: auto; }

/* Accessibilità: disabilita animazioni se l'utente le ha ridotte */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

body {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════════════
   NAVIGAZIONE
══════════════════════════════════════════════════════ */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: 82px;
  width: 100%; box-sizing: border-box;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 3rem;
}
/* Admin bar WordPress: sposta il nav per non essere coperto */
.admin-bar .nav { top: 32px; }

/* Home: nascosto su desktop, visibile nell'hamburger mobile */
li.menu-item-home,
li.nav__home { display: none; }
.nav--open li.menu-item-home,
.nav--open li.nav__home { display: block !important; }
@media screen and (max-width: 782px) {
  .admin-bar .nav { top: 46px; }
}
.nav__logo {
  display: flex; align-items: center; gap: 0.75rem;
  text-decoration: none;
}
.nav__logo svg { height: 42px; width: auto; }
.nav__links {
  display: flex; gap: 2.25rem; list-style: none;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.nav__links a {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.nav__links a:hover { color: var(--text); }
.nav__links a.active { color: var(--mint); }
.nav__cta {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--forest);
  padding: 0.65rem 1.6rem;
  text-decoration: none;
}

/* Hamburger */
.nav__burger {
  display: none; flex-direction: column; justify-content: center;
  gap: 5px; background: none; border: none; cursor: pointer;
  padding: 8px; min-width: 44px; min-height: 44px;
}
.nav__burger span {
  display: block; width: 22px; height: 2px; background: var(--forest);
  transition: transform 0.28s ease, opacity 0.2s ease;
  transform-origin: center; border-radius: 1px;
}
.nav__burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav__burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav__overlay {
  display: none; position: fixed; inset: 82px 0 0 0;
  background: rgba(0,0,0,0.25); z-index: 190;
}
/* admin-bar offset: il JS sovrascrive top dinamicamente, questo è il fallback CSS */
.admin-bar .nav__overlay { top: 114px; }
@media screen and (max-width: 782px) {
  .admin-bar .nav__overlay { top: 128px; }
}
.nav--open .nav__overlay { display: block; }
.nav__cta-mobile { display: none; }

/* ══════════════════════════════════════════════════════
   PAGE HEADER (intestazione pagine interne)
══════════════════════════════════════════════════════ */
.page-header {
  background: var(--forest);
  padding: 5rem 3rem 4rem;
  position: relative;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.page-header__ghost {
  position: absolute;
  top: 50%; left: 3rem;
  transform: translateY(-50%);
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: clamp(5rem, 14vw, 10rem);
  line-height: 1;
  letter-spacing: -0.05em;
  color: rgba(255,255,255,0.055);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}
.page-header__kicker {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mint);
  margin-bottom: 1rem;
  position: relative; z-index: 1;
}
.page-header__title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--white);
  position: relative; z-index: 1;
}
.page-header__desc {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.75;
  margin-top: 1rem;
  max-width: 520px;
  position: relative; z-index: 1;
}

/* ══════════════════════════════════════════════════════
   SECTION HEADER
══════════════════════════════════════════════════════ */
.sec-header {
  padding: 4.5rem 3rem 2.5rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.sec-kicker {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mint);
  margin-bottom: 0.6rem;
}
.sec-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  color: var(--forest);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.sec-link {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 0.875rem;
  color: var(--forest);
  text-decoration: none;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding-bottom: 0.1rem;
  border-bottom: 1px solid var(--mint);
}

/* ══════════════════════════════════════════════════════
   CTA BAND
══════════════════════════════════════════════════════ */
.cta-band {
  background: var(--forest);
  padding: 4.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3rem;
}
.cta-band--white {
  background: var(--white);
  border-top: 1px solid var(--border);
}
.cta-band__text h2 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  color: var(--white);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.cta-band--white .cta-band__text h2 { color: var(--forest); }
.cta-band__text p {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.88);
}
.cta-band--white .cta-band__text p { color: var(--muted); }
.cta-band__btns { display: flex; gap: 0.75rem; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════
   BOTTONI
══════════════════════════════════════════════════════ */
.btn-white {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  background: var(--white);
  color: var(--forest);
  padding: 0.9rem 2.25rem;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}
.btn-ghost {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.btn-mint {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  background: var(--mint);
  color: var(--white);
  padding: 0.85rem 2rem;
  text-decoration: none;
  display: inline-block;
}
.btn-forest {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  background: var(--forest);
  color: var(--white);
  padding: 0.85rem 2rem;
  text-decoration: none;
  display: inline-block;
}
.btn-outline-white {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  background: transparent;
  color: rgba(255,255,255,0.88);
  border: 1px solid rgba(255,255,255,0.45);
  padding: 0.85rem 2rem;
  text-decoration: none;
  display: inline-block;
}

/* ══════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════ */
.footer {
  background: #111;
  padding: 3.5rem 3rem 0;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 0.5fr;
  gap: 2rem 3rem;
  border-top: 3px solid var(--forest);
  align-items: start;
}
.footer__brand {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
}
.footer__tagline {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-style: italic;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.75);
  margin-top: 0.4rem;
  margin-bottom: 1.5rem;
}
.footer__piva {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.6);
}
.footer__address-label {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-top: 1rem;
  margin-bottom: 0.2rem;
}
.footer__address {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.88);
  line-height: 1.7;
}
.footer__col h4 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 0.63rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  margin-bottom: 1rem;
}
.footer__col a,
.footer__col p {
  display: block;
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  line-height: 2.1;
}
.footer__bottom {
  grid-column: 1 / -1;
  margin-top: 2.5rem;
  padding: 1.25rem 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer__bottom-left {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.8;
}
.footer__bottom-right { display: flex; gap: 1.5rem; }
.footer__bottom-right a {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
}

/* ══════════════════════════════════════════════════════
   ANIMAZIONI SCROLL
══════════════════════════════════════════════════════ */
.fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }

.stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.stagger.visible > *:nth-child(1) { opacity:1; transform:none; transition-delay:0s; }
.stagger.visible > *:nth-child(2) { opacity:1; transform:none; transition-delay:0.08s; }
.stagger.visible > *:nth-child(3) { opacity:1; transform:none; transition-delay:0.16s; }
.stagger.visible > *:nth-child(4) { opacity:1; transform:none; transition-delay:0.24s; }
.stagger.visible > *:nth-child(5) { opacity:1; transform:none; transition-delay:0.32s; }
.stagger.visible > *:nth-child(6) { opacity:1; transform:none; transition-delay:0.40s; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE CONDIVISO
══════════════════════════════════════════════════════ */
/* ── TABLET (iPad portrait ~768px) ───────────────── */
@media (min-width: 600px) and (max-width: 860px) {
  .footer {
    grid-template-columns: 1fr 1fr !important;
    padding: 3rem 2rem 0 !important;
  }
  .footer__bottom { padding: 1.25rem 0 !important; }
}

@media (max-width: 860px) {
  .nav { padding: 0 1.25rem; }
  .nav__links { display: none !important; }
  .nav__cta   { display: none !important; }
  .nav__burger { display: flex; }
  .nav .lang-switch { display: none !important; }

  /* Lang switch dentro overlay */
  .nav--open .nav__lang-item-mobile {
    display: flex !important;
    align-items: center; gap: 0.4rem;
    justify-content: flex-end;
    padding: 1rem 0; margin-top: 0.25rem;
    border-top: 1px solid var(--border);
  }
  /* Lingua attiva: sottolineata ma discreta — sei già qui */
  .nav__lang-item-mobile .lang-switch__active {
    font-family: 'Roboto', sans-serif; font-weight: 400;
    font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
  }
  .nav__lang-item-mobile .lang-switch__sep { color: var(--border); font-size: 0.72rem; }
  /* Lingua non attiva: più visibile — clicca qui per cambiare */
  .nav__lang-item-mobile .lang-switch__link {
    font-family: 'Roboto', sans-serif; font-weight: 700;
    font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--text); text-decoration: none;
  }

  /* Margine sinistro homepage progetti mobile */
  /* scroll-snap-align:start consuma il margin-left — serve scroll-padding-left per mostrarlo */
  .proj-grid-home {
    padding: 0 0 1.25rem !important;
    scroll-padding-left: 1.5rem !important;
  }
  .proj-grid-home > *:first-child { margin-left: 1.5rem; }
  .proj-grid-home > *:last-child  { margin-right: 1.5rem; }

  .nav--open .nav__links {
    display: flex !important;
    flex-direction: column;
    position: fixed; top: 82px; left: 0; right: 0;
    transform: none;
    max-height: calc(100vh - 82px);
    background: var(--white);
    padding: 0.5rem 1.25rem 1.5rem;
    z-index: 200; gap: 0;
    border-top: 1px solid var(--border);
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  }
  /* admin-bar desktop: il JS sovrascrive via getBoundingClientRect, questo è il CSS fallback */
  .admin-bar .nav--open .nav__links { top: 114px; max-height: calc(100vh - 114px); }
  .nav--open .nav__links li { border-bottom: none !important; border-top: none !important; }
  .nav--open .nav__links a {
    display: flex; align-items: center;
    padding: 0.8rem 0 0.8rem 0.75rem;
    font-family: 'Montserrat', sans-serif; font-weight: 600;
    font-size: 1rem; letter-spacing: -0.01em;
    color: var(--text); min-height: 44px;
    border-left: 3px solid transparent;
    transition: color .15s, border-color .15s, padding-left .15s;
  }
  .nav--open .nav__links a.active {
    color: var(--mint);
    border-left-color: var(--mint);
    padding-left: 1rem;
  }
  .nav--open .nav__cta-mobile {
    display: inline-flex !important;
    align-items: center; justify-content: center;
    margin-top: 1.25rem; padding: 0.85rem 1.5rem;
    background: var(--forest); color: var(--white) !important;
    font-family: 'Montserrat', sans-serif; font-weight: 700;
    font-size: 0.72rem; letter-spacing: 0.11em; text-transform: uppercase;
    text-decoration: none; width: 100%;
  }

  .cta-band {
    display: flex !important;
    flex-direction: column !important;
    padding: 3rem 1.25rem !important;
    gap: 1.5rem !important;
    text-align: center !important;
  }
  .cta-band__btns {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }
  .cta-band__btns a { text-align: center; }

  .footer {
    grid-template-columns: 1fr !important;
    padding: 3rem 1.25rem 2rem !important;
    gap: 2rem !important;
  }
  .footer__bottom {
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 1.25rem 0 !important;
    text-align: center !important;
  }
  .footer__bottom-right { flex-wrap: wrap; gap: 0.5rem; justify-content: center; }

  .page-header { padding: 2.5rem 1.25rem 2rem !important; min-height: 160px !important; }
  .page-header__title { font-size: clamp(1.6rem, 7vw, 2.5rem) !important; }
  .page-header__ghost { font-size: clamp(3rem, 16vw, 7rem) !important; }

  .sec-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
    padding: 2.5rem 1.25rem 1.25rem !important;
  }

  .btn-white, .btn-mint, .btn-forest, .btn-outline-white {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ── ADMIN BAR MOBILE — dropdown offset (questo media query NON può stare dentro @media 860px) ── */
@media screen and (max-width: 782px) {
  .admin-bar .nav--open .nav__links { top: 128px !important; max-height: calc(100vh - 128px) !important; }
}

/* ── PROGETTI HOMEPAGE — padding esplicito ───────── */
.proj-grid-home { padding: 0 3rem; }

/* ── LANG SWITCH ─────────────────────────────────── */
.nav .lang-switch {
  display: flex; align-items: center; gap: 0.3rem;
  font-family: 'Roboto', sans-serif;
  font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.nav .lang-switch__active {
  color: var(--mint); font-weight: 700;
  text-decoration: none;
}
.nav .lang-switch__sep { color: rgba(0,0,0,0.2); margin: 0 0.1rem; }
.nav .lang-switch__link {
  color: var(--muted) !important;
  text-decoration: none !important;
  transition: color .15s;
}
.nav .lang-switch__link:hover { color: var(--forest) !important; }

/* ── COMPLIANZ — nascondi bottone flottante ──────── */
.cmplz-manage-consent { display: none !important; }
