/* =========================================================
   HOME.CSS — la schermata di selezione
   Due mondi separati da un taglio diagonale.
   Tutto ruota attorno a una sola variabile: --split
   (0 = tutto il mondo di destra, 1 = tutto quello di sinistra).
   ========================================================= */

/* --split deve essere "registrata" per poter essere animata. */
@property --split {
  syntax: "<number>";
  inherits: true;
  initial-value: 0.5;
}

.pagina-scelta {
  height: 100svh;
  overflow: hidden;
  background: #05060d;
}

.scelta {
  --split: .5;          /* posizione del taglio */
  --obliquo: 4vh;       /* quanto è inclinato il taglio */
  position: relative;
  height: 100svh;
  isolation: isolate;
  transition: --split 1s var(--molla);
}

/* --- I due pannelli --------------------------------------------------- */
.mondo {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.mondo--drone {
  clip-path: polygon(0 0,
    calc(var(--split) * 100% + var(--obliquo)) 0,
    calc(var(--split) * 100% - var(--obliquo)) 100%,
    0 100%);
}
.mondo--luce {
  clip-path: polygon(calc(var(--split) * 100% + var(--obliquo)) 0,
    100% 0, 100% 100%,
    calc(var(--split) * 100% - var(--obliquo)) 100%);
}

/* Sfondo: immagine + velatura di colore proprio del mondo */
.mondo__sfondo {
  position: absolute; inset: -4%;
  background-size: cover; background-position: center;
  transform: scale(1.02);
  transition: transform 1.4s var(--molla), filter .8s var(--dolce);
}
.mondo--drone .mondo__sfondo {
  background-image:
    radial-gradient(120% 90% at 50% 20%, rgba(76,225,255,.16), transparent 60%),
    linear-gradient(to bottom, rgba(4,7,20,.35), rgba(4,7,20,.9)),
    url("../img/sfondo-drone.svg");
}
.mondo--luce .mondo__sfondo {
  background-image:
    radial-gradient(110% 80% at 50% 62%, rgba(227,168,92,.22), transparent 65%),
    linear-gradient(to bottom, rgba(28,21,38,.5), rgba(28,21,38,.82)),
    url("../img/sfondo-luce.svg");
}

/* Strato che scurisce il mondo non scelto */
.mondo__ombra {
  position: absolute; inset: 0;
  background: #04050c;
  opacity: 0;
  transition: opacity .75s var(--dolce);
  pointer-events: none;
  z-index: 3;
}

.mondo__particelle {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* --- Contenuto di ogni mondo ------------------------------------------ */
.mondo__contenuto {
  position: absolute; top: 0; bottom: 0;
  z-index: 4;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(.7rem, 1.5vh, 1.4rem);
  text-align: center;
  padding: 7rem clamp(1.5rem, 4vw, 4rem) 5rem;
  transition: opacity .5s var(--dolce);
}
.mondo--drone .mondo__contenuto { left: 0; width: calc(var(--split) * 100%); padding-right: 7vh; }
.mondo--luce  .mondo__contenuto { right: 0; width: calc(100% - var(--split) * 100%); padding-left: 7vh; }

.mondo__cover {
  width: auto;
  height: min(34vh, 22rem);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  transition: transform .9s var(--molla), box-shadow .9s var(--dolce);
}
.mondo--drone .mondo__cover {
  clip-path: polygon(0 0, 100% 0, 100% 88%, 88% 100%, 0 100%);
  box-shadow: 0 24px 60px -20px rgba(76,225,255,.5), 0 0 0 1px rgba(76,225,255,.35) inset;
}
.mondo--luce .mondo__cover {
  border-radius: 3px;
  box-shadow: 0 26px 70px -24px rgba(0,0,0,.85), 0 0 0 6px rgba(242,231,213,.08);
}

.mondo__genere {
  font-size: var(--t-xs);
  letter-spacing: .28em;
  text-transform: uppercase;
  opacity: .75;
}
.mondo--drone .mondo__genere { font-family: var(--f-mono); color: #7fe6ff; }
.mondo--luce  .mondo__genere { font-family: var(--f-corpo); letter-spacing: .2em; color: #e8c79a; }

.mondo__titolo {
  font-size: var(--t-lg);
  line-height: .95;
  font-weight: 700;
}
.mondo--drone .mondo__titolo {
  font-family: var(--f-drone);
  color: #ecf7ff;
  letter-spacing: -.01em;
  text-shadow: 0 0 34px rgba(76,225,255,.55);
}
.mondo--luce .mondo__titolo {
  font-family: var(--f-luce);
  font-weight: 500;
  font-variation-settings: "SOFT" 40, "WONK" 1;
  color: #fbeedd;
  letter-spacing: -.015em;
}

.mondo__frase {
  max-width: 26ch;
  font-size: var(--t-sm);
  line-height: 1.55;
  color: rgba(255,255,255,.74);
  text-wrap: balance;
}
.mondo--luce .mondo__frase { font-style: italic; color: rgba(255,240,224,.8); }

.mondo__entra { margin-top: .6rem; }
.mondo--drone .mondo__entra {
  --b-colore: #4ce1ff;
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: var(--t-xs);
  clip-path: polygon(0 0, 100% 0, 100% 62%, calc(100% - .9rem) 100%, 0 100%);
}
.mondo--luce .mondo__entra {
  --b-colore: #f0d3a6;
  border-radius: 999px;
  font-weight: 500;
}

/* --- Reazione al passaggio del mouse ---------------------------------- */
@media (hover: hover) and (pointer: fine) {
  .scelta.verso-drone { --split: .64; }
  .scelta.verso-luce  { --split: .36; }

  .scelta.verso-drone .mondo--luce  .mondo__ombra,
  .scelta.verso-luce  .mondo--drone .mondo__ombra { opacity: .62; }

  .scelta.verso-drone .mondo--luce  .mondo__sfondo,
  .scelta.verso-luce  .mondo--drone .mondo__sfondo { filter: saturate(.35) blur(2px); }

  .scelta.verso-drone .mondo--luce  .mondo__contenuto,
  .scelta.verso-luce  .mondo--drone .mondo__contenuto { opacity: .45; }

  .mondo:hover .mondo__sfondo { transform: scale(1.09); }
  .mondo:hover .mondo__cover  { transform: translateY(-10px) scale(1.03); }
  .mondo--drone:hover .mondo__cover { box-shadow: 0 30px 80px -18px rgba(76,225,255,.75), 0 0 0 1px rgba(76,225,255,.6) inset; }
}

/* --- La cucitura luminosa fra i due mondi ----------------------------- */
.cucitura {
  position: absolute; top: -10%; bottom: -10%;
  left: calc(var(--split) * 100%);
  width: 2px;
  transform: translateX(-50%) skewX(-4.5deg);
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,.85), rgba(255,255,255,.25), transparent);
  box-shadow: 0 0 26px rgba(255,255,255,.35);
  z-index: 5;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* --- Marchio dello studio e suggerimento ------------------------------ */
.marchio {
  position: absolute; z-index: 6;
  top: clamp(1.4rem, 3.5vh, 2.6rem); left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: .6rem;
  font-size: var(--t-sm); font-weight: 600; letter-spacing: .05em;
  color: #fff;
  mix-blend-mode: difference;
}
.marchio__segno {
  width: 1.55rem; height: 1.55rem;
  border: 1.5px solid currentColor;
  transform: rotate(45deg);
  position: relative;
}
.marchio__segno::after {
  content: ""; position: absolute; inset: 4px 4px auto auto;
  width: 5px; height: 5px; background: currentColor;
}

.suggerimento {
  position: absolute; z-index: 6;
  bottom: clamp(1.3rem, 4vh, 2.6rem); left: 50%;
  transform: translateX(-50%);
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
  white-space: nowrap;
}
@keyframes respiro { 0%, 100% { opacity: .35; } 50% { opacity: .85; } }

/* --- Uscita verso la pagina del gioco --------------------------------- */
.scelta.esci-drone { --split: 1; }
.scelta.esci-luce  { --split: 0; }
.scelta.esci-drone .mondo--luce,
.scelta.esci-luce  .mondo--drone { opacity: 0; transition: opacity .5s var(--dolce); }
.scelta.esci-drone .cucitura,
.scelta.esci-luce  .cucitura,
.scelta.esci-drone .suggerimento,
.scelta.esci-luce  .suggerimento { opacity: 0; transition: opacity .35s; }
.scelta.esci-drone .mondo--drone .mondo__contenuto,
.scelta.esci-luce  .mondo--luce  .mondo__contenuto {
  transform: scale(1.08);
  opacity: 0;
  transition: transform .9s var(--molla), opacity .7s .2s var(--dolce);
}

/* Il velo che copre lo schermo un attimo prima del cambio pagina */
.velo {
  position: fixed; inset: 0; z-index: 90;
  pointer-events: none;
  opacity: 0;
  transition: opacity .55s var(--dolce);
}
.velo.attivo { opacity: 1; }
.velo[data-verso="drone"] { background: radial-gradient(circle at 50% 55%, #0d1a4a, #04060f 70%); }
.velo[data-verso="luce"]  { background: radial-gradient(circle at 50% 55%, #f2e7d5, #d9c3a4 75%); }

/* --- Apertura della pagina (prima visita) ----------------------------- */
.mondo { animation: entra-dolce 1.2s var(--molla) both; }
.mondo--luce { animation-delay: .12s; }
@keyframes entra-dolce {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cucitura { animation: entra-dolce 1.6s .35s var(--molla) both; }

.marchio { animation: entra-marchio 1.1s .5s var(--molla) both; }
@keyframes entra-marchio {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%); }
}
/* prima entra, poi comincia a respirare */
.suggerimento {
  animation: entra-marchio 1.1s .75s var(--molla) both,
             respiro 4s 1.9s ease-in-out infinite;
}

/* =========================================================
   MOBILE — il taglio diventa orizzontale, i mondi si impilano
   ========================================================= */
@media (max-width: 860px), (orientation: portrait) and (max-width: 1024px) {
  .scelta { --split: .5; --obliquo: 3vw; }

  .mondo--drone {
    clip-path: polygon(0 0, 100% 0,
      100% calc(var(--split) * 100% - var(--obliquo)),
      0 calc(var(--split) * 100% + var(--obliquo)));
  }
  .mondo--luce {
    clip-path: polygon(0 calc(var(--split) * 100% + var(--obliquo)),
      100% calc(var(--split) * 100% - var(--obliquo)),
      100% 100%, 0 100%);
  }

  .mondo__contenuto {
    left: 0 !important; right: 0 !important;
    width: 100% !important;
    padding: 1.5rem !important;
    gap: .55rem;
  }
  .mondo--drone .mondo__contenuto { top: 0; bottom: 50%; padding-bottom: 3.5rem !important; }
  .mondo--luce  .mondo__contenuto { top: 50%; bottom: 0; padding-top: 3.5rem !important; }

  .mondo__cover { height: min(20vh, 11rem); }
  .mondo__titolo { font-size: clamp(1.6rem, 7.5vw, 2.4rem); }
  .mondo__frase { font-size: var(--t-xs); max-width: 30ch; }

  .cucitura {
    top: calc(var(--split) * 100%); bottom: auto; left: -10%; right: -10%;
    width: auto; height: 2px;
    transform: translateY(-50%) skewY(-3.4deg);
    background: linear-gradient(to right, transparent, rgba(255,255,255,.8), transparent);
  }

  .marchio { top: 50%; transform: translate(-50%, -50%); }
  .marchio { animation: none; opacity: 1; }
  .suggerimento { display: none; }

  .scelta.esci-drone .mondo--drone .mondo__contenuto,
  .scelta.esci-luce  .mondo--luce  .mondo__contenuto { transform: scale(1.05); }
}

/* Schermi molto bassi: niente copertina, solo testo */
@media (max-height: 560px) and (min-width: 861px) {
  .mondo__cover { display: none; }
}
