/* ============================================================
   ANDREA DONI — style.css
   ============================================================ */

/* ── 1. VARIABLES ─────────────────────────────────────────── */
:root {
  --bg:          #0f0f11;
  --surface:     #18181c;
  --surface-2:   #212126;
  --border:      rgba(255,255,255,0.10);
  --border-soft: rgba(255,255,255,0.055);
  --text:        #e8e8ed;
  --text-muted:  #7c7c8a;
  --text-dim:    #4a4a56;
  --accent:      #10b981;
  --accent-lt:   #34d399;
  --accent-dim:  rgba(16,185,129,0.12);
  --accent-glow: rgba(16,185,129,0.18);
  --font:        'Outfit', system-ui, sans-serif;
  /* Monospace di sistema: nessun file da scaricare. Serve solo a <code>,
     che oggi non compare nella pagina ma resta pronto. Prima qui c'era
     JetBrains Mono da Google: 31 KB per una ventina di parole. */
  --mono:        ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono', monospace;
  --ease:        cubic-bezier(0.16, 1, 0.3, 1);
  --ease-std:    cubic-bezier(0.4, 0, 0.2, 1);
  --pad:         clamp(1.5rem, 5vw, 2.5rem);
  --max-w:       1400px;
  --radius:      1.25rem;
}

/* ── 2. RESET ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  cursor: none;
}
a, button { cursor: none; }
img { display: block; max-width: 100%; }
::selection { background: rgba(16,185,129,0.25); color: #ecfdf5; }

/* ── 3. UTILITIES ─────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--pad);
}
.accent-dot    { color: var(--accent); }
.accent-gradient {
  background: linear-gradient(135deg, var(--accent) 0%, #22d3ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-muted { color: var(--text-muted); }
.glass-panel {
  background: rgba(255,255,255,0.02);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.section-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(16,185,129,0.6);
  font-weight: 500;
  margin-bottom: 1.2rem;
}
.body-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-muted);
  max-width: 58ch;
}
.body-text strong { color: var(--text); font-weight: 600; }
/* Bio "Chi Sono": testo pieno invece del grigio, che sullo sfondo
   scuro risultava poco leggibile. */
.about-text-col .body-text { color: #f4f4f5; }
.about-text-col .body-text strong { color: #ffffff; }
code {
  font-family: var(--mono);
  font-size: 0.8em;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}
.section-divider {
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: min(500px, 100%);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(100px);
}
.ambient-glow--left   { width: 500px; height: 500px; top: 30%;  left: -10%; background: rgba(16,185,129,0.06); }
.ambient-glow--right  { width: 500px; height: 500px; top: 30%; right: -10%; background: rgba(6,182,212,0.05); }
.ambient-glow--center { width: 600px; height: 600px; top: 40%; left: 50%; transform: translateX(-50%); background: rgba(16,185,129,0.05); }
.ambient-glow--footer { width: 600px; height: 350px; bottom: 0; left: 20%; background: rgba(16,185,129,0.04); }

/* ── 4. BUTTONS ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.9rem 1.75rem;
  font-family: var(--font); font-size: 0.875rem; font-weight: 600;
  border-radius: 0.75rem; border: none;
  text-decoration: none; transition: all 0.35s var(--ease);
  white-space: nowrap;
}
.btn--primary {
  background: var(--accent); color: #030a06;
}
.btn--primary:hover { background: var(--accent-lt); }
.btn--primary:active { transform: scale(0.97); }
.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn--ghost:hover { border-color: rgba(255,255,255,0.12); color: var(--text); }
.btn--ghost:active { transform: scale(0.97); }

/* ── 5. TAGS ──────────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2rem; }
.tag {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 100px;
  transition: border-color 0.4s, color 0.4s, background 0.4s;
  position: relative; overflow: hidden;
}
.tag::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, var(--accent-dim), transparent 70%);
  opacity: 0; transition: opacity 0.5s var(--ease);
}
.tag:hover { border-color: rgba(16,185,129,0.2); color: rgba(16,185,129,0.75); }
.tag:hover::before { opacity: 1; }

/* ── 6. LOADING SCREEN ────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem;
  /* Mezzo secondo di dissolvenza era attesa percepita in più su una schermata
     che ormai esce appena la pagina è pronta. */
  transition: opacity 0.4s var(--ease), visibility 0.4s;
  /* Rete di sicurezza puramente CSS: se main.js non parte affatto
     (errore di rete, script bloccato) il loader sparisce comunque
     invece di lasciare il sito come schermo nero. */
  animation: loaderFailsafe 0.8s var(--ease) 6s forwards;
}
#loading-screen.done { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes loaderFailsafe {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}
.loading-name { font-size: 0.75rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--text-dim); }
.loading-track {
  width: 120px; height: 1px;
  background: rgba(255,255,255,0.05);
  overflow: hidden; border-radius: 1px;
}
.loading-fill {
  height: 100%; background: var(--accent); width: 0%;
  transition: width 0.25s var(--ease);
}
.loading-pct {
  font-size: 0.65rem; letter-spacing: 0.12em; color: var(--text-dim);
  /* Le cifre cambiano di continuo: senza tabular-nums la percentuale
     balla in larghezza a ogni aggiornamento. */
  font-variant-numeric: tabular-nums;
}

/* ── 7. CUSTOM CURSOR ─────────────────────────────────────── */
#cursor-dot {
  position: fixed; top: 0; left: 0; z-index: 999;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  mix-blend-mode: difference;
  will-change: transform;
  transition: width 0.35s var(--ease), height 0.35s var(--ease);
}
#cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 998;
  width: 36px; height: 36px;
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  transition: width 0.5s var(--ease), height 0.5s var(--ease), border-color 0.4s;
}
#cursor-dot.hover  { width: 44px; height: 44px; background: rgba(16,185,129,0.12); mix-blend-mode: normal; backdrop-filter: blur(4px); }
#cursor-ring.hover { width: 60px; height: 60px; border-color: rgba(16,185,129,0.07); }

/* ── 8. NAVBAR ────────────────────────────────────────────── */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background 0.6s var(--ease), border-color 0.6s;
}
#navbar.scrolled {
  background: rgba(15,15,17,0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--pad);
}
.nav-logo {
  font-size: 1.1rem; font-weight: 700;
  letter-spacing: -0.03em; color: var(--text);
  text-decoration: none;
  transition: color 0.3s;
}
.nav-logo:hover { color: #fff; }
.nav-links {
  display: flex; align-items: center; gap: 0.25rem;
  position: relative;
}
.nav-link {
  position: relative; z-index: 1;
  padding: 0.5rem 1rem;
  font-size: 0.72rem; letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.4s;
}
.nav-link:hover { color: var(--text-muted); }
.nav-link.active { color: #e4e4e7; }
.nav-indicator {
  position: absolute;
  left: 0;
  height: 32px;
  /* Centratura verticale con top+margin invece che con transform:
     main.js scrive transform:translateX(...) per spostare l'indicatore
     e sovrascriverebbe qualsiasi translateY messo qui, lasciandolo
     alzato di 16px (metà altezza). Così le due cose non si toccano. */
  top: 50%;
  margin-top: -16px;
  border-radius: 100px;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
  transition: transform 0.5s var(--ease), width 0.5s var(--ease), opacity 0.4s var(--ease);
  opacity: 0;
}
.nav-burger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; padding: 8px; cursor: none;
}
.nav-burger span {
  display: block; width: 22px; height: 1px;
  background: var(--text-muted);
  transition: all 0.45s var(--ease);
  transform-origin: center;
}
.nav-burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.nav-mobile {
  display: none; flex-direction: column;
  background: rgba(15,15,17,0.95); backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-soft);
  max-height: 0; overflow: hidden;
  transition: max-height 0.5s var(--ease);
}
.nav-mobile.open { max-height: 320px; }
.nav-mobile-link {
  display: block; padding: 1rem var(--pad);
  font-size: 0.8rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border-soft);
  transition: color 0.3s, padding-left 0.4s var(--ease);
}
.nav-mobile-link:hover { color: var(--text); padding-left: calc(var(--pad) + 0.5rem); }

/* ── 9. HERO ──────────────────────────────────────────────── */
#home {
  position: relative; min-height: 100dvh;
  display: flex; align-items: center; overflow: hidden;
}
.grid-overlay {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.022; z-index: 1;
  background-image:
    linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 100px 100px;
}
.orbs { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.orb {
  position: absolute;
  left: var(--x); top: var(--y);
  width: var(--s); height: var(--s);
  background: rgba(16,185,129,0.5);
  border-radius: 50%;
  animation: floatOrb var(--dur) ease-in-out infinite;
  animation-delay: var(--del);
  opacity: 0;
  transition: opacity 1.5s ease;
}
.orb.visible { opacity: 0.6; }
.hero-inner {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 7fr 5fr;
  align-items: center; gap: 2rem;
  padding-top: 5rem; padding-bottom: 5rem;
  min-height: 100dvh;
}
.hero-text { display: flex; flex-direction: column; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 1rem; margin-bottom: 2.5rem;
  border-radius: 100px;
  border: 1px solid rgba(16,185,129,0.14);
  background: rgba(16,185,129,0.03);
  font-size: 0.7rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: rgba(16,185,129,0.65);
  width: fit-content;
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.hero-badge.show { opacity: 1; transform: translateY(0); }
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  position: relative; flex-shrink: 0;
}
.pulse-dot::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: var(--accent); opacity: 0.35;
  animation: ping 2s cubic-bezier(0,0,0.2,1) infinite;
}
.pulse-dot--sm { width: 5px; height: 5px; }
.hero-title {
  font-size: clamp(3.2rem, 8.5vw, 7rem);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: #f4f4f5;
  margin-bottom: 1.75rem;
}
.split-word { display: inline-block; overflow: hidden; vertical-align: bottom; }
.split-word .char {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.75s var(--ease);
}
.split-word.revealed .char {
  transform: translateY(0);
}
.hero-sub {
  font-size: 1.05rem; line-height: 1.75;
  color: var(--text-muted); max-width: 46ch;
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.hero-sub.show { opacity: 1; transform: translateY(0); }
.hero-divider {
  width: 48px; height: 1px; margin: 2rem 0;
  background: linear-gradient(90deg, rgba(16,185,129,0.5), transparent);
  transform-origin: left;
  transform: scaleX(0); opacity: 0;
  transition: transform 0.9s var(--ease), opacity 0.9s var(--ease);
}
.hero-divider.show { transform: scaleX(1); opacity: 1; }
.hero-cta {
  display: flex; flex-wrap: wrap; gap: 1rem;
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.hero-cta.show { opacity: 1; transform: translateY(0); }

/* Rete di sicurezza gemella di quella del loader (loaderFailsafe, 6s): se
   main.js non parte affatto, lì il loader spariva ma restava un hero vuoto,
   perché badge, sottotitolo, divisore e pulsanti nascono a opacity:0.
   Lo stato finale è identico a quello delle classi .show, quindi quando il
   JS funziona — cioè sempre, entro il primo secondo — non si vede nulla. */
.hero-badge, .hero-sub, .hero-cta { animation: heroFailsafe 0.6s var(--ease) 6s forwards; }
.hero-divider     { animation: heroDividerFailsafe 0.6s var(--ease) 6s forwards; }
.split-word .char { animation: heroCharFailsafe 0.6s var(--ease) 6s forwards; }
@keyframes heroFailsafe        { to { opacity: 1; transform: translateY(0); } }
@keyframes heroDividerFailsafe { to { opacity: 1; transform: scaleX(1); } }
@keyframes heroCharFailsafe    { to { transform: translateY(0); } }
.hero-deco {
  position: relative;
  width: clamp(300px, 40vw, 460px);
  height: clamp(300px, 40vw, 460px);
  margin-inline: auto;
  opacity: 0; transform: scale(0.7);
  transition: opacity 1.3s var(--ease), transform 1.3s var(--ease);
}
.hero-deco.show { opacity: 1; transform: scale(1); }
.ring {
  position: absolute; border-radius: 50%;
}
.ring--outer {
  inset: 0; border: 1px solid rgba(16,185,129,0.07);
  animation: spinRing 25s linear infinite;
}
.ring--mid {
  inset: 24px; border: 1px dashed rgba(255,255,255,0.05);
  animation: spinRing 35s linear infinite reverse;
}
.ring--inner {
  inset: 56px; border: 1px solid rgba(16,185,129,0.04);
  animation: spinRing 18s linear infinite;
}
.ring-glow {
  position: absolute; inset: 30%;
  background: rgba(16,185,129,0.06); border-radius: 50%;
  filter: blur(30px);
  animation: pulseGlow 5s ease-in-out infinite;
}
.scroll-hint {
  position: absolute; bottom: 2.5rem; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  z-index: 2;
  opacity: 0; transition: opacity 0.9s var(--ease);
}
.scroll-hint.show { opacity: 1; }
.scroll-hint span { font-size: 0.6rem; letter-spacing: 0.35em; text-transform: uppercase; color: var(--text-dim); }
.scroll-line {
  width: 1px; height: 40px; background: rgba(255,255,255,0.08);
  overflow: hidden; border-radius: 1px;
  position: relative;
}
.scroll-bar {
  position: absolute; top: -100%; left: 0;
  width: 100%; height: 40%;
  background: var(--accent); opacity: 0.6;
  border-radius: 1px;
  animation: scrollDown 2s ease-in-out infinite;
}

/* ── 10. ABOUT ────────────────────────────────────────────── */
#about {
  position: relative; padding: clamp(5rem,10vw,9rem) 0;
}
.about-grid {
  display: grid; grid-template-columns: 5fr 7fr;
  gap: clamp(3rem,6vw,6rem); align-items: start;
}
.about-img-col { position: relative; }
.about-img-frame {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--surface);
}
.about-img-frame img {
  width: 100%; aspect-ratio: 4/5; object-fit: cover;
  display: block;
}
.about-img-grad {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(15,15,17,0.55) 0%, transparent 50%);
  pointer-events: none;
}
.about-chip {
  position: absolute; bottom: -1.25rem; right: -1.5rem;
  border-radius: 0.875rem; padding: 1rem 1.25rem; max-width: 210px;
  z-index: 2;
}
.chip-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.chip-eyebrow { font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim); }
.chip-title { font-size: 0.9rem; font-weight: 600; color: #e4e4e7; }
.chip-sub { font-size: 0.7rem; color: rgba(16,185,129,0.6); margin-top: 0.2rem; }
.about-corner {
  position: absolute; top: -12px; left: -12px;
  width: 44px; height: 44px;
  border-top: 1px solid rgba(16,185,129,0.15);
  border-left: 1px solid rgba(16,185,129,0.15);
  border-radius: 4px 0 0 0; pointer-events: none;
}
.about-text-col { padding-top: 1rem; }
.about-text-col h2 {
  font-size: clamp(2rem,4vw,3.2rem); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.1;
  color: #f4f4f5; margin-bottom: 0.3rem;
}
.about-text-col .body-text { margin-top: 1.5rem; }
.stats {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 1.5rem; margin-top: 2.5rem;
  padding-top: 2rem; border-top: 1px solid rgba(255,255,255,0.05);
}
.stat { display: flex; flex-direction: column; gap: 0.4rem; }
.stat-num {
  font-size: 1.8rem; font-weight: 800;
  letter-spacing: -0.04em; color: #f4f4f5;
}
.stat-lbl {
  font-size: 0.65rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--text-dim);
}

/* ── 11. SECTION HEAD ─────────────────────────────────────── */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 2rem; margin-bottom: 3.5rem; flex-wrap: wrap;
}
.section-head h2 {
  font-size: clamp(2rem,4vw,3.2rem); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.1;
  color: #f4f4f5; margin-bottom: 0.3rem;
}
.section-sub {
  font-size: 0.8rem; line-height: 1.75;
  color: var(--text-dim); text-align: right;
}

/* ── 12. PROJECTS ─────────────────────────────────────────── */
#projects { position: relative; padding: clamp(5rem,10vw,9rem) 0; }
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 1.5rem;
}
/* Project card — real */
.project-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: inherit;
  transition: transform 0.55s var(--ease), border-color 0.55s, box-shadow 0.55s;
  position: relative;
}
.project-card::before {
  content: '';
  position: absolute; inset: -1px; border-radius: var(--radius);
  background: conic-gradient(from var(--conic,0deg), transparent 60%, rgba(16,185,129,0.35), transparent 80%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  padding: 1px; opacity: 0;
  transition: opacity 0.5s ease;
  animation: conicSpin 4s linear infinite;
  pointer-events: none; z-index: 1;
}
.project-card:hover { transform: translateY(-6px); border-color: transparent; box-shadow: 0 24px 60px rgba(0,0,0,0.5); }
.project-card:hover::before { opacity: 1; }
.project-img {
  display: block; /* è un <a>: senza questo resterebbe inline */
  aspect-ratio: 16/9; overflow: hidden;
  background: var(--surface-2); flex-shrink: 0;
}
/* Shown when image file is missing or not yet set */
.project-img--missing {
  background: linear-gradient(135deg,
    rgba(16,185,129,0.08) 0%,
    rgba(6,182,212,0.06) 50%,
    rgba(16,185,129,0.04) 100%
  );
  position: relative;
}
.project-img--missing::after {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    transparent, transparent 18px,
    rgba(255,255,255,0.015) 18px, rgba(255,255,255,0.015) 19px
  );
}
.project-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.7s var(--ease), filter 0.7s;
}
.project-card:hover .project-img img { transform: scale(1.08); filter: brightness(1.06); }
.project-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }
.project-title {
  font-size: 1rem; font-weight: 700;
  letter-spacing: -0.02em; color: #e4e4e7;
  margin-bottom: 0.6rem; line-height: 1.4;
}
.project-desc {
  font-size: 0.83rem; line-height: 1.7;
  color: var(--text-muted); flex: 1;
}
.project-tech {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-top: 1rem;
}
.project-tech span {
  /* Erano in JetBrains Mono. Outfit con spaziatura larga e peso 500
     tiene la stessa aria da etichetta tecnica senza scaricare un font. */
  font-size: 0.65rem; letter-spacing: 0.06em; font-weight: 500;
  color: var(--accent); background: var(--accent-dim);
  border: 1px solid rgba(16,185,129,0.1);
  border-radius: 100px; padding: 0.18rem 0.6rem;
}
.project-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1.25rem; padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.project-gh-link {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.35s, gap 0.35s var(--ease);
}
.project-card:hover .project-gh-link { color: var(--accent); gap: 0.75rem; }
.project-gh-link svg { transition: transform 0.35s var(--ease); }
.project-card:hover .project-gh-link svg { transform: translate(2px,-2px); }
/* Placeholder card */
.project-card--placeholder {
  border-style: dashed;
  border-color: rgba(255,255,255,0.05);
  background: transparent;
  align-items: center; justify-content: center;
  text-align: center; padding: 3rem 2rem;
  min-height: 220px;
}
.project-card--placeholder:hover {
  border-color: rgba(16,185,129,0.12); transform: none;
}
.project-placeholder-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  margin-inline: auto; margin-bottom: 0.75rem;
}
.project-placeholder-icon svg { color: var(--text-dim); }
.project-card--placeholder p { font-size: 0.8rem; color: var(--text-dim); }

/* ── 13. TRAVELS / CAROUSEL ───────────────────────────────── */
#travels { position: relative; padding-bottom: clamp(5rem,10vw,9rem); }
.marquee-outer {
  overflow: hidden;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  margin-bottom: 0;
}
.marquee-track {
  display: flex; width: max-content;
  animation: marquee 36s linear infinite;
}
.marquee-track:hover { animation-play-state: paused; }
.marquee-item {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0 1.5rem;
  font-size: 0.7rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--text-dim);
  white-space: nowrap;
}
.marquee-sep {
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(16,185,129,0.25); flex-shrink: 0;
}
.travels-body { margin-top: 4rem; }
.travels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(250px,100%),1fr));
  gap: 1.25rem;
}
/* Travel card */
.travel-card {
  position: relative; border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
  aspect-ratio: 3/4;
  cursor: none;
  transform-style: preserve-3d; perspective: 1000px;
}
.travel-card::before {
  content: '';
  position: absolute; inset: -1px; border-radius: var(--radius);
  background: conic-gradient(from var(--conic,0deg), transparent 60%, rgba(16,185,129,0.3), transparent 80%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  padding: 1px; opacity: 0;
  transition: opacity 0.5s ease;
  animation: conicSpin 4s linear infinite;
  pointer-events: none; z-index: 3;
}
.travel-card:hover::before { opacity: 1; }
.card-inner {
  position: absolute; inset: 0;
  transition: transform 0.45s var(--ease);
  transform-style: preserve-3d;
}
/* Carousel */
.carousel { position: absolute; inset: 0; overflow: hidden; touch-action: pan-y; }
.carousel-track {
  display: flex; height: 100%; width: 100%;
  transition: transform 0.75s var(--ease);
  will-change: transform;
}
.carousel-slide {
  flex: 0 0 100%; height: 100%; overflow: hidden; position: relative;
}
.carousel-slide img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.8s var(--ease);
  /* --py è l'offset di parallasse scritto da main.js: tenendolo in una
     custom property lo zoom in hover qui sotto continua a funzionare. */
  transform: scale(1.12) translateY(var(--py, 0px));
}
.travel-card:hover .carousel-slide img { transform: scale(1.18) translateY(var(--py, 0px)); }
/* Gradient overlay */
.travel-grad {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(15,15,17,0.85) 0%, rgba(15,15,17,0.1) 50%, transparent 100%);
  pointer-events: none;
}
/* Hover overlay */
.travel-overlay {
  position: absolute; inset: 0; z-index: 2;
  background: rgba(16,185,129,0.04);
  opacity: 0; transition: opacity 0.5s var(--ease);
  pointer-events: none;
}
.travel-card:hover .travel-overlay { opacity: 1; }
/* Card label */
.travel-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  z-index: 4; padding: 1.25rem;
}
.travel-name {
  font-size: 1.1rem; font-weight: 700;
  letter-spacing: -0.02em; color: #f4f4f5;
  line-height: 1.2;
}
/* Carousel dots */
.carousel-dots {
  position: absolute; bottom: 4.5rem; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 5px; z-index: 5;
}
.carousel-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: none; cursor: none;
  transition: background 0.35s, transform 0.35s;
  padding: 0;
}
.carousel-dot.active {
  background: var(--accent); transform: scale(1.35);
}
.carousel-dots--single { display: none !important; }
/* Footer counter */
.travels-foot {
  display: flex; align-items: center; gap: 1.25rem;
  margin-top: 3rem;
}
.travels-line { flex: 1; height: 1px; background: rgba(255,255,255,0.05); }
#travels-count {
  font-size: 0.65rem; letter-spacing: 0.18em; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ── 14. FOOTER ───────────────────────────────────────────── */
#contact { position: relative; padding: clamp(4rem,8vw,7rem) 0 clamp(2rem,4vw,3rem); }
.footer-contact { margin-bottom: 3.5rem; }
.footer-contact .section-label { margin-bottom: 2rem; }
.footer-contact-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
  padding: 2rem 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.footer-bar {
  display: flex; align-items: center; justify-content: flex-end;
  padding-top: 1.5rem; border-top: 1px solid var(--border-soft);
}
.footer-brand p { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.footer-brand span { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.25rem; display: block; letter-spacing: 0.02em; }
.footer-socials { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.social-btn {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.6rem 1.1rem; border-radius: 0.6rem;
  border: 1px solid var(--border);
  color: var(--text-muted); text-decoration: none;
  font-size: 0.78rem; font-weight: 500;
  transition: all 0.4s var(--ease);
  background: var(--surface-2);
}
.social-btn:hover {
  border-color: rgba(16,185,129,0.3);
  color: var(--accent);
  background: var(--accent-dim);
}
.footer-copy { font-size: 0.65rem; letter-spacing: 0.12em; color: var(--text-dim); }

/* ── 15. REVEAL ANIMATIONS ────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(50px);
  transition: opacity 0.9s var(--ease) var(--delay,0s),
              transform 0.9s var(--ease) var(--delay,0s);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-left {
  opacity: 0; transform: translateX(-70px);
  transition: opacity 0.9s var(--ease) var(--delay,0s),
              transform 0.9s var(--ease) var(--delay,0s);
}
.reveal-left.visible { opacity: 1; transform: translateX(0); }
.reveal-mask {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.2s var(--ease) var(--delay,0s);
}
.reveal-mask.visible { clip-path: inset(0 0 0 0); }
.stagger-children > * {
  opacity: 0; transform: translateY(36px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.stagger-children.visible > *:nth-child(1)  { opacity:1; transform:translateY(0); transition-delay:0.00s; }
.stagger-children.visible > *:nth-child(2)  { opacity:1; transform:translateY(0); transition-delay:0.08s; }
.stagger-children.visible > *:nth-child(3)  { opacity:1; transform:translateY(0); transition-delay:0.16s; }
.stagger-children.visible > *:nth-child(4)  { opacity:1; transform:translateY(0); transition-delay:0.24s; }
.stagger-children.visible > *:nth-child(5)  { opacity:1; transform:translateY(0); transition-delay:0.32s; }
.stagger-children.visible > *:nth-child(6)  { opacity:1; transform:translateY(0); transition-delay:0.40s; }
.stagger-children.visible > *:nth-child(7)  { opacity:1; transform:translateY(0); transition-delay:0.48s; }
.stagger-children.visible > *:nth-child(8)  { opacity:1; transform:translateY(0); transition-delay:0.56s; }
.stagger-children.visible > *:nth-child(9)  { opacity:1; transform:translateY(0); transition-delay:0.64s; }
.stagger-children.visible > *:nth-child(10) { opacity:1; transform:translateY(0); transition-delay:0.72s; }

/* ── 16. KEYFRAMES ────────────────────────────────────────── */
@keyframes floatOrb {
  0%,100% { transform:translate(0,0) scale(1); }
  25%      { transform:translate(20px,-15px) scale(1.08); }
  50%      { transform:translate(-15px,12px) scale(0.94); }
  75%      { transform:translate(12px,8px) scale(1.04); }
}
@keyframes spinRing {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes pulseGlow {
  0%,100% { opacity:.4; transform:scale(1); }
  50%      { opacity:.75; transform:scale(1.18); }
}
@keyframes ping {
  75%,100% { transform:scale(2); opacity:0; }
}
@keyframes scrollDown {
  0%   { top:-100%; }
  100% { top:100%; }
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@property --conic { syntax:"<angle>"; initial-value:0deg; inherits:false; }
@keyframes conicSpin {
  from { --conic:0deg; }
  to   { --conic:360deg; }
}

/* ── 17. NOISE OVERLAY ────────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 500; pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

/* ── 18. SCROLLBAR ────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #1f1f1f; }

/* ── 19. RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-deco { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .about-img-col { max-width: 420px; margin-inline: auto; }
  .about-chip { right: -0.5rem; }
}
@media (max-width: 768px) {
  body { cursor: auto; }
  a, button { cursor: pointer; }
  #cursor-dot, #cursor-ring { display: none !important; }
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  .nav-mobile { display: flex; }
  .hero-title { font-size: clamp(2.8rem, 12vw, 4.5rem); }
  .hero-cta { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  .section-head { flex-direction: column; gap: 1rem; }
  .section-sub { text-align: left; }
  .travels-grid { grid-template-columns: repeat(2,1fr); }
  .footer-contact-inner { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
  .footer-socials { flex-wrap: wrap; }
  .projects-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3,1fr); gap: 1rem; }
  .about-chip { position: static; margin-top: 1rem; max-width: 100%; }
}
@media (max-width: 480px) {
  .travels-grid { grid-template-columns: 1fr; }
  .hero-badge { font-size: 0.6rem; padding: 0.35rem 0.8rem; }
  .footer-contact-inner { padding: 1.25rem; }
  .social-btn { flex: 1; justify-content: center; min-width: 140px; }
}

/* ── Carousel nav arrows (fuori dall'overflow:hidden del carousel) ── */
.carousel-arrow--prev,
.carousel-arrow--next {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  z-index: 6;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(15,15,17,0.55);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  display: flex; align-items: center; justify-content: center;
  cursor: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease), background 0.3s, border-color 0.3s;
  pointer-events: auto;
}
.carousel-arrow--prev { left: 0.6rem; }
.carousel-arrow--next { right: 0.6rem; }
.travel-card:hover .carousel-arrow--prev,
.travel-card:hover .carousel-arrow--next { opacity: 1; }
/* Su touch device (no hover) le frecce sono sempre visibili */
@media (hover: none) {
  .carousel-arrow--prev,
  .carousel-arrow--next { opacity: 0.75; cursor: pointer; }
}
.carousel-arrow--prev:hover,
.carousel-arrow--next:hover {
  background: rgba(16,185,129,0.2);
  border-color: rgba(16,185,129,0.3);
  color: var(--accent);
}

/* ── THREE.JS CANVAS ───────────────────────────────────────── */
#webgl-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
  /* Il 3D ora parte dopo il primo disegno (init3D in main.js): senza
     dissolvenza comparirebbe di colpo su una pagina già visibile.
     La classe .ready la mette init3D quando il rendering è avviato. */
  opacity: 0;
  transition: opacity 1s var(--ease);
}
#webgl-canvas.ready { opacity: 1; }

/* <picture> è un contenitore inline: senza questo l'`height: 100%` degli
   <img> dentro le card non avrebbe più un riferimento e le foto
   collasserebbero. `display: contents` lo toglie di mezzo dal layout. */
picture { display: contents; }
section { position: relative; z-index: 1; }

/* ── 20. FOCUS DA TASTIERA ─────────────────────────────────── */
/* Il sito usa cursor:none ovunque: senza questi stili chi naviga
   con Tab non ha alcun modo di capire dove si trova. :focus-visible
   si attiva solo da tastiera, quindi il mouse non ne è influenzato. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.btn:focus-visible,
.social-btn:focus-visible,
.nav-link:focus-visible,
.nav-mobile-link:focus-visible,
.nav-logo:focus-visible,
.project-gh-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.carousel-dot:focus-visible,
.carousel-arrow--prev:focus-visible,
.carousel-arrow--next:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  opacity: 1;
}
/* Salta al contenuto: visibile solo quando riceve focus */
.skip-link {
  position: absolute; top: -100px; left: var(--pad);
  z-index: 300;
  padding: 0.7rem 1.2rem; border-radius: 0.5rem;
  background: var(--accent); color: #030a06;
  font-size: 0.8rem; font-weight: 600; text-decoration: none;
  transition: top 0.3s var(--ease);
}
.skip-link:focus { top: 0.75rem; }

/* ── 21. PREFERS-REDUCED-MOTION ────────────────────────────── */
/* Chi ha attivato "riduci animazioni" nel sistema operativo vede
   il sito completo e statico, senza movimenti che possono dare
   nausea o disorientamento. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* I contenuti animati devono restare VISIBILI, non nascosti */
  .reveal, .reveal-left, .stagger-children > * {
    opacity: 1 !important;
    transform: none !important;
  }
  .reveal-mask { clip-path: none !important; }
  .split-word .char { transform: none !important; }
  .hero-badge, .hero-sub, .hero-cta, .hero-divider,
  .scroll-hint, .hero-deco, .orb {
    opacity: 1 !important;
    transform: none !important;
  }
  .hero-divider { transform: scaleX(1) !important; }

  /* Movimenti puramente decorativi: fermi */
  .marquee-track { animation: none !important; }
  .ring, .ring-glow, .pulse-dot::before, .scroll-bar { animation: none !important; }
  .travel-card::before { animation: none !important; }
}
