/* ==============================================
   CODICE 3 — Modern Design System 2024
   ============================================== */

/* Font caricato tramite <link> in header.php con preconnect (più veloce dell'@import) */

/* ─── Custom Properties ─── */
:root {
  --red:        #e67e22;
  --red-dark:   #ca6f1e;
  --red-light:  #f39c12;
  --navy:       #142840;
  --navy-mid:   #1e3a5f;
  --navy-light: #2a4a7f;
  --bg:         #f5f0eb;
  --bg-alt:     #ffffff;
  --text:       #2d3748;
  --text-muted: #5a6472;
  --border:     #e2e8f0;

  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Oswald', 'Impact', sans-serif;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 40px rgba(0,0,0,.15);

  --r-sm: 4px;
  --r-md: 10px;
  --r-lg: 18px;
  --r-full: 9999px;

  --ease: .25s ease;
  --nav-h: 68px;

  /* Gradienti riutilizzati — definiti una volta sola per consistenza */
  --grad-hero:   linear-gradient(135deg, #0b1929 0%, var(--navy) 50%, var(--navy-mid) 100%);
  --grad-banner: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--red-dark); }
ul { list-style: none; }
button { font-family: inherit; }

/* ─── Typography ─── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  color: var(--navy);
  line-height: 1.2;
  letter-spacing: .3px;
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 600; }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.75rem); font-weight: 600; }
h4 { font-size: 1.2rem; font-weight: 600; }
p  { margin-bottom: 1rem; }
strong { font-weight: 600; }

/* ─── Layout ─── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* =============================================
   NAVIGATION
   ============================================= */

.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: var(--navy);
  box-shadow: 0 2px 20px rgba(0,0,0,.35);
}

.navbar .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  flex-shrink: 0;
}
.nav-brand img { height: 42px; width: auto; }
.nav-brand-text {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
}
.nav-brand-text span { color: var(--red-light); }

/* Logo S.A.R. sulla destra della navbar (mirror del brand a sinistra).
   L'artwork ha molto margine trasparente interno: a parità di altezza
   con l'altro logo risulterebbe visivamente più piccolo, quindi qui
   l'immagine è leggermente più alta per compensare. */
.nav-brand-sar { flex-shrink: 0; }
.nav-brand-sar img { height: 54px; }

/* Desktop menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: .1rem;
}
.nav-item { position: relative; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .45rem .7rem;
  color: rgba(255,255,255,.82);
  font-size: .8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .6px;
  border-radius: var(--r-sm);
  transition: all var(--ease);
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.1);
}
.nav-link .arr { font-size: .55rem; transition: transform var(--ease); }
.nav-item:hover .arr, .nav-item:focus-within .arr { transform: rotate(180deg); }

/* Dropdown */
.dropdown {
  position: absolute;
  top: calc(100% + .5rem);
  left: 0;
  min-width: 195px;
  background: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xl);
  padding: .4rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--ease);
  z-index: 200;
}
.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown a {
  display: block;
  padding: .45rem .8rem;
  color: var(--text);
  font-size: .82rem;
  font-weight: 500;
  border-radius: var(--r-sm);
  transition: all var(--ease);
}
.dropdown a:hover {
  background: var(--bg);
  color: var(--red);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: .5rem;
  background: none;
  border: none;
  outline: none;
}
.hamburger:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all var(--ease);
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile overlay */
.nav-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 998;
  opacity: 0; visibility: hidden;
  transition: all var(--ease);
}
.nav-overlay.open { opacity: 1; visibility: visible; }

/* Mobile drawer */
.mobile-menu {
  position: fixed;
  top: 0; right: -100%;
  width: 82%; max-width: 340px;
  height: 100%;
  background: var(--navy);
  z-index: 999;
  overflow-y: auto;
  transition: right .3s cubic-bezier(.4,0,.2,1);
  padding: 1rem;
  /* La navbar è sticky con z-index maggiore e resta sopra: senza questo spazio
     il mob-head (logo, toggle tema, chiusura) rimarrebbe nascosto sotto di lei */
  padding-top: calc(var(--nav-h) + 1rem);
}
.mobile-menu.open { right: 0; }
.mob-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .8rem 0 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: .5rem;
}
.mob-head-actions { display: flex; align-items: center; gap: .7rem; }
.mob-close {
  background: none; border: none;
  color: #fff; font-size: 1.6rem;
  cursor: pointer; line-height: 1; padding: .2rem;
}
.mob-item { border-bottom: 1px solid rgba(255,255,255,.05); }
.mob-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: .8rem .4rem;
  background: none;
  border: none;
  color: rgba(255,255,255,.82);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
  text-align: left;
  cursor: pointer;
}
.mob-link:hover { color: #fff; }
.mob-sub { display: none; padding: .25rem 0 .5rem 1rem; background: rgba(0,0,0,.2); }
.mob-sub.open { display: block; }
.mob-sub a {
  display: block;
  padding: .45rem .4rem;
  color: rgba(255,255,255,.65);
  font-size: .82rem;
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.mob-sub a:hover { color: var(--red-light); }

/* =============================================
   HERO
   ============================================= */

.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: center;
  background: var(--grad-hero);
  overflow: hidden;
}
.hero-shape {
  position: absolute;
  right: -5%;
  top: 50%;
  transform: translateY(-50%);
  width: min(45vw, 500px);
  height: min(45vw, 500px);
  background: radial-gradient(circle, rgba(230,126,34,.25) 0%, transparent 70%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; max-width: 680px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: rgba(230,126,34,.18);
  border: 1px solid rgba(243,156,18,.35);
  color: var(--red-light);
  padding: .35rem 1rem;
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 1.5rem;
}
.hero h1 {
  color: #fff;
  margin-bottom: 1.25rem;
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.hero h1 em {
  font-style: normal;
  color: var(--red-light);
}
/* Riga titolo + anteprima "novità": l'immagine si ingrandisce al passaggio
   del mouse per rendere leggibile la locandina, senza aprire un lightbox. */
.hero-title-row {
  display: flex;
  align-items: center;
  gap: 3rem;
  flex-wrap: wrap;
}
.hero-title-row h1 { margin-bottom: 0; }
.novita-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
}
/* Oltre la tablet c'è spazio per affiancare titolo e anteprima sulla stessa riga:
   .hero-content è limitato a 680px per la leggibilità del paragrafo, ma qui la riga
   del titolo deve poter sporgere oltre quel limite senza andare a capo.
   Soglia 1400px (non 1025px): con l'h1 esteso "Codice 3 → S.A.R. Support at
   Rescuers" il testo da solo supera già i 1025px, quindi forzare nowrap prima
   di 1400px tagliava il riquadro "Novità" fuori dal viewport (.hero ha
   overflow:hidden, quindi il taglio è silenzioso, non uno scroll orizzontale
   visibile — verificato via screenshot a varie larghezze). Sotto 1400px la
   riga va semplicemente a capo (comportamento .hero-title-row di base). */
@media (min-width: 1400px) {
  .hero-title-row {
    flex-wrap: nowrap;
    width: max-content;
    max-width: none;
  }
}
/* Sopra i 1400px compare la decorazione fissa della volontaria sul lato destro
   (.side-deco-dx): qui spostiamo la locandina verso la sua spalla, come se la
   stesse leggendo. Sotto quella soglia la decorazione è nascosta, quindi la
   locandina resta semplicemente accanto al titolo.
   La costante qui sotto è tarata sulla larghezza renderizzata dell'h1: la
   locandina segue il testo nel flusso flex, quindi un titolo più lungo la
   sposta già più a destra da sola, prima ancora di questa translate aggiuntiva
   — un titolo più corto o più lungo richiede di ricalibrare la costante
   (verificato via screenshot a varie larghezze, .hero ha overflow:hidden quindi
   uno sforamento non dà scroll orizzontale ma taglia silenziosamente la locandina). */
@media (min-width: 1401px) {
  .novita-preview {
    transform: translate(calc(50vw - 800px), 140px) rotate(-6deg);
  }
}
.novita-label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--red-light);
}
.novita-badge {
  width: 256px;
  height: 256px;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 2px solid rgba(255,255,255,.4);
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  cursor: pointer;
  transition: transform .3s ease, box-shadow .3s ease;
  transform-origin: center;
  position: relative;
  z-index: 5;
}
.novita-badge:hover,
.novita-badge:focus-visible {
  transform: scale(1.4);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,.75);
  margin-bottom: 2.5rem;
  max-width: 560px;
}
.hero-btns { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-scroll {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  animation: pulse-down 2.2s ease-in-out infinite;
}
@keyframes pulse-down {
  0%,100% { transform: translateX(-50%) translateY(0); opacity: .4; }
  50%      { transform: translateX(-50%) translateY(8px); opacity: .9; }
}

/* Page banner (smaller than full hero) */
.page-banner {
  background: var(--grad-banner);
  padding: 3.5rem 0 2.5rem;
  position: relative;
  overflow: hidden;
}
.page-banner::after {
  content: '';
  position: absolute;
  top: -60%;
  right: -8%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(230,126,34,.18) 0%, transparent 68%);
  pointer-events: none;
}
.page-banner h1 { color: #fff; margin-bottom: .5rem; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: rgba(255,255,255,.55);
  font-size: .82rem;
}
.breadcrumb a { color: rgba(255,255,255,.55); }
.breadcrumb a:hover { color: #fff; }
.breadcrumb .sep { color: rgba(255,255,255,.3); }

/* =============================================
   BUTTONS
   ============================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.8rem;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: .875rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  transition: all var(--ease);
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  line-height: 1;
}
.btn-primary {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-primary:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,.45);
}
.btn-outline:hover {
  background: rgba(255,255,255,.1);
  border-color: #fff;
  color: #fff;
  transform: translateY(-2px);
}
.btn-secondary {
  background: var(--navy-mid);
  color: #fff;
  border-color: var(--navy-mid);
}
.btn-secondary:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* =============================================
   NAVIGAZIONE TRA EDIZIONI (prev / next)
   usata in fondo alle pagine esercitazioni/
   ============================================= */

/* Griglia a 2 colonne di pari larghezza: precedente | successiva */
.ex-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 1rem;
}

/* Card prev/next: cerchio con freccia + etichetta/anno, cliccabile su tutta l'area.
   "Precedente" è ancorata a sinistra (icona+testo verso il bordo sinistro,
   testo allineato a sinistra). "Successiva" è il mirror: ancorata a destra,
   con freccia e testo entrambi "rivolti" verso il bordo esterno destro. */
.ex-nav-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .9rem;
  min-width: 0;             /* permette al testo di andare in ellissi invece di sforare */
  padding: .9rem 1.2rem;
  border-radius: var(--r-md);
  background: var(--bg-alt);
  border: 2px solid var(--border);
  text-decoration: none;
  transition: all var(--ease);
}
.ex-nav-link:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
/* "Successiva": gruppo testo+freccia spostato sul bordo destro (esterno) della
   card, con la freccia per ultima (più esterna) e il testo allineato a destra
   in modo che cresca nella stessa direzione della freccia */
.ex-nav-link.is-next { justify-content: flex-end; }
.ex-nav-link.is-next .ex-nav-text { align-items: flex-end; }
.ex-nav-link.is-next .ex-nav-label,
.ex-nav-link.is-next .ex-nav-year { text-align: right; }

.ex-nav-arrow {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: var(--r-full);
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--ease);
}
.ex-nav-link:hover .ex-nav-arrow { background: var(--red); transform: scale(1.12); }

.ex-nav-text { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.ex-nav-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  white-space: nowrap;
}
.ex-nav-year {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .ex-nav-year { color: var(--text); }

/* Quando manca prev o next (prima/ultima edizione), un placeholder invisibile
   mantiene l'altra card nella sua colonna invece di farla espandere a piena larghezza */
.ex-nav-placeholder { visibility: hidden; }

/* Suggerimento per lo swipe: nascosto su desktop, dove non serve */
.ex-nav-hint {
  display: none;
  text-align: center;
  margin-top: .9rem;
  font-size: .78rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  /* Le due card restano sempre affiancate anche su mobile: qui si riducono
     solo gli spazi e si nasconde l'etichetta, per evitare che sforino */
  .ex-nav { gap: .6rem; }
  .ex-nav-link { padding: .7rem .8rem; gap: .6rem; }
  .ex-nav-arrow { width: 2rem; height: 2rem; font-size: 1rem; }
  .ex-nav-label { display: none; }     /* spazio limitato: resta visibile solo l'anno */
  .ex-nav-year { font-size: 1rem; }
  .ex-nav-hint { display: block; }     /* qui lo swipe è comodo: lo segnaliamo */
}

/* =============================================
   SECTIONS
   ============================================= */

.section { padding: 5rem 0; }
.section-white { background: #fff; }
.section-dark  {
  background: var(--navy);
  color: rgba(255,255,255,.85);
}
.section-dark h2, .section-dark h3, .section-dark h4 { color: #fff; }
.section-dark p { color: rgba(255,255,255,.82); }
/* Le card hanno sfondo #fff fisso (vedi .card più sotto) anche dentro una
   sezione scura: il testo va quindi scuro come in una sezione chiara,
   altrimenti ".section-dark p" sopra lo forza bianco su sfondo bianco. */
.section-dark .card-text { color: var(--text-muted); }

/* Traccia cardiaco animata (decorazione, es. soccorso-sanitario.php): due <svg>
   identici affiancati in una striscia larga il 200% del contenitore. Lo
   scorrimento sposta la striscia di -50% della SUA larghezza, cioè esattamente
   una larghezza di contenitore: quando il primo tracciato esce a sinistra il
   secondo (identico) si trova già dov'era il primo all'inizio, quindi il loop
   è invisibile e continuo. */
.ecg-section { padding: 3rem 0; }
.ecg-wrap {
  --ecg-color: #2ecc71;
  overflow: hidden;
  border-radius: var(--r-md);
  background: rgba(0,0,0,.15);
}
.ecg-track {
  display: flex;
  width: 200%;
  animation: ecg-scroll 7s linear infinite;
}
.ecg-trace {
  width: 50%;
  flex: 0 0 50%;
  height: 90px;
  display: block;
}
.ecg-line {
  fill: none;
  stroke: var(--ecg-color);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px var(--ecg-color));
}
@keyframes ecg-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ecg-track { animation: none; }
}

/* Sezione con foto random in dissolvenza sullo sfondo (es. "Le Esercitazioni"
   in home): le <img> restano quasi trasparenti, così si fondono col colore
   di sfondo della sezione (bianco o navy) invece di coprirlo. Il colore di
   sfondo resta quello di .section-white/.section-dark: qui si aggiunge solo
   il layer decorativo sopra.
   Il ciclo tra le foto è pilotato da JS (modern.js), non da N animazioni CSS
   indipendenti: con animation-delay su ogni <img>, su alcuni browser i
   timeline potevano disallinearsi (tab in background, throttling) lasciando
   più foto visibili insieme o lo slideshow bloccato. Con una sola classe
   .is-active spostata da JS c'è sempre un solo stato coerente. */
.section-photobg { position: relative; overflow: hidden; }
.section-photobg .container { position: relative; z-index: 1; }
.photobg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.photobg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: grayscale(35%) blur(1px);
  transition: opacity 1.8s ease;
}
.photobg-img.is-active { opacity: .14; }
@media (prefers-reduced-motion: reduce) {
  .photobg-img { transition: none; }
}

.s-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 3.5rem;
}
.s-tag {
  display: inline-block;
  padding: .25rem 1rem;
  background: rgba(230,126,34,.1);
  color: var(--red);
  border-radius: var(--r-full);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: .75rem;
}
.section-dark .s-tag {
  background: rgba(243,156,18,.2);
  color: var(--red-light);
}
.s-header h2 { margin-bottom: .75rem; }
.s-header p { color: var(--text-muted); font-size: 1.05rem; }
.section-dark .s-header p { color: rgba(255,255,255,.80); }
.divider {
  width: 50px; height: 4px;
  background: var(--red);
  border-radius: 2px;
  margin: .8rem auto;
}

/* =============================================
   CARDS
   ============================================= */

.card {
  background: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--ease);
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.card-img { width: 100%; height: 210px; object-fit: cover; }
.card-body { padding: 1.4rem; }
.card-tag {
  display: inline-block;
  padding: .2rem .75rem;
  background: rgba(230,126,34,.1);
  color: var(--red);
  border-radius: var(--r-full);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .7rem;
}
.card-title { font-size: 1.1rem; margin-bottom: .4rem; }
/* Stesso motivo di ".section-dark .card-text" sopra: la card resta chiara
   anche dentro una sezione scura, quindi anche il titolo va scuro. */
.section-dark .card-title { color: var(--navy); }
.card-text { color: var(--text-muted); font-size: .88rem; margin-bottom: 0; }

/* =============================================
   GRIDS
   ============================================= */

.grid { display: grid; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }

/* =============================================
   STATS / FEATURES
   ============================================= */

.stat-card { text-align: center; padding: 2.5rem 1rem; }
.stat-number {
  font-family: var(--font-heading);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--red);
  line-height: 1;
  margin-bottom: .5rem;
}
.stat-label {
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.section-dark .stat-label { color: rgba(255,255,255,.6); }

.feat-icon {
  width: 60px; height: 60px;
  background: rgba(230,126,34,.1);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

/* =============================================
   TIMELINE
   ============================================= */

.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: .45rem; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.tl-item { position: relative; margin-bottom: 2.2rem; }
.tl-item::before {
  content: '';
  position: absolute;
  left: -1.625rem;
  top: .3rem;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--red);
}
.tl-year {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: .15rem;
}
.tl-title { font-size: 1rem; font-weight: 600; color: var(--navy); margin-bottom: .2rem; }
.tl-text  { font-size: .875rem; color: var(--text-muted); }

/* =============================================
   GALLERY
   ============================================= */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.g-item {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
  background: var(--navy);
}
.g-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.g-item:hover img { transform: scale(1.07); }
.g-item:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.g-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.72) 0%, transparent 55%);
  opacity: 0;
  transition: opacity var(--ease);
  display: flex; align-items: flex-end;
  padding: .9rem;
}
.g-item:hover .g-overlay { opacity: 1; }
.g-caption {
  color: #fff;
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.4;
}

/* ─── Effetto "dado": le foto ruotano in 3D seguendo il mouse (vedi
   modern.js), come se mostrassero un'altra faccia. Attivo solo sulle
   griglie con classe aggiuntiva .gallery-dice, non su tutte le gallerie. */
.gallery-dice .g-item { perspective: 450px; aspect-ratio: 3/4; }
.gallery-dice .g-item img { transition: transform .15s ease-out; object-fit: contain; } /* contain, non cover: niente ritagli, si vede sempre tutta la foto */
.gallery-dice .g-item:hover img { transform: none; } /* il tilt lo applica il JS via inline style */

/* ─── Galleria verticale: per foto in formato verticale (es. locandine/bigini).
   Riquadro alto invece che 4/3, e "contain" invece di "cover" così l'immagine
   non viene mai ritagliata, anche se il riquadro si rimpicciolisce. */
.gallery-vertical .g-item { aspect-ratio: 3/4; }
.gallery-vertical .g-item img { object-fit: contain; }

/* alias used by exercise pages */
.gallery-item {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
  background: var(--navy);
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
  display: block;
}
.gallery-item:hover img { transform: scale(1.07); }

/* ─── Foto-grid (gallerie esercitazioni) ─── */
.foto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}
.foto-grid .g-item {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-sm);
}

/* Foto non ancora caricate (oltre il primo blocco): nessuna richiesta di
   rete finché non si clicca "Carica altre foto" (vedi modern.js) */
.g-item.g-pending { display: none; }

.gallery-more-wrap {
  text-align: center;
  margin-top: 1.5rem;
}

/* ─── Lightbox ─── */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.93);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
}
.lightbox.open { display: flex; }
.lb-inner {
  position: relative;
  flex-shrink: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lb-inner img {
  max-width: 88vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--r-md);
  user-select: none;
}
.lb-close {
  position: absolute;
  top: -2.8rem; right: 0;
  background: none; border: none;
  color: #fff; font-size: 2.2rem;
  cursor: pointer; line-height: 1;
}
.lb-caption {
  color: rgba(255,255,255,.75);
  font-size: .88rem;
  margin-top: .75rem;
  text-align: center;
}
.lb-counter {
  color: rgba(255,255,255,.4);
  font-size: .78rem;
  margin-top: .25rem;
}
.lb-prev, .lb-next {
  flex-shrink: 0;
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  font-size: 2.4rem;
  width: 3rem; height: 3rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  line-height: 1;
  user-select: none;
}
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.28); }

/* mobile: frecce fisse in basso al centro */
@media (max-width: 640px) {
  .lb-prev, .lb-next {
    position: absolute;
    bottom: 1.5rem;
    top: auto;
    transform: none;
    z-index: 10;
    width: 3.2rem;
    height: 3.2rem;
    font-size: 2rem;
  }
  .lb-prev { left: calc(50% - 3.8rem); }
  .lb-next { right: calc(50% - 3.8rem); }
  .lb-inner img {
    max-width: 96vw;
    max-height: 70vh;
  }
}

/* =============================================
   ORGANIZZAZIONI PARTECIPANTI
   ============================================= */

.org-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: center;
}
/* Card a riga singola: solo il nome (niente più ruolo sotto), quindi
   padding più snello e nessuna larghezza minima forzata → più compatta
   e si adatta al testo, soprattutto utile con liste lunghe. */
.org-badge {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: .55rem .9rem;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.org-badge:hover {
  border-color: var(--red);
  box-shadow: var(--shadow-sm);
}
.org-nome {
  font-weight: 600;
  font-size: .9rem;
  color: var(--navy);
}

/* =============================================
   PATROCINI
   ============================================= */

/* Barra compatta su sfondo navy — si distingue nettamente dalle sezioni adiacenti */
.patrocini-bar {
  background: var(--navy);
  padding: 1.1rem 0;
}

/* Label + pills su unica riga con wrap su mobile */
.patrocini-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem 1rem;
}

/* Etichetta "PATROCINI" in bianco attenuato */
.patrocini-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255,255,255,.5);
  flex-shrink: 0;
}

/* Contenitore pills */
.patrocini-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

/* Singola pill bianca su navy */
.patrocini-item {
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--r-sm);
  padding: .3rem .85rem;
  font-size: .85rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
}

/* =============================================
   VIDEO SECTION
   ============================================= */

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.5rem; }
/* Video non ancora caricati (oltre il primo blocco): segnaposto vuoto senza
   tag <video>/<iframe>, nessuna richiesta di rete finché non si clicca
   "Carica altri video" (vedi modern.js) */
.video-card.v-pending { display: none; }
.video-card { background: #fff; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--ease); }
.video-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.video-card video { width: 100%; display: block; }
.video-card-body { padding: 1rem 1.2rem; }
.video-card-title { font-size: .95rem; font-weight: 600; color: var(--navy); }

/* =============================================
   TABLES
   ============================================= */

.tbl-wrap { overflow-x: auto; border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.tbl { width: 100%; border-collapse: collapse; background: #fff; font-size: .85rem; }
.tbl th {
  background: var(--navy-mid);
  color: #fff;
  padding: .8rem 1rem;
  text-align: left;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.tbl td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:nth-child(even) td { background: var(--bg); }
.tbl tr:hover td { background: rgba(230,126,34,.04); }

/* =============================================
   ACCORDION
   ============================================= */

.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: .75rem;
  overflow: hidden;
  background: #fff;
}
.accordion-item h3 { margin: 0; }
.accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  transition: background var(--ease);
}
.accordion-btn:hover { background: var(--bg); }
.accordion-btn .acc-arr { transition: transform var(--ease); font-size: .7rem; }
.accordion-btn.open { background: var(--navy); color: #fff; }
.accordion-btn.open .acc-arr { transform: rotate(180deg); }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s ease, padding .3s ease;
  padding: 0 1.25rem;
}
.accordion-body.open {
  max-height: 1000px;
  padding: 1.25rem;
}

/* =============================================
   ALERT
   ============================================= */

.alert {
  padding: 1rem 1.4rem;
  border-radius: var(--r-md);
  border-left: 4px solid;
  margin-bottom: 1.5rem;
  font-size: .9rem;
}
.alert-info { background: rgba(30,58,95,.08); border-color: var(--navy-mid); color: var(--navy); }
.alert-red  { background: rgba(230,126,34,.08); border-color: var(--red); color: var(--red-dark); }

/* =============================================
   INFO BLOCK
   ============================================= */

.info-block {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem;
  background: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.info-block-icon {
  width: 52px; height: 52px;
  flex-shrink: 0;
  background: rgba(230,126,34,.1);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
/* h3 invece di h4: la gerarchia heading sotto l'h2 della sezione non deve
   saltare un livello (vedi chi-siamo.php, cosa-abbiamo-fatto.php,
   risorse/francese.php, index.php). font-size esplicito per mantenere
   l'aspetto identico all'h4 di prima, invece della taglia più grande
   dell'h3 generico (clamp 1.2rem–1.75rem, vedi regola "h3" in cima al file). */
.info-block-body h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: .35rem; }
.info-block-body p { margin-bottom: 0; font-size: .9rem; color: var(--text-muted); }

/* =============================================
   EVENT META (data + luogo semplice)
   ============================================= */

.event-meta {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  font-size: .9rem;
  color: var(--text-muted);
}
.event-meta-sep { opacity: .35; }

/* =============================================
   QUOTE
   ============================================= */

.quote {
  border-left: 4px solid var(--red);
  padding: 1.25rem 1.5rem;
  background: rgba(230,126,34,.05);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin: 1.5rem 0;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--navy);
}

/* =============================================
   FOOTER
   ============================================= */

.footer {
  background: var(--navy);
  padding: 3.5rem 0 1.5rem;
  color: rgba(255,255,255,.68);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}
.footer-logo { height: 48px; margin-bottom: 1rem; }
.footer-brand h3 { color: #fff; font-size: 1.25rem; margin-bottom: .4rem; }
.footer-brand p { font-size: .855rem; margin-bottom: .5rem; }
.footer-col h4 {
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 1rem;
}
.footer-links { display: flex; flex-direction: column; gap: .5rem; }
.footer-links a {
  color: rgba(255,255,255,.58);
  font-size: .855rem;
  transition: color var(--ease);
}
.footer-links a:hover { color: #fff; }
.f-social { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .5rem; }
.f-social a {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  background: rgba(255,255,255,.08);
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.7);
  font-size: .8rem;
  font-weight: 600;
  transition: all var(--ease);
}
.f-social a:hover { background: var(--red); color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .78rem;
}
.footer-bottom a { color: rgba(255,255,255,.45); }
.footer-bottom a:hover { color: #fff; }

/* =============================================
   SCROLL TO TOP
   ============================================= */

.to-top {
  position: fixed;
  bottom: 1.75rem; right: 1.75rem;
  width: 44px; height: 44px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md);
  transition: all var(--ease);
  z-index: 500;
  line-height: 1;
}
.to-top:hover { background: var(--red-dark); transform: translateY(-3px); }
.to-top.vis { display: flex; }

/* =============================================
   ANIMATIONS
   ============================================= */

.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s ease, transform .6s ease;
}
.fade-up.in {
  opacity: 1;
  transform: translateY(0);
}

/* =============================================
   UTILITIES
   ============================================= */

.mt-1 { margin-top: .5rem; }  .mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }   .mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }.mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-red     { color: var(--red); }
.text-white   { color: #fff; }
.fw-bold      { font-weight: 700; }
.fw-600       { font-weight: 600; }
.uppercase    { text-transform: uppercase; letter-spacing: .8px; }

/* Divider seguito da un blocco di testo lungo: stesso .divider ma con più
   margine sotto. Sostituisce lo style="margin:0 0 1.5rem" ripetuto su
   decine di pagine (esercitazioni, viaggi, risorse, home). */
.divider-lg { margin: 0 0 1.5rem; }

/* Blocco di testo centrato più stretto, usato per il testo introduttivo
   delle pagine esercitazione. Sostituisce lo style="max-width:860px;
   margin:0 auto" ripetuto identico su ogni pagina esercitazioni/. */
.content-narrow { max-width: 860px; margin: 0 auto; }

/* Link (.card o .info-block) che deve ereditare il colore del testo del
   contenitore invece del rosso di default dei link (vedi regola "a" in
   cima al file). Il text-decoration:none è già garantito da quella regola,
   quindi qui serve solo il colore. */
.link-card { color: inherit; }

/* Immagine di copertina a piena larghezza con angoli arrotondati e ombra
   (copertine novità, foto pagina volontario). */
.cover-img { width: 100%; border-radius: var(--r-md); box-shadow: var(--shadow-lg); }

/* Prima foto di una galleria usata come copertina cliccabile che apre il
   lightbox (pagine viaggi). */
.g-cover { border-radius: var(--r-md); overflow: hidden; cursor: pointer; box-shadow: var(--shadow-lg); }
.g-cover img { width: 100%; display: block; }

/* Sezione senza spazio sotto, quando è seguita a ruota da un'altra sezione
   correlata (es. meta data/luogo di una novità appena sotto il banner). */
.section-notop { padding-bottom: 0; }

/* Badge bandiera + sigla Paese (viaggi, amici, home). */
.flag-badge { display: flex; align-items: center; justify-content: center; gap: .5rem; margin-bottom: .75rem; }
.flag-badge img { width: 2rem; height: auto; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
.flag-badge span { font-weight: 700; letter-spacing: .05em; color: var(--text-muted); }

/* Wrapper per embed video responsivo 16:9 (iframe YouTube/Vimeo). */
.embed-16-9 { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; }
.embed-16-9 iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* =============================================
   SPLIT LAYOUTS
   ============================================= */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
  .nav-menu      { display: none; }
  /* Il toggle tema si sposta nel drawer mobile (vedi .mob-head-actions): qui si nasconde
     solo quello nella navbar in alto, per lasciare spazio al logo S.A.R. con scritta */
  .navbar .dark-toggle { display: none; }
  .nav-brand-sar img { height: 38px; }
  .hamburger { display: flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Tablet: 769 px – 1024 px ── */
@media (min-width: 769px) and (max-width: 1024px) {
  /* three-col è fixed repeat(3,1fr): su tablet si porta a 2 colonne
     per evitare card troppo strette (< 200 px) su schermi da 800-900 px. */
  .three-col { grid-template-columns: repeat(2, 1fr); }
  /* Il page-banner mantiene padding più compatto su tablet */
  .page-banner { padding: 3rem 0 2rem; }
  .page-banner h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
}

@media (max-width: 768px) {
  .g2 { grid-template-columns: 1fr; }
  .two-col, .three-col { grid-template-columns: 1fr; gap: 2rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .video-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --nav-h: 60px; }
  /* Gap più stretto per lasciare più posto al logo S.A.R. con scritta nella navbar */
  .navbar .container { gap: .5rem; }
  .nav-brand-sar img { height: 32px; }
  .section { padding: 3.5rem 0; }
  .hero { min-height: 100svh; padding: 2rem 0; }
  .hero-btns { flex-direction: column; }
  .hero-btns .btn { width: 100%; justify-content: center; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .footer-bottom { flex-direction: column; align-items: center; text-align: center; }
  .footer-social-bar { flex-direction: column; gap: .75rem; }
}

/* Telefoni larghi ≤340px (ormai rari): la scritta "S.A.R." non ci starebbe
   più insieme a logo, icona e hamburger, quindi torna a mostrare solo l'icona */
@media (max-width: 340px) {
  .nav-brand-sar .nav-brand-text { display: none; }
}

/* ── Social bar footer ── */
.footer-social-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: 2rem;
}
.social-label {
  color: rgba(255,255,255,.4);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.social-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.3rem;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--ease);
}
.social-btn:hover               { color: #fff; }
.social-btn-fb:hover            { background: #1877f2; border-color: #1877f2; }
.social-btn-ig:hover            { background: #e1306c; border-color: #e1306c; }
.social-btn-tk:hover            { background: #ff0050; border-color: #ff0050; }
.social-btn-tg:hover            { background: #2ca5e0; border-color: #2ca5e0; }

/* ── Decorazioni laterali fisse ── */
.side-deco {
  position: fixed;
  bottom: 0;
  height: 420px;
  width: auto;
  /* Sopra .hero-content (z-index:1): la locandina "novità" nell'hero si
     sovrappone alla decorazione destra e deve restare dietro la volontaria. */
  z-index: 2;
  pointer-events: none;
  user-select: none;
}
.side-deco-sx { left: 0; }
.side-deco-dx { right: 0; }
@media (max-width: 1400px) { .side-deco { display: none; } }

/* ── Skip Link (accessibilità) ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--red);
  color: #fff !important;
  padding: .5rem 1.2rem;
  font-weight: 600;
  font-size: .875rem;
  z-index: 10000;
  border-radius: 0 0 var(--r-sm) 0;
  transition: top .2s;
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ── Counter footer ── */
.footer-counter {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: rgba(255,255,255,.35);
  font-size: .78rem;
}

/* ── Pulsante toggle dark/light nella navbar ── */
.dark-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.85);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--ease);
  flex-shrink: 0;
  line-height: 1;
}
.dark-toggle:hover {
  background: rgba(255,255,255,.2);
  color: #fff;
  border-color: rgba(255,255,255,.4);
}

/* =============================================
   DARK MODE
   Il tema scuro viene attivato aggiungendo
   data-theme="dark" all'elemento <html> via JS.
   Si sovrascrivono le variabili CSS e i colori
   hard-coded nei componenti (che non usano var()).
   ============================================= */

[data-theme="dark"] {
  /* Palette sfondo e testo per il tema scuro */
  --bg:         #0d1b2a;   /* sfondo generale della pagina */
  --bg-alt:     #152233;   /* sfondo alternativo: card, pannelli, dropdown */
  --text:       #e2e8f0;   /* testo principale */
  --text-muted: #94a3b8;   /* testo secondario/didascalie */
  --border:     #2d3f55;   /* bordi e separatori */
}

/* Intestazioni: in light mode usano --navy (blu scuro su bianco),
   in dark mode devono essere chiare per leggibilità sul fondo scuro */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5 { color: var(--text); }

/* Eccezioni: sezioni e banner già su sfondo navy mantengono i titoli bianchi */
[data-theme="dark"] .section-dark h2,
[data-theme="dark"] .section-dark h3,
[data-theme="dark"] .section-dark h4,
[data-theme="dark"] .hero h1,
[data-theme="dark"] .page-banner h1 { color: #fff; }

/* Card: sfondo hard-coded #fff → sfondo alternativo scuro */
[data-theme="dark"] .card,
[data-theme="dark"] .video-card { background: var(--bg-alt); }

/* Titoli card/video: color:var(--navy) fisso pensato per il sfondo chiaro
   della card in light mode — su --bg-alt (scuro) sarebbe quasi illeggibile */
[data-theme="dark"] .section-dark .card-title,
[data-theme="dark"] .video-card-title { color: var(--text); }

/* Dropdown: sfondo bianco → pannello scuro con ombra accentuata */
[data-theme="dark"] .dropdown {
  background: #1a2e45;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
}
[data-theme="dark"] .dropdown a { color: var(--text); }
[data-theme="dark"] .dropdown a:hover { background: rgba(255,255,255,.06); color: var(--red-light); }

/* Sezioni bianche: .section-white ha background:#fff hard-coded */
[data-theme="dark"] .section-white { background: var(--bg-alt); }

/* Tabelle: sfondo e righe alternate */
[data-theme="dark"] .tbl                          { background: var(--bg-alt); }
[data-theme="dark"] .tbl td                       { color: var(--text); border-bottom-color: var(--border); }
[data-theme="dark"] .tbl tr:nth-child(even) td    { background: rgba(255,255,255,.03); }
[data-theme="dark"] .tbl tr:hover td              { background: rgba(230,126,34,.08); }

/* Accordion: bordo e sfondo dei pannelli */
[data-theme="dark"] .accordion-item   { background: var(--bg-alt); border-color: var(--border); }
[data-theme="dark"] .accordion-btn    { color: var(--text); }
[data-theme="dark"] .accordion-btn:hover { background: rgba(255,255,255,.05); }

/* Alert: colori ricalibrati per contrasto su sfondo scuro */
[data-theme="dark"] .alert-info { background: rgba(30,58,95,.35); border-color: var(--navy-light); color: #a8c4e0; }
[data-theme="dark"] .alert-red  { background: rgba(230,126,34,.2);  border-color: var(--red);        color: #fde9cc; }

/* Info block */
[data-theme="dark"] .info-block { background: var(--bg-alt); }

/* Variante per .info-block dentro una .section-dark (sfondo scuro fisso,
   indipendente dal tema chiaro/scuro del sito): sostituisce lo style
   inline ripetuto identico su chi-siamo.php, cosa-abbiamo-fatto.php e
   risorse/francese.php. Stessa specificità della regola [data-theme="dark"]
   qui sopra: va dopo nel file per vincere anche in dark mode. */
.info-block.info-block-on-dark { background: rgba(255,255,255,.07); border-radius: var(--r-md); }
.info-block.info-block-on-dark .info-block-body h3 { color: #fff; }
.info-block.info-block-on-dark .info-block-body p  { color: rgba(255,255,255,.65); }

/* Quote: testo su sfondo light usa --navy; in dark si usa --text */
[data-theme="dark"] .quote { color: var(--text); background: rgba(230,126,34,.1); }

/* Timeline: il pallino ha bordo bianco in light (border: 2px solid #fff);
   in dark il bordo deve matchare il fondo scuro */
[data-theme="dark"] .tl-item::before { border-color: var(--bg); }
[data-theme="dark"] .tl-title        { color: var(--text); }

/* Org badge: in light usa --bg (grigio chiaro) e --navy per il testo →
   in dark risulta invisibile perché entrambi sono quasi neri */
[data-theme="dark"] .org-badge { background: var(--bg-alt); }
[data-theme="dark"] .org-nome  { color: var(--text); }

/* ─── Ambulanza animata in fondo alla pagina ─── */
.ambulanza-bar {
  text-align: center;
  padding: 1rem 0 .5rem;
  background: url('../images/ambulanza_corre_sfondo.jpg') center/cover no-repeat;
}
.ambulanza-bar img {
  height: 80px;
  width: auto;
  display: inline-block;
}
