/* =====================================================================
   Federal Home — pannello di controllo istituzionale, esperienza museale
   Blu notte / azzurro / bianco, accenti rossi discreti, vetro e profondità.
   Logo 3D protagonista; le tre aree sono "stazioni" agganciate al nucleo.
   ===================================================================== */

:root {
  --night: #060b16;
  --deep: #0a1428;
  --blue: #1e3a8a;
  --sky: #5cc8ff;
  --white: #eef4ff;
  --muted: #93a7c6;
  --red: #e4443a;
  --teal: #7dd3c0;

  --glass: rgba(14, 26, 50, 0.5);
  --glass-brd: rgba(120, 170, 235, 0.18);
  --glass-brd-hover: rgba(160, 205, 255, 0.6);
  --hairline: rgba(150, 200, 255, 0.22);
  --shadow: 0 30px 70px -24px rgba(0, 0, 0, 0.85);
  --font: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

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

html,
body { height: 100%; }

body.fh {
  font-family: var(--font);
  color: var(--white);
  background:
    radial-gradient(120% 90% at 50% -10%, #16305c 0%, transparent 45%),
    radial-gradient(1200px 820px at 50% 42%, #0f2244 0%, var(--deep) 46%, var(--night) 100%);
  min-height: 100svh;
  overflow-x: hidden; /* nessun overflow orizzontale */
  position: relative;
}

/* Vignette + faro museale morbido + velatura atmosferica */
body.fh::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    radial-gradient(58% 55% at 50% 44%, transparent 52%, rgba(0, 0, 0, 0.6) 100%),
    linear-gradient(180deg, rgba(120, 170, 240, 0.06) 0%, transparent 22%),
    linear-gradient(120deg, transparent 0%, rgba(228, 68, 58, 0.035) 100%);
}

/* Grana finissima per resa "museale" (nessun asset esterno) */
body.fh::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.04;
  background-image: radial-gradient(rgba(255, 255, 255, 0.7) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
}

/* ---------------------------------------------------------------------
   Scena 3D (canvas) + faro + fallback CSS
   --------------------------------------------------------------------- */
.fh-scene { position: fixed; inset: 0; z-index: 1; }

.fh-scene__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Faro dall'alto verso il nucleo */
.fh-scene__spot {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 60% at 50% 4%, rgba(150, 200, 255, 0.14), transparent 62%),
    radial-gradient(30% 26% at 50% 52%, rgba(92, 200, 255, 0.1), transparent 70%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 1.6s ease;
}

/* Bagliore soft usato anche come fallback quando WebGL non è disponibile */
.fh-scene__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 40% at 50% 50%, rgba(92, 200, 255, 0.16), transparent 70%),
    radial-gradient(28% 30% at 16% 82%, rgba(59, 130, 246, 0.14), transparent 70%),
    radial-gradient(28% 30% at 84% 82%, rgba(125, 211, 192, 0.12), transparent 70%);
  opacity: 0;
  transition: opacity 1.2s ease;
}

.no-webgl .fh-scene__glow,
.fh-ready .fh-scene__glow,
.fh-ready .fh-scene__spot,
.no-webgl .fh-scene__spot { opacity: 1; }

/* ---------------------------------------------------------------------
   Cornice da console istituzionale
   --------------------------------------------------------------------- */
.fh-frame { position: fixed; inset: 0; z-index: 3; pointer-events: none; }

.fh-frame__corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(150, 200, 255, 0.28);
  opacity: 0;
  transition: opacity 1.4s ease;
}

.fh-ready .fh-frame__corner { opacity: 1; }

.fh-frame__corner--tl { top: 16px; left: 16px; border-right: 0; border-bottom: 0; }
.fh-frame__corner--tr { top: 16px; right: 16px; border-left: 0; border-bottom: 0; }
.fh-frame__corner--bl { bottom: 16px; left: 16px; border-right: 0; border-top: 0; }
.fh-frame__corner--br { bottom: 16px; right: 16px; border-left: 0; border-top: 0; }

/* Micro-etichette tecniche decorative (opacità molto bassa, non cliccabili) */
.fh-decor {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s ease;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(150, 190, 240, 0.26);
}

.fh-ready .fh-decor { opacity: 1; }
.fh-decor span { position: absolute; white-space: nowrap; }
.fh-decor__a { top: 28%; left: 5%; }
.fh-decor__b { bottom: 24%; left: 6%; }
.fh-decor__c { top: 32%; right: 5%; }
.fh-decor__d { bottom: 20%; right: 6%; }
.fh-decor__e { top: 14%; right: 6%; }

/* ---------------------------------------------------------------------
   Connettori: linea guida + impulso luminoso verso le stazioni
   --------------------------------------------------------------------- */
.fh-links {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.fh-links__line {
  stroke: rgba(120, 190, 255, 0.4);
  stroke-width: 1;
  stroke-dasharray: 5 11;
  filter: drop-shadow(0 0 3px rgba(92, 200, 255, 0.4));
  opacity: 0;
  animation: fh-dash 6s linear infinite;
  transition: stroke 0.4s ease, opacity 0.8s ease;
}

.fh-links__pulse {
  stroke: rgba(170, 220, 255, 0.95);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 20 1400;
  filter: drop-shadow(0 0 6px rgba(140, 205, 255, 0.85));
  opacity: 0;
  animation: fh-travel 3.4s cubic-bezier(0.4, 0, 0.5, 1) infinite;
  transition: opacity 1s ease;
}

.fh-links__pulse[data-link="datagym"] { animation-delay: -1.1s; }
.fh-links__pulse[data-link="struttura"] { animation-delay: -2.2s; }

.fh-ready .fh-links__line { opacity: 1; }

/* l'impulso parte soprattutto su hover/focus della stazione e si spegne dolce.
   La linea attiva prende il colore della stazione; l'impulso una lievissima
   sfumatura tricolore (atmosfera italiana, non bandiera). */
.fh-links__pulse { opacity: 0; }
.fh-links__pulse.is-active {
  opacity: 0.9;
  animation-duration: 1.9s;
  stroke: url(#fh-tricolor);
}

.fh-links__line[data-link="musiche"].is-active { stroke: #5cc8ff; }
.fh-links__line[data-link="datagym"].is-active { stroke: #3b82f6; }
.fh-links__line[data-link="struttura"].is-active { stroke: #7dd3c0; }
.fh-links__line.is-active { stroke-opacity: 0.9; }

@keyframes fh-dash { to { stroke-dashoffset: -160; } }
@keyframes fh-travel {
  from { stroke-dashoffset: 20; }
  to { stroke-dashoffset: -560; }
}

/* ---------------------------------------------------------------------
   Palco / overlay HTML
   --------------------------------------------------------------------- */
.fh-stage {
  position: relative;
  z-index: 4;
  min-height: 100svh;
  width: 100%;
  max-width: 100%;
}

/* ---- Header da console ---- */
.fh-console {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 2.4vh, 1.6rem) clamp(1.1rem, 3vw, 2.4rem);
  z-index: 5;
}

.fh-console__id { display: flex; align-items: center; gap: 0.8rem; }

.fh-console__mark {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(150, 205, 255, 0.4);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.45), rgba(7, 13, 26, 0.6));
  flex-shrink: 0;
}

.fh-console__mark::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 3px;
  border: 1px solid rgba(185, 222, 255, 0.75);
}

.fh-console__labels { display: flex; flex-direction: column; line-height: 1.18; }

.fh-console__title {
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: clamp(0.72rem, 1.15vw, 0.92rem);
}

.fh-console__sub {
  font-size: clamp(0.62rem, 1vw, 0.76rem);
  color: var(--muted);
  letter-spacing: 0.05em;
}

.fh-console__status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.fh-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal);
  animation: fh-blink 2.6s ease-in-out infinite;
}

.fh-console__time {
  color: var(--white);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
}

@keyframes fh-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---- Nucleo centrale: il logo 3D è il protagonista ---- */
.fh-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(180px, 23vw, 280px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  z-index: 5;
}

/* pozza di luce sotto il logo (effetto piedistallo museale) */
.fh-core__pool {
  position: absolute;
  left: 50%;
  top: 92%;
  transform: translate(-50%, 0);
  width: 175%;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    rgba(92, 200, 255, 0.34),
    rgba(92, 200, 255, 0.07) 58%,
    transparent 76%);
  filter: blur(7px);
  z-index: -1;
  animation: fh-breathe 6.5s ease-in-out infinite;
}

.fh-core__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(150, 200, 255, 0.3);
  box-shadow:
    inset 0 0 44px rgba(92, 200, 255, 0.16),
    0 0 60px rgba(30, 58, 138, 0.35);
  animation: fh-spin 30s linear infinite, fh-breathe 6.5s ease-in-out infinite;
  transition: box-shadow 0.5s ease, border-color 0.5s ease;
}

/* il nucleo reagisce al focus di una stazione con un leggero aumento del glow */
.fh-focus .fh-core__ring {
  border-color: rgba(175, 218, 255, 0.5);
  box-shadow:
    inset 0 0 56px rgba(92, 200, 255, 0.26),
    0 0 90px rgba(60, 120, 220, 0.5);
}

.fh-core__pool { transition: opacity 0.5s ease, filter 0.5s ease; }
.fh-focus .fh-core__pool { filter: blur(7px) brightness(1.35); }

.fh-core__ring--outer {
  inset: -13%;
  border-style: dashed;
  border-color: rgba(130, 185, 255, 0.2);
  animation: fh-spin 46s linear infinite reverse;
  box-shadow: none;
}

@keyframes fh-spin { to { transform: rotate(360deg); } }
@keyframes fh-breathe {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

.fh-core__logo {
  position: relative;
  width: 64%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 34%, rgba(30, 58, 138, 0.5), rgba(6, 12, 24, 0.92));
  border: 1px solid rgba(150, 205, 255, 0.38);
  box-shadow:
    inset 0 2px 20px rgba(92, 200, 255, 0.24),
    0 12px 46px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.fh-core__logo img,
.fh-core__logo svg {
  width: 78%;
  height: 78%;
  object-fit: contain; /* logo mai deformato */
  display: block;
}

/* Micro-etichetta discreta sotto il nucleo (non compete con il logo) */
.fh-core__tag {
  position: absolute;
  top: calc(100% + 16px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.56rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(175, 208, 255, 0.5);
  white-space: nowrap;
  pointer-events: none;
}

/* Quando il modello GLB è pronto, il logo HTML lascia il posto al 3D. */
.fh-3d-logo .fh-core__logo {
  opacity: 0;
  visibility: hidden;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* ---------------------------------------------------------------------
   Stazioni (le tre aree agganciate al nucleo)
   --------------------------------------------------------------------- */
.fh-sections { position: absolute; inset: 0; z-index: 5; }

.fh-card {
  position: absolute;
  width: clamp(232px, 23vw, 316px);
  display: block;
  padding: 1.1rem 1.2rem 1.15rem;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(16px) saturate(125%);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  color: var(--white);
  text-decoration: none;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1),
    border-color 0.4s ease, box-shadow 0.4s ease;
  outline: none;
}

/* bordo con sfumatura del colore stazione */
.fh-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--sec, var(--sky)), transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

/* velo di luce superiore */
.fh-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 60% at 50% -10%, rgba(160, 205, 255, 0.14), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

/* nodo di aggancio verso il nucleo */
.fh-card__node {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sec, var(--sky));
  box-shadow: 0 0 12px var(--sec, var(--sky));
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.fh-card--top .fh-card__node { bottom: -5px; left: 50%; transform: translateX(-50%); }
.fh-card--bottom-left .fh-card__node { top: -5px; right: 24px; }
.fh-card--bottom-right .fh-card__node { top: -5px; left: 24px; }

/* posizioni triangolari (desktop) */
.fh-card--top { top: clamp(4rem, 8vh, 6rem); left: 50%; transform: translateX(-50%); }
.fh-card--bottom-left { bottom: clamp(4.5rem, 10vh, 7rem); left: clamp(1rem, 5vw, 4rem); }
.fh-card--bottom-right { bottom: clamp(4.5rem, 10vh, 7rem); right: clamp(1rem, 5vw, 4rem); }

.fh-card:hover,
.fh-card:focus-visible {
  border-color: var(--glass-brd-hover);
  box-shadow: var(--shadow), 0 0 0 1px var(--sec, var(--sky)),
    0 0 40px -8px var(--sec, var(--sky));
}

.fh-card:hover::after,
.fh-card:focus-visible::after { opacity: 1; }
.fh-card:hover::before,
.fh-card:focus-visible::before { opacity: 0.85; }

.fh-card:hover .fh-card__node,
.fh-card:focus-visible .fh-card__node {
  transform: scale(1.35);
}
.fh-card--top:hover .fh-card__node,
.fh-card--top:focus-visible .fh-card__node {
  transform: translateX(-50%) scale(1.35);
}

.fh-card--top:hover,
.fh-card--top:focus-visible { transform: translateX(-50%) translateY(-7px); }

.fh-card--bottom-left:hover,
.fh-card--bottom-left:focus-visible,
.fh-card--bottom-right:hover,
.fh-card--bottom-right:focus-visible { transform: translateY(-7px); }

.fh-card:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }

/* meta: codice stazione + pin */
.fh-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}

.fh-card__code {
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.fh-card__pin {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sec, var(--sky));
  box-shadow: 0 0 10px var(--sec, var(--sky));
}

.fh-card__viz {
  display: block;
  height: 92px;
  margin-bottom: 0.85rem;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(6, 14, 30, 0.65), rgba(6, 14, 30, 0.1));
  border: 1px solid rgba(120, 170, 235, 0.14);
  transition: filter 0.4s ease;
}

.fh-card__viz svg { width: 100%; height: 100%; display: block; }

.fh-card__title {
  display: block;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 1.08rem;
  color: var(--white);
}

.fh-card__desc {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}

.fh-card__foot {
  display: flex;
  align-items: center;
  margin-top: 0.9rem;
  min-height: 1.4rem;
}

.fh-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--white);
}

.fh-card__arrow { transition: transform 0.35s ease; }
.fh-card:hover .fh-card__arrow,
.fh-card:focus-visible .fh-card__arrow { transform: translateX(4px); }

.fh-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffd9d5;
  background: rgba(228, 68, 58, 0.13);
  border: 1px solid rgba(228, 68, 58, 0.4);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.fh-card__badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.fh-card:hover .fh-card__viz,
.fh-card:focus-visible .fh-card__viz { filter: saturate(140%) brightness(1.12); }

/* ---- Baseline / tagline ---- */
.fh-baseline {
  position: absolute;
  bottom: clamp(1rem, 3vh, 2rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1.1rem;
  width: min(92%, 780px);
  z-index: 5;
}

.fh-baseline__rule {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--hairline), transparent);
}

.fh-tagline {
  text-align: center;
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  color: var(--white);
  letter-spacing: 0.03em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.7);
  white-space: normal;
}

/* ---------------------------------------------------------------------
   Introduzione animata (non bloccante)
   --------------------------------------------------------------------- */
.fh-intro {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: var(--night);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.fh-intro__line {
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--sky), transparent);
  box-shadow: 0 0 18px var(--sky);
}

.is-preload .fh-stage { opacity: 0; }

/* ---------------------------------------------------------------------
   Fallback noscript
   --------------------------------------------------------------------- */
.fh-noscript {
  position: relative;
  z-index: 7;
  max-width: 640px;
  margin: 12vh auto;
  padding: 2rem;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: 16px;
}

.fh-noscript h1 { font-size: 1.25rem; margin-bottom: 1rem; }
.fh-noscript ul { list-style: none; display: grid; gap: 0.75rem; }
.fh-noscript a { color: var(--sky); font-weight: 600; }

/* ---------------------------------------------------------------------
   Responsive — tablet
   --------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .fh-card { width: clamp(210px, 40vw, 280px); }
  .fh-card--bottom-left { left: clamp(0.75rem, 3vw, 2rem); }
  .fh-card--bottom-right { right: clamp(0.75rem, 3vw, 2rem); }
}

/* ---------------------------------------------------------------------
   Responsive — smartphone: layout in colonna, niente sovrapposizioni
   --------------------------------------------------------------------- */
@media (max-width: 720px) {
  .fh-links,
  .fh-card__node,
  .fh-frame__corner,
  .fh-decor,
  .fh-core__tag { display: none; }

  .fh-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1rem 2rem;
    gap: 1.1rem;
    min-height: 100svh;
  }

  .fh-console {
    position: static;
    order: -3;
    width: 100%;
    justify-content: space-between;
  }

  .fh-console__sub { display: none; }
  .fh-console__status { font-size: 0.62rem; gap: 0.4rem; }

  .fh-core {
    position: static;
    transform: none;
    order: -1;
    width: clamp(150px, 46vw, 200px);
    margin: 0.75rem auto 0.5rem;
  }

  .fh-sections {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 460px;
  }

  .fh-card,
  .fh-card--top,
  .fh-card--bottom-left,
  .fh-card--bottom-right {
    position: static;
    transform: none;
    width: 100%;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
  }

  .fh-card--top:hover,
  .fh-card--top:focus-visible,
  .fh-card--bottom-left:hover,
  .fh-card--bottom-left:focus-visible,
  .fh-card--bottom-right:hover,
  .fh-card--bottom-right:focus-visible { transform: translateY(-4px); }

  .fh-baseline {
    position: static;
    transform: none;
    order: 2;
    margin-top: 0.5rem;
    width: 100%;
  }

  .fh-card__viz { height: 84px; }
}

/* ---------------------------------------------------------------------
   Landscape corto / desktop bassi: riduce nucleo e viz, niente overlap
   --------------------------------------------------------------------- */
@media (min-width: 721px) and (max-height: 560px) {
  .fh-core { width: clamp(120px, 16vw, 170px); }
  .fh-card--top { top: 3.25rem; }
  .fh-card--bottom-left,
  .fh-card--bottom-right { bottom: 2.5rem; }
  .fh-card__viz { height: 66px; }
  .fh-core__tag { display: none; }
}

/* ---------------------------------------------------------------------
   Animazioni interne alle visualizzazioni SVG
   --------------------------------------------------------------------- */
.fh-eq rect { transform-box: fill-box; transform-origin: bottom; animation: fh-eq 1.4s ease-in-out infinite; }
.fh-eq rect:nth-child(2) { animation-delay: 0.15s; }
.fh-eq rect:nth-child(3) { animation-delay: 0.3s; }
.fh-eq rect:nth-child(4) { animation-delay: 0.1s; }
.fh-eq rect:nth-child(5) { animation-delay: 0.4s; }
.fh-eq rect:nth-child(6) { animation-delay: 0.25s; }
.fh-eq rect:nth-child(7) { animation-delay: 0.5s; }
@keyframes fh-eq { 0%, 100% { transform: scaleY(0.5); } 50% { transform: scaleY(1.15); } }

.fh-wave path { stroke-dasharray: 340; stroke-dashoffset: 0; animation: fh-wave 6s linear infinite; }
@keyframes fh-wave { to { stroke-dashoffset: -680; } }

.fh-particle { animation: fh-float 4s ease-in-out infinite; }
.fh-particle:nth-of-type(2) { animation-delay: 1.2s; }
.fh-particle:nth-of-type(3) { animation-delay: 2.1s; }
@keyframes fh-float { 0%, 100% { opacity: 0.3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-6px); } }

.fh-bars rect { transform-box: fill-box; transform-origin: bottom; animation: fh-eq 1.8s ease-in-out infinite; }
.fh-bars rect:nth-child(2) { animation-delay: 0.2s; }
.fh-bars rect:nth-child(3) { animation-delay: 0.45s; }
.fh-bars rect:nth-child(4) { animation-delay: 0.3s; }

.fh-traj { stroke-dasharray: 4 5; animation: fh-traj 3.5s linear infinite; }
@keyframes fh-traj { to { stroke-dashoffset: -90; } }
.fh-node-dot { animation: fh-pulse 2s ease-in-out infinite; }
@keyframes fh-pulse { 0%, 100% { opacity: 0.4; r: 2.2; } 50% { opacity: 1; r: 3.2; } }

.fh-zones polygon { animation: fh-zone 4s ease-in-out infinite; }
.fh-zones polygon:nth-child(2) { animation-delay: 1s; }
.fh-zones polygon:nth-child(3) { animation-delay: 2s; }
.fh-zones polygon:nth-child(4) { animation-delay: 3s; }
@keyframes fh-zone { 0%, 100% { fill-opacity: 0.06; } 50% { fill-opacity: 0.28; } }
.fh-ind { animation: fh-pulse 2.4s ease-in-out infinite; }
.fh-ind:nth-child(2) { animation-delay: 0.6s; }
.fh-ind:nth-child(3) { animation-delay: 1.2s; }
.fh-ind:nth-child(4) { animation-delay: 1.8s; }

/* Le animazioni interne sono in pausa quando la stazione non è attiva:
   nessuna "musica" o dato in movimento a riposo. Partono su hover/focus. */
.fh-eq rect,
.fh-wave path,
.fh-particle,
.fh-bars rect,
.fh-traj,
.fh-node-dot,
.fh-zones polygon,
.fh-ind { animation-play-state: paused; }

.fh-card:hover :is(.fh-eq rect, .fh-wave path, .fh-particle, .fh-bars rect, .fh-traj, .fh-node-dot, .fh-zones polygon, .fh-ind),
.fh-card:focus-visible :is(.fh-eq rect, .fh-wave path, .fh-particle, .fh-bars rect, .fh-traj, .fh-node-dot, .fh-zones polygon, .fh-ind) {
  animation-play-state: running;
}

/* DataGym: i punti dati compaiono su hover/focus (valore invariato) */
.fh-data-pts circle {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.fh-data-pts circle:nth-child(2) { transition-delay: 0.06s; }
.fh-data-pts circle:nth-child(3) { transition-delay: 0.12s; }
.fh-data-pts circle:nth-child(4) { transition-delay: 0.18s; }
.fh-card:hover .fh-data-pts circle,
.fh-card:focus-visible .fh-data-pts circle { opacity: 1; transform: translateY(0); }

.fh-card:hover .fh-load,
.fh-card:focus-visible .fh-load { animation: fh-load-in 0.5s ease; }
@keyframes fh-load-in { 0% { opacity: 0.35; } 100% { opacity: 1; } }

/* ---------------------------------------------------------------------
   Riduzione movimento
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .fh-core__ring,
  .fh-core__ring--outer,
  .fh-core__pool,
  .fh-links__line,
  .fh-links__pulse,
  .fh-status-dot { animation: none !important; }

  .fh-links__pulse { opacity: 0 !important; }

  .fh-card { transition: border-color 0.2s ease, box-shadow 0.2s ease; }

  .is-preload .fh-stage { opacity: 1; }
  .fh-intro { display: none; }

  .fh-eq rect,
  .fh-wave path,
  .fh-particle,
  .fh-bars rect,
  .fh-traj,
  .fh-node-dot,
  .fh-zones polygon,
  .fh-ind,
  .fh-load { animation: none !important; }

  /* stato finale immediato: punti dati visibili senza spostamento */
  .fh-data-pts circle { transition: none !important; }
}
