/*
 * Errore Medico Risarcimento — Base CSS
 * Reset, header, footer, componenti condivisi e layout sezioni.
 * Stili specifici per-pagina vanno in assets/css/style.css
 */

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text);
  background: #fff;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.menu-open { overflow: hidden; }
img, video, svg { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }

/* ── Effetti globali ─────────────────────────────────────────────────────────── */
.grain {
  pointer-events: none; position: fixed; inset: 0; z-index: 9999; opacity: .035;
  background-image: radial-gradient(circle at 1px 1px, #000 1px, transparent 0);
  background-size: 5px 5px; mix-blend-mode: multiply;
}
.cursor-follower {
  position: fixed; z-index: 9998; width: 180px; height: 180px; border-radius: 50%;
  pointer-events: none; opacity: .12; filter: blur(30px); background: var(--gold);
  transform: translate(-50%,-50%); display: none;
}
@media (pointer: fine) { .cursor-follower { display: block; } }

/* ── Skip link ───────────────────────────────────────────────────────────────── */
.skip-link {
  position: fixed; top: -100%; left: 1rem;
  background: var(--navy); color: #fff;
  padding: .5rem 1rem; z-index: var(--z-toast);
  border-radius: var(--radius-full); font-size: var(--text-sm);
  transition: top var(--transition-fast);
}
.skip-link:focus { top: 1rem; }

/* ── Header ──────────────────────────────────────────────────────────────────── */
.site-header {
  position: fixed; z-index: var(--z-sticky); top: 18px;
  left: 50%; transform: translateX(-50%);
  width: min(1240px, calc(100% - 32px));
  height: var(--header-height);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
  padding: 10px 16px 10px 10px;
  background: var(--header-bg);
  border: 1px solid var(--header-border);
  border-radius: 999px;
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(8,21,42,.10);
  transition: height .25s ease, background .25s ease, box-shadow .25s ease;
  overflow: visible; isolation: isolate;
}
.site-header.is-scrolled {
  height: 66px;
  background: var(--header-bg-scrolled);
  box-shadow: 0 8px 32px rgba(8,21,42,.12);
}
.brand { display: flex; align-items: center; gap: 10px; padding-left: 16px; padding-right: 12px; }
.brand-logo { height: 50px; width: auto; display: block; }

/* Nav desktop */
.desktop-nav { display: flex; align-items: center; justify-content: center; gap: 2px; position: relative; z-index: 1200; }
.nav-item { position: relative; }
.nav-item > a {
  display: flex; align-items: center; gap: 6px;
  padding: 11px 14px; border-radius: 999px;
  color: var(--muted); font-weight: 700; font-size: 15px; white-space: nowrap;
}
.nav-item > a:hover,
.nav-item > a.is-active,
.nav-item > a.is-parent-active,
.nav-item.current-menu-item > a,
.nav-item.current_page_item > a,
.nav-item.current-menu-ancestor > a,
.nav-item.current-page-ancestor > a,
.nav-item > a[aria-current="page"] { background: var(--navy); color: #fff; }

/* Indicatore freccia dropdown */
.nav-item.has-menu > a::after {
  content: ""; width: 6px; height: 6px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); opacity: .65;
}

/* Dropdown base */
.dropdown {
  position: absolute;
  top: calc(100% + 4px); left: 50%;
  transform: translate(-50%, 4px);
  width: 260px; padding: 8px;
  border-radius: 20px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(22px);
  border: 1px solid rgba(226,232,240,.95);
  box-shadow: 0 28px 90px rgba(8,21,42,.18);
  opacity: 0; pointer-events: none;
  transition: .22s ease;
  display: grid; gap: 4px;
}
.dropdown::before {
  content: ""; position: absolute; top: -8px; left: 0; right: 0; height: 8px;
}
.has-menu:hover .dropdown,
.has-menu:focus-within .dropdown {
  opacity: 1; pointer-events: auto; transform: translate(-50%, 0);
}
.dropdown a {
  min-height: 44px; padding: 10px 14px; border-radius: 14px;
  color: var(--text); font-size: 14px; font-weight: 700;
  display: flex; align-items: center;
}
.dropdown a:hover, .dropdown a.is-active { background: var(--soft); }

/* Mega menu servizi */
.nav-item.mega { position: static; }
.nav-item.mega .service-dropdown {
  left: 50%; transform: translate(-50%, 4px);
  width: min(760px, calc(100vw - 48px));
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px; padding: 14px;
}
.nav-item.mega:hover .service-dropdown,
.nav-item.mega:focus-within .service-dropdown { transform: translate(-50%, 0); }
.service-dropdown a {
  min-height: 74px; grid-template-columns: 86px 1fr;
  display: grid; align-items: center; gap: 12px; padding: 14px;
  border: 1px solid rgba(226,232,240,.9); background: #fff;
  border-radius: 14px; line-height: 1.18;
}
.service-dropdown a:hover { background: var(--navy); color: #fff; }
.service-dropdown span {
  display: block; font-size: 10px; color: var(--gold-dark);
  letter-spacing: .1em; text-transform: uppercase; font-weight: 900;
}
.service-dropdown a:hover span { color: var(--gold); }

/* Azioni header */
.header-actions { display: flex; align-items: center; gap: 8px; position: relative; z-index: 1300; }
.call-link { padding: 10px 14px; border-radius: 999px; color: var(--red); font-weight: 800; font-size: 15px; }
.header-cta {
  background: var(--green); color: #fff; padding: 12px 18px;
  border-radius: 999px; font-weight: 800; font-size: 15px;
  box-shadow: 0 8px 20px rgba(26,122,76,.22);
}
.header-cta:hover { background: var(--green-dark); }

/* Burger mobile */
.menu-toggle {
  display: none; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: var(--navy);
  align-items: center; justify-content: center; cursor: pointer;
}
.menu-toggle span { display: block; width: 18px; height: 2px; background: #fff; margin: 3px auto; }

/* Menu mobile */
.mobile-menu {
  position: fixed; inset: 0; z-index: 1200;
  background: var(--navy); color: #fff;
  transform: translateX(100%);
  transition: transform .45s cubic-bezier(.19,1,.22,1);
  padding: 24px; display: grid; grid-template-rows: auto 1fr auto;
}
body.menu-open .mobile-menu { transform: none; }
.mobile-menu-head { display: flex; justify-content: space-between; align-items: center; }
.menu-close { background: #fff; color: var(--navy); border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 800; cursor: pointer; }
.mobile-menu nav { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.mobile-menu nav a { font-family: var(--serif); font-size: clamp(42px,10vw,84px); line-height: .9; letter-spacing: -.06em; }
.mobile-sub { display: grid; gap: 8px; border-top: 1px solid rgba(255,255,255,.16); padding-top: 18px; }
.mobile-sub span { color: var(--gold); font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: .12em; }
.mobile-sub a { color: rgba(255,255,255,.72); font-size: 14px; }

/* ── Elementi condivisi ──────────────────────────────────────────────────────── */
.eyebrow {
  display: block; color: var(--gold-dark);
  font-size: 12px; text-transform: uppercase;
  letter-spacing: .14em; font-weight: 900;
  margin-bottom: clamp(18px, 1.8vw, 28px); line-height: 1.1;
}

/* Bottoni */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; font-weight: 900; min-height: 48px;
  padding: 14px 22px; border: 1px solid transparent;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
  cursor: pointer;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 10px 24px rgba(26,122,76,.24); }
.btn-primary:hover { background: var(--green-dark); box-shadow: 0 16px 32px rgba(26,122,76,.28); }
.btn-ghost { border-color: rgba(255,255,255,.45); color: #fff; background: rgba(255,255,255,.06); }
.btn-secondary { background: #fff; color: var(--navy); }
.btn-lg { min-height: 52px; padding-inline: 26px; }
.btn-xl { min-height: 56px; padding-inline: 28px; font-size: 16px; }

/* Reveal on scroll — disattivato nell'editor Elementor (.elementor-editor-active sul body) */
body:not(.elementor-editor-active) [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
}
body:not(.elementor-editor-active) .is-revealed {
  opacity: 1 !important;
  transform: none !important;
  transition: opacity .8s cubic-bezier(.19,1,.22,1), transform .8s cubic-bezier(.19,1,.22,1);
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy-2); color: #fff;
  padding: var(--section-y-lg) var(--container-padding-x) 110px;
}
.footer-top {
  display: grid; grid-template-columns: 1fr auto; gap: 32px;
  align-items: end; border-bottom: 1px solid rgba(255,255,255,.12); padding-bottom: 36px;
}
.footer-top h2 {
  font-family: var(--serif); font-size: clamp(42px,6vw,96px);
  line-height: .88; letter-spacing: -.05em; margin: 0; color: #fff;
}
.footer-top p { color: rgba(255,255,255,.66); max-width: 780px; }
.footer-grid {
  display: grid; grid-template-columns: .8fr 1.1fr .9fr;
  gap: 34px; padding-top: 34px;
}
.footer-grid strong {
  display: block; color: var(--gold); margin-bottom: 16px;
  text-transform: uppercase; letter-spacing: .1em; font-size: 12px;
}
.footer-grid a { display: block; color: rgba(255,255,255,.66); margin-bottom: 10px; line-height: 1.35; }
.footer-grid a:hover { color: #fff; }
.footer-bottom {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,.12);
  margin-top: 34px; padding-top: 20px;
  color: rgba(255,255,255,.50); font-size: 13px;
}
.footer-bottom a { color: rgba(255,255,255,.50); }
.footer-bottom a:hover { color: #fff; }

/* ── Floating contacts ───────────────────────────────────────────────────────── */
.floating-contacts {
  position: fixed; z-index: 1100; right: 20px; bottom: 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.float-btn {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%; color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  transition: transform .2s ease, box-shadow .2s ease;
}
.float-btn:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.float-phone { background: var(--navy); }
.float-whatsapp { background: #25D366; }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.theme-toast {
  position: fixed; bottom: var(--space-8); left: 50%;
  transform: translateX(-50%) translateY(var(--space-8));
  background: var(--navy); color: #fff;
  padding: var(--space-3) var(--space-8); font-size: var(--text-sm);
  border-radius: var(--radius-full); z-index: var(--z-toast);
  opacity: 0; transition: opacity var(--transition-base), transform var(--transition-base);
  white-space: nowrap;
}
.theme-toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 1120px) {
  .desktop-nav, .call-link, .header-cta { display: none; }
  .menu-toggle { display: flex; }
  .site-header { grid-template-columns: auto 1fr auto; }
  .dropdown, .nav-item.mega .service-dropdown { display: none; }
  .footer-grid, .footer-top { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .site-header { top: 10px; width: calc(100% - 20px); height: var(--header-height-mobile); }
  .brand-logo { height: 34px; }
  .brand { padding-left: 8px; padding-right: 4px; }
  .floating-contacts { right: 14px; bottom: 16px; gap: 10px; }
  .float-btn { width: 50px; height: 50px; }
  .site-footer { padding-bottom: 120px; }
}

/* ── Accessibility / reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  video { animation: none !important; }
}

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.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; }
.hidden  { display: none !important; }
