/* ============================================================
   Fabio Mencio — Energy & AI Specialist
   Palette: antracite + ambra (energia) + ciano elettrico (AI).
   L'idea grafica: rete elettrica e rete neurale sono lo stesso disegno,
   nodi e collegamenti con qualcosa che scorre dentro.
   ============================================================ */

:root {
  --bg:        #080b12;
  --bg-alt:    #0d111a;
  --card:      #131824;
  --card-hi:   #1a2130;
  --line:      #232c3f;
  --line-hi:   #33405c;
  --text:      #e8ecf3;
  --muted:     #9aa5ba;
  --dim:       #6d7890;

  --energia:   #ffb020;   /* ambra: la corrente */
  --energia-hi:#ffc24d;
  --ai:        #3ddcff;   /* ciano: l'intelligenza */
  --ai-soft:   rgba(61, 220, 255, .12);
  --verde:     #7ee3a8;

  --grad: linear-gradient(100deg, var(--energia) 0%, #ff8a3d 42%, var(--ai) 100%);

  --wrap: 1140px;
  --radius: 16px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { line-height: 1.16; letter-spacing: -0.022em; margin: 0; }
p { margin: 0 0 1em; }
a { color: inherit; }
img { max-width: 100%; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--energia); color: #000; padding: .7em 1.2em; z-index: 100; }
.skip:focus { left: 0; }
:focus-visible { outline: 2px solid var(--ai); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(var(--wrap), calc(100% - 3rem)); margin-inline: auto; }
.wrap.narrow { width: min(760px, calc(100% - 3rem)); }

/* ---------- Barra superiore ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: .9rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(8, 11, 18, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 700; letter-spacing: -0.02em; text-decoration: none; font-size: 1.02rem; white-space: nowrap; }
.bolt { color: var(--energia); }
.topbar nav { display: flex; gap: clamp(.6rem, 2vw, 1.6rem); align-items: center; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; color: var(--muted); font-size: .93rem; font-weight: 500; transition: color .18s; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a.current { color: var(--energia); }
.nav-cta { border: 1px solid var(--line); border-radius: 99px; padding: .35em 1em; color: var(--text) !important; }
.nav-cta:hover { border-color: var(--ai); box-shadow: 0 0 18px -6px var(--ai); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(3rem, 7vw, 5rem);
  isolation: isolate;
  overflow: hidden;
}

/* ---------- La ragnatela di sfondo: corrente che scorre nei fili ----------
   I tracciati hanno pathLength="1000": un impulso lungo 55 su 1000 corre
   sempre alla stessa velocita' apparente, che il filo sia corto o lungo. */
.rete {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: -1; opacity: .62;
  pointer-events: none;
}
.rete .linee { opacity: .26; }
.rete .nodi circle { opacity: .5; }
.rete .alone { opacity: .3; }
.rete .scintille { opacity: .9; }

/* Gli impulsi: due lampi per filo, distanziati fra loro */
.rete .scorre {
  stroke-dasharray: 55 445;
  opacity: .95;
  animation: corrente 6s linear infinite;
}
.rete .v1  { animation-duration: 6.5s;  animation-delay: -0.4s; }
.rete .v2  { animation-duration: 8s;    animation-delay: -2.1s; }
.rete .v3  { animation-duration: 9.5s;  animation-delay: -4.3s; }
.rete .v4  { animation-duration: 5s;    animation-delay: -1.2s; stroke-dasharray: 70 930; }
.rete .v5  { animation-duration: 7.2s;  animation-delay: -3.6s; }
.rete .v6  { animation-duration: 6.8s;  animation-delay: -5.1s; }
.rete .v7  { animation-duration: 8.6s;  animation-delay: -0.9s; }
.rete .v8  { animation-duration: 7.8s;  animation-delay: -6.2s; }
.rete .v9  { animation-duration: 10s;   animation-delay: -2.8s; stroke-dasharray: 45 455; }
.rete .v10 { animation-duration: 4.6s;  animation-delay: -1.7s; stroke-dasharray: 60 940; }
@keyframes corrente { from { stroke-dashoffset: 1000; } to { stroke-dashoffset: 0; } }

/* I nodi respirano a ritmi diversi, come se la corrente li raggiungesse a turno */
.rete .pulsa { animation: respiro 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.rete .p2 { animation-delay: -1.1s; animation-duration: 5.2s; }
.rete .p3 { animation-delay: -2.4s; animation-duration: 3.4s; }
.rete .p4 { animation-delay: -3.3s; animation-duration: 6s; }
@keyframes respiro {
  0%, 100% { opacity: .3; }
  50%      { opacity: 1; }
}

.hero-grid {
  position: relative;
  width: min(var(--wrap), calc(100% - 3rem)); margin-inline: auto;
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem); align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--mono); font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--energia); margin-bottom: 1.1rem;
  padding: .35em .9em .35em .8em;
  border: 1px solid rgba(255, 176, 32, .28); border-radius: 99px;
  background: rgba(255, 176, 32, .07);
}
.eyebrow::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--energia); box-shadow: 0 0 10px var(--energia);
  animation: respiro 3s ease-in-out infinite;
}
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.3rem); font-weight: 800; margin-bottom: 1.2rem; }
/* La corrente resta ambra, l'intelligenza vira al ciano: due colori netti,
   senza il grigio in cui cade un gradiente ambra→ciano a metà strada. */
.hero h1 .accent { color: var(--energia); }
.hero h1 .ia { color: var(--ai); text-shadow: 0 0 32px rgba(61, 220, 255, .35); }
.lead { font-size: clamp(1.02rem, 1.5vw, 1.16rem); color: var(--muted); max-width: 60ch; }

.hero-actions { display: flex; gap: .9rem; flex-wrap: wrap; margin: 1.8rem 0 2.2rem; }
.btn {
  display: inline-block; text-decoration: none; font-weight: 600; font-size: .97rem;
  padding: .78em 1.5em; border-radius: 99px; border: 1px solid transparent;
  transition: transform .16s, background .16s, border-color .16s, box-shadow .16s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--grad); color: #12100c; box-shadow: 0 10px 30px -12px var(--energia); }
.btn-primary:hover { box-shadow: 0 14px 34px -10px var(--energia); }
.btn-ghost { border-color: var(--line-hi); color: var(--text); }
.btn-ghost:hover { border-color: var(--ai); box-shadow: 0 0 22px -8px var(--ai); }

/* Tre fatti in evidenza, non più numeri */
.hero-facts {
  list-style: none; padding: 1.5rem 0 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: .6rem;
  border-top: 1px solid var(--line);
}
.hero-facts li {
  display: inline-flex; align-items: center; gap: .55rem;
  font-size: .9rem; font-weight: 500; color: var(--muted);
  background: var(--card); border: 1px solid var(--line);
  padding: .5em 1em; border-radius: 99px;
}
.hero-facts .ico { font-size: 1rem; line-height: 1; }

/* Ritratto: cerchio con anello energia→AI */
.portrait-ring {
  position: relative; width: min(100%, 360px); aspect-ratio: 1;
  justify-self: center; border-radius: 50%; padding: 6px;
  background: conic-gradient(from 200deg, var(--energia), #ff7a18 30%, var(--ai) 62%, var(--energia) 100%);
  box-shadow: 0 22px 55px rgba(0, 0, 0, .55);
}
.portrait-ring::before {
  content: ''; position: absolute; inset: -18%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255, 176, 32, .18), transparent 62%);
}
.portrait {
  display: block; width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover; background: var(--card);
}

/* ---------- Fasce ---------- */
.band { position: relative; padding: clamp(3.2rem, 8vw, 5.5rem) 0; border-top: 1px solid var(--line); }
/* semitrasparente: la ragnatela deve vedersi anche sotto le fasce */
.band.alt { background: rgba(13, 17, 26, .74); }

.section-title { font-size: clamp(1.5rem, 3vw, 2.05rem); font-weight: 700; margin-bottom: .8rem; }
.section-title::after {
  content: ''; display: block; width: 54px; height: 3px; border-radius: 2px;
  background: var(--grad); margin-top: .75rem;
}
.section-intro { color: var(--muted); max-width: 68ch; margin-bottom: 2.4rem; }
.prose p { color: var(--muted); }
.prose strong { color: var(--text); font-weight: 600; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--energia), var(--ai) 60%, var(--line));
  opacity: .55;
}
.timeline li { position: relative; padding: 0 0 2.3rem 2.4rem; }
.timeline li::before {
  content: ''; position: absolute; left: 0; top: .5rem;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg-alt); border: 3px solid var(--energia);
}
.timeline li:last-child { padding-bottom: 0; }
.when { display: inline-block; font-family: var(--mono); font-size: .78rem; color: var(--energia); letter-spacing: .06em; margin-bottom: .35rem; }
.timeline h3 { font-size: 1.13rem; font-weight: 600; margin-bottom: .25rem; }
.where { color: var(--dim); font-size: .92rem; margin-bottom: .6rem; }
.timeline p:not(.where) { color: var(--muted); font-size: .97rem; max-width: 72ch; margin: 0; }

/* ---------- Card competenze ---------- */
.cards-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.2rem; }
.card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.5rem 1.4rem;
  transition: border-color .18s, transform .18s;
}
.card::before {   /* filo di corrente sul bordo alto */
  content: ''; position: absolute; top: -1px; left: 1.4rem; right: 1.4rem; height: 2px;
  background: var(--grad); border-radius: 2px; opacity: 0; transition: opacity .22s;
}
.card:hover { border-color: var(--line-hi); transform: translateY(-2px); }
.card:hover::before { opacity: .9; }
.card h3 {
  font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .13em;
  color: var(--energia); margin-bottom: 1.1rem;
}
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.tags li {
  font-size: .84rem; color: var(--muted);
  background: var(--card-hi); border: 1px solid var(--line);
  padding: .3em .75em; border-radius: 7px;
}

/* ---------- Progetti ---------- */
.group-title {
  font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .15em;
  color: var(--dim); margin: 2.8rem 0 .5rem; padding-bottom: .6rem;
  border-bottom: 1px solid var(--line);
}
.group-title:first-of-type { margin-top: 0; }
.group-note { color: var(--dim); font-size: .92rem; margin: .9rem 0 1.6rem; max-width: 74ch; }

.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1.2rem; margin-top: 1.5rem; }
.master-grid { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }

.project {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem 1.5rem; display: flex; flex-direction: column;
  transition: border-color .18s, transform .18s;
}
.project:hover { border-color: var(--line-hi); transform: translateY(-2px); }
.project header { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; margin-bottom: .7rem; }
.project h4 { font-size: 1.16rem; font-weight: 700; }
.badge {
  flex-shrink: 0; font-family: var(--mono); font-size: .66rem; letter-spacing: .1em;
  text-transform: uppercase; padding: .32em .7em; border-radius: 99px;
  border: 1px solid var(--line); color: var(--dim); background: var(--card-hi);
}
.badge.live  { color: var(--verde); border-color: rgba(126, 227, 168, .35); background: rgba(126, 227, 168, .08); }
/* Nota: la classe si chiama "corso" e non "edu" perche' .edu e' gia' la card
   della sezione Formazione, e le sue regole vincevano su quelle del badge. */
.badge.corso { color: var(--ai); border-color: rgba(61, 220, 255, .32); background: var(--ai-soft); }

.claim { color: var(--text); font-weight: 600; font-size: 1rem; margin-bottom: .7rem; }
.project > p:not(.claim):not(.credit) { color: var(--muted); font-size: .95rem; }

.stack { list-style: none; margin: auto 0 0; padding: 1rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; border-top: 1px solid var(--line); }
.stack li { font-family: var(--mono); font-size: .74rem; color: var(--dim); border: 1px solid var(--line); border-radius: 5px; padding: .22em .6em; }
.credit { font-size: .84rem; color: var(--dim); font-style: italic; margin: .9rem 0 0; }
.project-link { margin-top: .9rem; font-size: .9rem; font-weight: 600; color: var(--energia); text-decoration: none; }
.project-link:hover { text-decoration: underline; }

/* Anteprime dei progetti del master */
.anteprima {
  position: relative; display: block; margin: -1.6rem -1.5rem 1.2rem;
  border-bottom: 1px solid var(--line); overflow: hidden; text-decoration: none;
  background: var(--card-hi);
}
.anteprima img { display: block; width: 100%; height: auto; transition: transform .35s ease; }
.anteprima:hover img { transform: scale(1.03); }
.anteprima .apri {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 2.2rem .9rem .8rem;
  font-size: .82rem; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85));
  display: flex; align-items: center; gap: .4rem;
}
.anteprima .apri::after { content: '↗'; color: var(--ai); }

.anteprima-file {
  display: grid; place-items: center; gap: .5rem; padding: 2.6rem 1rem 2.2rem;
  background: linear-gradient(150deg, #16351f, #101b2b 70%);
  aspect-ratio: 16 / 9;
}
.anteprima-file .ext {
  font-family: var(--mono); font-size: 1.6rem; font-weight: 500; letter-spacing: .1em;
  color: var(--verde); border: 2px solid rgba(126, 227, 168, .4); border-radius: 10px;
  padding: .4em .7em;
}
.anteprima-file .apri { position: static; padding: 0; background: none; color: var(--muted); font-size: .85rem; }
/* Repository di codice: stessa tessera, toni calmi ciano invece del verde del foglio Excel */
.anteprima-codice { background: linear-gradient(150deg, #0f2d36, #141a2e 70%); }
.anteprima-codice .logo-linguaggio { width: clamp(64px, 22%, 104px); height: auto;
  transition: transform .35s ease; }
.anteprima-codice:hover .logo-linguaggio { transform: scale(1.06); }

/* ---------- Progetti Energy & AI ---------- */
.energy-grid { grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); }

/* La scheda in evidenza prende tutta la riga: anteprima da una parte, racconto dall'altra.
   Di "vetrina" ne va tenuta una sola, altrimenti la sezione diventa una colonna di banner. */
.project.vetrina { grid-column: 1 / -1; padding: 0; }
.project.vetrina .anteprima { margin: 0; }
.vetrina-testo { padding: 1.6rem 1.5rem; display: flex; flex-direction: column; }
.vetrina-testo header { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; margin-bottom: .7rem; }
.vetrina-testo > p:not(.claim):not(.credit) { color: var(--muted); font-size: .95rem; }

@media (min-width: 900px) {
  .project.vetrina { display: grid; grid-template-columns: minmax(0, 45%) minmax(0, 1fr); align-items: stretch; }
  .project.vetrina .anteprima {
    border-bottom: none; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; justify-content: center;
  }
  /* A tutta larghezza l'etichetta sta sotto l'immagine, non incollata in fondo al pannello */
  .project.vetrina .anteprima .apri {
    position: static; padding: .95rem 1.3rem 0; background: none; color: var(--muted);
  }
}

/* I numeri del progetto: pochi, grossi e verificabili nel documento allegato */
.numeri {
  list-style: none; margin: 1.2rem 0 .3rem; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); gap: .9rem 1.1rem;
}
.numeri b {
  display: block; font-family: var(--mono); font-size: 1.3rem; font-weight: 600;
  letter-spacing: -.02em; color: var(--energia);
}
.numeri li:nth-child(even) b { color: var(--ai); }
.numeri span { display: block; font-size: .76rem; color: var(--dim); line-height: 1.35; margin-top: .18rem; }

.project-links { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin: .9rem 0 0; }
.project-links .project-link { margin-top: 0; }

/* ---------- Formazione ---------- */
.edu-list { display: grid; gap: 1rem; }
.edu { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; }
.edu h3 { font-size: 1.06rem; font-weight: 600; margin: .15rem 0 .3rem; }
.edu p { margin: 0; }
.edu p + p { color: var(--muted); font-size: .94rem; margin-top: .55rem; }
/* I test superati: i certificati veri, non un elenco di parole */
.edu .superati { font-size: .88rem; color: var(--dim); margin: .9rem 0 .8rem;
  padding-top: .9rem; border-top: 1px dashed var(--line); }
.edu .superati strong { color: var(--ai); font-weight: 600; }

.certificati {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .7rem;
}
.certificati a {
  display: block; text-decoration: none; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #000;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.certificati a:hover {
  border-color: var(--verde); transform: translateY(-3px);
  box-shadow: 0 10px 26px -14px var(--verde);
}
.certificati img { display: block; width: 100%; height: auto; }
.certificati span {
  display: block; padding: .5em .6em; font-size: .74rem; line-height: 1.3;
  color: var(--muted); background: var(--card-hi); text-align: center;
}
@media (max-width: 520px) {
  .certificati { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
  .certificati span { font-size: .68rem; }
}

/* ---------- Interessi ---------- */
.interests { list-style: none; margin: 0 0 1.4rem; padding: 0; display: flex; flex-wrap: wrap; gap: .7rem; }
.interests li {
  display: flex; align-items: center; gap: .5rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 99px;
  padding: .55em 1.15em; font-size: .96rem; font-weight: 500;
}
.interest-note { color: var(--dim); font-size: .95rem; font-style: italic; }

/* ---------- Contatti ---------- */
.contact { text-align: center; }
.contact .section-title::after { margin-inline: auto; }
.contact .lead { margin-inline: auto; }
.contact-actions { display: flex; gap: .9rem; justify-content: center; flex-wrap: wrap; margin-top: 2rem; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 2.2rem 0; color: var(--dim); font-size: .88rem; background: rgba(8, 11, 18, .6); }
footer p { margin: 0; }
footer .colophon { margin-top: .35rem; font-size: .82rem; opacity: .75; }
footer .colophon.minuta { margin-top: .15rem; font-size: .78rem; opacity: .55; }

/* ============================================================
   MOVIMENTO
   Regola che mi sono dato: ogni animazione dura meno di un secondo,
   parte una volta sola e non si ripete mentre si legge. L'unica cosa
   che continua a muoversi e' la corrente nella rete di sfondo.
   Tutto si spegne con prefers-reduced-motion (in fondo al file).
   ============================================================ */

/* Barra di avanzamento della lettura: la corrente che attraversa la pagina */
.avanzamento {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: var(--grad);
  box-shadow: 0 0 12px rgba(255, 176, 32, .5);
  z-index: 60; pointer-events: none;
}

/* Entrata degli elementi al primo passaggio */
.pre-rivela { opacity: 0; transform: translateY(22px); }
.rivelato {
  opacity: 1; transform: none;
  transition: opacity .65s ease, transform .65s cubic-bezier(.2, .7, .3, 1);
}

/* Il trattino sotto i titoli si allunga quando la sezione entra in vista */
.section-title::after { width: 0; transition: width .7s cubic-bezier(.2, .7, .3, 1) .15s; }
.section-title.rivelato::after { width: 54px; }

/* La linea della timeline scende come corrente in un cavo */
.timeline::before { transform: scaleY(0); transform-origin: top; }
.timeline.rivelato::before { transform: scaleY(1); transition: transform 1.4s cubic-bezier(.3, .8, .4, 1); }

/* Apertura: titolo, testo e pulsanti entrano in cascata */
.hero-text > *   { animation: entra .75s cubic-bezier(.2, .7, .3, 1) backwards; }
.hero-text > *:nth-child(1) { animation-delay: .05s; }
.hero-text > *:nth-child(2) { animation-delay: .16s; }
.hero-text > *:nth-child(3) { animation-delay: .27s; }
.hero-text > *:nth-child(4) { animation-delay: .38s; }
.hero-text > *:nth-child(5) { animation-delay: .49s; }
.portrait-ring   { animation: entraFoto .9s cubic-bezier(.2, .7, .3, 1) .2s backwards; }
@keyframes entra     { from { opacity: 0; transform: translateY(18px); } }
@keyframes entraFoto { from { opacity: 0; transform: scale(.92); } }

/* L'anello attorno alla foto gira piano: energia che diventa intelligenza.
   Niente overflow:hidden qui, altrimenti taglierebbe l'alone del ::before. */
.portrait-ring { background: var(--line); }
.portrait-ring::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--energia), #ff7a18 30%, var(--ai) 62%, var(--energia) 100%);
  animation: giro 16s linear infinite;
}
.portrait { position: relative; z-index: 1; }
@keyframes giro { to { transform: rotate(360deg); } }

/* Il pallino verde dei progetti online respira */
.badge.live::before {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-right: .45em;
  border-radius: 50%; background: var(--verde); box-shadow: 0 0 8px var(--verde);
  animation: respiro 2.4s ease-in-out infinite;
}

/* Bagliore che segue il puntatore sulle schede */
.card, .project {
  background-image: radial-gradient(300px circle at var(--mx, 50%) var(--my, 0%), rgba(61, 220, 255, 0), transparent 70%);
  transition: border-color .18s, transform .18s, background-image .25s;
}
.card:hover, .project:hover {
  background-image: radial-gradient(300px circle at var(--mx, 50%) var(--my, 0%), rgba(61, 220, 255, .10), transparent 70%);
}

/* Le etichette delle competenze si accendono al passaggio */
.tags li { transition: color .18s, border-color .18s, background .18s; }
.tags li:hover { color: var(--text); border-color: rgba(61, 220, 255, .35); background: var(--ai-soft); }

/* La freccia dei link fa un passo avanti */
.project-link { display: inline-block; transition: transform .18s, color .18s; }
.project-link:hover { transform: translateX(3px); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 1.6rem; }
  .portrait-ring { order: -1; width: 138px; padding: 4px; justify-self: start; box-shadow: 0 12px 28px rgba(0,0,0,.45); }
  .master-grid { grid-template-columns: 1fr; }
  .topbar { gap: 1rem; }
  .topbar nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { font-size: .86rem; white-space: nowrap; }
  .rete { opacity: .35; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .wordmark { font-size: .95rem; }
  .topbar nav a:not(.nav-cta) { display: none; }
  .hero { padding-top: 2.4rem; }
  .project header { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .hero-facts li { font-size: .85rem; }
}

/* Movimento acceso o spento: decide la classe sul documento. Il sito nasce con
   'con-movimento' gia' scritta nell'HTML, quindi le animazioni partono sempre;
   l'interruttore in basso a destra puo' fermarle. */
html.senza-movimento *,
html.senza-movimento *::before,
html.senza-movimento *::after {
  animation: none !important;
  transition: none !important;
}
html.senza-movimento { scroll-behavior: auto; }
html.senza-movimento .pre-rivela { opacity: 1 !important; transform: none !important; }
html.senza-movimento .section-title::after { width: 54px !important; }
html.senza-movimento .timeline::before { transform: scaleY(1) !important; }
html.senza-movimento .avanzamento { display: none; }
html.senza-movimento .rete { transform: none !important; }

/* Rete di sicurezza: vale solo se qualcuno rimuove la classe dall'HTML */
@media (prefers-reduced-motion: reduce) {
  html:not(.con-movimento) *,
  html:not(.con-movimento) *::before,
  html:not(.con-movimento) *::after { animation: none !important; transition: none !important; }
  html:not(.con-movimento) { scroll-behavior: auto; }
  html:not(.con-movimento) .pre-rivela { opacity: 1 !important; transform: none !important; }
  html:not(.con-movimento) .section-title::after { width: 54px !important; }
  html:not(.con-movimento) .timeline::before { transform: scaleY(1) !important; }
  html:not(.con-movimento) .avanzamento { display: none; }
}

/* Interruttore del movimento */
.interruttore {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 70;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5em .95em; border-radius: 99px; cursor: pointer;
  font: 500 .8rem/1 var(--font); color: var(--muted);
  background: rgba(19, 24, 36, .9); border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  transition: color .18s, border-color .18s, box-shadow .18s;
}
.interruttore:hover { color: var(--text); border-color: var(--ai); box-shadow: 0 0 20px -8px var(--ai); }
.interruttore .spia {
  width: 8px; height: 8px; border-radius: 50%; background: var(--dim);
  box-shadow: none; transition: background .2s, box-shadow .2s;
}
.interruttore[aria-pressed="true"] { color: var(--text); }
.interruttore[aria-pressed="true"] .spia {
  background: var(--energia); box-shadow: 0 0 10px var(--energia);
}
@media (max-width: 520px) {
  .interruttore { right: .7rem; bottom: .7rem; font-size: .74rem; padding: .45em .8em; }
}

/* ---------- Stampa ---------- */
@media print {
  .topbar, .hero-actions, .contact-actions, .skip, .rete { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .band, .card, .project, .edu { border-color: #ccc; background: #fff; break-inside: avoid; }
  .lead, .prose p, .tags li, .stack li, .project > p { color: #333; }
  .hero h1 .accent { color: #b37200; -webkit-text-fill-color: #b37200; }
}
