.section-hero-lampo { padding: 80px 0; margin-top: 0; }
.flash-banner--hero { padding: 28px; border-radius: 24px; }
.flash-banner--hero .flash-head h2 { font-size: 48px; text-align: center; width: 100%; }
.flash-banner--hero .flash-head { justify-content: center; gap: 24px; }
.flash-banner--hero .flash-list { grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 24px; }
.flash-banner--hero .flash-card { min-height: 260px; }

/* Titoli sezioni - allineamento normale */
.section .section-head { align-items: baseline; position: relative; }
.section .section-head h2 { font-size: 24px; text-align: left; width: auto; margin: 0; }
.section .section-head .btn-yellow { margin-left: auto; position: absolute; right: 0; }
:root {
  --blue: #4A90E2; /* blu logo */
  --blue-dark: #2E5BBA; /* blu scuro onde */
  --yellow: #FFD400; /* giallo pulsanti */
  --text: #0b1020;
  --white: #ffffff;
}

* { box-sizing: border-box; }
html, body { 
  height: 100%; 
  overflow-x: visible; /* Permette scroll orizzontale se necessario per vedere la pubblicità */
}
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--white);
  background: var(--blue);
  overflow-x: visible; /* Assicura che nulla venga tagliato */
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus { left: 16px; top: 16px; width: auto; height: auto; background: var(--yellow); color: #000; padding: 8px 12px; border-radius: 6px; }

/* Container unificato per News e Convenzioni - STESSA LARGHEZZA */
.container { 
  width: min(1300px, 94%); 
  max-width: 1300px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
  padding-right: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #ffffff; /* barra bianca piena */
  color: var(--text);
  border-bottom: 1px solid rgba(11,16,32,0.08);
}
.site-header { height: 120px; min-height: 120px; overflow: visible; }
.brand { margin-left: 0; }
.main-nav { margin-right: 8px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0; gap: 24px; height: 120px; }
.brand { order: 1; }
.brand img { display: block; height: 162px; width: auto; }
.brand { display: flex; align-items: center; height: 100%; }

/* consenti al logo di uscire leggermente sotto la barra senza aumentarla */
.brand img { margin-bottom: -28px; }
.main-nav { order: 2; margin-left: auto; padding-right: 24px; height: 100%; display: flex; align-items: center; flex: 1; justify-content: flex-end; }
.main-nav ul { display: flex; gap: 40px; list-style: none; margin: 0; padding: 0; }
.main-nav a { color: var(--text); text-decoration: none; font-weight: 800; padding: 8px 16px; border-radius: 10px; font-size: 18px; letter-spacing: 0.01em; white-space: nowrap; }

/* Scala globale 100% - nessuna riduzione */
html { zoom: 1; }
@supports not (zoom: 1) {
  body { transform: scale(1); transform-origin: top center; }
}

/* LAYOUT SEMPLICE - PARTIAMO DA ZERO */
.container-wide { 
  width: min(2080px, 100%);
  margin: 0 auto;
  padding: 0 20px;
  overflow-x: visible !important;
}

/* Layout a 3 colonne con CSS Grid */
.page-grid { 
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 32px;
  align-items: start;
  overflow-x: visible !important;
  min-width: 0;
}

/* Posizionamento automatico delle sidebar */
.page-grid > .sidebar:first-child { 
  justify-self: start; 
  margin-top: 80px;
}
.page-grid > .section.news-in-grid {
  grid-column: 2;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.page-grid > .section.news-in-grid .container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
}
.page-grid > .section.news-in-grid .carousel {
  width: 100%;
  max-width: calc(340px * 3 + 16px * 2); /* 3 card visibili: 340px * 3 + gap * 2 */
  margin: 0 auto;
  overflow: visible; /* Cambiato da hidden a visible per mostrare i bottoni */
}
.page-grid > .section.news-in-grid .carousel-track {
  max-width: 100%;
}
.page-grid > .sidebar:last-child { 
  justify-self: end; 
  margin-top: 80px;
}

/* Sezione offerte-lampo: quando visibile, occupa tutte le colonne */
#offerte-lampo:not([style*="display: none"]) {
  grid-column: 1 / -1;
  grid-row: 1;
}

/* Quando la sezione è nascosta, rimuovila completamente dal grid */
#offerte-lampo[style*="display: none"] {
  display: none !important;
  grid-column: unset !important;
  grid-row: unset !important;
  grid-area: unset !important;
  position: absolute !important;
  left: -9999px !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.sidebar { 
  position: sticky; 
  top: 200px; 
}

/* News ora usa le stesse regole di Convenzioni */
.sidebar .box { background: rgba(255,255,255,0.10); border-radius: 16px; padding: 14px; margin-bottom: 16px; display: block !important; visibility: visible !important; }
.sidebar .box h3 { margin: 0 0 8px; font-size: 18px; }
.contact-list { margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 1.5; }
.ad-placeholder { 
  width: 100% !important; 
  min-height: 280px !important; 
  border-radius: 12px; 
  background: rgba(255,255,255,0.18) !important; 
  display: flex !important; 
  align-items: center; 
  justify-content: center; 
  color: var(--white) !important; 
  font-weight: 700; 
  visibility: visible !important; 
  opacity: 1 !important;
}
.newsletter input, .newsletter button { width: 100%; padding: 10px; border-radius: 8px; border: 0; margin-top: 8px; }
.newsletter button { background: var(--yellow); color: #000; font-weight: 800; cursor: pointer; }
.main-nav a:hover { background: rgba(11,16,32,0.06); }

.hero { padding: 48px 0 16px; text-align: left; }
.hero h1 { margin: 0 0 8px; font-size: 34px; line-height: 1.15; }
.subtitle { margin: 0; color: rgba(255,255,255,0.9); }

.section { 
  padding: 56px 0; 
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue) 70%, var(--blue-dark) 100%); 
}
.section + .section { 
  padding-top: 72px; 
}

/* News e Convenzioni STESSA LARGHEZZA - allineati */
/* Rimossa - ora gestita da .page-grid > .section.news-in-grid .container */

/* Convenzioni STESSA LARGHEZZA di News - senza grid */
.section-fullwidth {
  width: 100%;
}
.section-fullwidth .container-wide {
  width: min(2080px, 100%);
  margin: 0 auto;
  padding: 0 20px;
}
.section-fullwidth .container-wide .container {
  width: 100%;
  max-width: calc(100% - 640px - 64px); /* 320px + 320px sidebar + 32px gap * 2 */
  margin: 0 auto;
  padding: 0;
}
.section-muted { background: rgba(255,255,255,0.06); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section h2 { margin: 0; font-size: 24px; }
.section-desc { margin: 0; color: rgba(255,255,255,0.85); }

/* Alternanza sezioni: pari su bianco sfumato */
main .section:nth-of-type(even) {
  /* bianco -> grigio più percepibile */
  background: linear-gradient(180deg, #FFFFFF 0%, #F0F3F7 70%, #CBD6E3 100%);
  color: var(--text);
}
main .section:nth-of-type(even) .section-desc { color: rgba(11,16,32,0.75); }

/* Province */
.province-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 12px; }
.province-card { display: flex; align-items: center; justify-content: center; min-height: 100px; background: rgba(255,255,255,0.12); border-radius: 16px; text-decoration: none; color: var(--white); font-weight: 700; }
.province-card:hover { background: rgba(255,255,255,0.18); }

/* Offerte lampo */
.flash-banner { background: rgba(255,255,255,0.1); border-radius: 20px; padding: 20px; }
.flash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.countdown { font-weight: 800; background: var(--yellow); color: #000; padding: 8px 12px; border-radius: 10px; min-width: 140px; text-align: center; font-size: 16px; }
.flash-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.flash-card { background: rgba(255,255,255,0.12); border-radius: 16px; padding: 16px; min-height: 180px; }
.flash-title { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.flash-cta { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--yellow); color: #000; border-radius: 10px; text-decoration: none; font-weight: 800; }

/* Carousel orizzontale */
.carousel { position: relative; }
.carousel-track {
  display: grid;
  grid-auto-flow: column;
  /* Larghezza card standard (usata nel blocco Convenzioni in home) */
  grid-auto-columns: 340px;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 8px 8px 16px;
  max-width: 100%;
  margin: 0 auto;
}

/* News e Convenzioni ora usano la stessa larghezza delle card (340px) */
.carousel-track:focus { outline: 2px solid var(--yellow); outline-offset: 2px; }
.carousel-card { scroll-snap-align: start; background: rgba(255,255,255,0.12); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; min-height: 420px; }
.carousel-card img { width: 100%; height: 240px; object-fit: contain; background: #cfd8dc; padding: 8px; }
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card-title { margin: 0; font-size: 20px; font-weight: 700; color: var(--white); line-height: 1.3; min-height: 2.6em; }
.card-text { margin: 0; font-size: 16px; color: rgba(255,255,255,0.9); line-height: 1.6; overflow: hidden; text-overflow: ellipsis; max-height: 4.8em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.card-text.truncated { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.card-text-expand { margin-top: 4px; font-size: 12px; color: var(--yellow); cursor: pointer; text-decoration: underline; }
.card-text-expand:hover { color: #ffd700; }
.card-description-wrapper { display: flex; flex-direction: column; }
.card-meta { display: flex; gap: 8px; align-items: center; color: rgba(255,255,255,0.9); font-size: 13px; }
.badge { background: #2ecc71; color: #fff; border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: 12px; }
.btn-yellow { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; background: var(--yellow); color: #000; border: 0; border-radius: 8px; text-decoration: none; font-weight: 700; }
.btn-yellow:hover { filter: brightness(0.95); }

/* Variante outline per differenziare gruppi (sezioni) */
/* Etichette piccole sopra i gruppi di filtri (chip area) */
.filter-label { font-size: 13px; font-weight: 800; color: rgba(255,255,255,0.9); margin-bottom: 6px; display: inline-block; }
.filter-group { display: flex; flex-direction: column; gap: 8px; background: rgba(255,255,255,0.10); padding: 12px; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14); }
.filter-group .chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* Bottoni bianchi per le sezioni (secondo box) */
.category-filter .btn-yellow { background: #ffffff; color: var(--text); border: 1px solid rgba(11,16,32,0.08); }
.category-filter .btn-yellow:hover { background: #f7f7f7; }

/* Stile per filtri attivi - più scuri */
.province-filter .btn-yellow.active,
.category-filter .btn-yellow.active {
  background: var(--blue-dark);
  color: var(--white);
  border-color: var(--blue-dark);
  font-weight: 800;
}
.province-filter .btn-yellow.active:hover,
.category-filter .btn-yellow.active:hover {
  background: var(--blue-dark);
  filter: brightness(0.9);
}

.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: var(--yellow); color: #000; border: 0; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }
.carousel-btn.prev { left: -32px; }   /* leggermente più esterni rispetto al contenitore */
.carousel-btn.next { right: -32px; }

/* Grids per sezioni */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.card { background: rgba(255,255,255,0.12); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; min-height: 340px; }
.card img { width: 100%; height: 200px; object-fit: contain; background: #cfd8dc; padding: 8px; }
.card .card-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card .card-text { max-height: 4.8em !important; overflow: hidden !important; text-overflow: ellipsis !important; display: -webkit-box !important; -webkit-line-clamp: 3 !important; -webkit-box-orient: vertical !important; }

.site-footer { padding: 28px 0; background: rgba(0,0,0,0.2); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.site-footer a { color: var(--white); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* Media query per schermi intermedi - CSS Grid */
@media (min-width: 769px) and (max-width: 1400px) {
  .page-grid {
    grid-template-areas: 
      "main-content main-content"
      "sidebar-left sidebar-right";
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}

/* Media query per desktop largo - layout a 3 colonne laterali */
/* Range: > 1400px */
@media (min-width: 1401px) {
}

/* Media queries per mobile */
@media (max-width: 768px) {
  /* Rimuovi lo zoom globale su mobile */
  html { zoom: 1; }
  @supports not (zoom: 1) {
    body { transform: scale(1); transform-origin: top center; }
  }

  /* Header ottimizzato per mobile */
  .site-header { height: auto; min-height: auto; padding: 12px 0; }
  .header-inner { 
    flex-direction: column; 
    height: auto; 
    gap: 12px; 
    padding: 0 16px;
  }
  .brand { 
    order: 1; 
    margin: 0 auto;
  }
  .brand img { 
    height: 60px; 
    width: auto;
    margin-bottom: 0;
  }
  .main-nav { 
    order: 2; 
    margin: 0;
    padding: 0;
    width: 100%;
  }
  .main-nav ul { 
    flex-wrap: wrap; 
    gap: 8px; 
    justify-content: center;
  }
  .main-nav a { 
    font-size: 14px; 
    padding: 8px 12px;
  }

  /* Layout a colonna singola su mobile */
  main {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  /* Mobile - usa display: contents per far diventare tutti gli elementi figli diretti di main */
  .container-wide { 
    padding: 0 16px;
    display: contents;
  }
  .page-grid { 
    display: contents;
  }
  .sidebar { 
    position: static; 
    margin-top: 0 !important;
  }
  /* Ordine su mobile: News, Convenzioni, Come trovarci, Pubblicità */
  #offerte-news { order: 1; }
  #offerte { order: 2; }
  .page-grid > .sidebar:first-child { order: 3; }
  .page-grid > .sidebar:last-child { order: 4; }
  #informazioni { order: 5; }
  #download-app { order: 6; }

  /* Fix larghezza News e Convenzioni in mobile */
  .page-grid > .section.news-in-grid .container {
    width: 100%;
    max-width: 100%;
    padding: 0 16px; /* Aggiungi padding come Convenzioni */
  }
  .section-fullwidth .container-wide .container {
    max-width: 100% !important; /* Rimuovi il calc che rende stretto in mobile */
    padding: 0 16px;
  }

  /* Sezione offerte lampo */
  .section-hero-lampo { 
    padding: 32px 0; 
    margin-top: 0;
  }
  .flash-banner--hero { 
    padding: 20px; 
    border-radius: 16px;
  }
  .flash-banner--hero .flash-head { 
    flex-direction: column; 
    align-items: stretch;
    gap: 16px;
  }
  .flash-banner--hero .flash-head h2 { 
    font-size: 24px; 
    text-align: center;
  }
  .flash-banner--hero .flash-list { 
    grid-template-columns: 1fr; 
    gap: 16px;
  }
  .flash-banner--hero .flash-card { 
    min-height: auto;
  }

  /* Sezioni generali */
  .section { padding: 32px 0; }
  .section + .section { padding-top: 32px; }
  .section-head { 
    flex-direction: column; 
    align-items: stretch;
    gap: 12px;
  }
  .section .section-head h2 { 
    font-size: 24px; 
    text-align: center;
  }
  .section .section-head .btn-yellow { 
    margin: 0 auto;
    position: static;
  }
  .section h2 { font-size: 22px; }

  /* Carousel ottimizzato per mobile */
  .carousel-btn { display: none; }
  .carousel-track {
    grid-auto-columns: 85vw;
    padding: 8px 16px 16px;
  }

  /* Cards e grid */
  .flash-list { 
    grid-template-columns: 1fr; 
    gap: 16px;
  }
  .grid { 
    grid-template-columns: 1fr; 
    gap: 16px;
  }
  .province-grid { 
    grid-template-columns: 1fr; 
    gap: 12px;
  }

  /* Hero */
  .hero { 
    padding: 24px 0 16px; 
    text-align: center;
  }
  .hero h1 { font-size: 24px; }

  /* Sidebar boxes */
  .sidebar .box { 
    padding: 16px; 
    margin-bottom: 16px;
  }
  .sidebar .box h3 { 
    font-size: 18px; 
    margin-bottom: 12px;
  }
  .contact-list { font-size: 14px; }
  .ad-placeholder { 
    height: 200px;
  }

  /* Newsletter */
  .newsletter input, 
  .newsletter button { 
    font-size: 16px; /* Previene zoom su iOS */
  }

  /* Form di ricerca */
  form[style*="display:flex"] {
    flex-direction: column !important;
  }
  form[style*="display:flex"] input,
  form[style*="display:flex"] button {
    width: 100% !important;
    font-size: 16px; /* Previene zoom su iOS */
  }

  /* Bottoni di navigazione pagine */
  div[style*="display:flex"][style*="justify-content:center"] {
    flex-direction: column !important;
    gap: 8px !important;
  }
  div[style*="display:flex"][style*="justify-content:center"] button {
    width: 100% !important;
  }

  /* Filtri categoria */
  .filter-group .chips {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group .chips .btn-yellow {
    width: 100%;
    text-align: center;
  }

  /* Grid inline styles */
  div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Footer */
  .footer-inner { 
    flex-direction: column; 
    text-align: center;
    gap: 8px;
  }
}

/* Media query per schermi molto piccoli */
@media (max-width: 480px) {
  .container { width: 100%; padding-inline: 16px; }
  .container-wide { padding-inline: 12px; }
  
  .flash-banner--hero .flash-head h2 { font-size: 20px; }
  .section .section-head h2 { font-size: 20px; }
  .section h2 { font-size: 18px; }
  
  .main-nav a { font-size: 12px; padding: 6px 10px; }
  
  .carousel-track {
    grid-auto-columns: 90vw;
  }
}

/* Skeleton placeholders */
.skeleton { position: relative; overflow: hidden; }
.skeleton .img-placeholder { width: 100%; height: 160px; background: rgba(255,255,255,0.2); }
.skeleton .line { height: 12px; background: rgba(255,255,255,0.2); border-radius: 8px; margin: 8px 0; }
.skeleton .w-70 { width: 70%; }
.skeleton .w-100 { width: 100%; }
.skeleton .w-40 { width: 40%; }
.skeleton:after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transform: translateX(-100%); animation: shimmer 1.6s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Variante scura per skeleton e card su sezioni bianche */
main .section:nth-of-type(even) .carousel-card,
main .section:nth-of-type(even) .card { background: rgba(0,0,0,0.06); }
main .section:nth-of-type(even) .card-title { color: var(--text); }
main .section:nth-of-type(even) .card-text { color: rgba(11,16,32,0.8); }
main .section:nth-of-type(even) .skeleton .img-placeholder { background: rgba(0,0,0,0.08); }
main .section:nth-of-type(even) .skeleton .line { background: rgba(0,0,0,0.08); }
main .section:nth-of-type(even) .skeleton:after { background: linear-gradient(90deg, transparent, rgba(0,0,0,0.08), transparent); }

