/* ============================================================
   MIRA — TEASER "Sta arrivando" (cinematografico)
   Brand LOCKED: ink #1F1B17 · carta #FAF6F1 · corallo #E8633A
   · viola AI #6A5AE0 · verde #1F9D6B
   Display: Space Grotesk · Testo: Plus Jakarta Sans
   Animazioni: solo transform/opacity (60fps).
   ============================================================ */

:root {
  --ink: #1F1B17;
  --nero: #0D0B09;
  --paper: #FAF6F1;
  --paper-60: rgba(250, 246, 241, .60);
  --paper-38: rgba(250, 246, 241, .38);
  --paper-14: rgba(250, 246, 241, .14);
  --paper-08: rgba(250, 246, 241, .08);
  --coral: #E8633A;
  --coral-soft: rgba(232, 99, 58, .32);
  --viola: #8D80EC;      /* viola AI schiarito per contrasto su scuro */
  --viola-deep: #6A5AE0;
  --verde: #35B885;      /* verde brand schiarito per contrasto su scuro */
  --disp: "Space Grotesk", system-ui, sans-serif;
  --sans: "Plus Jakarta Sans", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background:
    radial-gradient(120vmax 90vmax at 50% -20%, #2A241E 0%, var(--ink) 42%, var(--nero) 100%)
    var(--nero);
  color: var(--paper);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--coral); color: var(--nero); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- skip link ---------- */
.t-skip {
  position: fixed; top: -60px; left: 16px; z-index: 60;
  background: var(--coral); color: var(--nero); font-weight: 600;
  padding: 10px 16px; border-radius: 10px; text-decoration: none;
  transition: top .2s ease;
}
.t-skip:focus-visible { top: 12px; }

/* ---------- livelli cinema (fissi, pointer-events none) ---------- */
.t-grain, .t-scan, .t-vignette {
  position: fixed; inset: 0; pointer-events: none;
}
.t-grain {
  z-index: 40; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
.t-scan {
  z-index: 39; opacity: .02;
  background: repeating-linear-gradient(
    to bottom, var(--paper) 0px, var(--paper) 1px, transparent 1px, transparent 5px);
}
.t-vignette {
  z-index: 41;
  background: radial-gradient(115% 95% at 50% 45%, transparent 58%, rgba(5, 4, 3, .55) 100%);
}

/* ---------- sequenza d'ingresso ---------- */
.reveal {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: opacity .9s cubic-bezier(.22, .8, .3, 1), transform .9s cubic-bezier(.22, .8, .3, 1);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: translate3d(0, 0, 0); }
/* scaglioni della scena hero */
body.is-on .hero .reveal:nth-of-type(1) { transition-delay: .05s; }
.hero-brand.reveal   { transition-delay: .10s; }
.scope.reveal        { transition-delay: .25s; }
.hero-h.reveal       { transition-delay: .55s; }
.hero-sub.reveal     { transition-delay: .75s; }
.hero-cta.reveal     { transition-delay: .95s; }
.hero-hint.reveal    { transition-delay: 1.35s; }

/* ============================================================
   SCENA 1 · HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center;
  padding: clamp(18px, 3.5vh, 36px) 20px clamp(28px, 5vh, 56px);
}

.hero-glow {
  position: absolute; z-index: 0; pointer-events: none;
  top: 4%; left: 50%; width: 92vmin; height: 92vmin;
  margin-left: -46vmin;
  background: radial-gradient(closest-side,
    rgba(232, 99, 58, .22) 0%,
    rgba(232, 99, 58, .09) 42%,
    rgba(232, 99, 58, .03) 62%,
    transparent 78%);
}

.hero-brand { width: 100%; max-width: 1080px; z-index: 2; }
.wordmark {
  font-family: var(--disp); font-weight: 700;
  font-size: 1.35rem; letter-spacing: -.02em; color: var(--paper);
}
.wm-dot {
  display: inline-block; width: .32em; height: .32em; margin-left: .09em;
  border-radius: 50%; background: var(--coral);
}

.hero-stage {
  position: relative; z-index: 2;
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  width: 100%; max-width: 900px;
  padding-top: 2vh;
}

/* ---------- IL MIRINO ---------- */
.scope {
  position: relative;
  width: clamp(240px, 41vmin, 375px);
  aspect-ratio: 1;
  margin-bottom: clamp(20px, 4.5vh, 44px);
}
.ret { width: 100%; height: 100%; display: block; overflow: visible; }

.ret circle, .ret line, .ret path { vector-effect: non-scaling-stroke; }
.c-dash {
  stroke: rgba(250, 246, 241, .48); stroke-width: 1;
  stroke-dasharray: 3 9; stroke-linecap: round;
}
.c-mid  { stroke: rgba(250, 246, 241, .20); stroke-width: 1; }
.c-in   { stroke: var(--paper-60); stroke-width: 1.2; }
.tick   { stroke: var(--coral); stroke-width: 1.6; stroke-linecap: round; opacity: .85; }
.cross  { stroke: rgba(250, 246, 241, .20); stroke-width: 1; }
.brk path {
  stroke: var(--coral); stroke-width: 1.8; stroke-linecap: round; fill: none;
}
.sweep {
  transform-origin: 210px 210px;
  animation: rotS 9s linear infinite;
}
.dot-pulse {
  fill: none; stroke: var(--coral); stroke-width: 1.4;
  transform-origin: center; transform-box: fill-box;
  animation: dotPulse 2.4s cubic-bezier(.2, .6, .35, 1) infinite;
}
.flash {
  fill: var(--paper); opacity: 0;
  transform-origin: center; transform-box: fill-box;
}

.ret-rot, .ret-rot-rev { transform-origin: 210px 210px; }
.ret-rot     { animation: rotS 60s linear infinite; }
.ret-rot-rev { animation: rotSrev 90s linear infinite; }

/* respiro del reticolo */
.ret { transform-origin: center; animation: breathe 7s ease-in-out infinite; }

/* corner brackets: si stringono nel lock-on */
.brk {
  transform-origin: 210px 210px;
  transform: scale(1.22); opacity: .0;
  transition: transform .34s cubic-bezier(.2, .9, .3, 1.15), opacity .3s ease;
}
.scope.is-lock .brk { transform: scale(1); opacity: 1; }
.scope.is-lock .flash { animation: lockFlash .5s ease-out 1; }
.scope.is-ai .brk path { stroke: var(--viola); }
.scope.is-ai .dot-pulse { stroke: var(--viola); }
.scope.is-ai .tick { stroke: var(--viola); }

/* parola agganciata */
.scope-word {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 26%;
}
.scope-word span {
  display: block;
  font-family: var(--disp); font-weight: 600;
  font-size: clamp(.95rem, 2.6vmin, 1.25rem);
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--paper); line-height: 1.35;
  opacity: 1; transform: translate3d(0, 0, 0);
  transition: opacity .3s ease, transform .3s cubic-bezier(.2, .8, .3, 1);
}
/* il punto corallo: chiude la parola agganciata, come il wordmark "mira." */
.scope-word span::after {
  content: ""; display: inline-block;
  width: .3em; height: .3em; margin-left: .14em;
  border-radius: 50%; background: var(--coral);
  animation: dotBeat 2.4s ease-in-out infinite;
}
.scope.is-swap .scope-word span { opacity: 0; transform: translate3d(0, 8px, 0); }
.scope.is-ai .scope-word span { color: var(--viola); }
.scope.is-ai .scope-word span::after { background: var(--viola); }

.scope-hud {
  position: absolute; left: 50%; bottom: -8px;
  transform: translate3d(-50%, 100%, 0);
  font-family: var(--disp); font-size: .72rem; font-weight: 500;
  letter-spacing: .3em; color: var(--paper-38);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.scope-hud span { color: var(--coral); }

/* ---------- tipografia hero ---------- */
.hero-h {
  font-family: var(--disp); font-weight: 700;
  font-size: clamp(2.55rem, 9.2vw, 5.6rem);
  line-height: 1.02; letter-spacing: -.03em;
  margin-top: clamp(26px, 4vh, 40px);
}
.hero-h em { font-style: normal; color: var(--coral); }
.h-dot { color: var(--coral); }

.hero-sub {
  margin-top: clamp(14px, 2.4vh, 22px);
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  color: var(--paper-60); max-width: 34em;
}
.hero-sub .ai { color: var(--viola); font-weight: 600; }

.hero-cta { margin-top: clamp(22px, 4vh, 38px); }

/* ---------- bottone ---------- */
.btn {
  display: inline-block;
  font-family: var(--disp); font-weight: 600; font-size: 1.02rem;
  color: var(--nero); background: var(--coral);
  padding: 15px 34px; border: 0; border-radius: 999px;
  text-decoration: none; cursor: pointer;
  transform: translate3d(0, 0, 0);
  transition: transform .18s cubic-bezier(.2, .8, .3, 1), opacity .18s ease;
}
.btn:hover { transform: translate3d(0, -2px, 0); }
.btn:active { transform: translate3d(0, 0, 0) scale(.98); }
.btn:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--coral); outline-offset: 3px; border-radius: 6px;
}
.btn:focus-visible { border-radius: 999px; }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn-full { width: 100%; padding: 16px 20px; }

/* ---------- hint scroll ---------- */
.hero-hint { z-index: 2; height: 46px; display: flex; justify-content: center; }
.hint-line {
  display: block; width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, var(--paper-38));
  transform-origin: top; animation: hintDrop 2.6s ease-in-out infinite;
}

/* ============================================================
   SCENA 2 · LE ARMI (striscia)
   ============================================================ */
.arms {
  border-top: 1px solid var(--paper-08);
  border-bottom: 1px solid var(--paper-08);
  padding: 22px 0; overflow: hidden;
}
.arms-track { display: flex; width: max-content; }
.arms-list {
  display: flex; align-items: center; list-style: none;
  gap: 2.2em; padding-right: 2.2em;
  font-family: var(--disp); font-weight: 500;
  font-size: .95rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--paper-60); white-space: nowrap;
}
.arms-list .sep { color: var(--coral); }
.arms-list .ai { color: var(--viola); }
.arms-track { animation: marquee 46s linear infinite; }

/* ============================================================
   SCENA 3 · LISTA D'ATTESA
   ============================================================ */
.wait {
  position: relative; overflow: hidden;
  display: flex; justify-content: center;
  padding: clamp(64px, 12vh, 120px) 20px;
}
/* eco del mirino dietro la card */
.wait-scene { position: absolute; inset: 0; pointer-events: none; }
.w-ring {
  position: absolute; left: 50%; top: 50%;
  border-radius: 50%; border: 1px dashed var(--paper-14);
  transform: translate3d(-50%, -50%, 0);
}
.w-ring-1 { width: min(680px, 150vw); aspect-ratio: 1; }
.w-ring-2 {
  width: min(880px, 190vw); aspect-ratio: 1;
  border-color: var(--paper-08);
}
.w-line { position: absolute; background: var(--paper-08); }
.w-line-v { left: 50%; top: 0; bottom: 0; width: 1px; }
.w-line-h { top: 50%; left: 0; right: 0; height: 1px; }
.wait-card {
  position: relative; width: 100%; max-width: 470px;
  background: rgba(28, 23, 19, .88);
  border: 1px solid var(--paper-14);
  border-radius: 20px;
  padding: clamp(28px, 5vw, 42px);
}
/* filo corallo in testa alla card */
.wait-card::before {
  content: ""; position: absolute; top: -1px; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--coral), transparent);
  opacity: .7;
}
.wait-h {
  font-family: var(--disp); font-weight: 700;
  font-size: clamp(1.55rem, 5.4vw, 2rem);
  letter-spacing: -.02em; line-height: 1.1;
}
.wait-sub { margin-top: 10px; color: var(--paper-60); font-size: .98rem; }

#waitForm { margin-top: 26px; }
.f-row { margin-bottom: 16px; text-align: left; }
.f-row label {
  display: block; margin-bottom: 7px;
  font-family: var(--disp); font-weight: 500; font-size: .82rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--paper-60);
}
.f-row .opt { color: var(--paper-38); text-transform: none; letter-spacing: 0; font-family: var(--sans); font-weight: 400; }
.f-row input {
  width: 100%; padding: 13px 15px;
  font: inherit; font-size: 1rem; color: var(--paper);
  background: rgba(13, 11, 9, .55);
  border: 1px solid var(--paper-14); border-radius: 12px;
  transition: border-color .2s ease;
}
.f-row input::placeholder { color: var(--paper-38); }
.f-row input:focus { border-color: var(--coral); }
.f-row input:focus-visible { outline: none; }

/* honeypot fuori schermo (mai display:none: i bot lo saltano) */
.f-hp {
  position: absolute; left: -5000px; top: 0;
  width: 1px; height: 1px; overflow: hidden;
}

.f-err {
  margin: 0 0 14px; padding: 11px 14px;
  font-size: .92rem; color: #F3B3A0;
  background: rgba(232, 99, 58, .12);
  border: 1px solid rgba(232, 99, 58, .35); border-radius: 10px;
  text-align: left;
}
.f-note { margin-top: 14px; font-size: .84rem; color: var(--paper-38); text-align: center; }

/* ---------- stato successo ---------- */
.wait-done { text-align: center; padding: 14px 0 6px; }
.done-mark { width: 84px; height: 84px; margin: 0 auto 18px; display: block; }
.done-ring {
  stroke: var(--verde); stroke-width: 2; fill: none;
  stroke-dasharray: 264; stroke-dashoffset: 264;
  transform: rotate(-90deg); transform-origin: center; transform-box: fill-box;
}
.done-check {
  stroke: var(--verde); stroke-width: 3; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 50; stroke-dashoffset: 50;
}
.wait-card.is-done .done-ring  { animation: draw 1s cubic-bezier(.4, 0, .2, 1) forwards; }
.wait-card.is-done .done-check { animation: draw .5s cubic-bezier(.4, 0, .2, 1) .7s forwards; }
.done-h {
  font-family: var(--disp); font-weight: 700;
  font-size: clamp(1.7rem, 6vw, 2.2rem); letter-spacing: -.02em;
  outline: none;
}
.done-p { margin-top: 8px; color: var(--paper-60); font-size: 1.02rem; }

/* ---------- footer ---------- */
.t-foot {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  padding: 26px 20px 34px;
  font-size: .84rem; color: var(--paper-60);
}
.t-foot a { color: var(--paper-60); text-decoration: none; }
.t-foot a:hover { color: var(--paper); }
.foot-sep { color: var(--coral); }

/* ============================================================
   KEYFRAMES (solo transform/opacity)
   ============================================================ */
@keyframes rotS    { to { transform: rotate(360deg); } }
@keyframes rotSrev { to { transform: rotate(-360deg); } }
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}
@keyframes dotPulse {
  0%   { transform: scale(1);   opacity: .9; }
  70%  { transform: scale(4.6); opacity: 0; }
  100% { transform: scale(4.6); opacity: 0; }
}
@keyframes lockFlash {
  0%   { opacity: 0; }
  18%  { opacity: .14; }
  100% { opacity: 0; }
}
@keyframes hintDrop {
  0%   { transform: scaleY(0); opacity: 0; }
  35%  { transform: scaleY(1); opacity: 1; }
  75%  { transform: scaleY(1); opacity: 0; }
  100% { transform: scaleY(0); opacity: 0; }
}
@keyframes marquee { to { transform: translate3d(-50%, 0, 0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes dotBeat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.35); }
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 640px) {
  .scope { width: min(64vw, 250px); margin-bottom: 30px; }
  .hero-sub br { display: none; }
  .arms-list { font-size: .84rem; gap: 1.6em; padding-right: 1.6em; }
  .hero-glow { width: 90vmin; height: 90vmin; margin-left: -45vmin; }
}

/* ============================================================
   REDUCED MOTION → statica elegante
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal { opacity: 1; transform: none; }
  .brk { transform: scale(1); opacity: 1; }
  .dot-pulse { opacity: 0; }
  .sweep { display: none; }
  .hint-line { transform: none; opacity: .6; }
  .arms { padding: 22px 20px; }
  .arms-track { width: auto; animation: none; justify-content: center; }
  .arms-list { flex-wrap: wrap; justify-content: center; white-space: normal;
               row-gap: .6em; padding-right: 0; }
  .arms-dup { display: none; }
  .done-ring, .done-check { stroke-dashoffset: 0; }
}
