/*
Theme Name: AgendaToday
Theme URI: https://agendatoday.it
Author: AgendaToday Editorial
Author URI: https://agendatoday.it
Description: Tema editoriale italiano per rivista digitale completa. Include 5 categorie tematiche (Economia, Lifestyle, Sport, Media e TV, People), breaking news ANSA, widget meteo, sistema pubblicitario con A/B testing, GDPR/cookie banner, newsletter integrata, abbonamenti con paywall e Stripe, area utente My Account, email marketing con tracking. Ottimizzato per Hosting Gestito Premium per WordPress di Aruba.
Version: 1.35.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: agendatoday
Tags: news, magazine, editorial, blog, italian, subscription, newsletter
*/

/* =========================================================
   AGENDATODAY - EDITORIAL THEME
   Palette: Navy #0E2C57 | Red #DC1F26 | Off-white #F7F5F0
   ========================================================= */

:root {
  --at-navy: #0E2C57;
  --at-navy-dark: #081A36;
  --at-red: #DC1F26;
  --at-red-dark: #B0181E;
  --at-cream: #F7F5F0;
  --at-paper: #FBFAF6;
  --at-ink: #1A1A1A;
  --at-gray: #6B7280;
  --at-line: #E5E1D8;
  --at-gold: #C9A961;

  --ff-display: 'Playfair Display', 'Times New Roman', Georgia, serif;
  --ff-serif: 'Lora', Georgia, serif;
  --ff-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --ff-cond: 'Oswald', 'Arial Narrow', sans-serif;

  --shadow-sm: 0 1px 2px rgba(14, 44, 87, 0.08);
  --shadow-md: 0 4px 12px rgba(14, 44, 87, 0.12);
  --shadow-lg: 0 12px 32px rgba(14, 44, 87, 0.18);
  /* v1.8.12: ombra "forte" - card chiaramente sollevate, stile Pinterest/Apple */
  --shadow-xl: 0 10px 28px rgba(14, 44, 87, 0.22), 0 4px 10px rgba(14, 44, 87, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--ff-serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--at-ink);
  background: var(--at-paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--at-navy); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--at-red); }

img { max-width: 100%; height: auto; display: block; }

/* ============ ALLINEAMENTI IMMAGINI WORDPRESS (v1.8.18) ============ */
/* Risolve: foto centrate in editor che escono a sinistra nell'articolo pubblicato.
   Le classi .aligncenter, .alignleft, .alignright e .wp-caption sono aggiunte
   automaticamente da WordPress (editor classico, Gutenberg, e shortcode caption). */

.at-article-body .aligncenter,
.at-article-body img.aligncenter,
.at-article-body .wp-caption.aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-top: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.at-article-body .alignleft,
.at-article-body img.alignleft,
.at-article-body .wp-caption.alignleft {
  float: left;
  margin: 8px 24px 16px 0;
  max-width: 50%;
}

.at-article-body .alignright,
.at-article-body img.alignright,
.at-article-body .wp-caption.alignright {
  float: right;
  margin: 8px 0 16px 24px;
  max-width: 50%;
}

.at-article-body .alignnone,
.at-article-body img.alignnone {
  display: block;
  margin: 16px 0;
}

/* Blocchi Gutenberg immagine (wp-block-image) */
.at-article-body .wp-block-image { margin: 24px 0; }
.at-article-body .wp-block-image.aligncenter { text-align: center; }
.at-article-body .wp-block-image.aligncenter img,
.at-article-body .wp-block-image.aligncenter figure { margin-left: auto; margin-right: auto; }
.at-article-body .wp-block-image.alignleft { float: left; margin: 8px 24px 16px 0; }
.at-article-body .wp-block-image.alignright { float: right; margin: 8px 0 16px 24px; }
.at-article-body .wp-block-image figcaption {
  font-family: var(--ff-sans);
  font-size: 14px;
  color: #666;
  text-align: center;
  margin-top: 8px;
  line-height: 1.4;
}

/* Caption WordPress classica */
.at-article-body .wp-caption {
  max-width: 100%;
  background: transparent;
}
.at-article-body .wp-caption img { margin: 0 auto; }
.at-article-body .wp-caption-text,
.at-article-body p.wp-caption-text {
  font-family: var(--ff-sans);
  font-size: 14px;
  color: #666;
  text-align: center;
  margin-top: 8px;
  line-height: 1.4;
}

/* Paragrafo che contiene SOLO un'immagine centrata: rimuovi text-align eredità */
.at-article-body p:has(> img.aligncenter) { text-align: center; }

/* Su mobile: float disattivato per non spezzare la lettura */
@media (max-width: 640px) {
  .at-article-body .alignleft,
  .at-article-body img.alignleft,
  .at-article-body .wp-caption.alignleft,
  .at-article-body .wp-block-image.alignleft,
  .at-article-body .alignright,
  .at-article-body img.alignright,
  .at-article-body .wp-caption.alignright,
  .at-article-body .wp-block-image.alignright {
    float: none;
    display: block;
    margin: 16px auto;
    max-width: 100%;
  }
}

.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* ============ TOP BAR ============ */
.at-topbar {
  background: var(--at-navy);
  color: #fff;
  font-family: var(--ff-sans);
  font-size: 13px;
  padding: 8px 0;
}
.at-topbar .container { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.at-topbar .date { letter-spacing: 0.05em; text-transform: uppercase; }
.at-topbar .quick-links { display: flex; gap: 18px; }
.at-topbar .quick-links a { color: rgba(255,255,255,0.85); }
.at-topbar .quick-links a:hover { color: #fff; }

/* ============ BREAKING NEWS TICKER ============ */
.at-breaking {
  background: var(--at-red);
  color: #fff;
  padding: 8px 0;
  overflow: hidden;
  position: relative;
}
.at-breaking .container { display: flex; align-items: center; gap: 28px; }
.at-breaking .label {
  font-family: var(--ff-cond);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 3px 12px;
  line-height: 1;
  background: rgba(0,0,0,0.28);
  font-size: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 3px;
}
.at-breaking .label::before {
  content: '';
  width: 10px; height: 10px;
  background: #fff;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}
.at-ticker {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--ff-sans);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
}
.at-ticker-track {
  display: inline-block;
  animation: ticker 230s linear infinite; /* v1.6.55: rallentato da 200s a 230s */
  padding-left: 100%;
}
.at-ticker-track a { color: #fff; margin-right: 50px; font-weight: 500; }
.at-ticker-track a:hover { text-decoration: underline; }
.at-ticker-track .sep { color: rgba(255,255,255,0.6); margin-right: 50px; font-size: 18px; }
@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Breaking news responsive mobile */
@media (max-width: 768px) {
  .at-breaking { padding: 6px 0; }
  .at-breaking .container { gap: 14px; min-height: 28px; }
  .at-breaking .label {
    font-family: var(--ff-cond);
    font-size: 16px;
    line-height: 1;
    padding: 3px 10px;
    height: auto;
  }
  .at-ticker { font-size: 17px; line-height: 1.1; }
}

/* ============ BARRA BORSA FTSE MIB ============ */
/* Stesso stile della breaking news, ma colore navy e scroll inverso */
.at-borsa {
  background: var(--at-navy);
  color: #fff;
  padding: 8px 0;
  overflow: hidden;
  position: relative;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.at-borsa .container { display: flex; align-items: center; gap: 28px; }
.at-borsa .label {
  font-family: var(--ff-cond);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 3px 12px;
  line-height: 1;
  background: var(--at-red);
  font-size: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 3px;
  color: #fff;
}
.at-borsa-ticker {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--ff-sans);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
}
.at-borsa-track {
  display: inline-block;
  /* Scroll INVERSO: da sinistra a destra (al contrario della breaking) */
  animation: borsa-ticker-reverse 230s linear infinite; /* v1.6.55: rallentato da 200s a 230s */
  padding-right: 100%;
}
.at-borsa-track .quote-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: 36px;
}
.at-borsa-track .symbol {
  font-weight: 700;
  color: #fff;
}
.at-borsa-track .price {
  color: rgba(255,255,255,0.9);
  font-variant-numeric: tabular-nums;
}
.at-borsa-track .change {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 18px;
}
.at-borsa-track .quote-item.positive .change {
  color: #4ade80; /* verde brillante */
}
.at-borsa-track .quote-item.negative .change {
  color: #f87171; /* rosso brillante */
}
.at-borsa-track .sep {
  color: rgba(255,255,255,0.3);
  margin-right: 36px;
  font-size: 18px;
}

/* Animazione INVERSA: da sinistra a destra */
@keyframes borsa-ticker-reverse {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(0); }
}

/* Pausa scroll su hover (UX) */
.at-borsa-ticker:hover .at-borsa-track {
  animation-play-state: paused;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .at-borsa { padding: 6px 0; }
  .at-borsa .container { gap: 14px; min-height: 28px; }
  /* Etichetta FTSE MIB - dimensioni IDENTICHE a Breaking News */
  .at-borsa .label {
    font-family: var(--ff-cond) !important;
    font-size: 16px !important;
    line-height: 1 !important;
    padding: 3px 10px !important;
    letter-spacing: 0.12em !important;
    gap: 8px !important;
    height: auto !important;
    box-sizing: border-box !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
  }
  .at-borsa .label::before {
    width: 10px;
    height: 10px;
  }
  .at-borsa-ticker { font-size: 17px; line-height: 1.1; }
  .at-borsa-track .change { font-size: 15px; }
  .at-borsa-track .quote-item { margin-right: 24px; }
  .at-borsa-track .sep { margin-right: 24px; }
}

/* === v1.8.88 — FORZA ALTEZZA IDENTICA delle due fasce su mobile === */
/* Cappello rigido: altezza fissa + overflow nascosto. Indipendente dal */
/* contenuto, dai font e da qualsiasi altra regola. Non possono differire. */
@media (max-width: 768px) {
  .at-breaking,
  .at-borsa {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    overflow: hidden !important;
  }
  .at-breaking > .container,
  .at-borsa > .container {
    width: 100% !important;
    min-height: 0 !important;
  }
}

/* ============ HEADER ============ */
.at-header {
  background: var(--at-paper);
  border-bottom: 1px solid var(--at-line);
  padding: 28px 0 24px;
}
.at-header .container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
}
.at-header .logo img { max-height: 90px; width: auto; }
.at-header .logo-center { text-align: center; }

/* Spazi pubblicitari laterali nell'header */
.at-header .header-ad {
  min-height: 90px;
  display: flex;
  align-items: center;
  font-family: var(--ff-sans);
  font-size: 11px;
  color: var(--at-gray);
}
.at-header .header-ad-left { justify-content: flex-start; }
.at-header .header-ad-right { justify-content: flex-end; }
.at-header .header-ad img,
.at-header .header-ad .at-banner img {
  max-width: 100%;
  max-height: 90px;
  width: auto;
  height: auto;
  display: block;
}
/* Placeholder se nessun banner attivo (visibile solo in admin preview) */
.at-header .header-ad:empty::before {
  content: '';
  display: block;
  width: 100%;
  min-height: 90px;
}

/* v1.6.27: Slot banner MOBILE — visibile solo sotto 1024px, contiene
   un banner casuale dal pool combinato header_left + header_right.
   Si posiziona SOTTO il logo (dopo il container .at-header). */
.at-header-mobile-ad {
  display: none; /* nascosto su desktop */
}
@media (max-width: 1024px) {
  /* v1.7.57: il container banner mobile sopra il menu è disabilitato di default.
     Crea solo spazio bianco fantasma su mobile e non sta funzionando per come previsto.
     Per riattivarlo in futuro, basta cambiare display:none in display:block qui sotto. */
  .at-header-mobile-ad {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }
  .at-header-mobile-ad-item {
    display: inline-block;
    max-width: 100%;
  }
  .at-header-mobile-ad-item .at-ad-sponsor-label {
    margin-bottom: 6px;
  }
  .at-header-mobile-ad-item img {
    max-width: 280px;
    width: 100%;
    height: auto;
    max-height: 90px;
    object-fit: contain;
  }
}

/* Topbar - bottoni e link aggiornati */
.at-topbar .topbar-search-btn {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  margin-right: 6px;
  text-transform: inherit;
  letter-spacing: inherit;
}
.at-topbar .topbar-search-btn:hover { color: var(--at-red); }
.at-topbar .topbar-subscribe {
  background: var(--at-red);
  color: #fff !important;
  padding: 4px 12px;
  border-radius: 3px;
  font-weight: 700;
}
.at-topbar .topbar-subscribe:hover { background: var(--at-navy); }

/* ============ ACCOUNT/LOGIN/DASHBOARD BUTTONS ============ */
.at-topbar .topbar-account,
.at-topbar .topbar-login,
.at-topbar .topbar-dashboard,
.at-topbar .topbar-logout {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(255,255,255,0.95) !important;
  font-weight: 500;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  transition: background 0.15s, border-color 0.15s;
  font-size: 12px;
}
.at-topbar .topbar-account:hover,
.at-topbar .topbar-login:hover,
.at-topbar .topbar-dashboard:hover,
.at-topbar .topbar-logout:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.5);
  color: #fff !important;
}
.at-topbar .topbar-login {
  background: var(--at-red);
  border-color: var(--at-red);
}
.at-topbar .topbar-login:hover {
  background: #b81a20;
  border-color: #b81a20;
}
.at-topbar .topbar-dashboard {
  background: rgba(255,255,255,0.1);
}

/* ============ MAIN NAV ============ */
.at-nav {
  background: var(--at-paper);
  border-bottom: 2px solid var(--at-navy);
  position: sticky;
  top: 0;
  z-index: 100;
}
.at-nav.scrolled { box-shadow: var(--shadow-md); }
.at-nav .container { display: flex; justify-content: center; }
.at-nav ul { list-style: none; display: flex; gap: 0; flex-wrap: wrap; }
.at-nav li a {
  display: block;
  padding: 16px 24px;
  font-family: var(--ff-cond);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 15px;
  color: var(--at-navy);
  position: relative;
  transition: color 0.2s;
}
.at-nav li a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--at-red);
  transition: all 0.3s;
  transform: translateX(-50%);
}
.at-nav li a:hover::after, .at-nav li.active a::after { width: 100%; }
.at-nav li a:hover, .at-nav li.active a { color: var(--at-red); }

/* ============ DROPDOWN MENU (sub-menu / v1.6.45) ============ */
.at-nav li { position: relative; }
.at-nav li.menu-item-has-children > a::before {
  content: '▾';
  font-size: 11px;
  margin-right: 6px;
  opacity: 0.7;
}
.at-nav .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: var(--at-paper, #fff);
  border-top: 3px solid var(--at-red, #DC1F26);
  border-bottom: 2px solid var(--at-navy, #0E2C57);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  display: none;
  flex-direction: column;
  z-index: 101;
  padding: 4px 0;
  list-style: none;
  margin: 0;
}
.at-nav li:hover > .sub-menu,
.at-nav li:focus-within > .sub-menu {
  display: flex;
}
.at-nav .sub-menu li {
  width: 100%;
}
.at-nav .sub-menu li a {
  padding: 10px 18px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: none;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.at-nav .sub-menu li:last-child a {
  border-bottom: none;
}
.at-nav .sub-menu li a:hover {
  background: var(--at-paper-dark, #f4f1ea);
  color: var(--at-red, #DC1F26);
}
.at-nav .sub-menu li a::after {
  display: none; /* niente underline rosso animato per le sub-voci */
}
/* Mobile: il sub-menu diventa inline (espanso) sotto la voce parent */
@media (max-width: 1023px) {
  .at-nav .sub-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: rgba(0,0,0,0.03);
    min-width: 0;
    width: 100%;
    display: flex; /* sempre aperto su mobile */
    padding: 0 0 6px 14px;
  }
  .at-nav .sub-menu li a {
    padding: 8px 14px;
    font-size: 12px;
  }
}

/* v1.6.97 — Menu nav mobile: scroll orizzontale con prime voci visibili e centrate */
/* v1.7.78 — Aggiunto touch-action: pan-x per evitare cattura scroll verticale della pagina */
@media (max-width: 768px) {
  .at-nav .container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    /* Il dito può scrollare verticalmente la pagina anche stando sul menu;
       per scorrere il menu orizzontalmente serve uno swipe esplicito laterale */
    touch-action: pan-x;
    scrollbar-width: none; /* Firefox */
    justify-content: flex-start;
    /* padding bilanciato così la prima vista è centrata otticamente */
    padding-left: 14px;
    padding-right: 14px;
    /* v1.7.78: snap delle voci per scroll più "deciso" */
    scroll-snap-type: x proximity;
  }
  .at-nav .container::-webkit-scrollbar { display: none; }
  .at-nav ul {
    flex-wrap: nowrap;
    margin: 0 auto;
    padding: 0;
    /* v1.7.78: anche su <ul> per coerenza */
    touch-action: pan-x;
  }
  .at-nav li {
    scroll-snap-align: start;
  }
  .at-nav li a {
    padding: 14px 16px;
    font-size: 14px;
    white-space: nowrap;
  }
}

/* ============ HERO / MAIN GRID ============ */
.at-hero {
  padding: 40px 0;
  background: var(--at-paper);
}

/* v1.8.79/80: etichetta "TODAY IN EVIDENZA" sopra l'hero — stile menu, allineata a sinistra */
.at-hero-section-label {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0 0 24px;
}
.at-hero-section-label::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, #C9A961, transparent);
}
.at-hero-section-label-text {
  font-family: var(--ff-cond);
  font-size: 22px;
  font-weight: 500;
  color: var(--at-navy, #0E2C57);
  letter-spacing: 0.12em;
  white-space: nowrap;
  text-transform: uppercase;
}
@media (max-width: 600px) {
  .at-hero-section-label { gap: 14px; margin-bottom: 18px; }
  .at-hero-section-label-text { font-size: 16px; }
}

.at-hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}

.at-main-story {
  position: relative;
  overflow: hidden;
  background: var(--at-navy);
  /* v1.8.12: ombra forte + angoli arrotondati per uniformità con le altre card */
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  transition: box-shadow 0.3s, transform 0.3s;
}
.at-main-story:hover {
  box-shadow: var(--shadow-lg);
}
.at-main-story img,
.at-main-story video {
  /* v1.28.5: anche il VIDEO in evidenza segue le regole della foto (prima
     restava alla larghezza sua e la card lo ghigliottinava, scritte comprese) */
  width: 100%;
  height: 540px;
  object-fit: cover;
  opacity: 0.85;
  transition: transform 0.6s;
  display: block;
  background: var(--at-navy);
}
.at-main-story:hover img { transform: scale(1.04); }
.at-main-story .overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 48px 40px 36px;
  background: linear-gradient(to top, rgba(8,26,54,0.95) 0%, rgba(8,26,54,0.4) 70%, transparent 100%);
  color: #fff;
}
.at-main-story .category {
  display: inline-block;
  background: var(--at-red);
  color: #fff;
  padding: 6px 14px;
  font-family: var(--ff-cond);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}
.at-main-story h1 {
  font-family: var(--ff-display);
  font-size: 44px;
  line-height: 1.15;
  font-weight: 700;
  margin-bottom: 14px;
  color: #fff;
}
.at-main-story .excerpt {
  font-size: 17px;
  line-height: 1.5;
  opacity: 0.9;
  margin-bottom: 12px;
  max-width: 720px;
}
.at-main-story .meta {
  font-family: var(--ff-sans);
  font-size: 13px;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.at-side-stories { display: flex; flex-direction: column; gap: 18px; }
.at-side-story {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--at-line);
  align-items: start;
}
.at-side-story:last-child { border-bottom: none; }
/* v1.6.99: blocca immagini side-story con aspect-ratio fisso 16:10 - tutte uguali */
.at-side-story > img,
.at-side-story > a > img,
.at-side-story a img:first-child,
.at-side-story img {
  width: 140px !important;
  height: 88px !important;
  aspect-ratio: 16/10;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #f3f3f3;
  flex-shrink: 0;
  /* v1.8.12: angoli + ombra forte (era md, troppo leggera) */
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}
.at-side-story .category {
  font-family: var(--ff-cond);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--at-red);
  font-weight: 600;
  margin-bottom: 6px;
}
.at-side-story h3 {
  font-family: var(--ff-display);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 600;
  color: var(--at-navy);
  transition: color 0.2s;
}
.at-side-story:hover h3 { color: var(--at-red); }
.at-side-story .meta {
  font-family: var(--ff-sans);
  font-size: 11px;
  color: var(--at-gray);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============ SECTION HEADER ============ */
.at-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 50px 0 28px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--at-navy);
  position: relative;
}
.at-section-header::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 80px;
  height: 3px;
  background: var(--at-red);
}
.at-section-header h2 {
  font-family: var(--ff-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--at-navy);
  letter-spacing: -0.01em;
}
.at-section-header .view-all {
  font-family: var(--ff-sans);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--at-red);
  font-weight: 600;
}

/* ============ CATEGORY GRID ============ */
.at-category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.at-card {
  background: #fff;
  border: 1px solid var(--at-line);
  display: flex;
  flex-direction: column;
  transition: all 0.3s;
  /* v1.8.12: ombra forte (era md) — card chiaramente sollevate */
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}
.at-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.at-card .img-wrap {
  overflow: hidden;
  aspect-ratio: 16/10;
  position: relative;
  width: 100%;
  background: #f3f3f3;
}
.at-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s;
}
.at-card:hover img { transform: scale(1.08); }
.at-card .content { padding: 20px 22px 24px; flex: 1; display: flex; flex-direction: column; }
.at-card .category {
  font-family: var(--ff-cond);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 11px;
  color: var(--at-red);
  font-weight: 600;
  margin-bottom: 10px;
}
.at-card h3 {
  font-family: var(--ff-display);
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--at-navy);
  margin-bottom: 10px;
}
.at-card .excerpt {
  font-size: 15px;
  color: var(--at-gray);
  line-height: 1.55;
  margin-bottom: 14px;
  flex: 1;
}
.at-card .meta {
  font-family: var(--ff-sans);
  font-size: 12px;
  color: var(--at-gray);
  display: flex;
  gap: 10px;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 12px;
  border-top: 1px solid var(--at-line);
}
.at-card .meta .author { color: var(--at-navy); font-weight: 600; }

/* ==========================================================================
   v1.8.11: Ombra evidente + angoli arrotondati su foto articoli (stile Medium)
   Applicata a: foto featured (hero), foto dentro contenuto articolo
   ========================================================================== */
.at-featured-img {
  border-radius: 10px !important;
  box-shadow: var(--shadow-lg);
  transition: box-shadow 0.3s;
}
.at-article-body img,
.at-article-body figure img,
.at-article-body .wp-block-image img {
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  max-width: 100%;
  height: auto;
  display: block;
  margin: 24px auto;
  transition: box-shadow 0.3s, transform 0.3s;
}
.at-article-body img:hover {
  box-shadow: var(--shadow-lg);
}

/* ============ TWO COLUMN: CONTENT + SIDEBAR ============ */
.at-two-col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
  padding: 40px 0;
}

/* ============ SIDEBAR ============ */
.at-sidebar { display: flex; flex-direction: column; gap: 32px; }

.at-widget,
.at-sidebar > .widget,
.at-sidebar > aside.widget {
  background: #fff;
  border: 1px solid var(--at-line);
  padding: 24px;
  margin-bottom: 28px;
}
.at-widget .widget-title,
.at-sidebar > .widget .widget-title,
.at-sidebar > .widget > h1,
.at-sidebar > .widget > h2,
.at-sidebar > .widget > h3,
.at-sidebar > .widget > h4,
.at-sidebar > aside.widget .widget-title,
.at-sidebar > aside.widget > h1,
.at-sidebar > aside.widget > h2,
.at-sidebar > aside.widget > h3,
.at-sidebar > aside.widget > h4 {
  font-family: var(--ff-cond);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 14px;
  color: var(--at-navy);
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--at-red);
  margin-top: 0;
  margin-bottom: 18px;
}

/* Liste dentro widget (Archivio, Categorie, Articoli recenti, ecc.) */
.at-sidebar > .widget ul,
.at-sidebar > aside.widget ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.at-sidebar > .widget li,
.at-sidebar > aside.widget li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(14, 44, 87, 0.08);
}
.at-sidebar > .widget li:last-child,
.at-sidebar > aside.widget li:last-child {
  border-bottom: none;
}
.at-sidebar > .widget li a,
.at-sidebar > aside.widget li a {
  color: var(--at-navy);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s;
}
.at-sidebar > .widget li a:hover,
.at-sidebar > aside.widget li a:hover {
  color: var(--at-red);
}

/* Dropdown nei widget (Archivio dropdown, Categorie dropdown) */
.at-sidebar > .widget select,
.at-sidebar > aside.widget select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--at-line);
  border-radius: 4px;
  color: var(--at-navy);
  background: #fff;
}

/* Search form dentro widget */
.at-sidebar > .widget .search-form,
.at-sidebar > aside.widget .search-form {
  display: flex;
  gap: 6px;
}
.at-sidebar > .widget .search-field,
.at-sidebar > aside.widget .search-field {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--at-line);
  border-radius: 4px;
  font-size: 13px;
}
.at-sidebar > .widget .search-submit,
.at-sidebar > aside.widget .search-submit {
  background: var(--at-navy);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

/* Tag cloud */
.at-sidebar > .widget .tagcloud,
.at-sidebar > aside.widget .tagcloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.at-sidebar > .widget .tagcloud a,
.at-sidebar > aside.widget .tagcloud a {
  background: rgba(14, 44, 87, 0.08);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px !important;
  color: var(--at-navy);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.at-sidebar > .widget .tagcloud a:hover,
.at-sidebar > aside.widget .tagcloud a:hover {
  background: var(--at-red);
  color: #fff;
}

/* Articoli recenti AgendaToday con thumbnail */
.at-recent-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
.at-recent-item {
  display: flex !important;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0 !important;
  border-bottom: 1px solid rgba(14, 44, 87, 0.08) !important;
}
.at-recent-item:last-child {
  border-bottom: none !important;
}
.at-recent-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 60px;
  overflow: hidden;
  border-radius: 4px;
  display: block;
}
.at-recent-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
}
.at-recent-body {
  flex: 1;
  min-width: 0;
}
.at-recent-title {
  display: block !important;
  color: var(--at-navy) !important;
  text-decoration: none !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  transition: color 0.15s;
}
.at-recent-title:hover {
  color: var(--at-red) !important;
}
.at-recent-date {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: 4px;
}

/* ============ OROSCOPO WIDGET ============ */
.at-oroscopo-widget {
  background: linear-gradient(135deg, #1a1a3e 0%, #2d1b69 50%, #4527a0 100%);
  color: #fff;
  border: none;
  position: relative;
  overflow: visible; /* v1.6.64: era 'hidden', clippava segni su mobile */
  border-radius: 8px;
}
.at-oroscopo-widget::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px; /* v1.6.64: stesso del wrapper, ora che overflow è visible */
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.08) 1px, transparent 1.5px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.06) 1px, transparent 1.5px),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,0.07) 1px, transparent 1.5px),
    radial-gradient(circle at 85% 20%, rgba(255,255,255,0.05) 1px, transparent 1.5px);
  background-size: 100px 100px, 80px 80px, 120px 120px, 90px 90px;
  pointer-events: none;
  opacity: 0.6;
}
.at-oroscopo-widget > * { position: relative; z-index: 1; }

.at-oroscopo-widget .widget-title {
  color: #fff !important;
  border-bottom-color: rgba(255,255,255,0.4) !important;
  display: flex;
  align-items: center;
  gap: 8px;
}

.at-oroscopo-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin: -10px 0 16px;
  font-style: italic;
  text-transform: capitalize;
}

.at-oroscopo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}
/* v1.6.64: forza sempre tutti i 12 segni a essere visibili.
   Non c'è overflow:hidden né max-height su questo widget. */
.at-oroscopo-grid > .at-oroscopo-sign {
  min-width: 0; /* permette al contenuto di restringersi */
}
.at-oroscopo-sign {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.85);
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.2s;
  font-family: inherit;
}
.at-oroscopo-sign:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.35);
  transform: translateY(-1px);
}
.at-oroscopo-sign.active {
  background: var(--at-red);
  border-color: var(--at-red);
  color: #fff;
  box-shadow: 0 4px 12px rgba(220,31,38,0.35);
}
.at-oroscopo-sign .zodiac-icon {
  font-size: 18px;
  line-height: 1;
}
.at-oroscopo-sign .zodiac-name {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  line-height: 1;
}

.at-oroscopo-text {
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,0.1);
}

.at-oroscopo-active-sign {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.at-oroscopo-active-sign .active-icon {
  font-size: 22px;
  line-height: 1;
}
.at-oroscopo-active-sign .active-name {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  font-family: var(--ff-display);
}
.at-oroscopo-active-sign .active-dates {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  margin-left: auto;
}
.at-oroscopo-content {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255,255,255,0.92);
}

/* v1.6.64: griglia 4 colonne su tutti i device, 3 righe da 4 = 12 segni perfetti */
@media (max-width: 768px) {
  .at-oroscopo-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .at-oroscopo-sign {
    padding: 8px 2px;
  }
  .at-oroscopo-sign .zodiac-icon {
    font-size: 18px;
  }
  .at-oroscopo-sign .zodiac-name {
    font-size: 9px;
  }
}
@media (max-width: 380px) {
  .at-oroscopo-sign .zodiac-name {
    font-size: 8px;
  }
}

/* Meteo Widget */
.at-meteo {
  background: linear-gradient(135deg, #4A90E2 0%, #2C5F95 100%);
  color: #fff;
  border: none;
}
.at-meteo .widget-title { color: #fff; border-bottom-color: rgba(255,255,255,0.4); }
.at-meteo .meteo-main {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
}
.at-meteo .temp { font-size: 56px; font-family: var(--ff-display); font-weight: 700; line-height: 1; }
.at-meteo .icon { font-size: 56px; line-height: 1; }
.at-meteo .location {
  font-family: var(--ff-sans);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.9;
}
.at-meteo .desc { font-family: var(--ff-sans); font-size: 14px; margin-bottom: 14px; }
.at-meteo .stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  font-family: var(--ff-sans);
  font-size: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.2);
}
.at-meteo .stat-label { opacity: 0.7; text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; }
.at-meteo .stat-value { font-size: 16px; font-weight: 600; margin-top: 2px; }
.at-meteo .source {
  text-align: center;
  font-family: var(--ff-sans);
  font-size: 11px;
  opacity: 0.7;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.at-meteo .source a { color: #fff; text-decoration: underline; }

/* Most Read */
.at-mostread ol { list-style: none; counter-reset: rank; }
.at-mostread li {
  counter-increment: rank;
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--at-line);
}
.at-mostread li:last-child { border-bottom: none; }
.at-mostread li::before {
  content: counter(rank);
  font-family: var(--ff-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--at-red);
  line-height: 1;
  flex-shrink: 0;
  min-width: 28px;
}
.at-mostread h4 {
  font-family: var(--ff-display);
  font-size: 15px;
  line-height: 1.3;
  color: var(--at-navy);
  font-weight: 600;
}
.at-mostread .meta {
  font-family: var(--ff-sans);
  font-size: 11px;
  color: var(--at-gray);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Newsletter */
.at-newsletter {
  background: var(--at-navy);
  color: #fff;
  border: none;
  text-align: center;
  padding: 28px 24px;
}
.at-newsletter h3 {
  font-family: var(--ff-display);
  font-size: 24px;
  margin-bottom: 8px;
  color: #fff;
}
.at-newsletter p { font-size: 14px; opacity: 0.85; margin-bottom: 18px; }
.at-newsletter input {
  width: 100%;
  padding: 12px 14px;
  border: none;
  font-family: var(--ff-sans);
  font-size: 14px;
  margin-bottom: 10px;
}
.at-newsletter button {
  width: 100%;
  padding: 12px;
  background: var(--at-red);
  color: #fff;
  border: none;
  font-family: var(--ff-cond);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.at-newsletter button:hover { background: var(--at-red-dark); }

/* ============ CATEGORY ROW (HORIZONTAL) ============ */
.at-cat-row {
  padding: 40px 0;
  border-top: 1px solid var(--at-line);
}
.at-cat-row .cat-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.at-cat-row .cat-tag {
  font-family: var(--ff-cond);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 14px;
  background: var(--at-navy);
  color: #fff;
  padding: 8px 18px;
  font-weight: 600;
}
.at-cat-row .cat-tag.red { background: var(--at-red); }
.at-cat-row .cat-tag.gold { background: var(--at-gold); }
.at-cat-row .cat-line { flex: 1; height: 1px; background: var(--at-line); }
.at-cat-row .cat-link {
  font-family: var(--ff-sans);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--at-red);
  font-weight: 600;
}
.at-cat-row-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 28px;
}
.at-cat-feature h3 {
  font-family: var(--ff-display);
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--at-navy);
  margin: 16px 0 10px;
}
.at-cat-feature img { aspect-ratio: 16/10; object-fit: cover; }
.at-cat-feature .excerpt { font-size: 15px; color: var(--at-gray); line-height: 1.55; }
.at-cat-small { padding-bottom: 18px; border-bottom: 1px solid var(--at-line); }
.at-cat-small:last-child { border-bottom: none; }
.at-cat-small h4 {
  font-family: var(--ff-display);
  font-size: 18px;
  line-height: 1.3;
  color: var(--at-navy);
  margin-bottom: 6px;
}
.at-cat-small .meta {
  font-family: var(--ff-sans);
  font-size: 11px;
  color: var(--at-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.at-cat-col-stack { display: flex; flex-direction: column; gap: 18px; }

/* ============ NEW: ADAPTIVE CATEGORY GRID (v1.5.2) ============ */
/* Layout dinamico in base al numero di articoli per categoria */
/* Card sempre della stessa dimensione, anche con 1 solo articolo */
.at-cat-grid {
  display: grid;
  gap: 24px;
  margin-top: 18px;
  grid-template-columns: repeat(3, 1fr);
}
.at-cat-cols-1,
.at-cat-cols-2,
.at-cat-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.at-cat-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--at-line);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  /* v1.8.12: ombra forte XL */
  border-radius: 10px;
  box-shadow: var(--shadow-xl);
}
.at-cat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.at-cat-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: #f3f3f3;
}
.at-cat-card-thumb img,
.at-cat-card-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s;
}
.at-cat-card:hover .at-cat-card-thumb img {
  transform: scale(1.05);
}
.at-cat-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.at-cat-card-title {
  font-family: var(--ff-display);
  font-weight: 700;
  color: var(--at-navy);
  line-height: 1.25;
  margin: 0;
  font-size: 18px;
}
.at-cat-card.is-featured .at-cat-card-title { font-size: 19px; }

.at-cat-card-excerpt {
  font-size: 13px;
  color: var(--at-gray);
  line-height: 1.5;
  margin: 0;
}

.at-cat-card-meta {
  font-family: var(--ff-sans);
  font-size: 11px;
  color: var(--at-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: auto;
  padding-top: 6px;
}

/* Card placeholder per posti vuoti */
.at-cat-card-empty {
  background: rgba(247, 245, 240, 0.5) !important;
  border-style: dashed !important;
  cursor: default !important;
  pointer-events: none;
}
.at-cat-card-empty:hover {
  transform: none !important;
  box-shadow: none !important;
}
.at-cat-card-empty .at-cat-card-placeholder {
  position: relative;
}

/* Responsive: tablet 2 colonne, mobile 1 colonna */
@media (max-width: 900px) {
  .at-cat-cols-1,
  .at-cat-cols-2,
  .at-cat-cols-3,
  .at-cat-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .at-cat-cols-1,
  .at-cat-cols-2,
  .at-cat-cols-3,
  .at-cat-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ FOOTER ============ */
.at-footer {
  background: var(--at-navy-dark);
  color: #fff;
  padding: 60px 0 0;
  margin-top: 60px;
}
.at-footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.at-footer h4 {
  font-family: var(--ff-cond);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 14px;
  margin-bottom: 18px;
  color: #fff;
}
.at-footer ul { list-style: none; }
.at-footer li { margin-bottom: 10px; }
.at-footer a { color: rgba(255,255,255,0.7); font-size: 14px; font-family: var(--ff-sans); }
.at-footer a:hover { color: #fff; }
.at-footer .brand-block .logo-text {
  font-family: var(--ff-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}
.at-footer .brand-block .logo-text span { color: var(--at-red); }
.at-footer .brand-block p { font-size: 14px; color: rgba(255,255,255,0.65); line-height: 1.6; }
.at-footer .social { display: flex; gap: 12px; margin-top: 18px; }
.at-footer .social a {
  width: 38px; height: 38px;
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}
.at-footer .social a:hover { background: var(--at-red); border-color: var(--at-red); }
.at-footer-bottom {
  padding: 24px 0;
  font-family: var(--ff-sans);
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.at-footer-bottom .legal { display: flex; gap: 20px; }
.at-footer-bottom .legal a { color: rgba(255,255,255,0.5); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .at-hero-grid { grid-template-columns: 1fr; }
  .at-two-col { grid-template-columns: 1fr; }
  .at-category-grid { grid-template-columns: repeat(2, 1fr); }
  .at-cat-row-grid { grid-template-columns: 1fr; }
  .at-footer-grid { grid-template-columns: 1fr 1fr; }
  .at-main-story h1 { font-size: 32px; }
}
/* v1.6.27: sotto 1024px i banner laterali NON si vedono, vince lo slot mobile sotto il logo */
@media (max-width: 1024px) {
  .at-header .header-ad-left,
  .at-header .header-ad-right,
  .at-ad-slot-header_left,
  .at-ad-slot-header_right {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  /* v1.7.55-56: fix DEFINITIVO centratura logo mobile/tablet con !important per battere
     qualsiasi regola WP custom-logo o cache CSS */
  .at-header {
    padding: 12px 0 !important;
  }
  .at-header .container {
    grid-template-columns: 1fr !important;
    text-align: center !important;
    gap: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  .at-header .logo,
  .at-header .logo-center {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    display: block !important;
    min-height: 0 !important;
  }
  .at-header .logo-center > a,
  .at-header .logo-center .custom-logo-link,
  .at-header .custom-logo-link,
  .at-header a {
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    vertical-align: top !important;
    border: 0 !important;
    min-height: 0 !important;
  }
  .at-header .logo img,
  .at-header .logo-center img,
  .at-header .custom-logo,
  .at-header img {
    max-height: 70px !important;
    width: auto !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
    padding: 0 !important;
    vertical-align: top !important;
  }
}
@media (max-width: 640px) {
  .at-header {
    padding: 8px 0 !important;
  }
  .at-header .logo img,
  .at-header .logo-center img,
  .at-header .custom-logo {
    max-height: 56px !important;
  }
}

/* v1.7.57: collasso universale di qualsiasi slot banner posizionato tra header e nav su mobile */
@media (max-width: 1024px) {
  .at-header + .at-ad-slot,
  .at-header + .at-banner,
  .at-header + div[class*="at-ad"],
  .at-header + div[class*="banner"]:empty {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
}

/* v1.7.58: DEBUG bordi colorati ESTESI su mobile per identificare lo spazio fantasma.
   Versione potenziata: colora ANCHE elementi che potrebbero esistere tra header e nav. */
@media (max-width: 1024px) {
  /* Header e suoi elementi */
  body.at-debug-header .at-header { outline: 4px solid red !important; outline-offset: -4px; }
  body.at-debug-header .at-header .container { outline: 4px solid blue !important; outline-offset: -4px; }
  body.at-debug-header .at-header .logo,
  body.at-debug-header .at-debug-header .logo-center { outline: 4px solid green !important; outline-offset: -4px; }
  body.at-debug-header .at-header .custom-logo-link { outline: 4px solid orange !important; outline-offset: -4px; }
  body.at-debug-header .at-header img { outline: 4px solid purple !important; }

  /* Slot banner mobile sopra il menu */
  body.at-debug-header .at-header-mobile-ad { outline: 4px solid #ff00ff !important; background: rgba(255,255,0,0.4) !important; outline-offset: -4px; }

  /* Menu */
  body.at-debug-header .at-nav { outline: 4px solid #00ffff !important; outline-offset: -4px; }

  /* v1.7.58: marca con bordi spessi neri TUTTI i fratelli diretti del body
     così identifichiamo elementi sconosciuti tra header e nav */
  body.at-debug-header > * {
    outline: 2px dashed #000 !important;
    background-color: rgba(255, 192, 203, 0.15) !important; /* rosa chiaro semitrasparente */
  }
  body.at-debug-header > *::before {
    content: "TAG: " attr(class) " | ID: " attr(id) " | H: " attr(data-h-debug);
    display: block;
    background: yellow;
    color: black;
    padding: 4px 8px;
    font-size: 11px;
    font-family: monospace;
    border-bottom: 2px solid red;
  }

  /* Marca anche TUTTI gli elementi al primo livello dentro header */
  body.at-debug-header .at-header > * {
    outline: 2px dotted #888 !important;
  }

  /* Search overlay (se accidentalmente aperto) */
  body.at-debug-header #atSearch,
  body.at-debug-header .at-search-overlay { outline: 4px solid lime !important; outline-offset: -4px; }

  /* Slot before-header e after-header se esistono */
  body.at-debug-header .at-ad-slot,
  body.at-debug-header [class*="at-ad-slot"],
  body.at-debug-header [class*="at-banner"] { outline: 4px solid brown !important; background: rgba(139,69,19,0.2) !important; outline-offset: -4px; }
}
@media (max-width: 640px) {
  /* v1.6.99: side-story responsive - immagini sempre uniformi */
  .at-side-story {
    grid-template-columns: 130px 1fr;
    gap: 14px;
  }
  .at-side-story > img,
  .at-side-story > a > img,
  .at-side-story a img:first-child,
  .at-side-story img {
    width: 130px !important;
    height: 82px !important;
  }
  .at-side-story h3 { font-size: 15px; }

  .at-header .container { grid-template-columns: 1fr; text-align: center; gap: 16px; }
  .at-category-grid { grid-template-columns: 1fr; }
  .at-footer-grid { grid-template-columns: 1fr; }
  .at-nav ul {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    /* v1.7.78: il dito scrolla la pagina verticalmente anche sul menu */
    touch-action: pan-x;
  }
  .at-nav li a { padding: 14px 18px; font-size: 13px; }
  .at-section-header h2 { font-size: 24px; }
  .at-main-story h1 { font-size: 24px; }
  .at-main-story .overlay { padding: 24px 20px 20px; }
  /* v1.28.5: sul telefono la storia in evidenza mostra il media PER INTERO
     (foto o video, larghezza piena e altezza proporzionale: niente parole
     tagliate ai lati) e il pannello col titolo scende sotto, nel flusso:
     così nemmeno il titolo viene più mozzato dall'altezza della card. */
  .at-main-story img,
  .at-main-story video { height: auto; object-fit: contain; opacity: 1; }
  .at-main-story .overlay { position: static; background: var(--at-navy); }
  .at-topbar .quick-links { flex-wrap: wrap; gap: 8px; }

  /* Su mobile, nascondiamo le etichette dei pulsanti account/login/dashboard ma teniamo le icone */
  .at-topbar .account-label,
  .at-topbar .login-label,
  .at-topbar .dash-label,
  .at-topbar .logout-label {
    display: none;
  }
  /* FORZIAMO SEMPRE VISIBILI questi pulsanti su mobile (anche se CSS custom li nasconde) */
  .at-topbar .topbar-account,
  .at-topbar .topbar-login,
  .at-topbar .topbar-dashboard,
  .at-topbar .topbar-logout {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 6px 10px !important;
    font-size: 16px !important;
    min-width: 38px !important;
    height: 32px !important;
    justify-content: center;
    align-items: center;
  }
  .at-topbar .topbar-contatti { display: none; }
}

/* Mobile molto piccolo (iPhone SE) — riduci ulteriormente */
@media (max-width: 380px) {
  .at-topbar .date { font-size: 10px; }
  .at-topbar .quick-links { gap: 6px; }
  .at-topbar .topbar-subscribe { padding: 4px 10px; font-size: 11px; }
  /* Anche su iPhone SE, i pulsanti login/account devono restare visibili */
  .at-topbar .topbar-account,
  .at-topbar .topbar-login,
  .at-topbar .topbar-dashboard,
  .at-topbar .topbar-logout {
    display: inline-flex !important;
    visibility: visible !important;
  }
}

/* ============================================================
   FIX v1.6.10 — Anti-overflow mobile/tablet
   ROOT CAUSE: CSS Grid figli senza min-width:0 si dimensionano
   in base al contenuto naturale (immagini grandi → grid sfora viewport).
   ============================================================ */
@media (max-width: 1024px) {
  /* Blocca scroll orizzontale a livello pagina senza alterare layout */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
  }

  /* FIX CHIAVE: i figli dei grid devono poter rimpicciolirsi sotto la
     dimensione del loro contenuto. Senza min-width:0, un'immagine grande
     forza la colonna a essere larga quanto l'immagine ignorando il "1fr". */
  .at-two-col,
  .at-two-col > *,
  .at-cat-grid,
  .at-cat-grid > *,
  .at-hero-grid,
  .at-hero-grid > * {
    min-width: 0;
  }

  /* Box-sizing universale per evitare che padding/border sforino i contenitori */
  .at-main *,
  .at-main *::before,
  .at-main *::after {
    box-sizing: border-box;
  }

  /* Immagini, video, iframe MAI più larghi del loro contenitore */
  .at-main img,
  .at-main video,
  .at-main iframe {
    max-width: 100%;
    height: auto;
  }

  /* Tabelle e pre se sforano scrollano dentro un wrapper, non sfondano la pagina */
  .at-main table,
  .at-main pre {
    max-width: 100%;
    overflow-x: auto;
    display: block;
  }
}

/* ============================================================
   FIX v1.6.11 — Featured "at-main-story" su mobile/tablet
   Layout: FOTO visibile in alto, TESTO sotto su sfondo navy pieno
   (non più overlay che copre la foto)
   ============================================================ */
@media (max-width: 1024px) {
  .at-main-story {
    background: var(--at-navy);
  }
  .at-main-story img {
    height: auto;          /* altezza naturale invece di 540px fissi */
    aspect-ratio: 16 / 10; /* mantiene proporzioni gradevoli */
    opacity: 1;            /* foto a piena visibilità */
  }
  .at-main-story .overlay {
    position: static;      /* non più sovrapposto alla foto */
    background: var(--at-navy); /* sfondo navy pieno invece di gradiente */
    padding: 24px 20px 24px;
  }
  .at-main-story h1 {
    font-size: 26px;
    line-height: 1.2;
  }
  .at-main-story .excerpt {
    font-size: 15px;
  }
}





/* ============================================================
   v1.11.5 — Parole e indirizzi web lunghi vanno a capo
   Senza queste regole un URL come
   "portalesanzioniamministrative.poliziadistato.it" non può
   spezzarsi e sfonda il testo, soprattutto sui telefoni.
   ============================================================ */
.at-article-body,
.at-article-body p,
.at-article-body li,
.at-article-body blockquote,
.at-article-body figcaption,
.at-article-body td,
.at-article-body dd {
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.at-article-body a,
.at-article-body code,
.at-article-body pre {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.at-article-body pre { white-space: pre-wrap; }

/* Stessa protezione per titoli, occhielli e schede laterali */
.at-article-title, .at-article-excerpt,
.at-card h3, .at-cat-card h3, .at-side-story h3,
.at-widget, .at-widget p, .at-widget a {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ============================================================
   v1.11.6 — Più larghezza ai contenuti sui telefoni
   Il margine laterale di 24px è pensato per il desktop; su uno
   schermo da 369px si mangiava il 13% della larghezza, lasciando
   immagini e card più strette del necessario.
   ============================================================ */
@media (max-width: 768px) {
  .container { padding: 0 14px; }
}
@media (max-width: 480px) {
  .container { padding: 0 10px; }
  .at-main-story h1 { font-size: 26px; line-height: 1.22; }
}
