/* ---------- Base comune a tutte le pagine (colori, font, reset) ---------- */
:root {
  --space: #05070b;
  --bone: #ece8df;
  --mute: #8d95a3;
  --glow: #7fdcd0;
  --display: "Neuton", "Times New Roman", serif;   /* solo il menu del pianeta */
  --text: "Helvetica Neue", Helvetica, Arial, sans-serif;   /* tutti gli altri testi */
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--space);
  color: var(--bone);
  font-family: var(--text);   /* tutti i testi in Helvetica Neue; Neuton resta solo nel menu del pianeta */
  font-weight: 300;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}


/* ---------- Cursore personalizzato (js/cursor.js) ---------- */
html.has-cursor,
html.has-cursor * { cursor: none !important; }   /* nasconde il cursore di sistema solo se c'è quello nuovo */

/* contenitore: tutto quello che c'è dentro si inverte su ciò che ha sotto */
.cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2147483647;       /* sopra tutto */
  width: 0;
  height: 0;
  pointer-events: none;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity .2s ease;
}
.cursor.is-visible { opacity: 1; }

/* il rettangolino: posizione e misure le aggiorna js/cursor.js a ogni fotogramma */
.cursor-box {
  position: absolute;
  left: 0;
  top: 0;
  border: 1px solid #fff;
  background-color: transparent;
  transition: background-color .2s ease;
  will-change: transform, width, height;
}
/* la croce, più piccola, centrata sul punto */
.cursor-cross {
  position: absolute;
  left: -3.5px;
  top: -3.5px;
  width: 7px;
  height: 7px;
  background:
    linear-gradient(#fff, #fff) center / 100% 1px no-repeat,
    linear-gradient(#fff, #fff) center / 1px 100% no-repeat;
  transition: opacity .15s ease;
  will-change: transform;
}

/* sopra qualcosa di cliccabile: quadratino pieno, niente croce */
.cursor.is-hover .cursor-box { background-color: #fff; }
.cursor.is-hover .cursor-cross { opacity: 0; }
/* sopra un campo dove si scrive: una barretta sottile (le misure le dà js/cursor.js), niente croce */
.cursor.is-text .cursor-box { background-color: #fff; }
.cursor.is-text .cursor-cross { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .cursor, .cursor-box, .cursor-cross { transition: none; }
}

/* ---------- Ritorno al globo: piccola Terra 3D in alto a sinistra (js/mini-globe.js e js/home-globe.js) ---------- */
.home {
  position: fixed;
  top: max(32px, env(safe-area-inset-top));
  left: 40px;
  z-index: 3;
  display: block;
  width: 38px;                      /* il piccolo globo (Works, Photography) */
  height: 38px;
  color: var(--bone);
  transition: color .3s;
}
.home svg,
.home canvas { display: block; width: 100%; height: 100%; }
.home.has-globe svg { display: none; }   /* c'è la Terra 3D: l'icona disegnata non serve */
.home.is-locked,
html:not(.has-cursor) .home:hover { color: var(--glow); }
.home:focus-visible { outline: 1px solid var(--bone); outline-offset: 8px; }
.home.is-expanding { pointer-events: none; }

/* ---------- Suoni accesi o spenti (js/sound-toggle.js): in alto a destra, alla linea del piccolo globo ---------- */
.sound-toggle {
  position: fixed;
  top: calc(max(32px, env(safe-area-inset-top)) + 13px);
  right: 40px;
  z-index: 5;                        /* sopra le pagine; sotto il globo che cresce e la pagina del pianeta (10, 11) */
  display: flex;
  align-items: center;
  gap: 10px;
  height: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  mix-blend-mode: difference;        /* come il cursore: leggibile sia sul chiaro che sullo scuro (anche sopra le foto) */
  font: 400 10px/1 var(--text);
  letter-spacing: .2em;
  text-transform: uppercase;
  transition: opacity .3s;
}
.sound-bars { display: flex; align-items: flex-end; gap: 2px; height: 10px; }
.sound-bars i {
  display: block;
  width: 2px;
  height: 100%;
  background: currentColor;
  transform-origin: bottom;
  animation: sound-bar 1s ease-in-out infinite alternate;
}
.sound-bars i:nth-child(2) { animation-duration: .7s; animation-delay: -.3s; }
.sound-bars i:nth-child(3) { animation-duration: 1.2s; animation-delay: -.6s; }
.sound-bars i:nth-child(4) { animation-duration: .85s; animation-delay: -.15s; }
@keyframes sound-bar { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
.sound-toggle.is-off .sound-bars i { animation: none; transform: scaleY(.2); }   /* spenti: barrette basse e ferme */
.sound-toggle.is-off { opacity: .6; }
.sound-toggle.is-locked,
html:not(.has-cursor) .sound-toggle:hover { opacity: 1; }
.sound-toggle:focus-visible { outline: 1px solid #fff; outline-offset: 8px; }
@media (max-width: 640px) {
  .sound-toggle { right: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .sound-bars i { animation: none; transform: scaleY(.6); }
}

/* ---------- Passaggio al pianeta: il globo che cresce e la pagina che gli compare sopra ---------- */
.globe-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
.globe-layer canvas { display: block; width: 100%; height: 100%; }
.planet-frame {
  position: fixed;
  inset: 0;
  z-index: 11;                      /* sopra il globo: quando è pronta si dissolve sopra di lui */
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  pointer-events: none;
  background: var(--space);
}
.planet-frame.is-page { pointer-events: auto; }
