/* ============================================================================
   FPINEWS.IT — CSS MOBILE & TABLET
   Versione: 09.11.2025
   Usato da: /index_cell.php
   ============================================================================
   Struttura ottimizzata per schermi fino a 1024px
   ============================================================================ */

/* ===================== RESET ===================== */
html, body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #ffffff;
  color: #222;
  overflow-x: hidden;
}

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

/* ===================== HEADER ===================== */
.site-header-cell {
  background: #fff;
  text-align: center;
  border-bottom: 2px solid #871919;
  padding-top: 5px;
}

.header-banner-cell img {
  width: 95%;
  max-width: 600px;
  height: auto;
  margin: 0 auto;
}

.header-datetime-cell {
  font-size: 0.9rem;
  color: #333;
  margin-top: 4px;
  padding-bottom: 6px;
  font-family: 'Courier New', monospace;
}

/* ===================== RULLO ===================== */
.news-ticker-cell {
  background: #871919;
  overflow: hidden;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  white-space: nowrap;
}

.ticker-frame-cell {
  display: block;
  width: 100%;
  height: 28px;
  border: none;
  margin: 0;
  background: #871919 !important;
}

/* ===================== NAVBAR (correzione 2025-11-07) ===================== */
.site-nav {
  background: #871919;
  color: #fff;
  display: flex;
  flex-wrap: wrap;            /* ✅ va su più righe se serve */
  justify-content: center;    /* ✅ centrata orizzontalmente */
  align-items: center;
  gap: 10px 14px;             /* spazio orizzontale/verticale */
  padding: 10px 0;
  text-align: center;
  position: sticky;
  top: 42px;                  /* ✅ resta sotto il rullo fisso */
  z-index: 1000;
}

.site-nav a {
  color: #fff;
  text-decoration: none;
  padding: 5px 10px;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.site-nav a:hover {
  color: #ffebeb;
}

/* ===================== CELLE ===================== */
.grid-home {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin: 12px auto;
  width: 95%;
  justify-content: center;
}

.cella-home {
  border: 2px solid #871919;
  border-radius: 14px;
  background: #fff;
  min-height: 420px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: box-shadow 0.25s ease-in-out;
}

.cella-home:hover {
  box-shadow: 0 0 15px rgba(135,25,25,0.35);
}

/* ===================== LOADER ===================== */
.cella-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 420px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #ddd;
  border-top-color: #871919;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===================== FOOTER ===================== */
#bloccoC {
  text-align: center;
  background: #fff;
  color: #666;
  font-size: 0.85rem;
  padding: 15px 0;
}

#bloccoC a {
  color: #871919;
  text-decoration: none;
}

#bloccoC a:hover {
  text-decoration: underline;
}

/* ===================== COOKIE POPUP ===================== */
.cookie-modal {
  width: 90%;
  max-width: 340px;
  padding: 18px;
  border-radius: 14px;
  font-size: 0.9rem;
}

.cookie-modal h2 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.btn {
  padding: 8px 14px;
  font-size: 0.9rem;
}

/* ===================== TABLET ADAPTATION ===================== */
@media (min-width: 700px) and (max-width: 1024px) {
  .grid-home {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 95%;
  }

  .site-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .site-nav a {
    font-size: 1rem;
  }
}
/* ============================================================================
   PATCH MOBILE — Correzione rullo fermo su Safari / Android
   ============================================================================
   Forza la GPU e disattiva sticky header per garantire animazione fluida.
   ============================================================================ */
@media (max-width: 1024px) {
  #bloccoA {
    position: static !important;
    overflow: visible !important;
  }

  .site-header,
  header {
    position: static !important;
  }

  .rullo-notizie {
    position: relative;
    overflow: hidden;
    background: #871919;
    color: #fff;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
  }

  .rullo-inner {
    display: flex;
    width: 200%;
    animation: tickerMove 40s linear infinite;
    will-change: transform;
    transform: translateZ(0);
  }

  .rullo-track {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 40px;
  }

  .rullo-track a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
  }

  .rullo-track a:hover {
    color: #ffebeb;
  }

  @keyframes tickerMove {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
  }
}
/* ============================================================================
   FIX MOBILE: luogo su prima riga, data/ora sotto, firma centrata e dentro cella
   ============================================================================ */
@media (max-width: 1024px) {
  .cella-home {
    padding-bottom: 44px;        /* spazio reale in fondo per non tagliare firma */
    box-sizing: border-box;
    overflow: hidden;            /* impedisce di uscire dai bordi */
  }

  .article-meta {
    display: flex;
    flex-direction: column;      /* 📍 luogo sopra — 🕒 data/ora sotto */
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 3px;
    margin-top: 10px;
    margin-bottom: 6px;
    line-height: 1.4;
    font-size: 0.9rem;
    color: #333;
    padding: 0 8px;              /* piccolo margine interno */
    white-space: normal;
    word-break: break-word;
  }

  .article-firma {
    text-align: center;
    margin: 8px auto 4px auto;
    font-size: 0.85rem;
    color: #555;
    max-width: 95%;
    line-height: 1.3;
  }
}