/* =====================================================================
   International Gym Center Brescia — Homepage
   Tema chiaro, luminoso e istituzionale. Il logo 3D è il fulcro.
   Prefissi classi: .igc-*  (redesign completo)
   ===================================================================== */

:root {
  /* Base chiara e premium */
  --ivory:      #f8f5ef;   /* bianco caldo */
  --paper:      #fcfbf8;   /* avorio molto chiaro */
  --pearl:      #eef1f6;   /* grigio perla */
  --ice:        #dce9f8;   /* azzurro ghiaccio */
  --ice-soft:   #eaf2fc;

  /* Blu istituzionale (colore principale) */
  --blue:       #1b3f8f;
  --blue-2:     #2f6bd0;
  --sky:        #5cc8ff;

  /* Testo */
  --ink:        #16233d;
  --ink-soft:   #33425e;
  --muted:      #61708c;
  --hairline:   rgba(27, 63, 143, 0.14);
  --hairline-2: rgba(27, 63, 143, 0.08);

  /* Metallo / riflessi */
  --metal:      #c8d2e2;
  --metal-hi:   #ffffff;

  /* Accenti italiani (uso discreto) */
  --it-green:   #1f9d57;
  --it-white:   #f4f1ea;
  --it-red:     #c9302c;

  /* Superfici card */
  --card-bg:    rgba(255, 255, 255, 0.62);
  --card-brd:   rgba(27, 63, 143, 0.16);
  --card-sh:    0 24px 60px -30px rgba(19, 42, 92, 0.45),
                0 2px 8px -4px rgba(19, 42, 92, 0.20);

  --ease:       cubic-bezier(0.22, 1, 0.36, 1);
  --shell:      min(1320px, 92vw);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body.igc {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Nascondi lo scroll orizzontale involontario */
body.igc { overflow-x: hidden; }

a { color: inherit; }

/* =====================================================================
   Fondale luminoso
   ===================================================================== */
.igc-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.igc-bg__wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 8%, #ffffff 0%, var(--paper) 34%, var(--ivory) 62%, var(--pearl) 100%);
}

/* Atmosfera tricolore delicata: verde a sinistra, luce al centro, rosso a destra.
   Molto tenue: evoca l'Italia senza bandiere. Il blu resta predominante. */
.igc-bg__aurora {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(38% 46% at 18% 78%, rgba(31, 157, 87, 0.10), transparent 70%),
    radial-gradient(40% 50% at 82% 80%, rgba(201, 48, 44, 0.09), transparent 72%),
    radial-gradient(60% 60% at 50% 30%, rgba(92, 200, 255, 0.16), transparent 70%),
    radial-gradient(90% 70% at 50% 120%, rgba(27, 63, 143, 0.10), transparent 70%);
  filter: saturate(1.05);
  animation: igc-drift 26s ease-in-out infinite alternate;
}

@keyframes igc-drift {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1.02); }
  to   { transform: translate3d(1.5%, 1%, 0) scale(1.05); }
}

.igc-bg__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 100% at 50% 46%, transparent 58%, rgba(27, 42, 74, 0.06) 100%);
}

.igc-bg__grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* =====================================================================
   Scena 3D
   ===================================================================== */
.igc-scene {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

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

/* Alone morbido dietro al logo (usato quando il 3D non è disponibile) */
.igc-scene__spot {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(60vw, 720px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(92, 200, 255, 0.22), rgba(255,255,255,0) 62%);
  filter: blur(6px);
  opacity: 0;
  transition: opacity 0.8s var(--ease);
}
.igc.no-webgl .igc-scene__spot { opacity: 1; }

/* =====================================================================
   Guide di luce (connettori nucleo → sezioni)
   Tricolore italiano raffinato: verde smeraldo / ghiaccio / rubino tenue.
   ===================================================================== */
.igc-links {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.igc-links__line {
  fill: none;
  stroke-linecap: round;
  pointer-events: none;
}

.igc-links__line--base {
  stroke-width: 1.35;
  opacity: 0;
  transition: opacity 0.55s var(--ease);
}

.igc-links__line--fill {
  stroke-width: 1.85;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

/* Riposo: dominante cromatica quasi impercettibile */
.igc.igc-ready .igc-links__line--base { opacity: 0.38; }

.igc-links__line--base[data-link="datagym"] {
  filter: drop-shadow(0 0 5px rgba(106, 159, 140, 0.10));
}
.igc-links__line--base[data-link="musiche"] {
  filter: drop-shadow(0 0 5px rgba(220, 230, 240, 0.12));
}
.igc-links__line--base[data-link="struttura"] {
  filter: drop-shadow(0 0 5px rgba(196, 154, 159, 0.10));
}

.igc.igc-ready .igc-links__line--fill { opacity: 0.68; }

.igc-links__line--fill[data-link="datagym"] {
  filter: drop-shadow(0 0 4px rgba(139, 184, 168, 0.16));
}
.igc-links__line--fill[data-link="musiche"] {
  filter: drop-shadow(0 0 4px rgba(238, 243, 248, 0.18));
}
.igc-links__line--fill[data-link="struttura"] {
  filter: drop-shadow(0 0 4px rgba(212, 174, 179, 0.14));
}

/* Base leggermente più presente durante hover/focus */
.igc-links__line--base.is-hovered { opacity: 0.48; }

/* Impulso apertura: verde → bianco → rosso (logo → card, < 1s totale) */
.igc-links__line--base.is-pulse-green,
.igc-links__line--base.is-pulse-white,
.igc-links__line--base.is-pulse-red {
  stroke-dasharray: 34 420;
  stroke-dashoffset: 454;
  opacity: 0.62;
  animation: igc-tri-pulse 0.24s ease-out forwards;
}

.igc-links__line--base.is-pulse-green {
  stroke: #8bb8a8;
  filter: drop-shadow(0 0 7px rgba(139, 184, 168, 0.22));
}
.igc-links__line--base.is-pulse-white {
  stroke: #eef3f8;
  filter: drop-shadow(0 0 7px rgba(238, 243, 248, 0.28));
}
.igc-links__line--base.is-pulse-red {
  stroke: #d4aeb3;
  filter: drop-shadow(0 0 7px rgba(212, 174, 179, 0.20));
}

@keyframes igc-tri-pulse {
  from { stroke-dashoffset: 454; }
  to   { stroke-dashoffset: 0; }
}

/* =====================================================================
   Stage / griglia principale
   ===================================================================== */
.igc-stage {
  position: relative;
  z-index: 3;
  width: 100%;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(18px, 3vh, 34px) clamp(18px, 4vw, 54px) clamp(16px, 3vh, 30px);
}

/* ------------------------------- Header ------------------------------ */
.igc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.igc-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
  border-radius: 12px;
  padding: 4px;
  outline: none;
}
.igc-brand:focus-visible {
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--blue-2);
}

.igc-brand__mark {
  color: var(--blue);
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 6px 12px rgba(27, 63, 143, 0.18));
}
.igc-brand__mark svg { width: 40px; height: 40px; }

.igc-brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.igc-brand__title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: clamp(19px, 2.1vw, 27px);
  letter-spacing: 0.01em;
  color: var(--blue);
}
.igc-brand__sub {
  margin-top: 3px;
  font-size: clamp(11px, 1.05vw, 13px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.igc-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(6px);
}
.igc-status__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--it-green);
  box-shadow: 0 0 0 3px rgba(31, 157, 87, 0.16);
}

/* ------------------------------- Core -------------------------------- */
.igc-stage__mid,
.igc-core {
  /* Il core è centrato nella riga centrale della griglia */
}

.igc-core {
  position: relative;
  align-self: center;
  justify-self: center;
  grid-row: 2;
  display: grid;
  place-items: center;
  width: clamp(250px, 33vw, 440px);
  aspect-ratio: 1;
  margin: 0 auto;
  z-index: 4;
}

/* Alone volutamente discreto: il modello domina, l'anello accompagna. */
.igc-core__ring {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 1px solid var(--hairline-2);
  box-shadow: 0 40px 80px -50px rgba(27, 63, 143, 0.35);
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,0.22), rgba(255,255,255,0) 55%);
  opacity: 0.55;
}
.igc-core__ring::after {
  content: "";
  position: absolute;
  inset: -7%;
  border-radius: 50%;
  border: 1px dashed rgba(27, 63, 143, 0.08);
  animation: igc-spin 60s linear infinite;
}
@keyframes igc-spin { to { transform: rotate(360deg); } }

.igc-core__logo {
  position: relative;
  z-index: 2;
  width: 74%;
  height: 74%;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 24px 40px rgba(27, 63, 143, 0.22));
}
.igc-core__logo svg,
.igc-core__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Quando il logo 3D è attivo, il fallback HTML viene nascosto */
.igc.igc-3d-logo .igc-core__logo { opacity: 0; visibility: hidden; }

.igc-core__caption {
  position: absolute;
  bottom: -6%;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ------------------------------ Sezioni ------------------------------ */
.igc-sections {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.igc-sections .igc-card { pointer-events: auto; }

.igc-card {
  position: absolute;
  width: clamp(232px, 24vw, 316px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 16px;
  text-decoration: none;
  color: var(--ink);
  background: var(--card-bg);
  border: 1px solid var(--card-brd);
  border-radius: 18px;
  box-shadow: var(--card-sh);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease),
              border-color 0.45s var(--ease);
  overflow: hidden;
  --sec: var(--blue-2);
  --sec-accent: var(--sky);
}
.igc-card::before {
  /* micro-accento colorato in alto: personalità della sezione */
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--sec), var(--sec-accent), transparent);
  opacity: 0.85;
}

.igc-card--top {
  left: 50%;
  top: clamp(64px, 8.1vh, 94px);
  transform: translateX(-50%);
}
.igc-card--bottom-left {
  left: clamp(14px, 5.4vw, 90px);
  bottom: clamp(70px, 12vh, 120px);
}
.igc-card--bottom-right {
  right: clamp(14px, 5.4vw, 90px);
  bottom: clamp(70px, 12vh, 120px);
}

.igc-card:hover,
.igc-card:focus-visible {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--sec) 55%, var(--card-brd));
  box-shadow:
    0 34px 70px -30px rgba(19, 42, 92, 0.5),
    0 0 0 1px color-mix(in srgb, var(--sec) 30%, transparent);
  outline: none;
}
.igc-card--top:hover, .igc-card--top:focus-visible { transform: translateX(-50%) translateY(-6px); }
.igc-card:focus-visible {
  box-shadow:
    0 0 0 2px var(--paper),
    0 0 0 4px var(--sec),
    var(--card-sh);
}

.igc-card__viz {
  height: 74px;
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.7), rgba(236, 242, 251, 0.5));
  border: 1px solid var(--hairline-2);
}
.igc-card__viz svg { width: 100%; height: 100%; display: block; }

.igc-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.igc-card__title {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
}
.igc-card__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.igc-card__foot {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  min-height: 18px;
}
.igc-card__badge {
  color: var(--muted);
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.igc-card__badge::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--sec-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sec-accent) 22%, transparent);
}
.igc-card__cta {
  color: var(--sec);
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.igc-card__arrow { transition: transform 0.35s var(--ease); }
.igc-card:hover .igc-card__arrow,
.igc-card:focus-visible .igc-card__arrow { transform: translateX(4px); }

/* Animazioni delle viz al focus/hover della card */
.igc-card:hover .igc-eq rect,
.igc-card:focus-visible .igc-eq rect { animation: igc-bounce 1s ease-in-out infinite; }
.igc-eq rect { transform-origin: bottom; transform-box: fill-box; }
.igc-eq rect:nth-child(2n) { animation-delay: 0.15s; }
.igc-eq rect:nth-child(3n) { animation-delay: 0.3s; }
@keyframes igc-bounce { 0%,100% { transform: scaleY(0.6); } 50% { transform: scaleY(1.15); } }

.igc-card:hover .igc-wave path,
.igc-card:focus-visible .igc-wave path { animation: igc-wave 2.4s linear infinite; }
@keyframes igc-wave { to { stroke-dashoffset: -160; } }
.igc-wave path { stroke-dasharray: 6 6; }

.igc-card:hover .igc-traj,
.igc-card:focus-visible .igc-traj { animation: igc-dash 3s linear infinite; }
@keyframes igc-dash { to { stroke-dashoffset: -80; } }

.igc-card:hover .igc-bars rect,
.igc-card:focus-visible .igc-bars rect { animation: igc-grow 1.4s ease-in-out infinite alternate; }
.igc-bars rect { transform-origin: bottom; transform-box: fill-box; }
.igc-bars rect:nth-child(2) { animation-delay: 0.12s; }
.igc-bars rect:nth-child(3) { animation-delay: 0.24s; }
.igc-bars rect:nth-child(4) { animation-delay: 0.36s; }
@keyframes igc-grow { from { transform: scaleY(0.7); } to { transform: scaleY(1.1); } }

.igc-card:hover .igc-zones polygon,
.igc-card:focus-visible .igc-zones polygon { animation: igc-glow 1.8s ease-in-out infinite; }
.igc-zones polygon:nth-child(2) { animation-delay: 0.2s; }
.igc-zones polygon:nth-child(3) { animation-delay: 0.4s; }
.igc-zones polygon:nth-child(4) { animation-delay: 0.6s; }
@keyframes igc-glow { 0%,100% { fill-opacity: 0.08; } 50% { fill-opacity: 0.3; } }

.igc-card:hover .igc-ind,
.igc-card:focus-visible .igc-ind { animation: igc-blink 1.4s ease-in-out infinite; }
@keyframes igc-blink { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ------------------------------ Baseline ----------------------------- */
.igc-baseline {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-top: 8px;
}
.igc-baseline__rule {
  height: 1px;
  width: clamp(30px, 12vw, 150px);
  background: linear-gradient(90deg, transparent, var(--hairline), transparent);
}
.igc-tagline {
  margin: 0;
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(15px, 1.7vw, 20px);
  font-style: italic;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  max-width: 60ch;
}

/* =====================================================================
   Intro (overlay chiaro, non bloccante)
   ===================================================================== */
.igc-intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 90% at 50% 40%, #ffffff, var(--ivory) 70%);
  pointer-events: none;
}
.igc-intro__glow {
  position: absolute;
  width: 40vmin; height: 40vmin;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(92,200,255,0.5), rgba(255,255,255,0) 65%);
  opacity: 0;
}
.igc-intro__line {
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, transparent, var(--it-green) 20%, var(--metal-hi) 50%, var(--it-red) 80%, transparent);
  border-radius: 2px;
  box-shadow: 0 0 14px rgba(92, 200, 255, 0.5);
}

/* Stato pre-caricamento: overlay visibile, stage nascosto */
.igc.is-preload .igc-stage { opacity: 0; }
.igc.igc-ready .igc-intro { display: none; }

/* =====================================================================
   NoScript
   ===================================================================== */
.igc-noscript {
  position: relative;
  z-index: 30;
  max-width: 640px;
  margin: 12vh auto;
  padding: 28px 32px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--hairline);
  border-radius: 16px;
}
.igc-noscript h1 { color: var(--blue); font-family: "Cormorant Garamond", serif; }
.igc-noscript a { color: var(--blue-2); font-weight: 600; }

/* =====================================================================
   Responsive
   ===================================================================== */

/* Tablet: riduci la scena, conserva la gerarchia */
@media (max-width: 1080px) {
  .igc-card { width: clamp(210px, 30vw, 280px); }
  .igc-card--bottom-left  { left: clamp(10px, 2.7vw, 36px); }
  .igc-card--bottom-right { right: clamp(10px, 2.7vw, 36px); }
  .igc-core { width: clamp(220px, 40vw, 380px); }
}

/* Mobile: logo 3D in alto, sezioni subito visibili, nessuna intro */
@media (max-width: 760px) {
  body.igc-mobile { overflow-y: auto; height: auto; }
  body.igc-mobile .igc-intro { display: none !important; }
  body.igc-mobile.is-preload .igc-stage,
  body.igc-mobile .igc-stage { opacity: 1; }

  body.igc-mobile .igc-scene {
    position: relative;
    inset: auto;
    height: clamp(28vh, 32vh, 35vh);
    width: 100%;
    flex-shrink: 0;
    z-index: 1;
  }
  body.igc-mobile .igc-scene__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
  body.igc-mobile .igc-scene__canvas--pending { opacity: 0; }
  body.igc-mobile .igc-scene__canvas--visible {
    opacity: 1;
    transition: opacity 0.55s var(--ease);
  }
  body.igc-mobile.igc-3d-logo .igc-core { display: none; }

  body.igc { overflow-y: auto; height: auto; }
  .igc-scene { position: fixed; }
  .igc-links { display: none; } /* niente connettori sovrapposti nello stack */

  .igc-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    min-height: 100svh;
    padding: 20px 18px 40px;
  }
  .igc-header {
    width: 100%;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }
  .igc-brand { flex-direction: column; text-align: center; gap: 8px; }
  .igc-brand__sub { letter-spacing: 0.1em; }

  .igc-core {
    position: relative;
    grid-row: auto;
    width: min(72vw, 320px);
    margin: 8px auto 4px;
  }

  .igc-sections {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .igc-card,
  .igc-card--top,
  .igc-card--bottom-left,
  .igc-card--bottom-right {
    position: relative;
    inset: auto;
    left: auto; right: auto; top: auto; bottom: auto;
    transform: none;
    width: 100%;
  }
  .igc-card--top:hover, .igc-card--top:focus-visible,
  .igc-card:hover, .igc-card:focus-visible { transform: translateY(-3px); }

  .igc-baseline { grid-row: auto; }
}

/* Schermi bassi / landscape corto */
@media (max-height: 560px) and (min-width: 761px) {
  .igc-core { width: clamp(180px, 26vh, 260px); }
  .igc-card { padding: 12px 14px; }
  .igc-card__viz { height: 54px; }
  .igc-card--top { top: clamp(68px, 11vh, 100px); }
}

/* =====================================================================
   Preferenza movimento ridotto: mostra direttamente lo stato finale
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  .igc-bg__aurora,
  .igc-core__ring::after,
  .igc-links__line--base.is-pulse-green,
  .igc-links__line--base.is-pulse-white,
  .igc-links__line--base.is-pulse-red,
  .igc-eq rect,
  .igc-wave path,
  .igc-bars rect,
  .igc-zones polygon,
  .igc-ind,
  .igc-traj { animation: none !important; }

  .igc.is-preload .igc-stage { opacity: 1; }
  .igc-intro { display: none !important; }
  * { scroll-behavior: auto !important; }
}
