/* ===========================================================================
   Redazione — cornice condivisa: base della pagina, testata e footer.

   Unica definizione per le pagine della Redazione rese dal server
   (api/redazione.js per l'elenco, api/articolo.js per l'articolo), che
   scrivono il markup da api/_redazione.js. Le sezioni sospese (classifica,
   calendario, probabili formazioni) usano ancora js/redazione-subnav.js, che
   genera la stessa testata e carica questo foglio se la pagina non lo include.

   Prima questi stili vivevano solo dentro redazione-subnav.js, e l'articolo
   aveva una testata disegnata a parte: le due pagine sembravano due siti.
   I dropdown delle sezioni sospese restano nella JS, che e' l'unica a usarli.
   =========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--fb-font, 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

/* Ricalca .app-footer di css/styles.css (il footer delle altre pagine del
   sito) con i valori del tema chiaro al posto delle variabili --theme-*:
   queste pagine non caricano styles.css. */
.app-footer {
  margin-top: 3rem;
  border-top: 1px solid rgba(37, 99, 235, 0.18);
  background: rgba(255, 255, 255, 0.5);
  padding: 2.5rem clamp(1rem, 4vw, 3rem);
  text-align: center;
  line-height: 1.5;
}

.app-footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.app-footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.app-footer-logo {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
  opacity: .75;
}

.app-footer-wordmark {
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: .12em;
  color: #64748b;
}

.app-footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.app-footer-link {
  font-size: .82rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
  transition: color .15s;
}

.app-footer-link:hover {
  color: #1d4ed8;
}

.app-footer-copy {
  margin: 0;
  font-size: .75rem;
  color: #64748b;
  opacity: .6;
}

/* ── Testata ─────────────────────────────────────────────────────────────── */

.redazione-sticky-stack {
  position: sticky;
  top: var(--redazione-sticky-offset, 0px);
  z-index: 59;
  overflow: visible;
  isolation: isolate;
}

/* ── Fascia scura: logo, tab (desktop), badge ─────────────────────────────── */

.redazione-sticky-stack .red-hero {
  background: rgba(10, 14, 46, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.5);
  padding: 0;
  margin-bottom: 0;
}

.redazione-sticky-stack .red-hero-inner {
  /* Stesso max-width + padding di .red-page: la nav resta allineata alla
     colonna dei contenuti a ogni larghezza. */
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: calc(env(safe-area-inset-top, 0px) + 60px);
  padding: env(safe-area-inset-top, 0px) 1rem 0;
}

.red-hero-logo-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  flex-shrink: 0;
  padding-right: 1.25rem;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  height: 100%;
}

.red-hero-logo-img {
  height: 30px;
  width: auto;
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.45));
}

.red-hero-logo-name {
  font-family: var(--fb-font, 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.5;
  background: linear-gradient(to right, #ffffff 40%, #7ea8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.red-hero-nav {
  display: flex;
  align-items: center;
  flex: 1;
  height: 100%;
  padding-left: 0.25rem;
  overflow: visible;
  position: relative;
}

.red-hero-nav .red-tab {
  padding: 0 1.1rem;
  height: 100%;
  display: inline-flex;
  align-items: center;
}

.red-hero-nav .red-tab-dropdown-wrap {
  height: 100%;
  display: flex;
  align-items: center;
}

.red-hero-section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 1rem;
  padding: 0.28rem 0.85rem;
  border-radius: 9999px;
  flex-shrink: 0;
  font-family: var(--fb-font, 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.5;
  background: rgba(59, 130, 246, 0.14);
  color: #7ea8ff;
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.12);
}

.red-hero-social {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  margin-left: 0.75rem;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: color .15s, border-color .15s;
}

.red-hero-social:hover {
  color: #7ea8ff;
  border-color: rgba(59, 130, 246, 0.45);
}

.red-hero-app-cta {
  display: none;
  align-items: center;
  margin-left: 0.75rem;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  flex-shrink: 0;
  font-family: var(--fb-font, 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
}

@media (min-width: 641px) {
  .red-hero-social,
  .red-hero-app-cta {
    display: inline-flex;
  }
}

/* ── Tab ──────────────────────────────────────────────────────────────────── */

.redazione-subnav-shell {
  overflow: visible;
}

/* Desktop: la barra tab sotto la fascia e' nascosta, i tab stanno nella
   fascia scura. Su mobile e' il contrario (vedi media query in fondo). */
.redazione-sticky-stack > .redazione-subnav-shell {
  display: none;
}

/* Il logo nella fascia scura e' gia' un link alla home: il vecchio tasto
   "FantaBit ←" era un doppione, nascosto a ogni larghezza. */
#red-tab-fantabit {
  display: none;
}

.red-hero-nav .red-tabs {
  background: transparent !important;
  border-bottom: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  height: 100%;
  display: flex;
  align-items: center;
}

.red-hero-nav .red-tab {
  height: 100%;
  border-bottom-width: 2px;
}

.redazione-subnav-shell .red-tabs {
  display: flex;
  gap: 0;
  background: rgba(10, 14, 46, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(59, 130, 246, 0.14);
  overflow: visible;
  scrollbar-width: none;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.redazione-subnav-shell .red-tabs::-webkit-scrollbar {
  display: none;
}

.redazione-subnav-shell .red-tab {
  padding: .85rem 1.15rem;
  margin-bottom: -2px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.5;
  text-transform: uppercase;
  font-family: var(--fb-font, 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  color: rgba(255, 255, 255, 0.45);
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color .15s, border-color .15s;
}

.redazione-subnav-shell .red-tab:hover {
  color: #7ea8ff;
}

.redazione-subnav-shell .red-tab.active,
.redazione-subnav-shell .red-tab-dropdown-wrap.red-section-active > .red-tab-has-dropdown {
  color: #7ea8ff;
  border-bottom-color: #7ea8ff;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .redazione-sticky-stack {
    top: 0;
  }

  /* La fascia scura mostra solo il logo, centrato; i tab scendono nella
     barra sotto. */
  .red-hero-nav {
    display: none !important;
  }

  .red-hero-section-badge {
    display: none;
  }

  .red-hero-logo-link {
    border-right: none;
    padding-right: 0;
  }

  .redazione-sticky-stack .red-hero-inner {
    height: calc(env(safe-area-inset-top, 0px) + 52px);
    justify-content: center;
  }

  .redazione-sticky-stack > .redazione-subnav-shell {
    display: block;
  }

  .redazione-subnav-shell .red-tabs {
    overflow-x: auto;
    overflow-y: visible;
  }

  .redazione-subnav-shell .red-tab {
    padding: .8rem .95rem;
  }
}

@media (max-width: 600px) {
  /* Stesso breakpoint di .red-page: logo allineato al titolo sottostante. */
  .redazione-sticky-stack .red-hero-inner {
    padding-left: .75rem;
    padding-right: .75rem;
  }
}
