/* ============================================================
   Solidali — Header condiviso
   Topbar (ultime) + Header sticky + Mobile drawer
   Caricato da TUTTE le pagine pubbliche dopo style.css
   ============================================================ */

/* ===== SKIP-TO-CONTENT (accessibilità tastiera) ===== */
.skip-link {
  position: fixed;
  top: 0;
  left: 16px;
  z-index: 9999;
  transform: translateY(-120%);
  background: var(--color-orange);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 0 0 6px 6px;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: transform var(--transition), opacity var(--transition);
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  outline: 3px solid var(--color-black);
  outline-offset: 2px;
}

/* ===== TOPBAR (ultime notizie, slim) ===== */
.topbar {
  background: var(--color-dark);
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--font-sans);
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topbar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 9px 32px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar__lead {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}
.topbar__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-orange);
  box-shadow: 0 0 0 3px rgba(255, 92, 0, 0.25);
  animation: topbar-pulse 2s ease-in-out infinite;
}
@keyframes topbar-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 92, 0, 0.25); }
  50%      { box-shadow: 0 0 0 5px rgba(255, 92, 0, 0.06); }
}
.topbar__kicker {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 11px;
  color: var(--color-orange);
}
.topbar__rotator {
  flex: 1;
  position: relative;
  height: 20px;
  overflow: hidden;
  min-width: 0;
}
.topbar__item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  opacity: 0;
  /* I tre titoli stanno uno sopra l'altro: senza questo il tocco arriva
     sempre all'ultimo del DOM, e sul telefono si apre una notizia diversa
     da quella che si sta leggendo. */
  pointer-events: none;
  transform: translateY(10px);
  animation: topbar-rotate 12s infinite;
  transition: color .15s;
}
.topbar__item:nth-child(1) { animation-delay: 0s; }
.topbar__item:nth-child(2) { animation-delay: 4s; }
.topbar__item:nth-child(3) { animation-delay: 8s; }
@keyframes topbar-rotate {
  0%, 3%    { opacity: 0; transform: translateY(10px); pointer-events: none; }
  8%, 30%   { opacity: 1; transform: translateY(0);   pointer-events: auto; }
  35%, 100% { opacity: 0; transform: translateY(-10px); pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
  .topbar__dot { animation: none; }
  .topbar__item { animation: none; opacity: 1; transform: none; pointer-events: auto; }
  .topbar__item:nth-child(n+2) { display: none; }
}
.topbar__item:hover { color: var(--color-orange); }
.topbar__more {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  letter-spacing: .04em;
  transition: color .15s;
}
.topbar__more:hover { color: #fff; }

/* ===== HEADER MAIN (sticky + shrink) ===== */
.hdr {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  backdrop-filter: blur(14px) saturate(180%);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow .3s ease, border-color .3s ease;
}
.hdr__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  transition: padding .3s ease;
}
.hdr[data-scrolled="true"] {
  box-shadow: 0 4px 20px rgba(13, 11, 8, 0.06);
  border-color: transparent;
}
.hdr[data-scrolled="true"] .hdr__inner { padding: 10px 32px; }
.hdr[data-scrolled="true"] .hdr__logo  { height: 64px; }
.hdr[data-scrolled="true"] .hdr__sub   { opacity: 0; max-height: 0; margin-top: 0; }

.hdr__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}
.hdr__logo {
  height: 88px;
  width: auto;
  transition: height .3s ease;
}
.hdr__wordmark { display: flex; flex-direction: column; line-height: 1; }
.hdr__name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--color-black);
  letter-spacing: -.01em;
  line-height: 1;
}
.hdr__sub {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--color-mid);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-top: 5px;
  max-height: 16px;
  overflow: hidden;
  transition: opacity .25s, max-height .25s, margin-top .25s;
}

.hdr__nav {
  display: flex;
  gap: 2px;
  margin-left: auto;
  margin-right: 8px;
}
.hdr__link {
  position: relative;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-mid);
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 6px;
  transition: color .15s ease, background .15s ease;
}
.hdr__link:hover {
  color: var(--color-black);
  background: rgba(13, 11, 8, 0.04);
}
.hdr__link--active {
  color: var(--color-black);
  font-weight: 700;
}
.hdr__link--active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-orange);
}

.hdr__cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--color-orange);
  /* Bianco su arancio è 3.1:1: sotto il minimo per il testo. */
  color: var(--color-black);
  padding: 11px 18px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  text-decoration: none;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(255, 92, 0, 0.22);
  transition: transform .15s ease, box-shadow .15s ease;
}
.hdr__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 92, 0, 0.34);
}
.hdr__cta svg {
  width: 14px;
  height: 14px;
  transition: transform .2s ease;
}
.hdr__cta:hover svg { transform: translateX(3px); }

.hdr__cta--blue {
  background: var(--color-blue);
  /* Sul blu il rapporto giusto ce l'ha il bianco (5.0:1), non lo scuro. */
  color: var(--color-white);
  box-shadow: 0 2px 10px rgba(28, 114, 192, 0.22);
}
.hdr__cta--blue:hover {
  box-shadow: 0 6px 18px rgba(28, 114, 192, 0.34);
}

.hdr__ctas {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Burger (mobile) */
.hdr__burger {
  display: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  z-index: 110;
}
.hdr__burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-black);
  border-radius: 2px;
  transition: transform .25s ease, opacity .15s ease;
}
.hdr.is-open .hdr__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hdr.is-open .hdr__burger span:nth-child(2) { opacity: 0; }
.hdr.is-open .hdr__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.hdr-drawer {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 95;
  padding: 88px 24px 24px;
  padding-top: calc(88px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
  /* Sei voci di menu più due pulsanti superano l'altezza di un telefono:
     senza lo scorrimento interno "Tesserati ora" resta fuori dallo schermo
     e il corpo pagina è bloccato, quindi non lo raggiunge nessuno. */
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.hdr-drawer.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.hdr-drawer__nav {
  display: flex;
  flex-direction: column;
}
.hdr-drawer__link {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: var(--color-black);
  text-decoration: none;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
  letter-spacing: -.01em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hdr-drawer__link::after {
  content: "→";
  color: var(--color-mid);
  font-size: 22px;
  font-weight: 400;
}
.hdr-drawer__link--active { color: var(--color-orange-display); }
.hdr-drawer__link--active::after { color: var(--color-orange-display); }
.hdr-drawer__cta {
  margin-top: 8px;
  background: var(--color-orange);
  color: var(--color-black);
  padding: 18px;
  border-radius: 6px;
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  letter-spacing: .02em;
  box-shadow: 0 4px 16px rgba(255, 92, 0, 0.28);
}
.hdr-drawer__cta--blue {
  background: var(--color-blue);
  color: var(--color-white);
  box-shadow: 0 4px 16px rgba(28, 114, 192, 0.28);
}
.hdr-drawer__social {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}
.hdr-drawer__social a {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-mid);
  text-decoration: none;
  letter-spacing: .04em;
}

/* Responsive */
@media (max-width: 900px) {
  .topbar__more { display: none; }
  .topbar__inner { padding: 10px 18px; gap: 12px; }
  .topbar__rotator { height: 24px; }
  .hdr__inner { padding: 12px 20px; gap: 12px; }
  /* Senza questa riga la regola dello stato "scrolled" (specificità più
     alta) rimette 32px di lato e il logo scivola appena si scorre. */
  .hdr[data-scrolled="true"] .hdr__inner { padding: 8px 20px; }
  .hdr__nav { display: none; }
  .hdr__ctas { display: none; }
  .hdr__burger { display: flex; }
  .hdr__logo { height: 72px; }
  .hdr[data-scrolled="true"] .hdr__logo { height: 56px; }
  .hdr__name { font-size: 20px; }
  .hdr__sub { font-size: 9.5px; letter-spacing: .12em; }
}
@media (max-width: 520px) {
  .topbar__kicker { font-size: 10px; }
  .topbar__rotator { font-size: 12.5px; }
  .hdr__inner { padding: 10px 16px; gap: 10px; }
  .hdr[data-scrolled="true"] .hdr__inner { padding: 7px 16px; }
  .hdr__logo { height: 60px; }
  .hdr[data-scrolled="true"] .hdr__logo { height: 48px; }
  .hdr-drawer { padding-left: 20px; padding-right: 20px; }
}

/* Telefono in orizzontale, o schermo corto: il menu deve restare un menu,
   non una lista da scorrere per intero. */
@media (max-height: 700px) and (max-width: 900px) {
  .hdr-drawer { padding-top: calc(76px + env(safe-area-inset-top)); gap: 14px; }
  .hdr-drawer__link { font-size: 24px; padding: 12px 0; }
  .hdr-drawer__link::after { font-size: 18px; }
  .hdr-drawer__cta { padding: 14px; font-size: 15px; }
  .hdr-drawer__social { padding-top: 16px; }
}
