/* ============================================================
   VETRO — lo stesso materiale di Pizza Architect e Planning Poker
   Caricato da tutte le pagine (home, curriculum, contatti, in italiano e
   in inglese) dopo liquid-glass.css, che resta la base.

   L'idea: il sito e' una finestra macOS di vetro, a tutto schermo, su
   una scrivania viva. Lo sfondo (.lg-wallpaper) ha tre lenti colorate e una
   trasparente che vagano piano; la finestra le lascia intravedere, e i
   vetri veri (barra del titolo, menu, pie' di pagina) le sfocano.

   Prestazioni: ogni fotogramma in cui una lente si muove costringe il
   browser a risfocare tutti i vetri. Per questo i vetri sono pochi, le
   lenti si muovono solo con transform su un layer loro (will-change) e
   nessuna animazione infinita tocca proprieta' che ridipingono.
   ============================================================ */

/* ── Le ricette del vetro, per tema ─────────────────────────────── */
:root {
  /* tema scuro, il default del sito */
  --wall-bg: radial-gradient(120% 90% at 50% 40%, #12161a 0%, #0a0c0f 100%);
  --pane: rgb(18 20 26 / 0.38);

  --g-fill: linear-gradient(160deg, rgb(255 255 255 / 0.13) 0%, rgb(255 255 255 / 0.05) 50%, rgb(255 255 255 / 0.09) 100%);
  --g-fill-clear: linear-gradient(160deg, rgb(255 255 255 / 0.12), rgb(255 255 255 / 0.03));
  --g-blur: blur(28px) saturate(170%);
  --g-blur-clear: blur(16px) saturate(180%) brightness(0.92);
  --g-inset: inset 0 1px 0 rgb(255 255 255 / 0.16), inset 0 -1px 0 rgb(255 255 255 / 0.04);
  --g-spec: linear-gradient(135deg,
      rgb(255 255 255 / 0.42) 0%, rgb(255 255 255 / 0.12) 30%,
      rgb(255 255 255 / 0.04) 60%, rgb(255 255 255 / 0.2) 88%, rgb(255 255 255 / 0.4) 100%);
  --g-light: rgb(255 255 255 / 0.12);
  --g-float: 0 18px 50px -18px rgb(0 0 0 / 0.65);
  --g-hair: rgb(255 255 255 / 0.08);

  --disc-blend: screen;
  --disc-alpha: 0.72;
  --clear-veil: 0.45;
  --code-alpha: 0.13;
  --sheet: linear-gradient(180deg, rgb(22 25 31 / 0.62), rgb(14 16 20 / 0.72));
  --seg-thumb: linear-gradient(180deg, rgb(255 255 255 / 0.22), rgb(255 255 255 / 0.1));
  --clear-glyph: rgb(255 255 255 / 0.5);
  --tip-bg: rgb(28 30 36 / 0.94);
}

[data-theme="light"] {
  /* Piu' profondo del bianco di liquid-glass.css: su un fondo quasi bianco
     velato di bianco tutto era luminoso allo stesso modo, il vetro non si
     staccava e il testo grigio si leggeva male. Ora la scrivania e' un
     grigio-verde medio, il velo e' leggero e il testo piu' scuro. */
  --wall-bg: radial-gradient(120% 90% at 50% 40%, #e8ecea 0%, #d6dcd9 100%);
  --pane: rgb(255 255 255 / 0.12);
  --text-secondary: rgba(29, 29, 31, 0.74);
  --text-tertiary: rgba(29, 29, 31, 0.56);
  /* il verde di iOS chiaro (#34c759) su questo fondo sta a 2:1: si
     scurisce come il verde "accessibile" di iOS. Il titolo grande arriva
     a 3:1, il bottone Contatti ha i suoi colori e resta com'e'. */
  --accent: #1e9a44;
  --accent-hover: #178236;
  --accent-gradient: linear-gradient(135deg, #24a54a, #168035);
  --accent-glow: rgba(30, 154, 68, 0.16);

  /* Piu' trasparente della ricetta delle app (0,72 / 0,5 / 0,6): con le
     lenti pastello su un fondo chiaro il vetro quasi pieno copriva tutto,
     e l'effetto era molto piu' debole che nel tema scuro, dove il vetro e'
     al 5-13% e lascia passare il colore sfocato. */
  --g-fill: linear-gradient(160deg, rgb(255 255 255 / 0.5) 0%, rgb(255 255 255 / 0.26) 45%, rgb(255 255 255 / 0.38) 100%);
  --g-fill-clear: linear-gradient(160deg, rgb(255 255 255 / 0.58), rgb(255 255 255 / 0.2));
  --g-blur: blur(28px) saturate(210%);
  --g-blur-clear: blur(16px) saturate(190%) brightness(1.05);
  --g-inset: inset 0 1px 0 rgb(255 255 255 / 0.95), inset 0 -1px 0 rgb(255 255 255 / 0.4);
  --g-spec: linear-gradient(135deg,
      rgb(255 255 255 / 1) 0%, rgb(255 255 255 / 0.5) 30%,
      rgb(180 186 200 / 0.25) 60%, rgb(255 255 255 / 0.7) 88%, rgb(255 255 255 / 1) 100%);
  --g-light: rgb(255 255 255 / 0.55);
  --g-float: 0 18px 44px -16px rgb(16 24 40 / 0.28);
  --g-hair: rgb(16 24 40 / 0.1);

  --disc-blend: multiply;
  --disc-alpha: 1;
  --clear-veil: 1;
  --code-alpha: 0.2;
  --sheet: linear-gradient(180deg, rgb(255 255 255 / 0.62), rgb(246 248 247 / 0.72));
  --seg-thumb: linear-gradient(180deg, rgb(255 255 255 / 0.72), rgb(255 255 255 / 0.3));
  --clear-glyph: rgb(29 29 31 / 0.22);
  --tip-bg: rgb(255 255 255 / 0.94);
}

/* ── La scrivania: sfondo vivo ──────────────────────────────────── */
/* Lo sfondo ambientale animato di liquid-glass.css qui non serve: lo fanno
   le lenti. */
body::before { display: none; }

.lg-wallpaper {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--wall-bg);
}

.lg-disc {
  position: absolute;
  /* era clamp(200px, 30vmax, 460px): grandi cosi', quando passavano
     insieme dietro al titolo coprivano mezza pagina */
  --d: clamp(170px, 25vmax, 400px);
  width: var(--d);
  aspect-ratio: 1;
  border-radius: 50%;
  mix-blend-mode: var(--disc-blend);
  opacity: var(--disc-alpha);
  will-change: transform;
  animation: var(--path) var(--t) ease-in-out infinite alternate;
}
/* corpo della lente: bordo piu' acceso, centro piu' profondo, riflesso in alto */
.lg-disc::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(60% 45% at 32% 22%, rgb(255 255 255 / 0.55), transparent 70%),
    radial-gradient(circle at 50% 55%, var(--c-core) 0%, var(--c-body) 62%, var(--c-rim) 100%);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.35),
    inset 0 0 18px 2px rgb(255 255 255 / 0.35),
    inset 0 -22px 50px -12px var(--c-rim);
}
/* l'ombra colorata sotto la lente */
.lg-disc::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -8%;
  height: 20%;
  border-radius: 50%;
  background: var(--c-shadow);
  filter: blur(30px);
  z-index: -1;
}

/* il verde del sito, una menta e un azzurro: tre toni vicini, nessun tema */
.lg-disc-green { --c-core: rgb(140 230 160 / 0.5); --c-body: rgb(52 199 89 / 0.5); --c-rim: rgb(30 150 60 / 0.68); --c-shadow: rgb(52 199 89 / 0.28);
  top: 8%; left: 6%; --path: drift-a; --t: 46s; }
.lg-disc-mint  { --c-core: rgb(150 240 230 / 0.5); --c-body: rgb(0 199 190 / 0.46); --c-rim: rgb(0 140 135 / 0.64); --c-shadow: rgb(0 199 190 / 0.26);
  top: 44%; left: 58%; --path: drift-b; --t: 58s; }
.lg-disc-sky   { --c-core: rgb(170 220 255 / 0.5); --c-body: rgb(90 170 250 / 0.44); --c-rim: rgb(40 120 210 / 0.6); --c-shadow: rgb(90 170 250 / 0.26);
  top: -12%; left: 62%; --path: drift-c; --t: 52s; }
/* la lente trasparente: niente colore, sfoca e schiarisce cio' che le passa sotto */
.lg-disc-clear {
  --c-core: rgb(255 255 255 / 0.22);
  --c-body: rgb(244 247 252 / 0.16);
  --c-rim: rgb(105 117 145 / 0.3);
  --c-shadow: rgb(16 24 40 / 0.14);
  top: 52%; left: 14%;
  --d: clamp(150px, 21vmax, 330px);
  mix-blend-mode: normal;
  /* sul fondo scuro il suo bianco pesava: lo si vela */
  opacity: var(--clear-veil);
  --path: drift-d; --t: 64s;
  -webkit-backdrop-filter: blur(12px) saturate(180%) brightness(1.04);
  backdrop-filter: blur(12px) saturate(180%) brightness(1.04);
}
.lg-disc-clear::before {
  box-shadow:
    0 0 0 0.5px rgb(105 117 145 / 0.3),
    inset 0 0 0 1.5px rgb(255 255 255 / 0.7),
    inset 0 0 14px 2px rgb(255 255 255 / 0.4),
    inset 0 -18px 40px -10px var(--c-rim),
    inset 0 14px 28px -12px rgb(255 255 255 / 0.8);
}

/* Il volto delle lenti, come le pizze e le fiche delle app: un simbolo
   di codice inciso nel vetro e un anello tratteggiato che ruota piano su
   un layer suo (ruotarlo senza will-change ridipingerebbe la lente a ogni
   fotogramma). Il simbolo e' bianco dentro una lente in multiply: nel tema
   chiaro diventa una finestra sul codice che sta sotto. */
.lg-face {
  position: absolute;
  inset: 0;
  /* flex e non grid: in una griglia ">" e il cursore diventerebbero due
     righe */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  font: 600 calc(var(--d) * 0.24)/1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  letter-spacing: -0.06em;
  color: rgb(255 255 255 / 0.62);
  text-shadow: 0 1px 0 rgb(255 255 255 / 0.5), 0 -1px 1px rgb(0 0 0 / 0.12);
}
.lg-ring {
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  border: 2px dashed rgb(255 255 255 / 0.45);
  z-index: 1;
  will-change: transform;
  animation: lg-spin var(--spin, 90s) linear infinite;
}
@keyframes lg-spin { to { transform: rotate(360deg); } }
/* la lente trasparente non ha colore: un simbolo bianco sparirebbe nel
   tema chiaro, quindi e' inciso scuro */
.lg-disc-clear .lg-face { color: var(--clear-glyph); text-shadow: 0 1px 0 rgb(255 255 255 / 0.4); }
.lg-disc-clear .lg-ring { border-color: var(--clear-glyph); }
/* il cursore del prompt lampeggia: solo opacita', su un layer suo */
.lg-caret { display: inline-block; will-change: opacity; animation: lg-caret 1.1s steps(1) infinite; }
@keyframes lg-caret { 50% { opacity: 0; } }

/* ── Il codice sulla scrivania ──────────────────────────────────── */
/* Il profilo scritto come un sorgente (glass.js lo inserisce: nel markup
   sarebbe testo indicizzato). Tenue, piu' tenue ancora dietro al titolo,
   e fermo: si disegna una volta sola, le lenti gli scorrono sopra e la
   lente trasparente lo sfoca passando. */
.lg-code {
  position: absolute;
  inset: 0;
  /* in alto parte sotto barra del titolo e menu (52 + 54 px): a 72 la prima
     riga passava dietro ai link */
  padding: 118px max(40px, 7vw) 72px;
  columns: 420px;
  column-gap: 8vw;
  column-fill: auto;
  overflow: hidden;
  white-space: pre;
  font: 400 12.5px/1.8 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color: var(--text-primary);
  opacity: var(--code-alpha);
  -webkit-mask-image: radial-gradient(ellipse 42% 30% at 50% 50%, rgb(0 0 0 / 0.25) 0%, #000 100%);
  mask-image: radial-gradient(ellipse 42% 30% at 50% 50%, rgb(0 0 0 / 0.25) 0%, #000 100%);
  user-select: none;
  -webkit-user-select: none;
}
.lg-code .k { color: var(--accent); }
.lg-code .c { opacity: 0.6; }

/* Percorsi lenti e diversi, avanti e indietro, che attraversano tutto lo
   schermo: ogni tanto le lenti passano insieme dietro al titolo, ed e'
   voluto (provati percorsi che giravano attorno al centro: all'utente
   piaceva di piu' questo). Per questo sono piccole. */
@keyframes drift-a {
  0% { transform: translate(0, 0); }
  33% { transform: translate(22vw, 18vh); }
  66% { transform: translate(8vw, 42vh); }
  100% { transform: translate(34vw, 30vh); }
}
@keyframes drift-b {
  0% { transform: translate(0, 0); }
  30% { transform: translate(-26vw, -10vh); }
  70% { transform: translate(-10vw, -34vh); }
  100% { transform: translate(-38vw, -20vh); }
}
@keyframes drift-c {
  0% { transform: translate(0, 0); }
  40% { transform: translate(-18vw, 30vh); }
  100% { transform: translate(-40vw, 12vh); }
}
@keyframes drift-d {
  0% { transform: translate(0, 0); }
  35% { transform: translate(30vw, -20vh); }
  70% { transform: translate(52vw, 6vh); }
  100% { transform: translate(18vw, -36vh); }
}

/* ── La finestra ────────────────────────────────────────────────── */
/* La finestra del browser e' la finestra macOS: occupa tutto lo schermo,
   e la barra del titolo coi semafori basta a dirlo. (Staccata dai bordi di
   20 px restava a meta': troppo vicina ai bordi per sembrare appoggiata
   sulla scrivania, troppo lontana per sembrare la finestra stessa.)
   Il vetro della finestra NON ha backdrop-filter: un filtro sul
   contenitore farebbe del menu fisso (.glass-nav.scrolled) un figlio della
   finestra invece che del viewport. Il velo basta a farla leggere come una
   lastra; sfocano i vetri dentro. */
.window-frame {
  --win-r: 28px;
  border-radius: var(--win-r);
  background: var(--pane);
}
/* Angoli tondi e bordo di luce restano anche a tutto schermo: sono la
   firma della finestra macOS, e negli angoli si intravede la scrivania.
   Il bordo sta sopra a tutto quello che la finestra contiene. */
.window-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--g-spec);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 250;
}
@media (max-width: 768px) {
  .window-frame { --win-r: 22px; }
}


/* ── Il vetro: una ricetta per tutti ────────────────────────────── */
.title-bar,
.glass-nav.scrolled,
.glass-footer,
.theme-toggle,
.footer-social a {
  isolation: isolate;
}
/* la luce che segue il puntatore (glass.js scrive --mx/--my) */
.title-bar::after,
.glass-nav.scrolled::after,
.glass-footer::after,
.theme-toggle::after,
.footer-social a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -60%), var(--g-light), transparent 45%);
  pointer-events: none;
  z-index: -1;
}
/* bordo speculare: luminoso in alto a sinistra e in basso a destra */
.glass-nav.scrolled::before,
.theme-toggle::before,
.footer-social a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--g-spec);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ── Barra del titolo ───────────────────────────────────────────── */
.title-bar {
  height: 52px;
  border-radius: var(--win-r) var(--win-r) 0 0;
  background: var(--g-fill-clear);
  -webkit-backdrop-filter: var(--g-blur-clear);
  backdrop-filter: var(--g-blur-clear);
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--g-hair);
}
.traffic-lights { left: 20px; gap: 9px; }

/* I semafori sono gocce di vetro colorato: riflesso in alto, ombra
   interna in basso. Al passaggio compaiono i simboli, come su macOS. */
.traffic-lights .dot {
  position: relative;
  width: 13px;
  height: 13px;
  box-shadow:
    inset 0 -2px 3px rgb(0 0 0 / 0.16),
    inset 0 0 0 0.5px rgb(0 0 0 / 0.18),
    0 1px 2px rgb(0 0 0 / 0.12);
}
.traffic-lights .dot.red { background: radial-gradient(circle at 50% 30%, #ff8c85 0%, #ff5f57 55%, #e0443c 100%); }
.traffic-lights .dot.yellow { background: radial-gradient(circle at 50% 30%, #ffd77a 0%, #febc2e 55%, #e09e14 100%); }
.traffic-lights .dot.green { background: radial-gradient(circle at 50% 30%, #6fe07f 0%, #28c840 55%, #1aa52f 100%); }
.traffic-lights .dot::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 8%;
  height: 38%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.85), rgb(255 255 255 / 0));
}
.traffic-lights .dot::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 10px/1 -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  color: rgb(0 0 0 / 0.5);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.traffic-lights .dot.red::after { content: "×"; font-size: 11px; }
.traffic-lights .dot.yellow::after { content: "−"; }
.traffic-lights .dot.green::after { content: "+"; }
.traffic-lights:hover .dot { opacity: 1; }
.traffic-lights:hover .dot::after { opacity: 1; }

.window-title { font-weight: 600; letter-spacing: -0.005em; }

/* ── Bottoni di vetro: tema e social ────────────────────────────── */
/* il bottone del tema resta absolute (liquid-glass.css): e' gia' un
   contenitore per i suoi riflessi */
.footer-social a { position: relative; }
.theme-toggle,
.footer-social a {
  border: 0;
  background: var(--g-fill);
  -webkit-backdrop-filter: var(--g-blur);
  backdrop-filter: var(--g-blur);
  box-shadow: var(--g-inset), 0 6px 18px -10px rgb(16 24 40 / 0.35);
  transition: transform 0.35s cubic-bezier(.3, 1.4, .5, 1), color 0.2s ease;
}
.theme-toggle {
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 15px;
}
.theme-toggle:hover,
.footer-social a:hover {
  background: var(--g-fill);
  border-color: transparent;
  transform: translateY(-1px) scale(1.06);
}
.theme-toggle:active,
.footer-social a:active { transform: scale(0.94); transition-duration: 0.12s; }
.footer-social a { width: 38px; height: 38px; }
.footer-social a:hover { color: var(--accent); }

/* Il tooltip del tema (liquid-glass.js lo aggiunge al bottone): dice se il
   tema segue il sistema e cosa fa il bottone. Al passaggio del mouse, col
   focus da tastiera e per un momento dopo un tocco (.show-tip). Niente
   backdrop-filter: un blur dentro il blur del bottone Safari lo ridisegna
   male. */
.theme-tip {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: max-content;
  max-width: 220px;
  padding: 8px 12px;
  border-radius: 12px;
  font: 500 12px/1.35 -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  text-align: left;
  color: var(--text-primary);
  background: var(--tip-bg);
  box-shadow: var(--g-inset), 0 0 0 0.5px var(--g-hair), var(--g-float);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
@media (hover: hover) {
  .theme-toggle:hover .theme-tip { opacity: 1; transform: none; }
}
.theme-toggle:focus-visible .theme-tip,
.theme-toggle.show-tip .theme-tip { opacity: 1; transform: none; }

/* ── Menu ───────────────────────────────────────────────────────── */
.glass-nav { border-bottom: 0; }

.nav-menu a { transition: color 0.2s ease, background 0.25s ease, transform 0.35s cubic-bezier(.3, 1.4, .5, 1); }
.nav-menu a:hover { background: rgb(127 127 127 / 0.1); }
/* la voce attiva: una goccia di vetro verde chiaro */
.nav-menu a.active {
  background: linear-gradient(180deg, rgb(52 199 89 / 0.2), rgb(52 199 89 / 0.1));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), inset 0 0 0 0.5px rgb(52 199 89 / 0.3);
}
/* Contatti: vetro colorato, come il bottone primario delle app */
.nav-menu a.nav-cta {
  color: #fff;
  text-shadow: 0 1px 1px rgb(10 90 30 / 0.3);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.4) 0%, rgb(255 255 255 / 0) 55%),
    linear-gradient(180deg, rgb(70 214 106 / 0.95) 0%, rgb(36 170 70 / 0.97) 100%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.7),
    inset 0 -2px 6px rgb(10 90 30 / 0.28),
    0 0 0 0.5px rgb(20 120 45 / 0.4),
    0 12px 28px -10px rgb(52 199 89 / 0.6);
}
.nav-menu a.nav-cta:hover {
  opacity: 1;
  transform: translateY(-1px) scale(1.03);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.8),
    inset 0 -2px 6px rgb(10 90 30 / 0.28),
    0 0 0 0.5px rgb(20 120 45 / 0.4),
    0 16px 36px -10px rgb(52 199 89 / 0.75);
}

/* Il menu che galleggia scorrendo: vetro quasi trasparente, come le barre
   di iOS. liquid-glass.css lo forza pieno con !important (nero con il
   bordo verde, o bianco): qui serve la stessa arma, con una specificita'
   piu' alta. Entra con una molla fatta solo di translate/scale/opacity,
   che il compositore anima anche in Safari. */
html[data-theme] .glass-nav.scrolled {
  background: var(--g-fill-clear) !important;
  -webkit-backdrop-filter: var(--g-blur-clear) !important;
  backdrop-filter: var(--g-blur-clear) !important;
  border: 0 !important;
  box-shadow: var(--g-float), var(--g-inset) !important;
  /* backwards e non both: finita la molla non deve restare niente. Con
     both restavano opacita', scala e spostamento, e un'opacita' animata fa
     da radice della sfocatura: il vetro del menu su telefono, dentro la
     capsula, non vedeva piu' la pagina. */
  animation: nav-float-in 620ms cubic-bezier(.3, 1.3, .4, 1) backwards;
}
@keyframes nav-float-in {
  from { opacity: 0; translate: 0 -16px; scale: 0.94; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}

/* La lingua: un selettore a segmenti di vetro, come quelli di iOS e delle
   schede di Pizza Architect. Un binario scavato, e una goccia di vetro
   sotto la lingua attiva; la barretta fra le due non serve piu'. */
.lang-switch {
  gap: 0;
  padding: 3px;
  border-radius: 999px;
  background: rgb(127 127 127 / 0.13);
  box-shadow: inset 0 1px 2px rgb(16 24 40 / 0.16), 0 1px 0 rgb(255 255 255 / 0.2);
}
.lang-switch .separator { display: none; }
.lang-switch .lang-btn {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  transition: color 0.2s ease, background 0.25s ease;
}
.lang-switch .lang-btn:hover { color: var(--text-primary); background: rgb(127 127 127 / 0.1); }
/* La goccia attiva e' vetro senza sfocatura: sta gia' dentro il vetro del
   menu, e un backdrop-filter dentro un altro Safari lo ridisegna male. La
   fanno vetro la trasparenza e il bordo di luce. */
.lang-switch .lang-btn.active,
.lang-switch .lang-btn.active:hover {
  position: relative;
  color: var(--text-primary);
  background: var(--seg-thumb);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.5),
    0 0 0 0.5px var(--g-hair),
    0 3px 8px -2px rgb(16 24 40 / 0.22);
}
.lang-switch .lang-btn.active::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--g-spec);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
/* Nel tema chiaro la goccia era bianca su un menu gia' chiaro, e il bordo
   di luce, bianco su bianco, spariva: si leggeva come un selettore iOS
   qualunque. Il vetro qui lo fa il contrasto: binario chiaro e trasparente
   invece del grigio pieno, goccia con un filo scuro e un'ombra piu' netta,
   come una lente appoggiata sopra. Le regole battono anche quelle del
   telefono (piu' specifiche), e il tema scuro non cambia. */
[data-theme="light"] .lang-switch {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.22), rgb(255 255 255 / 0.42));
  box-shadow:
    inset 0 1px 3px rgb(16 24 40 / 0.14),
    inset 0 0 0 0.5px rgb(16 24 40 / 0.1),
    0 1px 0 rgb(255 255 255 / 0.7);
}
[data-theme="light"] .lang-switch .lang-btn.active,
[data-theme="light"] .lang-switch .lang-btn.active:hover {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.85), rgb(255 255 255 / 0.4));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.9),
    inset 0 -1px 2px rgb(16 24 40 / 0.08),
    0 0 0 0.5px rgb(16 24 40 / 0.16),
    0 4px 10px -3px rgb(16 24 40 / 0.32);
}

/* Nel menu a tendina del telefono: centrato, piu' grande da toccare, e
   con piu' volume. Sulla lastra quasi bianca del menu una goccia di vetro
   trasparente spariva e restava un selettore grigio piatto: qui il binario
   e' scavato con il bordo di luce, e la goccia ha un'ombra piu' marcata. */
@media (max-width: 768px) {
  .lang-switch {
    position: relative;
    width: auto;
    margin: var(--space-xl) auto 0;
    padding: 3px;
    border-top: 0;
    background: rgb(127 127 127 / 0.16);
    box-shadow: inset 0 2px 4px rgb(16 24 40 / 0.2), inset 0 0 0 0.5px var(--g-hair);
  }
  .lang-switch::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(180deg, transparent 40%, rgb(255 255 255 / 0.6));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
  }
  .lang-switch .lang-btn {
    padding: 6px 18px;
    font-size: 13px;
  }
  .lang-switch .lang-btn.active,
  .lang-switch .lang-btn.active:hover {
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.6),
      0 0 0 0.5px var(--g-hair),
      0 6px 14px -4px rgb(16 24 40 / 0.35),
      0 1px 3px rgb(16 24 40 / 0.12);
  }
}

/* ── Menu su telefono ───────────────────────────────────────────── */
/* Il pannello a tendina e' una lastra di vetro invece del fondo pieno.
   Sta dentro la capsula del menu, che scorrendo e' gia' vetro: un vetro
   dentro un vetro in Chrome vede solo la capsula (il backdrop-filter la
   rende "radice" della sfocatura) e in Safari si ridisegna male. Mentre il
   menu e' aperto la capsula perde la sfocatura: il pannello la copre, e
   cosi' sfoca la pagina vera. */
@media (max-width: 768px) {
  .nav-links {
    background: var(--sheet);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    backdrop-filter: blur(30px) saturate(180%);
    box-shadow: inset 0 1px 0 var(--g-hair), 0 30px 60px -30px rgb(16 24 40 / 0.4);
  }
  /* Il bottone che apre e chiude il menu: una lente tonda come il bottone
     del tema, con le tre linee piu' corte dentro; la X resta quella di
     liquid-glass.css. Niente sfocatura: scorrendo sta dentro la capsula
     di vetro, e un vetro dentro l'altro Safari lo ridisegna male. */
  .menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--g-fill);
    box-shadow:
      var(--g-inset),
      0 0 0 0.5px var(--g-hair),
      0 6px 16px -8px rgb(16 24 40 / 0.4);
    transition: transform 0.35s cubic-bezier(.3, 1.4, .5, 1);
  }
  .menu-btn:active { transform: scale(0.92); transition-duration: 0.12s; }
  /* Le linee stanno tutte al centro e si separano con translate: cosi' il
     passaggio a X anima solo transform e opacita' (prima animava top e
     bottom), con la molla dei bottoni. La X ruota, va un filo oltre e si
     assesta; la linea centrale si stringe e sfuma. Le liste di funzioni
     sono le stesse nei due stati, perche' l'interpolazione resti pulita. */
  .menu-btn span,
  .menu-btn::before,
  .menu-btn::after {
    left: 11px;
    width: 18px;
    height: 2px;
    top: 50%;
    bottom: auto;
    margin-top: -1px;
    --gap: 6px;
    transition: transform 0.55s cubic-bezier(.3, 1.5, .5, 1), opacity 0.2s ease;
  }
  .menu-btn::before { transform: translateY(calc(-1 * var(--gap))) rotate(0deg); }
  .menu-btn::after { transform: translateY(var(--gap)) rotate(0deg); }
  .menu-btn span { transform: scaleX(1); }
  .menu-btn.active::before { top: 50%; transform: translateY(0) rotate(45deg); }
  .menu-btn.active::after { top: 50%; bottom: auto; transform: translateY(0) rotate(-45deg); }
  .menu-btn.active span { opacity: 0; transform: scaleX(0.2); }
  /* scorrendo la capsula si stringe: il bottone ci sta dentro con un
     respiro uguale sopra e sotto */
  .glass-nav.scrolled .menu-btn { width: 36px; height: 36px; }
  .glass-nav.scrolled .menu-btn span,
  .glass-nav.scrolled .menu-btn::before,
  .glass-nav.scrolled .menu-btn::after { left: 10px; width: 16px; --gap: 5px; }

  /* Scorrendo, su telefono la capsula non c'e': conteneva solo il
     bottone, e restava un'ellisse larga quanto lo schermo con un tondo in
     mezzo. Galleggia il solo bottone, come i bottoni flottanti di iOS, e
     da solo puo' sfocare quello che gli passa sotto (nessun vetro intorno).
     La barra resta larga quanto lo schermo per centrarlo, ma e'
     trasparente e non prende i tocchi: li prendono il bottone e il menu
     aperto. Senza transform ne' filtri, il menu aperto si misura sullo
     schermo. */
  html[data-theme] .glass-nav.scrolled {
    left: 0 !important;
    width: 100% !important;
    padding: 0 !important;
    background: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    pointer-events: none;
  }
  .glass-nav.scrolled::before,
  .glass-nav.scrolled::after { display: none; }
  .glass-nav.scrolled .menu-btn {
    pointer-events: auto;
    -webkit-backdrop-filter: var(--g-blur);
    backdrop-filter: var(--g-blur);
  }

  html[data-theme] .glass-nav.scrolled:has(.nav-links.open) {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  /* fino in fondo allo schermo: prima restava scoperta una striscia di
     pagina. Senza sfocatura la capsula non contiene piu' il pannello, che
     si misura sullo schermo: da qui anche left: 0, che liquid-glass.css
     aveva tolto quando il pannello si misurava sulla capsula. */
  .nav-links { left: 0; height: calc(100vh - 30px); height: calc(100dvh - 30px); }
  .glass-nav.scrolled .nav-links { top: 0; height: 100vh; height: 100dvh; padding-top: 72px; }
}

/* ── Pie' di pagina ─────────────────────────────────────────────── */
.glass-footer {
  position: relative;
  border-radius: 0 0 var(--win-r) var(--win-r);
  border-top: 0;
  background: var(--g-fill-clear);
  -webkit-backdrop-filter: var(--g-blur-clear);
  backdrop-filter: var(--g-blur-clear);
  box-shadow: inset 0 1px 0 var(--g-hair);
}

/* ── Hero ───────────────────────────────────────────────────────── */
/* il titolo sta direttamente sulla scrivania: un alone del colore di
   fondo lo stacca dalle lenti che gli passano dietro */
.hero-title { text-shadow: 0 2px 30px var(--bg-primary); }
.hero-title .accent { text-shadow: none; }

/* L'invito a scorrere: il mouse e' una capsula di vetro e la rotellina una
   goccia verde. Il movimento resta quello di liquid-glass.css (transform e
   opacita'). */
.scroll-indicator .mouse-icon {
  width: 26px;
  height: 42px;
  border: 0;
  border-radius: 13px;
  isolation: isolate;
  background: var(--g-fill);
  -webkit-backdrop-filter: var(--g-blur);
  backdrop-filter: var(--g-blur);
  /* il filo di contorno: nel tema chiaro, bianco su bianco, spariva */
  box-shadow: var(--g-inset), 0 0 0 0.5px var(--g-hair), 0 10px 24px -8px rgb(16 24 40 / 0.35);
  transition: transform 0.35s cubic-bezier(.3, 1.4, .5, 1);
}
.scroll-indicator .mouse-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--g-spec);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.scroll-indicator .mouse-icon::after,
.scroll-indicator:hover .mouse-icon::after {
  width: 5px;
  height: 9px;
  top: 8px;
  border-radius: 3px;
  background: linear-gradient(180deg, #6fe07f, var(--accent));
  box-shadow: 0 0 8px var(--accent), inset 0 1px 0 rgb(255 255 255 / 0.6);
}
.scroll-indicator:hover .mouse-icon { transform: translateY(-2px) scale(1.06); }

/* ── Curriculum e contatti ──────────────────────────────────────── */
/* Le card (esperienze, formazione, certificazioni, servizi, contatti):
   stesso vetro della barra e dei bottoni, bordo di luce e riflesso che
   segue il puntatore. Sono i vetri piu' numerosi del sito: quelli fuori
   dallo schermo il browser non li risfoca, ma non aggiungerne altri. */
/* "Chi sono" e le competenze non sono card nell'HTML, ma stavano sulla
   scrivania e il loro testo si mescolava al codice: anche loro su una
   lastra, senza il sollevamento delle card. */
.glass-card,
.about-content,
.skills-grid {
  position: relative;
  isolation: isolate;
  border: 0;
  border-radius: 20px;
  background: var(--g-fill);
  -webkit-backdrop-filter: var(--g-blur);
  backdrop-filter: var(--g-blur);
  box-shadow: var(--g-inset), 0 0 0 0.5px var(--g-hair), 0 18px 40px -24px rgb(16 24 40 / 0.35);
  transition: transform 0.45s cubic-bezier(.3, 1.3, .4, 1), box-shadow 0.3s ease;
}
.glass-card:hover {
  transform: translateY(-3px);
  border-color: transparent;
  box-shadow: var(--g-inset), 0 0 0 0.5px var(--g-hair), 0 26px 50px -24px rgb(16 24 40 / 0.45);
}
/* Il bordo di luce prende il posto della linea verde a sinistra delle
   voci del curriculum (stesso ::before): dentro una card tonda la linea
   stonava. Vale anche per l'ultima voce, a cui liquid-glass.css la toglie. */
.glass-card::before,
.about-content::before,
.skills-grid::before,
.resume-item.glass-card::before,
.resume-item.glass-card:last-child::before {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  width: auto;
  border-radius: inherit;
  padding: 1px;
  background: var(--g-spec);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.glass-card::after,
.about-content::after,
.skills-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -60%), var(--g-light), transparent 45%);
  pointer-events: none;
  z-index: -1;
}
.resume-item.glass-card { padding: 20px 22px; }
.about-content { padding: 28px; }
.skills-grid { padding: 12px 28px 20px; column-gap: 28px; }

/* etichette di sezione e date: gocce di vetro verde */
.section-title,
.resume-item .date {
  border: 0;
  background: linear-gradient(180deg, rgb(52 199 89 / 0.2), rgb(52 199 89 / 0.08));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), inset 0 0 0 0.5px rgb(52 199 89 / 0.35);
}

/* la foto: una lente, con l'anello di vetro e l'ombra */
.about-image {
  border: 3px solid rgb(255 255 255 / 0.55);
  box-shadow: 0 0 0 0.5px var(--g-hair), 0 14px 34px -12px rgb(16 24 40 / 0.45);
}

/* le competenze: binario di vetro scavato, riempimento verde luminoso */
.skill-item .progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgb(127 127 127 / 0.14);
  box-shadow: inset 0 1px 2px rgb(16 24 40 / 0.18), 0 1px 0 rgb(255 255 255 / 0.25);
}
.skill-item .progress-fill {
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.45), rgb(255 255 255 / 0) 60%),
    var(--accent-gradient);
  box-shadow: 0 0 10px rgb(52 199 89 / 0.4);
}

/* le icone dei servizi e dei contatti: piccole lenti */
.service-card .icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 22px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgb(52 199 89 / 0.2), rgb(52 199 89 / 0.07));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.4), inset 0 0 0 0.5px rgb(52 199 89 / 0.35);
}

/* Scarica CV: vetro verde, come Contatti nel menu */
.btn-submit {
  color: #fff;
  text-shadow: 0 1px 1px rgb(10 90 30 / 0.3);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.4) 0%, rgb(255 255 255 / 0) 55%),
    linear-gradient(180deg, rgb(70 214 106 / 0.95) 0%, rgb(36 170 70 / 0.97) 100%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.7),
    inset 0 -2px 6px rgb(10 90 30 / 0.28),
    0 0 0 0.5px rgb(20 120 45 / 0.4),
    0 12px 28px -10px rgb(52 199 89 / 0.6);
  transition: transform 0.35s cubic-bezier(.3, 1.4, .5, 1), box-shadow 0.3s ease;
}
.btn-submit:hover {
  color: #fff;
  transform: translateY(-1px) scale(1.03);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.8),
    inset 0 -2px 6px rgb(10 90 30 / 0.28),
    0 0 0 0.5px rgb(20 120 45 / 0.4),
    0 16px 36px -10px rgb(52 199 89 / 0.75);
}

/* la mappa: una lastra con il bordo di luce. Leaflet mette i suoi livelli
   fino a z-index 1000: il bordo sta sopra, e non intercetta il mouse. */
.map-container {
  position: relative;
  border: 0 !important;
  border-radius: 24px;
  box-shadow: 0 0 0 0.5px var(--g-hair), 0 24px 50px -24px rgb(16 24 40 / 0.45) !important;
}
.map-container::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.6), inset 0 0 0 1px rgb(255 255 255 / 0.25);
  pointer-events: none;
  z-index: 1001;
}

/* Sulla mappa il vetro e' quello di Apple Maps: la mappa resta piena (le
   tessere trasparenti non si leggerebbero) e il vetro sono i controlli che
   ci galleggiano sopra e la sfocano. */
.map-container .leaflet-bar,
.map-container .leaflet-touch .leaflet-bar,
.leaflet-touch .map-container .leaflet-bar {
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--g-fill-clear);
  -webkit-backdrop-filter: var(--g-blur-clear);
  backdrop-filter: var(--g-blur-clear);
  box-shadow: var(--g-float), var(--g-inset), 0 0 0 0.5px var(--g-hair);
}
.map-container .leaflet-bar a,
.leaflet-touch .map-container .leaflet-bar a {
  width: 36px;
  height: 36px;
  line-height: 36px;
  font-size: 20px;
  font-weight: 400;
  color: var(--text-primary);
  background: transparent;
  border-bottom: 0.5px solid var(--g-hair);
}
.map-container .leaflet-bar a:last-child { border-bottom: 0; }
.map-container .leaflet-bar a:hover { background: rgb(127 127 127 / 0.14); color: var(--text-primary); }
.map-container .leaflet-top.leaflet-left .leaflet-control { margin: 14px 0 0 14px; }

/* il credito di OpenStreetMap (lo chiede la licenza): una pillola di vetro */
.map-container .leaflet-control-attribution {
  margin: 0 12px 12px 0 !important;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--g-fill-clear) !important;
  -webkit-backdrop-filter: var(--g-blur-clear);
  backdrop-filter: var(--g-blur-clear);
  box-shadow: var(--g-inset), 0 0 0 0.5px var(--g-hair);
}
.map-container .leaflet-control-attribution a { color: var(--accent); }

/* Il segnaposto: una goccia di vetro verde con la punta in basso, e un
   anello che si allarga e sfuma (solo scala e opacita'). */
.lg-pin { background: none; border: 0; }
.lg-pin span {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background:
    radial-gradient(circle at 50% 50%, #fff 0 4.5px, transparent 5.5px),
    radial-gradient(60% 50% at 35% 25%, rgb(255 255 255 / 0.7), transparent 70%),
    linear-gradient(180deg, #46d66a, #1e9a44);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.7),
    inset 0 -3px 6px rgb(10 90 30 / 0.35),
    0 0 0 0.5px rgb(20 120 45 / 0.5),
    0 8px 16px -4px rgb(10 90 30 / 0.5);
}
.lg-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 28px;
  height: 12px;
  margin-left: -14px;
  border-radius: 50%;
  background: rgb(52 199 89 / 0.45);
  z-index: -1;
  will-change: transform, opacity;
  animation: lg-pin-pulse 2.4s ease-out infinite;
}
@keyframes lg-pin-pulse {
  from { transform: scale(0.4); opacity: 0.9; }
  to { transform: scale(2.2); opacity: 0; }
}

/* Nel tema scuro la mappa chiara di OpenStreetMap abbagliava: si
   invertono le sole tessere (non il segnaposto ne' i controlli) e si
   riportano le tinte al loro posto con hue-rotate. */
:root:not([data-theme="light"]) .map-container .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.7);
}
:root:not([data-theme="light"]) .map-container { background: #1a1d22 !important; }

/* ── Movimento ridotto, meno trasparenza ────────────────────────── */
/* ── Entrata delle sezioni ─────────────────────────────────────────
   Il vetro non entra in dissolvenza: mentre una sezione sfuma, i vetri
   dentro non sfocano (un antenato con opacita' < 1 li isola dallo sfondo; in
   Safari il blur resta spento per tutta la transizione) e alla fine
   "scattano" a vetro. La sezione quindi si muove soltanto, e sfuma tutto cio'
   che non e' vetro e non ne contiene: i titoli e il contenuto delle card.
   Senza :has() le sezioni si muovono e basta. */
.reveal { opacity: 1; }
.reveal:not(.visible) > :not(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container):not(:has(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container)),
.reveal:not(.visible) :is(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container, :has(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container)) > :not(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container):not(:has(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container)) { opacity: 0; }
/* un'animazione e non una transizione: non sostituisce le transizioni
   (hover) che quegli elementi hanno gia' */
.reveal.visible > :not(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container):not(:has(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container)),
.reveal.visible :is(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container, :has(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container)) > :not(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container):not(:has(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container)) {
  animation: reveal-in 0.8s ease-out backwards;
}
@keyframes reveal-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .lg-disc, .lg-ring, .lg-caret, .lg-pin::after { animation: none; }
  .menu-btn span, .menu-btn::before, .menu-btn::after { transition-duration: 1ms; }
  html[data-theme] .glass-nav.scrolled { animation: none; }
  .reveal.visible > :not(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container):not(:has(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container)),
  .reveal.visible :is(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container, :has(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container)) > :not(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container):not(:has(.glass-card, .glass-panel, .about-content, .skills-grid, .map-container)) { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .title-bar, .glass-footer, html[data-theme] .glass-nav.scrolled { background: var(--bg-primary) !important; }
}
