/* ── Variables ── */
:root {
  --navy: #1B3A6B;
  --night: #0F1F3D;
  --red: #C8102E;
  --gray-bg: #F5F7FA;
  --white: #FFFFFF;
  --header-height: 68px;
}

/* ── Reset ── */
* { box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; color: var(--night); background: var(--white); margin: 0; overflow-x: hidden; }
h1, h2, h3, h4 { font-family: 'Outfit', sans-serif; }
/* Micro-reset che sostituisce il preflight di Tailwind (rimosso: nessuna utility in uso) */
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }

/* ── Skip link (Fix #14) ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--red);
  color: white;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 9999;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ── Nav ── */
.site-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: rgba(11, 25, 55, 0.97); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(255,255,255,0.07); }
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 2rem; height: var(--header-height); display: flex; align-items: center; justify-content: space-between; }
.nav-logo { display: inline-flex; align-items: center; flex-shrink: 0; min-height: 44px; text-decoration: none; }
.nav-logo img { width: 220px; height: auto; }
.nav-links { display: flex; align-items: center; gap: clamp(0.75rem, 1.5vw, 1.5rem); white-space: nowrap; list-style: none; margin: 0; padding: 0; }
.nav-links a { font-size: 0.875rem; font-weight: 500; color: rgba(255,255,255,0.75); text-decoration: none; letter-spacing: 0.01em; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: white; }
/* Fix #10: specificità superiore invece di !important */
.nav-links .btn-nav { min-height: 44px; display: inline-flex; align-items: center; background: var(--red); color: white; padding: 0.5rem 1.25rem; border-radius: 6px; font-weight: 600; font-size: 0.85rem; transition: background 0.2s, opacity 0.2s; }
.nav-links .btn-nav:hover { opacity: 0.88; }
.nav-links .nav-phone { display: inline-flex; align-items: center; gap: 0.4rem; font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 0.875rem; color: rgba(255,255,255,0.9); }
.nav-links .nav-phone:hover { color: white; }
.nav-links .nav-phone svg { color: var(--red); }
.nav-phone--light { display: inline-flex; align-items: center; gap: 0.45rem; color: white; font-weight: 600; text-decoration: none; transition: opacity 0.2s; }
.nav-phone--light:hover { opacity: 0.85; }

/* ── Hamburger ── */
.hamburger { display: none; position: relative; flex-direction: column; justify-content: center; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; padding: 0.875rem 0.75rem; touch-action: manipulation; -webkit-tap-highlight-color: transparent; z-index: 110; }
.hamburger span { display: block; width: 22px; height: 2px; background: white; border-radius: 2px; transition: transform 0.3s, opacity 0.3s; pointer-events: none; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile menu ── */
.mobile-menu { display: none; position: fixed; top: var(--header-height); left: 0; right: 0; z-index: 99; background: rgba(11,25,55,0.99); border-bottom: 1px solid rgba(255,255,255,0.07); padding: 1rem 2rem 1.5rem; transform: translateY(8px); opacity: 0; transition: transform 0.25s ease, opacity 0.25s ease; pointer-events: none; max-height: calc(100vh - var(--header-height)); max-height: calc(100dvh - var(--header-height)); overflow-y: auto; overscroll-behavior: contain; }
.mobile-menu.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.mobile-menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.mobile-menu ul li a { display: block; padding: 0.85rem 0; font-size: 1rem; font-weight: 500; color: rgba(255,255,255,0.75); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.06); transition: color 0.2s; }
.mobile-menu ul li:last-child a { border-bottom: none; }
.mobile-menu ul li a:hover, .mobile-menu ul li a.active { color: white; }
/* Fix #10: rimosso !important */
.mobile-menu .mobile-menu-cta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1.25rem; }
.mobile-menu .btn-nav-mobile { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; background: var(--red); color: white; padding: 0.75rem 1rem; border-radius: 8px; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.95rem; text-align: center; text-decoration: none; transition: opacity 0.2s; }
.mobile-menu .btn-nav-mobile:hover { opacity: 0.88; }
.mobile-menu .btn-nav-mobile--wa { background: #157a3e; }

/* ── Page hero (pagine interne) ── */
.page-hero { background: linear-gradient(135deg, var(--night) 0%, var(--navy) 60%, #1e4d8c 100%); padding: 8rem 2rem 4rem; position: relative; overflow: hidden; }
.page-hero::before { content: ''; position: absolute; top: -20%; right: -5%; width: 600px; height: 600px; background: radial-gradient(circle, rgba(200,16,46,0.1) 0%, transparent 70%); pointer-events: none; }
.page-hero-inner { max-width: 1200px; margin: 0 auto; position: relative; z-index: 1; }
.page-tag { display: inline-flex; align-items: center; gap: 0.5rem; background: rgba(200,16,46,0.15); border: 1px solid rgba(200,16,46,0.3); color: #ffb3bf; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.3rem 0.85rem; border-radius: 100px; margin-bottom: 1.5rem; }
.page-tag::before { content: ''; width: 5px; height: 5px; background: var(--red); border-radius: 50%; }
.page-hero h1 { font-size: clamp(2.2rem, 4vw, 3.6rem); font-weight: 800; color: white; line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 1rem; }
.page-hero p { font-size: 1.05rem; color: rgba(255,255,255,0.8); max-width: 480px; line-height: 1.7; margin: 0; }

/* ── Footer ── */
footer { background: var(--night); padding: 3rem 2rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; }
.footer-logo { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.footer-logo img { width: 240px; height: auto; }
.footer-links { display: flex; gap: 2rem; list-style: none; margin: 0; padding: 0; }
.footer-links a { font-size: 0.82rem; color: rgba(255,255,255,0.75); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: white; }
.footer-copy { font-size: 0.78rem; color: rgba(255,255,255,0.75); }
.footer-brand { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-tagline { font-size: 0.82rem; font-style: italic; line-height: 1.5; color: rgba(255,255,255,0.75); }
.footer-contacts { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.footer-contacts a { font-size: 0.78rem; color: rgba(255,255,255,0.75); text-decoration: none; transition: color 0.2s; }
.footer-contacts a:hover { color: rgba(255,255,255,0.85); }

/* ── Focus visibile ── */
:focus-visible { outline: 3px solid #0066bb; outline-offset: 3px; border-radius: 4px; }
a:focus-visible { outline-offset: 2px; }

/* ── Banner CTA condivisi (pagine interne) ── */
.cta-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn-white { display: inline-flex; align-items: center; gap: 0.55rem; }
.btn-white svg { flex-shrink: 0; }
.btn-ghost { display: inline-flex; align-items: center; gap: 0.55rem; background: transparent; color: white; padding: 0.85rem 2rem; border-radius: 8px; font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 0.95rem; text-decoration: none; border: 1px solid rgba(255,255,255,0.5); transition: background 0.2s, border-color 0.2s; white-space: nowrap; }
.btn-ghost:hover { background: rgba(255,255,255,0.12); border-color: white; }

/* ── Pulsanti hero condivisi (definiti anche in home.css per la homepage) ── */
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn-primary { display: inline-flex; align-items: center; gap: 0.55rem; background: var(--red); color: white; padding: 0.85rem 2rem; border-radius: 8px; font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 0.95rem; text-decoration: none; transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 4px 20px rgba(200,16,46,0.35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(200,16,46,0.45); }
.btn-primary svg { flex-shrink: 0; }
.btn-secondary { display: inline-flex; align-items: center; gap: 0.55rem; background: rgba(255,255,255,0.08); color: white; padding: 0.85rem 2rem; border-radius: 8px; font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 0.95rem; text-decoration: none; border: 1px solid rgba(255,255,255,0.2); transition: background 0.2s, border-color 0.2s; }
.btn-secondary:hover { background: rgba(255,255,255,0.13); border-color: rgba(255,255,255,0.35); }
.btn-secondary svg { flex-shrink: 0; }
.btn-secondary.btn-wa { border-color: rgba(37,211,102,0.45); }
.btn-secondary.btn-wa svg { color: #4ade80; }
.btn-secondary.btn-wa:hover { border-color: rgba(37,211,102,0.75); background: rgba(37,211,102,0.12); }
.page-hero .hero-cta { margin-top: 2rem; }

/* ── Animazioni ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

/* ── Floating WhatsApp button ── */
.wa-float { display: flex; position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 200; align-items: center; gap: 0.6rem; background: #157a3e; border-radius: 100px; padding: 0.65rem 1.15rem 0.65rem 0.8rem; text-decoration: none; box-shadow: 0 4px 20px rgba(37,211,102,0.4); transition: transform 0.2s, box-shadow 0.2s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.wa-float:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(37,211,102,0.45); }
.wa-float-icon { display: flex; }
.wa-float-icon svg { width: 26px; height: 26px; fill: white; }
.wa-float-label { font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 0.85rem; color: white; white-space: nowrap; }
@media (max-width: 640px) {
  .wa-float { bottom: 1.25rem; right: 1.25rem; width: 56px; height: 56px; padding: 0; justify-content: center; border-radius: 50%; }
  .wa-float-label { display: none; }
  .wa-float-icon svg { width: 30px; height: 30px; }
  .wa-float:active { transform: scale(0.94); box-shadow: 0 2px 12px rgba(37,211,102,0.35); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
.page-tag { animation: fadeUp 0.5s ease both; }

/* ── Touch feedback (mobile) ── */
@media (hover: none) {
  .nav-links a:active { color: white; }
  .mobile-menu ul li a:active { color: white; }
  .mobile-menu .btn-nav-mobile:active { opacity: 0.8; }
  .faq-question:active { color: var(--red); }
}

/* ── Banner aggiornamento service worker (Punto 7) ── */
.sw-update-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--night);
  color: white;
  padding: 0.75rem 1rem 0.75rem 1.25rem;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  font-size: 0.85rem;
  animation: fadeUp 0.3s ease both;
  max-width: calc(100vw - 3rem);
}
.sw-update-text { font-family: 'Outfit', sans-serif; font-weight: 600; }
.sw-update-btn {
  background: var(--red);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.sw-update-btn:hover { opacity: 0.88; }
.sw-update-dismiss {
  background: transparent;
  color: rgba(255,255,255,0.75);
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0 0.25rem;
  cursor: pointer;
  transition: color 0.2s;
}
.sw-update-dismiss:hover { color: white; }
@media (max-width: 640px) {
  .sw-update-banner { left: 1rem; right: 1rem; bottom: 5.5rem; max-width: none; }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .footer-inner { flex-wrap: wrap; gap: 1.25rem; }
  .footer-links { flex-wrap: wrap; gap: 1.25rem; }
}
/* L'altezza del menu mobile è stabile anche prima dell'avvio di nav.js.
   Il fallback senza JavaScript è caricato nel head tramite noscript. */
@media (max-width: 1200px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .mobile-menu { display: block; }
}
@media (max-width: 640px) {
  .nav-inner { padding-left: 1.25rem; padding-right: 1.25rem; }
  .nav-logo img { width: 210px; }
  .mobile-menu { padding-left: 1.25rem; padding-right: 1.25rem; }
  .page-hero { padding: 7rem 1.5rem 3.5rem; }
  .page-hero h1 { font-size: clamp(1.6rem, 7vw, 2.2rem); }
  .page-hero p { font-size: 0.95rem; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-logo { align-self: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }
  .footer-contacts { justify-content: center; }
}

/* hidden e focus restano affidabili anche in componenti con display personalizzato. */
[hidden] { display: none !important; }
.site-nav :focus-visible, .mobile-menu :focus-visible, footer :focus-visible,
.page-hero :focus-visible, .article-hero :focus-visible,
.category-cta :focus-visible { outline-color: #ffcf66; }
[id] { scroll-margin-top: calc(var(--header-height) + 1rem); }
.sw-update-banner { flex-wrap: wrap; }
.sw-update-btn, .sw-update-dismiss { min-height: 44px; }
.sw-update-dismiss { min-width: 44px; }
