/* Présentation animée de ChapChap (sans voix). */

.intro {
  position: fixed; inset: 0; z-index: 60; display: grid; grid-template-rows: 1fr auto auto;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(22px + env(safe-area-inset-bottom));
  color: #fff; text-align: center; overflow: hidden;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .14), transparent 55%), linear-gradient(160deg, #4f6bff, #8b5cf6);
  animation: i-fade .3s ease;
}
.intro.leaving { animation: i-out .28s ease forwards; }
@keyframes i-fade { from { opacity: 0; } }
@keyframes i-out { to { opacity: 0; transform: scale(1.03); } }

.intro-skip {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; z-index: 2;
  border: 0; border-radius: 999px; padding: 8px 14px; font: 600 14px system-ui, sans-serif; cursor: pointer;
  color: #fff; background: rgba(255, 255, 255, .18);
}

.intro-stage { position: relative; display: grid; place-items: center; min-height: 250px; cursor: pointer; }
.i-scene { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .35s ease; }
.i-scene.active { opacity: 1; }

.intro-text { max-width: 420px; margin: 0 auto; min-height: 96px; }
.intro-text h2 { margin: 0 0 8px; font-size: clamp(22px, 5.5vw, 28px); line-height: 1.2; letter-spacing: -.01em; }
.intro-text p { margin: 0; font-size: 16px; opacity: .88; }
.i-scene.active ~ * { animation: none; }

.intro-foot { display: grid; gap: 16px; justify-items: center; margin-top: 18px; }
.i-dots { display: flex; gap: 8px; }
.i-dots i { width: 8px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .35); cursor: pointer; transition: width .3s, background .3s; }
.i-dots i.on { width: 26px; background: #fff; }
.intro-next {
  min-width: 220px; min-height: 52px; border: 0; border-radius: 16px; cursor: pointer;
  font: 700 17px system-ui, sans-serif; color: #4f46e5; background: #fff; box-shadow: 0 12px 30px rgba(20, 20, 80, .25);
}
.intro-next:active { transform: scale(.97); }

/* ---------- maquettes d'appareils */
.i-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 18px; width: min(330px, 92vw); }
.i-row.center { justify-content: center; }
.m-phone { width: 78px; height: 150px; border-radius: 18px; padding: 6px; background: #0d1222; box-shadow: 0 20px 40px rgba(10, 10, 50, .35); flex: none; }
.m-phone.big { width: 120px; height: 230px; border-radius: 24px; padding: 8px; }
.m-laptop { width: 160px; flex: none; }
.m-laptop .lid { height: 104px; border-radius: 12px 12px 0 0; padding: 6px; background: #0d1222; box-shadow: 0 20px 40px rgba(10, 10, 50, .35); }
.m-laptop .base { height: 10px; margin: 0 -16px; border-radius: 0 0 14px 14px; background: #dfe3f3; }
.scr { position: relative; height: 100%; border-radius: 12px; overflow: hidden; background: #f4f6fb; display: grid; place-items: center; color: #4f6bff; }
.m-laptop .scr { border-radius: 6px; }
.scr.col { align-content: space-evenly; justify-items: center; }
.m-logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #4f6bff, #8b5cf6); }
.m-logo .pi { width: 22px; height: 22px; }
.m-av { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.m-av .pi { width: 22px; height: 22px; }
.av-a { background: linear-gradient(135deg, #f472b6, #a855f7); }
.av-b { background: linear-gradient(135deg, #34d399, #16a34a); }

/* ---------- animations communes (ne jouent que dans la scène active) */
.i-scene.active .a-left { animation: from-left .6s cubic-bezier(.2, .9, .3, 1.2) both; }
.i-scene.active .a-right { animation: from-right .6s cubic-bezier(.2, .9, .3, 1.2) .15s both; }
.i-scene.active .a-pop { animation: pop .45s cubic-bezier(.2, .9, .3, 1.4) both; }
.i-scene.active .a-up { animation: up .5s cubic-bezier(.2, .9, .3, 1.1) both; }
.d1 { animation-delay: .5s !important; }
.d2 { animation-delay: .8s !important; }
.d3 { animation-delay: 1.1s !important; }
.d4 { animation-delay: 1.9s !important; }
.d5 { animation-delay: 2.6s !important; }
@keyframes from-left { from { transform: translateX(-60px) rotate(-8deg); opacity: 0; } }
@keyframes from-right { from { transform: translateX(60px); opacity: 0; } }
@keyframes pop { from { transform: scale(0); opacity: 0; } }
@keyframes up { from { transform: translateY(60px); opacity: 0; } }

/* Scène 2 : ondes Wi-Fi et lien entre les appareils */
.i-wifi { position: relative; width: 56px; height: 56px; display: grid; place-items: center; }
.i-wifi .pi { width: 34px; height: 34px; color: #fff; position: relative; }
.i-wifi .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .7); opacity: 0; }
.i-scene.active .ring { animation: ripple 2.2s ease-out infinite; }
.i-scene.active .r2 { animation-delay: .7s; }
.i-scene.active .r3 { animation-delay: 1.4s; }
@keyframes ripple { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.6); opacity: 0; } }
.i-line { position: absolute; left: 50%; bottom: 20px; width: min(240px, 70vw); height: 4px; transform: translateX(-50%); border-radius: 2px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.i-line span { display: block; height: 100%; width: 0; background: #fff; border-radius: 2px; }
.i-scene.active .i-line span { animation: grow 1s ease .9s forwards; }
@keyframes grow { to { width: 100%; } }

/* Scène 3 : scan du QR code */
.qr-big { width: 64px; height: 64px; color: #0d1222; }
.qr-mini { width: 40px; height: 40px; color: #0d1222; opacity: 0; }
.i-scene.active .a-scan { animation: scan-move 1.6s cubic-bezier(.4, 0, .2, 1) both; }
.i-scene.active .qr-mini { animation: show 0s 1.3s forwards; }
@keyframes scan-move { 0% { transform: translateX(0) rotate(0); } 60%, 100% { transform: translateX(46px) rotate(-6deg); } }
@keyframes show { to { opacity: 1; } }
.scanline { position: absolute; left: 6px; right: 6px; height: 3px; top: 10%; border-radius: 2px; background: #22c55e; box-shadow: 0 0 10px #22c55e; opacity: 0; }
.i-scene.active .scanline { animation: scanline 1s ease-in-out .5s 2 alternate; }
@keyframes scanline { 0% { top: 12%; opacity: 1; } 100% { top: 84%; opacity: 1; } }
.ok-badge { position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #16a34a; box-shadow: 0 4px 12px rgba(22, 163, 74, .5); }
.ok-badge .pi { width: 20px; height: 20px; }

/* Scène 4 : toucher un appareil puis choisir */
.tap-ring { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid #4f6bff; opacity: 0; }
.i-scene.active .tap .tap-ring { animation: tap 1s ease-out .4s 2; }
@keyframes tap { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.m-sheet { display: flex; gap: 6px; padding: 8px; border-radius: 12px; background: #fff; box-shadow: 0 6px 18px rgba(30, 40, 90, .2); }
.m-sheet span { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: #eef1ff; color: #4f6bff; }
.m-sheet .pi { width: 18px; height: 18px; }
.i-scene.active .m-sheet span:first-child { animation: choose .6s ease 2.1s both; }
@keyframes choose { 50% { transform: scale(1.25); background: #4f6bff; color: #fff; } 100% { background: #4f6bff; color: #fff; } }

/* Scène 5 : les fichiers volent vers l'ordinateur */
.m-accept { padding: 6px 12px; border-radius: 10px; font: 700 12px system-ui, sans-serif; color: #fff; background: linear-gradient(135deg, #4f6bff, #8b5cf6); }
.fly { position: absolute; left: calc(50% - 130px); top: 50%; width: 34px; height: 34px; margin-top: -17px; border-radius: 10px; display: grid; place-items: center; color: #4f6bff; background: #fff; box-shadow: 0 8px 18px rgba(10, 10, 60, .3); opacity: 0; }
.fly .pi { width: 20px; height: 20px; }
.i-scene.active .fly { animation: fly 1.1s cubic-bezier(.5, 0, .3, 1) both; }
.i-scene.active .f1 { animation-delay: 1.2s; }
.i-scene.active .f2 { animation-delay: 1.45s; }
.i-scene.active .f3 { animation-delay: 1.7s; }
@keyframes fly {
  0% { transform: translate(0, 0) scale(.6); opacity: 0; }
  15% { opacity: 1; }
  50% { transform: translate(110px, -70px) scale(1); }
  100% { transform: translate(230px, 0) scale(.5); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .intro *, .intro { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition: none !important; }
}
