/* ================================================================
   NEWSPRESS ITALIA — main.css
   Stili aggiuntivi e stati dinamici (JS-driven)
   ================================================================ */

/* Header scrolled: leggermente compresso */
.site-header.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.site-header.scrolled .logo-testata {
  font-size: 2.4rem;
  transition: font-size 0.3s ease;
}
.site-header.scrolled .testata-interna {
  padding-bottom: 0;
}

/* Menu mobile */
@media (max-width: 640px) {
  #menu-principale-lista {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bianco);
    border-top: 2px solid var(--rosso);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 500;
    flex-direction: column;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
  }
  #menu-principale-lista.aperto {
    display: flex;
    max-height: 80vh;
    overflow-y: auto;
  }
  #menu-principale-lista > li > a {
    padding: 14px 20px;
    border-bottom: 1px solid var(--grigio-bg);
    border-left: 3px solid transparent;
    width: 100%;
    text-align: left;
    font-size: 0.85rem;
  }
  #menu-principale-lista > li > a:hover {
    border-left-color: var(--rosso);
    background: var(--grigio-bg);
  }
  .sub-menu {
    position: static !important;
    box-shadow: none !important;
    border-top: none !important;
    background: var(--grigio-bg) !important;
    display: block !important;
  }
  .sub-menu a {
    padding-left: 32px !important;
  }
}

/* ================================================================
   BARRA RICERCA ESPANSA
   ================================================================ */
.barra-ricerca-espansa {
  background: var(--grigio-bg);
  border-top: 1px solid var(--grigio-bordo);
}
.barra-ricerca-espansa .form-ricerca {
  max-width: 640px;
  margin: 0 auto;
}

/* ================================================================
   ANIMAZIONE CARD: fade-in da sotto allo scroll
   ================================================================ */
@keyframes fadeInSu {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-articolo {
  animation: fadeInSu 0.4s ease both;
}
.card-articolo:nth-child(1) { animation-delay: 0.05s; }
.card-articolo:nth-child(2) { animation-delay: 0.10s; }
.card-articolo:nth-child(3) { animation-delay: 0.15s; }
.card-articolo:nth-child(4) { animation-delay: 0.20s; }
.card-articolo:nth-child(5) { animation-delay: 0.25s; }
.card-articolo:nth-child(6) { animation-delay: 0.30s; }

/* ================================================================
   FOCUS ACCESSIBILITY
   ================================================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--rosso);
  outline-offset: 2px;
}

/* ================================================================
   PRINT STYLES
   ================================================================ */
@media print {
  .barra-superiore,
  .site-header,
  .breaking-news-bar,
  .sidebar,
  .barra-condivisione,
  .site-footer,
  #torna-su { display: none !important; }

  .griglia-principale { grid-template-columns: 1fr !important; }
  .corpo-articolo { box-shadow: none; }
  a::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
}

/* ================================================================
   AVVISO NESSUN POST
   ================================================================ */
.avviso-nessun-post {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  background: var(--bianco);
  border-radius: var(--raggio);
  font-family: var(--font-ui);
  color: var(--grigio-medio);
  box-shadow: var(--ombra);
}

/* ================================================================
   COMMENTI WORDPRESS
   ================================================================ */
.comment-list { list-style: none; }

.comment-list .comment {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--grigio-bg);
}

.comment-list .comment-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--grigio-bordo);
}

.comment-list .comment-content { flex: 1; }

.comment-list .comment-author {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--testo);
  margin-bottom: 4px;
}

.comment-list .comment-date {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--testo-leggero);
  margin-bottom: 8px;
}

.comment-list .comment-text {
  font-family: var(--font-corpo);
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--testo);
}

.comment-respond {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid var(--grigio-scuro);
}

.comment-respond h3 {
  font-size: 1rem;
  margin-bottom: 16px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--grigio-bordo);
  border-radius: var(--raggio);
  padding: 9px 12px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--testo);
  outline: none;
  transition: border-color var(--transizione);
  margin-bottom: 10px;
}

.comment-form input:focus,
.comment-form textarea:focus { border-color: var(--rosso); }

.comment-form textarea { min-height: 120px; resize: vertical; }

.comment-form input[type="submit"] {
  background: var(--rosso);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background var(--transizione);
  width: auto;
  padding: 10px 24px;
}

.comment-form input[type="submit"]:hover { background: var(--rosso-hover); }

/* ================================================================
   WIDGET WORDPRESS NATIVI
   ================================================================ */
.widget_recent_posts ul li,
.widget_categories ul li,
.widget_pages ul li,
.widget_archive ul li {
  padding: 8px 0;
  border-bottom: 1px solid var(--grigio-bg);
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

.widget_recent_posts ul li a,
.widget_categories ul li a,
.widget_pages ul li a,
.widget_archive ul li a {
  color: var(--testo);
  transition: color var(--transizione);
}

.widget_recent_posts ul li a:hover,
.widget_categories ul li a:hover,
.widget_pages ul li a:hover,
.widget_archive ul li a:hover { color: var(--rosso); }

/* Nasconde il div corpo del widget se aperto via dynamic_sidebar */
.widget .widget__corpo:empty { display: none; }
