/* ============================================================
   99STORE.MA — SPLASH / INTRO ANIMATION
   ------------------------------------------------------------
   Plays once per browser session on first load. Sequence:
   dark overlay -> logo fade/scale in with glow -> short hold ->
   logo travels to its real header position -> header, nav and
   rest of the page reveal underneath as the overlay dissolves.
   Pure CSS transform/opacity transitions, driven by a handful
   of class toggles in js/splash.js. Respects prefers-reduced-motion
   and is fully skipped on repeat visits within the same session.
   ============================================================ */

/* Hidden by default; only shown for a first-time-this-session visit
   (html.splash-pending is added by the inline bootstrap script in
   <head>, before first paint, so there is never a flash of the
   overlay for returning sessions). */
.splash-screen{
  position:fixed;
  inset:0;
  z-index:99999;
  display:none;
  overflow:hidden;
}
html.splash-pending .splash-screen{
  display:block;
}

.splash-bg{
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 50% 42%, rgba(44,39,98,.10) 0%, rgba(44,39,98,0) 55%),
    linear-gradient(135deg, #ffffff 0%, #f7f6fc 55%, #eef2ff 100%);
  opacity:1;
  transition:opacity .75s ease;
}
.splash-bg.fade{
  opacity:0;
}

.splash-logo-wrap{
  position:fixed;
  left:50%;
  top:50%;
  width:96px;
  height:96px;
  transform:translate(-50%,-50%) scale(.8);
  opacity:0;
  transition:opacity .5s ease, transform .5s cubic-bezier(.34,1.56,.64,1);
  will-change:transform, opacity;
}
.splash-logo-wrap::before{
  content:"";
  position:absolute;
  inset:-35%;
  border-radius:50%;
  background:radial-gradient(circle, rgba(44,39,98,.22) 0%, rgba(44,39,98,0) 70%);
  filter:blur(6px);
  opacity:0;
  transition:opacity .6s ease;
}
.splash-logo-wrap img{
  position:relative;
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

.splash-logo-wrap.show{
  opacity:1;
  transform:translate(-50%,-50%) scale(1);
}
.splash-logo-wrap.show::before{
  opacity:1;
}
.splash-logo-wrap.glow-pulse::before{
  animation:splashGlowPulse 1s ease-in-out infinite alternate;
}
.splash-logo-wrap.move{
  transition:transform .65s cubic-bezier(.45,0,.2,1), opacity .3s ease .35s;
  transform:translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(var(--s, .375));
  opacity:0;
}
.splash-logo-wrap.move::before{
  opacity:0;
  transition:opacity .3s ease;
}

@keyframes splashGlowPulse{
  from{opacity:.55; transform:scale(1);}
  to{opacity:.9; transform:scale(1.15);}
}

/* ---------- page content stays hidden/settled until the splash
   finishes, then reveals with a fade + slight slide-up ---------- */
html.splash-pending body{
  overflow:hidden;
}
html.splash-pending .utility-bar,
html.splash-pending .site-header .logo,
html.splash-pending .site-header .main-nav,
html.splash-pending .site-header .nav-actions,
html.splash-pending body > section,
html.splash-pending body > footer{
  opacity:0;
  transform:translateY(22px);
}
html.splash-pending .site-header .logo{
  transition:opacity .5s ease, transform .5s ease;
}

body.splash-reveal .utility-bar,
body.splash-reveal .site-header .logo,
body.splash-reveal .site-header .main-nav,
body.splash-reveal .site-header .nav-actions,
body.splash-reveal > section,
body.splash-reveal > footer{
  opacity:1;
  transform:translateY(0);
  transition:opacity .6s var(--ease, ease), transform .6s var(--ease, ease);
}
body.splash-reveal > section{transition-delay:.04s;}
body.splash-reveal > footer{transition-delay:.08s;}

/* never let the animation block a returning session or users who
   prefer reduced motion */
@media (prefers-reduced-motion: reduce){
  .splash-screen{display:none !important;}
  html.splash-pending body{overflow:auto;}
  html.splash-pending .utility-bar,
  html.splash-pending .site-header .logo,
  html.splash-pending .site-header .main-nav,
  html.splash-pending .site-header .nav-actions,
  html.splash-pending body > section,
  html.splash-pending body > footer{
    opacity:1;
    transform:none;
  }
}
