/* ============================================================================
   Dabil — Splash / Loading Experience
   ----------------------------------------------------------------------------
   Concept: "Aperture of light."
   A pure white canvas. A single soft glow breathes open behind the wordmark,
   the logo settles into place with a gentle spring, one quiet glint travels
   across it, and a few motes of light drift through the air. No bars, no
   spinners — the light itself communicates that something is loading.

   Design constraints honoured:
     • Brand, not industry. No food / fintech / restaurant motifs.
     • Logo is the hero; every layer exists to support it.
     • GPU-friendly: animates only transform / opacity / filter.
     • Honours prefers-reduced-motion.
   ============================================================================ */

:root {
  /* Palette ---------------------------------------------------------------- */
  --dabil-blue:        #2F80ED;   /* primary brand blue                       */
  --dabil-blue-soft:   #56CCF2;   /* secondary, cooler accent                 */
  --bg-top:            #FFFFFF;   /* canvas — top                             */
  --bg-bottom:         #F4F8FF;   /* canvas — bottom (a whisper of blue)      */
  --text-muted:        #64748B;   /* secondary text                          */

  /* Motion ----------------------------------------------------------------- */
  --ease-glide:  cubic-bezier(.22, 1, .36, 1);     /* calm decelerate         */
  --ease-spring: cubic-bezier(.34, 1.18, .42, 1);  /* gentle, intentional     */
}

/* Reset within the splash scope only — safe to drop into any PHP page ------ */
.dabil-splash *,
.dabil-splash *::before,
.dabil-splash *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ----------------------------------------------------------------------------
   Stage — full-viewport, fixed, sits above the page until it dissolves.
---------------------------------------------------------------------------- */
.dabil-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* The canvas: white settling into the faintest cool light toward the floor */
  background:
    radial-gradient(120% 90% at 50% 18%, #FFFFFF 0%, var(--bg-top) 42%, var(--bg-bottom) 100%);

  /* Phase 1 — the whole screen fades up from pure white (0 – 0.3s) */
  animation: stage-in .3s ease-out both;

  /* Phase 6 — dissolve. Added by JS; transition keeps it buttery. */
  transition: opacity .6s var(--ease-glide), visibility .6s var(--ease-glide);
}

.dabil-splash.is-dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes stage-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ----------------------------------------------------------------------------
   Ambient light — the breathing radial glow behind the logo.
   Two stacked layers give the glow real depth rather than a flat circle.
---------------------------------------------------------------------------- */
.dabil-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(70vw, 620px);
  aspect-ratio: 1;
  translate: -50% -50%;
  pointer-events: none;
  will-change: transform, opacity;
}

.dabil-glow::before,
.dabil-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

/* Core glow — soft brand blue, low opacity. This is "light", not a shape. */
.dabil-glow::before {
  background: radial-gradient(circle at 50% 50%,
              rgba(47, 128, 237, .15) 0%,
              rgba(47, 128, 237, .07) 34%,
              rgba(47, 128, 237, 0)  68%);
  /* Phase 2 — expand open (0.3 – 0.8s), then breathe forever after. */
  animation:
    glow-open .9s .15s var(--ease-glide) both,
    glow-breathe 6s 1s ease-in-out infinite;
}

/* Halo — wider, cooler, even fainter; adds atmosphere and diffusion. */
.dabil-glow::after {
  background: radial-gradient(circle at 50% 42%,
              rgba(86, 204, 242, .10) 0%,
              rgba(86, 204, 242, 0)   60%);
  transform: scale(1.35);
  animation:
    glow-open 1.1s .1s var(--ease-glide) both,
    glow-breathe 7.5s 1.2s ease-in-out infinite reverse;
}

@keyframes glow-open {
  from { opacity: 0; transform: scale(.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* Breathing: a slow swell of light, never a pulse. */
@keyframes glow-breathe {
  0%, 100% { transform: scale(1);    opacity: .9; }
  50%      { transform: scale(1.07); opacity: 1;  }
}

/* ----------------------------------------------------------------------------
   Logo — the hero. Fades in while scaling 98% → 100% with a gentle spring.
---------------------------------------------------------------------------- */
.dabil-logo {
  position: relative;
  z-index: 2;
  display: block;
  width: auto;
  height: clamp(46px, 9vw, 72px);   /* responsive, never oversized */
  max-width: 72vw;
  object-fit: contain;
  /* Phase 3 — gentle spring entrance (0.6 – 1.2s). */
  animation: logo-in 1s .55s var(--ease-spring) both;
  will-change: transform, opacity;
  /* No drop-shadow: the ambient glow lifts the mark. A colored halo here
     would read as decoration. Restraint keeps it timeless. */
}

@keyframes logo-in {
  from { opacity: 0; transform: scale(.98) translateY(6px); }
  60%  { opacity: 1; }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ----------------------------------------------------------------------------
   Glint — a single light sweep, masked to the logo's exact silhouette so the
   highlight travels through the artwork itself (Apple-style), not a band over
   a rectangle. Runs once (Phase 4, 1.2 – 1.8s).
   The image is supplied via --logo-src from the markup.
---------------------------------------------------------------------------- */
.dabil-sheen {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  height: clamp(46px, 9vw, 72px);
  width: 72vw;                       /* covers the logo box; mask clips it */
  translate: -50% -50%;
  pointer-events: none;

  /* The moving highlight. */
  background: linear-gradient(105deg,
              transparent 42%,
              rgba(255, 255, 255, .55) 50%,
              rgba(214, 232, 255, .32) 53%,
              transparent 60%);
  background-size: 220% 100%;
  background-position: 150% 0;       /* start off the right edge */
  mix-blend-mode: screen;            /* glints, never darkens */

  /* Confine the highlight to the logo shape. */
  -webkit-mask: var(--logo-src) center / contain no-repeat;
          mask: var(--logo-src) center / contain no-repeat;

  opacity: 0;
  animation: sheen-sweep 1.1s 1.25s var(--ease-glide) forwards;
  will-change: background-position, opacity;
}

@keyframes sheen-sweep {
  0%   { background-position: 150% 0; opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { background-position: -120% 0; opacity: 0; }
}

/* ----------------------------------------------------------------------------
   Ambient particles — a handful of motes drifting like dust in sunlight.
   Nodes are created in JS; each gets per-node CSS vars for organic variety.
   (Phase 5 — fade in around 1.5 – 2.2s, then drift indefinitely.)
---------------------------------------------------------------------------- */
.dabil-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  animation: particles-in 1.4s 1.4s ease-out forwards;
}

@keyframes particles-in { to { opacity: 1; } }

.dabil-mote {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  /* Soft, slightly desaturated blue so motes read as faint dust on a white
     canvas (pure white would vanish). Low per-mote opacity + blur from JS
     keep them ambient, never "bubbles". */
  background: radial-gradient(circle, rgba(120, 162, 224, .8), rgba(120, 162, 224, 0) 70%);
  opacity: var(--opacity);
  filter: blur(.6px);
  will-change: transform, opacity;
  animation: mote-drift var(--duration) var(--delay) ease-in-out infinite alternate;
}

/* Slow vertical + horizontal drift with a soft opacity shimmer. */
@keyframes mote-drift {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(var(--drift-x), var(--drift-y)); }
  100% { transform: translate(calc(var(--drift-x) * -.6), calc(var(--drift-y) * -1)); }
}

/* ----------------------------------------------------------------------------
   Reduced motion — preserve the premium look, remove the movement.
   Glow holds steady, logo simply fades, no sweep, no drifting particles.
---------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .dabil-splash { animation: stage-in .3s ease-out both; }

  .dabil-glow::before,
  .dabil-glow::after { animation: glow-open .6s ease-out both; }

  .dabil-logo { animation: logo-fade .6s .1s ease-out both; }
  @keyframes logo-fade { from { opacity: 0; } to { opacity: 1; } }

  .dabil-sheen { display: none; }

  .dabil-particles { animation: particles-in 1s .3s ease-out forwards; }
  .dabil-mote { animation: none; }
}
