/* ==========================================================================
   M-It LevelUP — Animations, introduction cinématique & mouvements
   ========================================================================== */

/* Images clés ------------------------------------------------------------ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes feedIn { from { opacity: 0; transform: translateY(-8px); background: var(--red-08); } to { opacity: 1; transform: none; } }
@keyframes rowFlash { 0% { background: var(--red-15); } 100% { background: transparent; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes waPulse {
  0% { transform: scale(1); opacity: .45; }
  60%, 100% { transform: scale(1.55); opacity: 0; }
}
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes floatY { from { transform: translateY(-6px); } to { transform: translateY(6px); } }
@keyframes floatY2 { from { transform: translateY(5px) rotate(-.4deg); } to { transform: translateY(-7px) rotate(.4deg); } }
@keyframes dashFlow { to { stroke-dashoffset: -1000; } }
@keyframes drawLine { from { stroke-dashoffset: var(--len, 600); } to { stroke-dashoffset: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes introFloat {
  from { transform: translate3d(0, -7px, 0) rotate(-.6deg); }
  to { transform: translate3d(0, 7px, 0) rotate(.6deg); }
}
@keyframes introProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes charUp { from { transform: translateY(105%); } to { transform: none; } }
@keyframes softPop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes ripple { from { transform: scale(0); opacity: .5; } to { transform: scale(1); opacity: 0; } }

/* Mouvements décoratifs ------------------------------------------------- */
.float-chip { animation: floatY 4.5s ease-in-out infinite alternate; }
.float-chip--br, .float-chip--bl { animation-name: floatY2; animation-duration: 5.2s; }
.devices .device--tablet { animation: floatY 6s ease-in-out infinite alternate; }
.devices .device--phone { animation: floatY2 5s ease-in-out infinite alternate; }

.hero__flow .flow-base { stroke: rgba(17, 17, 17, .07); }
.hero__flow .flow-pulse {
  stroke: rgba(227, 38, 54, .55);
  stroke-width: 1.4;
  stroke-dasharray: 4 180;
  animation: dashFlow 26s linear infinite;
}
.hero__flow .flow-pulse:nth-of-type(2n) { animation-duration: 34s; animation-direction: reverse; }

.chart .line { stroke-dasharray: var(--len, 600); stroke-dashoffset: 0; }
.slide.is-active .chart .line { animation: drawLine 1.6s var(--ease-out) .3s both; }
.slide.is-active .chart .area { animation: panelIn 1s var(--ease) .9s both; }
.slide.is-active .chart .bar { transform-box: fill-box; transform-origin: bottom; animation: growY .8s var(--ease-out) both; }
.slide.is-active .chart .bar:nth-child(2) { animation-delay: .05s; }
.slide.is-active .chart .bar:nth-child(3) { animation-delay: .1s; }
.slide.is-active .chart .bar:nth-child(4) { animation-delay: .15s; }
.slide.is-active .chart .bar:nth-child(5) { animation-delay: .2s; }
.slide.is-active .chart .bar:nth-child(6) { animation-delay: .25s; }
.slide.is-active .chart .bar:nth-child(7) { animation-delay: .3s; }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.caret { display: inline-block; width: 1px; height: 1em; background: currentColor; margin-left: 1px; vertical-align: -2px; animation: blink 1s steps(1) infinite; }

/* Apparition au défilement --------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s var(--ease), transform 1.1s var(--ease-out);
  transition-delay: var(--d, 0s);
}
.js .reveal--left { transform: translateX(-32px); }
.js .reveal--right { transform: translateX(32px); }
.js .reveal--scale { transform: scale(.96); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* Révélation de titres mot par mot */
.split-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.split-w > span { display: inline-block; transform: translateY(105%); transition: transform 1s var(--ease-out); transition-delay: calc(var(--i, 0) * 45ms); }
.is-split.is-visible .split-w > span,
.no-split .split-w > span { transform: none; }

/* Ondulation discrète au clic (boutons) */
.ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: currentColor;
  opacity: .25;
  animation: ripple .7s var(--ease-out) forwards;
}

/* ==========================================================================
   Introduction cinématique
   ========================================================================== */
.intro {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  background: var(--off);
  color: var(--ink);
  overflow: hidden;
  transition: transform 1s var(--ease-in-out), opacity .6s var(--ease);
}
.intro-on .intro { display: block; }
html.intro-on,
html.intro-on body { overflow: hidden; }
.intro-on .wa,
.intro-on .site-header { visibility: hidden; }

.intro__noise {
  position: absolute;
  inset: 0;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}
.intro__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(17,17,17,.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(17,17,17,.045) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 45%, #000, transparent 80%);
  mask-image: radial-gradient(ellipse 60% 60% at 50% 45%, #000, transparent 80%);
}
.intro[data-scene="2"] .intro__grid,
.intro[data-scene="3"] .intro__grid { opacity: 1; }

.intro__stage {
  position: absolute;
  inset: 0;
  transition: opacity .8s var(--ease), transform 1.2s var(--ease-out), filter .8s var(--ease);
}
.intro[data-scene="4"] .intro__stage { opacity: .12; transform: scale(.94); filter: blur(2px); }

.intro__links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.intro__links path {
  fill: none;
  stroke: var(--red);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: var(--len, 400);
  stroke-dashoffset: var(--len, 400);
  opacity: .8;
  transition: stroke-dashoffset 1.1s var(--ease-out), opacity .6s var(--ease);
}
.intro[data-scene="2"] .intro__links path { stroke-dashoffset: 0; }
.intro[data-scene="3"] .intro__links path { stroke-dashoffset: 0; opacity: 0; }
.intro__links circle { fill: var(--red); opacity: 0; transition: opacity .4s var(--ease) .6s; }
.intro[data-scene="2"] .intro__links circle { opacity: 1; }

.intro__item {
  position: absolute;
  left: 0; top: 0;
  width: var(--w, 168px);
  transform: translate3d(var(--x, 0), var(--y, 0), 0) rotate(var(--r, 0deg)) scale(var(--s, 1));
  opacity: 0;
  transition: transform 1.15s var(--ease-out), opacity .6s var(--ease), width 1.15s var(--ease-out);
  will-change: transform;
}
.intro.is-ready .intro__item { opacity: 1; }
.intro__float { animation: introFloat var(--fd, 3.4s) ease-in-out infinite alternate; animation-delay: var(--fdl, 0s); }
.intro[data-scene="3"] .intro__float { animation-play-state: paused; }
.intro__card {
  position: relative;
  min-height: 78px;
  border-radius: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(17,17,17,.04), 0 16px 32px -18px rgba(17,17,17,.25);
  overflow: hidden;
  transition: border-color .6s var(--ease), box-shadow .6s var(--ease);
}
.intro__face { padding: 12px 14px; transition: opacity .55s var(--ease), transform .7s var(--ease-out); }
.intro__face--b { position: absolute; inset: 0; opacity: 0; transform: translateY(8px); }
.intro[data-scene="2"] .intro__face--a,
.intro[data-scene="3"] .intro__face--a { opacity: 0; transform: translateY(-8px); }
.intro[data-scene="2"] .intro__face--b,
.intro[data-scene="3"] .intro__face--b { opacity: 1; transform: none; }
.intro[data-scene="2"] .intro__card,
.intro[data-scene="3"] .intro__card { border-color: var(--red-30); }
.intro[data-scene="3"] .intro__item--key .intro__card { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-08), 0 16px 32px -18px rgba(227,38,54,.4); }
.intro[data-scene="3"] .intro__item--noise { opacity: 0; }

.intro__label { display: flex; align-items: center; gap: 8px; font-size: .72rem; font-weight: 600; color: #2B2D31; white-space: nowrap; }
.intro__label svg { width: 18px; height: 18px; color: #8A8E96; flex: 0 0 auto; }
.intro__face--b .intro__label svg { color: var(--red); }
.intro__lines { display: grid; gap: 5px; margin-top: 10px; }
.intro__lines i { height: 4px; border-radius: 3px; background: var(--gray); }
.intro__lines i:nth-child(2) { width: 78%; }
.intro__lines i:nth-child(3) { width: 54%; }
.intro__bars { display: flex; align-items: flex-end; gap: 4px; height: 30px; margin-top: 10px; }
.intro__bars i { flex: 1; border-radius: 3px 3px 0 0; background: var(--red-15); }
.intro__bars i:nth-child(3), .intro__bars i:nth-child(5) { background: var(--red); }
.intro__big { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.intro__ok { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-size: .64rem; font-weight: 700; color: var(--green); background: rgba(31,157,87,.1); padding: 3px 8px; border-radius: 999px; }
.intro__badge { position: absolute; top: 8px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: .6rem; font-weight: 700; display: grid; place-items: center; }
.intro__rows { display: grid; gap: 4px; margin-top: 8px; }
.intro__rows span { display: flex; justify-content: space-between; font-size: .6rem; color: var(--muted); border-bottom: 1px dashed var(--line); padding-bottom: 3px; }
.intro__rows span b { color: var(--ink); font-weight: 600; }

.intro__ui {
  position: absolute;
  left: 50%; top: 50%;
  border-radius: 22px;
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
  box-shadow: 0 50px 100px -40px rgba(17,17,17,.3);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.92);
  transition: opacity .7s var(--ease), transform 1.1s var(--ease-out);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.intro[data-scene="3"] .intro__ui { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.intro__ui-bar { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-bottom: 1px solid var(--line-2); }
.intro__ui-bar i { width: 9px; height: 9px; border-radius: 50%; background: #E2E4E8; }
.intro__ui-bar i:first-child { background: var(--red); }
.intro__ui-bar span { margin-left: 12px; font-size: .72rem; font-weight: 600; color: var(--muted); }
.intro__ui-side { position: absolute; left: 0; top: 40px; bottom: 0; width: 56px; border-right: 1px solid var(--line-2); display: grid; align-content: start; justify-items: center; gap: 12px; padding-top: 18px; }
.intro__ui-side i { width: 22px; height: 22px; border-radius: 7px; background: var(--gray); }
.intro__ui-side i:first-child { background: var(--ink); }

.intro__captions {
  position: absolute;
  left: 0; right: 0;
  bottom: clamp(48px, 10vh, 110px);
  display: grid;
  justify-items: center;
  padding: 0 24px;
  pointer-events: none;
}
.intro__caption {
  grid-area: 1 / 1;
  max-width: 22ch;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.55rem, 3.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -.035em;
  opacity: 0;
  transform: translateY(18px);
  filter: blur(6px);
  transition: opacity .6s var(--ease), transform .8s var(--ease-out), filter .6s var(--ease);
  text-shadow: 0 0 30px rgba(250,250,250,.9), 0 0 12px rgba(250,250,250,.9);
}
.intro__caption em { font-style: normal; color: var(--red); }
.intro[data-scene="1"] .intro__caption[data-scene="1"],
.intro[data-scene="2"] .intro__caption[data-scene="2"],
.intro[data-scene="3"] .intro__caption[data-scene="3"] { opacity: 1; transform: none; filter: none; }
.intro__caption--wide { max-width: 26ch; }

.intro__brand {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: clamp(28px, 4vw, 44px);
  padding: 24px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s var(--ease), visibility 0s .5s;
}
.intro[data-scene="4"] .intro__brand { opacity: 1; visibility: visible; transition-delay: 0s; }
.intro__brand .logo { align-items: center; }
.intro__brand .logo__name > span,
.intro__brand .logo__tag { overflow: hidden; }
.intro__mask { display: inline-flex; overflow: hidden; padding-bottom: .06em; }
.intro__mask > span { display: inline-block; transform: translateY(105%); }
.intro[data-scene="4"] .intro__mask > span { animation: charUp .9s var(--ease-out) both; animation-delay: var(--dl, 0s); }
.intro__brand .logo__bars i { transform: scaleY(0); }
.intro[data-scene="4"] .intro__brand .logo__bars i { animation: growY .5s var(--ease-out) both; }
.intro[data-scene="4"] .intro__brand .logo__bars i:nth-child(1) { animation-delay: .55s; }
.intro[data-scene="4"] .intro__brand .logo__bars i:nth-child(2) { animation-delay: .65s; }
.intro[data-scene="4"] .intro__brand .logo__bars i:nth-child(3) { animation-delay: .75s; }
.intro__brand .logo__tag { opacity: 0; letter-spacing: .9em; transition: opacity .8s var(--ease) .6s, letter-spacing 1.2s var(--ease-out) .6s; }
.intro[data-scene="4"] .intro__brand .logo__tag { opacity: 1; letter-spacing: .46em; }
.intro__cta { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease) 1s, transform .8s var(--ease-out) 1s; }
.intro[data-scene="4"] .intro__cta { opacity: 1; transform: none; }

.intro__skip {
  position: absolute;
  top: 22px; right: 22px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.85);
  border: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: .88rem;
  font-weight: 600;
  transition: background-color .2s, border-color .2s, color .2s;
}
.intro__skip:hover { background: var(--ink); color: var(--white); border-color: var(--ink); }
.intro__skip svg { width: 14px; height: 14px; }
.intro__mark { position: absolute; top: 28px; left: 28px; z-index: 3; font-family: var(--font-display); font-weight: 700; font-size: .9rem; letter-spacing: -.02em; opacity: .85; }
.intro__mark span { color: var(--red); }
.intro__scene-n { position: absolute; left: 28px; bottom: 26px; z-index: 3; font-family: var(--font-mono); font-size: .72rem; color: var(--muted); letter-spacing: .1em; }
.intro__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(17,17,17,.06); }
.intro__progress i { position: absolute; inset: 0; background: var(--red); transform: scaleX(0); transform-origin: left; }
.intro.is-ready .intro__progress i { animation: introProgress var(--intro-dur, 7s) linear forwards; }

.intro.is-leaving { transform: translateY(-100%); }
.intro.is-leaving .intro__brand { opacity: 0; transition: opacity .3s; }

/* Hero : entrée après l'intro */
.hero-enter .slide.is-active .slide__content > * { transition-delay: .25s; }

/* ==========================================================================
   Mouvement réduit
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .split-w > span { transform: none; }
  .marquee__track { animation: none; }
  .wa__btn::before { display: none; }
  .intro { display: none !important; }
  .hero__halo { display: none; }
}
