/* Introduzione animata al primo avvio (js/ui/intro.js). Tempi in ms dall'inizio; l'impatto della A e del 2 e' a 620. */
body.has-intro { overflow: hidden; }
.intro {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow: hidden;
  background: var(--al2-navy); color: #fff; touch-action: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.intro-sky {
  position: absolute; inset: -10%; opacity: 0;
  background:
    radial-gradient(80% 50% at 78% 14%, rgb(241 81 27 / 0.30) 0%, rgb(241 81 27 / 0) 62%),
    radial-gradient(110% 70% at 20% 30%, #16498c 0%, #0b2a56 48%, #071a38 100%);
}
.intro-sky::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
}
.intro-glow {
  position: absolute; left: 50%; top: 44%; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, rgb(241 81 27 / 0.45) 0%, rgb(241 81 27 / 0.12) 40%, rgb(241 81 27 / 0) 70%);
}
.intro-streaks { position: absolute; inset: 0; transform: rotate(-14deg) scale(1.3); }
.intro-streaks i {
  position: absolute; left: 0; top: var(--y); width: var(--w); height: 2px; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.85), transparent);
  transform: translateX(-120%);
}
.intro-streaks i:nth-child(3n) { height: 3px; background: linear-gradient(90deg, transparent, rgb(255 138 61 / 0.95), transparent); }
.intro-wipe {
  position: absolute; left: 0; top: -40%; width: 38vmax; height: 180%; opacity: 0;
  background: linear-gradient(90deg, rgb(241 81 27 / 0), rgb(241 81 27 / 0.85) 40%, rgb(255 138 61 / 0.85) 60%, rgb(241 81 27 / 0));
  transform: translateX(-120%) rotate(14deg);
}
.intro-stage { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 0 24px; }
.intro-mark { width: min(64vw, 300px); height: auto; overflow: visible; color: #fff; filter: drop-shadow(0 18px 40px rgb(0 0 0 / 0.45)); }
.intro-mark path { transform-box: fill-box; opacity: 0; }
.intro-mark .a2-a { transform-origin: 100% 50%; }
.intro-mark .a2-due { transform-origin: 0% 50%; }
.intro-mark .a2-t1, .intro-mark .a2-t2, .intro-mark .a2-t3 { transform-origin: 50% 100%; }
.intro-ring {
  position: absolute; left: 50%; top: min(16vw, 74px); width: 160px; height: 160px; margin: -80px 0 0 -80px;
  border-radius: 50%; border: 4px solid var(--al2-orange); opacity: 0; pointer-events: none;
}
.intro-ring.is-late { border: 2px solid rgb(255 255 255 / 0.8); }
.intro-sparks { position: absolute; left: 50%; top: min(16vw, 74px); width: 0; height: 0; }
.intro-sparks i {
  position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; opacity: 0;
  background: #ffd9a8; box-shadow: 0 0 12px 3px rgb(255 170 90 / 0.75);
}
.intro-sparks i:nth-child(3n) { background: #fff; box-shadow: 0 0 10px 2px rgb(255 255 255 / 0.7); }
.intro-title {
  margin-top: 14px; display: flex; align-items: baseline; gap: 0.28em; flex-wrap: wrap; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-style: italic; letter-spacing: -0.015em; line-height: 1;
  font-size: clamp(36px, 10.5vw, 60px);
}
.intro-word { display: inline-flex; }
.intro-ch { display: inline-block; opacity: 0; transform: translateY(70%) skewX(-14deg); }
.intro-al2 { display: inline-block; color: var(--al2-orange); opacity: 0; transform: scale(0.3) rotate(-8deg); }
.intro-bar { display: block; width: 150px; height: 6px; border-radius: 3px; margin-top: 12px; background: var(--al2-orange); transform: scaleX(0); transform-origin: left; }
.intro-sub { margin-top: 10px; font-weight: 600; font-size: clamp(15px, 4.2vw, 19px); color: rgb(255 255 255 / 0.82); opacity: 0; transform: translateY(10px); }
.intro-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.intro-skip {
  position: absolute; top: calc(env(safe-area-inset-top) + 14px); right: 16px; padding: 8px 16px; min-height: 36px;
  border-radius: 999px; border: 1px solid rgb(255 255 255 / 0.28); background: rgb(255 255 255 / 0.12);
  color: #fff; font: 600 14px/1 var(--font); opacity: 0; cursor: pointer;
}
.intro-skip:focus-visible { outline: 3px solid var(--al2-orange); outline-offset: 2px; }

/* Sequenza */
.intro.is-on .intro-sky { animation: intro-fade 260ms ease-out forwards; }
.intro.is-on .intro-sky::after { animation: intro-grid 3200ms linear forwards; }
.intro.is-on .intro-streaks i { animation: intro-streak 620ms cubic-bezier(.3, 0, .2, 1) calc(80ms + var(--d)) forwards; }
.intro.is-on .a2-a { animation: intro-slam-l 560ms cubic-bezier(.2, .9, .25, 1.1) 140ms forwards; }
.intro.is-on .a2-due { animation: intro-slam-r 560ms cubic-bezier(.2, .9, .25, 1.1) 220ms forwards; }
.intro.is-on .a2-t1 { animation: intro-cut 260ms cubic-bezier(.2, .8, .2, 1) 760ms forwards; }
.intro.is-on .a2-t2 { animation: intro-cut 260ms cubic-bezier(.2, .8, .2, 1) 820ms forwards; }
.intro.is-on .a2-t3 { animation: intro-cut 260ms cubic-bezier(.2, .8, .2, 1) 880ms forwards; }
.intro.is-on .intro-stage { animation: intro-shake 340ms ease-out 620ms; }
.intro.is-on .intro-mark { animation: intro-shine 900ms ease-out 900ms; }
.intro.is-on .intro-flash { animation: intro-flash 420ms ease-out 620ms; }
.intro.is-on .intro-glow { animation: intro-glow 1400ms ease-out 600ms forwards; }
.intro.is-on .intro-ring { animation: intro-ring 820ms cubic-bezier(.1, .7, .3, 1) 620ms forwards; }
.intro.is-on .intro-ring.is-late { animation-delay: 760ms; animation-duration: 900ms; }
.intro.is-on .intro-sparks i { animation: intro-spark 760ms cubic-bezier(.1, .8, .3, 1) calc(640ms + var(--d)) forwards; }
.intro.is-on .intro-ch { animation: intro-rise 480ms cubic-bezier(.2, .9, .3, 1.25) calc(1000ms + var(--i) * 38ms) forwards; }
.intro.is-on .intro-al2 { animation: intro-pop 520ms cubic-bezier(.2, .9, .3, 1.4) 1440ms forwards; }
.intro.is-on .intro-bar { animation: intro-grow 420ms cubic-bezier(.2, .8, .2, 1) 1560ms forwards; }
.intro.is-on .intro-sub { animation: intro-up 420ms ease-out 1720ms forwards; }
.intro.is-on .intro-wipe { animation: intro-wipe 760ms cubic-bezier(.5, 0, .3, 1) 1640ms forwards; }
.intro.is-on .intro-skip { animation: intro-fade 300ms ease-out 500ms forwards; }

/* Uscita: si attraversa il marchio ed entra l'app */
.intro.is-out { pointer-events: none; animation: intro-out 650ms ease-in forwards; }
.intro.is-out .intro-stage { animation: intro-fly 650ms cubic-bezier(.7, 0, .84, 0) forwards; }
.intro.is-out.is-fast, .intro.is-out.is-fast .intro-stage { animation-duration: 320ms; }

@keyframes intro-fade { to { opacity: 1; } }
@keyframes intro-grid { from { transform: scale(1.25); } to { transform: scale(1); } }
@keyframes intro-streak { 0% { opacity: 0; transform: translateX(-120%); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateX(330%); } }
@keyframes intro-slam-l {
  0% { opacity: 0; transform: translateX(-190%) skewX(-28deg) scaleX(1.25); }
  55% { opacity: 1; transform: translateX(7%) skewX(8deg) scaleX(0.94); }
  78% { transform: translateX(-2%) skewX(-2deg) scaleX(1.01); }
  100% { opacity: 1; transform: none; }
}
@keyframes intro-slam-r {
  0% { opacity: 0; transform: translateX(190%) skewX(-28deg) scaleX(1.25); }
  55% { opacity: 1; transform: translateX(-7%) skewX(8deg) scaleX(0.94); }
  78% { transform: translateX(2%) skewX(-2deg) scaleX(1.01); }
  100% { opacity: 1; transform: none; }
}
@keyframes intro-cut { from { opacity: 1; transform: scaleY(0); } to { opacity: 1; transform: none; } }
@keyframes intro-shake {
  0%, 100% { transform: none; } 18% { transform: translate(-7px, 4px) rotate(-0.6deg); } 38% { transform: translate(6px, -4px) rotate(0.5deg); }
  58% { transform: translate(-4px, 2px); } 78% { transform: translate(2px, -1px); }
}
@keyframes intro-shine {
  0%, 100% { filter: drop-shadow(0 18px 40px rgb(0 0 0 / 0.45)); }
  35% { filter: drop-shadow(0 0 26px rgb(241 81 27 / 0.9)) drop-shadow(0 0 8px rgb(255 255 255 / 0.6)) brightness(1.15); }
}
@keyframes intro-flash { 0% { opacity: 0; } 18% { opacity: 0.55; } 100% { opacity: 0; } }
@keyframes intro-glow { 0% { opacity: 0; transform: scale(0.4); } 30% { opacity: 1; transform: scale(1.15); } 100% { opacity: 0.65; transform: scale(1); } }
@keyframes intro-ring { 0% { opacity: 1; transform: scale(0.2); } 100% { opacity: 0; transform: scale(4.2); } }
@keyframes intro-spark {
  0% { opacity: 1; transform: translate(0, 0) scale(1.2); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); }
}
@keyframes intro-rise { to { opacity: 1; transform: none; } }
@keyframes intro-pop { 0% { opacity: 0; transform: scale(0.3) rotate(-8deg); } 70% { opacity: 1; transform: scale(1.18) rotate(2deg); } 100% { opacity: 1; transform: none; } }
@keyframes intro-grow { to { transform: none; } }
@keyframes intro-up { to { opacity: 1; transform: none; } }
@keyframes intro-wipe {
  0% { opacity: 0; transform: translateX(-120%) rotate(14deg); } 30% { opacity: 0.85; }
  100% { opacity: 0; transform: translateX(320%) rotate(14deg); }
}
@keyframes intro-out { 0% { opacity: 1; } 55% { opacity: 1; } 100% { opacity: 0; } }
@keyframes intro-fly { to { opacity: 0; transform: scale(7); } }

/* Movimento ridotto: solo dissolvenze. */
.intro.is-reduced .intro-streaks, .intro.is-reduced .intro-wipe, .intro.is-reduced .intro-ring,
.intro.is-reduced .intro-sparks, .intro.is-reduced .intro-flash, .intro.is-reduced .intro-glow { display: none; }
.intro.is-reduced.is-on .intro-sky, .intro.is-reduced.is-on .intro-mark path, .intro.is-reduced.is-on .intro-ch,
.intro.is-reduced.is-on .intro-al2, .intro.is-reduced.is-on .intro-sub, .intro.is-reduced.is-on .intro-skip {
  animation: intro-fade 300ms ease-out forwards; transform: none;
}
.intro.is-reduced.is-on .intro-bar { animation: none; transform: none; }
.intro.is-reduced.is-on .intro-stage, .intro.is-reduced.is-on .intro-sky::after, .intro.is-reduced.is-on .intro-mark { animation: none; }
.intro.is-reduced.is-out .intro-stage { animation: none; }
