/**
 * FONDAZIONE ARMANDO - NEWS CARDS
 *
 * Card news riusabili. Usato da:
 *  - template-parts/fondazione-news.php (homepage)
 *  - archive-news.php
 *  - taxonomy-news_category.php
 *
 * Estratto dai blocchi <style> inline duplicati (Fase B/C del refactor).
 */

/* ============================================================
   Section wrapper (homepage news)
   Font Montserrat e box-sizing scoped sulla sezione news.
   ============================================================ */
.section--news {
  font-family: 'Montserrat', sans-serif;
}

.section--news *,
.section--news *::before,
.section--news *::after {
  box-sizing: border-box;
}

/* ============================================================
   Griglia card
   ============================================================ */
.fondazione-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
  justify-content: center;
}

@media (min-width: 769px) {
  /* Homepage: sempre 3 card su una riga (auto-fit su iPad portrait ne faceva entrare solo 2, lasciando il buco) */
  .section--news .fondazione-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* ← scoped homepage */
    justify-content: start;
  }

  /* Archivio/taxonomy: colonne adattive, con molte card l'auto-fit non crea buchi */
  .fondazione-section .fondazione-cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 350px)); /* ← scoped archivio */
    justify-content: start;
  }
}

@media (min-width: 1200px) {
  .fondazione-section .fondazione-cards-grid { /* ← scoped archivio: per la homepage basta la regola 769px */
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* ← minmax(0,1fr): titoli lunghi non allargano la colonna */
    gap: 30px;
  }
}

@media (max-width: 768px) {
  .fondazione-cards-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* ============================================================
   Card singola
   ============================================================ */
.fondazione-card {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.fondazione-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* ============================================================
   Immagine
   ============================================================ */
.fondazione-card-image {
  width: 100%;
  height: 220px;
  background: #b8e6d3;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fondazione-card-image::after {
  content: '📷';
  font-size: 48px;
  opacity: 0.4;
}

.fondazione-card-image:has(.fondazione-card-img)::after {
  display: none;
}

.fondazione-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

/* ============================================================
   Tag categoria (overlay sull'immagine)
   ============================================================ */
.fondazione-card-tag {
  background: rgba(38, 191, 148, 0.95);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  display: inline-block;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  text-decoration: none;
  transition: background 0.3s ease, color 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.fondazione-card-tag:hover {
  background: rgba(38, 191, 148, 1);
  color: #ffffff;
}

/* ============================================================
   Contenuto card
   ============================================================ */
.fondazione-card-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

@media (max-width: 768px) {
  .fondazione-card-content { padding: 20px; }
}

.fondazione-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
  margin-top: 0;
  line-height: 1.3;
  text-transform: lowercase;
}

.fondazione-card-title::first-letter {
  text-transform: uppercase;
}

.fondazione-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

.fondazione-card-title a:hover {
  color: #26BF94;
}

.fondazione-card-categories {
  font-size: 0.85rem;
  color: #6c757d;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fondazione-card-categories i {
  font-size: 0.9rem;
  color: #6c757d;
}

.fondazione-card-categories a {
  color: #6c757d;
  text-decoration: none;
  transition: color 0.3s ease;
}

.fondazione-card-categories a:hover {
  color: #26BF94;
}

.fondazione-card-description {
  font-size: 15px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 20px;
  margin-top: 0;
  flex: 1;
  min-height: 0;
}

/* ============================================================
   Stato vuoto
   ============================================================ */
.fondazione-no-news {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-style: italic;
}

/* ============================================================
   CTA "Vedi tutto" (sotto la grid)
   ============================================================ */
.fondazione-view-all {
  text-align: center;
  margin-top: 20px;
}

/* ============================================================
   Wrapper sezione per archive/taxonomy news
   (la homepage news ha background gestito inline sul <section>)
   ============================================================ */
.fondazione-section {
  background: #ffffff;
  padding: 30px 20px;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .fondazione-section { padding: 30px 15px; }
}

/* ============================================================
   CTA "Scopri di più" interno alla card
   ============================================================ */
.mission-card-cta {
  margin-top: auto;
  padding-top: 10px;
}

/* ============================================================
   Paginazione e stato vuoto archive
   ============================================================ */
.pagination-wrapper {
  text-align: center;
  margin-top: 40px;
}

.no-news {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.no-news h2 {
  font-size: 24px;
  margin-bottom: 16px;
  color: #333;
}
