/* ==========================================================================
   WISE SUITE — SIGNATURE BLACK CURTAIN PRELOADER & STAGGERED REVEAL
   Zero-dependency, self-contained, production-ready preloader engine.
   ========================================================================== */

/* Prevent scrolling and interactions while preloader curtain is active */
body.wise-curtain-active {
  overflow: hidden !important;
}

/* Isolate external ambient canvases or floating widgets during preloader */
body.wise-curtain-active > canvas,
body.wise-curtain-active > *:not(#wise-curtain):not(#appRoot) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Full-Screen Pure Black Curtain */
#wise-curtain {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background-color: #000000;
  z-index: 999999;
  pointer-events: all;
  contain: layout paint;
  transform: translateY(0);
  will-change: transform;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

/* Upward Curtain Slide Animation */
#wise-curtain.curtain-slide-up {
  transform: translateY(-100%);
  transition: transform 1.44s cubic-bezier(0.77, 0, 0.175, 1);
}

/* Luminous Bottom Accent Edge Line */
.wise-curtain-edge {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(56, 113, 193, 0.3) 10%,
    #51ADE5 26%,
    #FFFFFF 50%,
    #51ADE5 74%,
    rgba(56, 113, 193, 0.3) 90%,
    transparent 100%
  );
  box-shadow: 
    0 0 12px rgba(81, 173, 229, 0.6),
    0 0 24px rgba(56, 113, 193, 0.5);
  pointer-events: none;
  transition: height 0.35s ease, box-shadow 0.35s ease;
}

/* Vertical Trailing Light Beam extending downward from lifting edge */
.wise-curtain-trail {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 70px;
  background: linear-gradient(
    180deg,
    rgba(81, 173, 229, 0.5) 0%,
    rgba(56, 113, 193, 0.28) 25%,
    rgba(81, 173, 229, 0.1) 60%,
    transparent 100%
  );
  filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  transform-origin: top center;
  transition: opacity 0.35s ease, height 0.35s ease;
}

/* Glow and flare trailing beam as curtain ascends */
#wise-curtain.curtain-slide-up .wise-curtain-edge {
  height: 3.5px;
  box-shadow: 
    0 0 18px #51ADE5,
    0 0 38px rgba(81, 173, 229, 0.95),
    0 0 75px rgba(56, 113, 193, 0.85),
    0 0 115px rgba(81, 173, 229, 0.7);
}

#wise-curtain.curtain-slide-up .wise-curtain-trail {
  opacity: 1;
  height: 95px;
}

/* Centered Stage */
.wise-curtain-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 20px;
  user-select: none;
  pointer-events: none;
  position: relative;
  z-index: 10;
}

/* ========================================================
   AMBIENT DEPTH BACKGROUND (BEHIND LOGO)
   ======================================================== */
.wise-curtain-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

/* 1. Dotted Grid (Subtle Drift & Breathing Opacity) */
.wise-curtain-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(81, 173, 229, 0.18) 1.5px, transparent 1.5px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 48%, black 35%, transparent 95%);
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 48%, black 35%, transparent 95%);
  animation: wiseGridDrift 18s linear infinite, wiseGridBreathe 7s ease-in-out infinite;
}

@keyframes wiseGridDrift {
  0% { background-position: 0px 0px; }
  100% { background-position: 44px 44px; }
}

@keyframes wiseGridBreathe {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 0.95; }
}

/* 2. Top-Center Ambient Glow */
.wise-curtain-glow-top {
  position: absolute;
  top: -8rem;
  left: 50%;
  transform: translateX(-50%);
  width: 780px;
  height: 560px;
  border-radius: 9999px;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(81, 173, 229, 0.11) 0%, rgba(56, 113, 193, 0.05) 45%, transparent 70%);
  animation: wiseGlowTopPulse 12s ease-in-out infinite;
}

@keyframes wiseGlowTopPulse {
  0%, 100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.75;
  }
  50% {
    transform: translateX(-50%) scale(1.08);
    opacity: 1;
  }
}

/* 3. Left-Side Ambient Glow */
.wise-curtain-glow-left {
  position: absolute;
  top: 35%;
  left: -8rem;
  width: 540px;
  height: 540px;
  border-radius: 9999px;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(56, 113, 193, 0.09) 0%, rgba(81, 173, 229, 0.04) 50%, transparent 70%);
  animation: wiseGlowLeftDrift 16s ease-in-out infinite;
}

@keyframes wiseGlowLeftDrift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(25px, -20px); }
}

/* 4. Bottom-Right Ambient Glow */
.wise-curtain-glow-right {
  position: absolute;
  bottom: -6rem;
  right: -6rem;
  width: 620px;
  height: 620px;
  border-radius: 9999px;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(81, 173, 229, 0.09) 0%, rgba(56, 113, 193, 0.04) 50%, transparent 70%);
  animation: wiseGlowRightDrift 18s ease-in-out infinite;
}

@keyframes wiseGlowRightDrift {
  0%, 100% { transform: scale(1) translateX(0); }
  50% { transform: scale(1.06) translateX(-22px); }
}

/* 5. Minimalist Geometric Floating Accents */
.wise-curtain-geom {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  user-select: none;
}

.wise-shape-square {
  position: absolute;
  top: 4.5rem;
  right: 4.5rem;
  width: 110px;
  height: 110px;
  border: 1px solid rgba(81, 173, 229, 0.22);
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  box-shadow: 0 0 25px rgba(81, 173, 229, 0.05);
  animation: wiseRotateSquare 16s ease-in-out infinite;
}

.wise-shape-square-inner {
  width: 64px;
  height: 64px;
  border: 1px solid rgba(56, 113, 193, 0.28);
  border-radius: 0.75rem;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wise-shape-square-inner span {
  color: rgba(81, 173, 229, 0.6);
  font-family: monospace;
  font-size: 0.85rem;
}

@keyframes wiseRotateSquare {
  0%, 100% { transform: rotate(12deg) translateY(0); }
  50% { transform: rotate(38deg) translateY(-18px); }
}

.wise-shape-diamond {
  position: absolute;
  top: 48%;
  left: 3rem;
  width: 82px;
  height: 82px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  animation: wiseFloatDiamond 18s ease-in-out infinite;
}

.wise-shape-diamond span {
  color: rgba(81, 173, 229, 0.45);
  font-family: monospace;
  font-size: 0.95rem;
}

@keyframes wiseFloatDiamond {
  0%, 100% { transform: rotate(-12deg) translateY(0); }
  50% { transform: rotate(18deg) translateY(20px); }
}

.wise-shape-circle {
  position: absolute;
  bottom: 8rem;
  right: 7rem;
  width: 68px;
  height: 68px;
  border: 1px solid rgba(81, 173, 229, 0.18);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  animation: wisePulseCircle 10s ease-in-out infinite;
}

.wise-shape-circle span {
  color: rgba(81, 173, 229, 0.5);
  font-family: monospace;
  font-size: 0.85rem;
}

@keyframes wisePulseCircle {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.15) translateY(-16px); }
}

/* 6. Interactive Canvas inside Curtain */
canvas.wise-curtain-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Responsive adjustments for geometric badges */
@media (max-width: 768px) {
  .wise-shape-square {
    top: 2rem;
    right: 1.5rem;
    width: 75px;
    height: 75px;
  }
  .wise-shape-diamond {
    left: 1rem;
    width: 60px;
    height: 60px;
  }
  .wise-shape-circle {
    bottom: 4rem;
    right: 2rem;
    width: 50px;
    height: 50px;
  }
}

/* Logo Wrapper */
.wise-logo-wrap {
  position: relative;
  width: clamp(210px, 32vw, 320px);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wise-logo-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
}

/* PHASE 1: DOUBLE-J RIBBON MONOGRAM */
.wise-double-j {
  transform-origin: center;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.wise-j-left,
.wise-j-right {
  opacity: 0;
  transform: translateY(22px) scale(0.93);
  filter: blur(8px);
  transform-origin: center;
  will-change: transform, opacity, filter;
  transition: 
    transform 0.85s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.58s ease,
    filter 0.58s ease;
}

.wise-j-left.j-revealed,
.wise-j-right.j-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.wise-double-j.j-pulse {
  animation: wiseJFloat 4.2s ease-in-out infinite;
}

@keyframes wiseJFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* PHASE 2: MINIMALIST BRAND TYPOGRAPHY (W-I-S-E) */
.wise-bottom-section {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.65s ease, transform 0.78s cubic-bezier(0.16, 1, 0.3, 1);
}

.wise-bottom-section.bottom-active {
  opacity: 1;
  transform: translateY(0);
}

.wise-letter {
  opacity: 0;
  transform: translateY(14px) scale(0.92);
  filter: blur(5px);
  transform-origin: center;
  transition: 
    transform 0.62s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.52s ease,
    filter 0.52s ease;
}

.wise-letter.letter-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* PHASE 3: INTERNAL LIGHT RAY SWEEP (100% CONFINED VIA SVG <clipPath>) */
.wise-sweep-clipper {
  pointer-events: none;
}

.wise-sweep-runner {
  opacity: 0;
  transform: translateX(-360px);
  will-change: transform, opacity;
}

.wise-sweep-runner.sweep-active {
  animation: wiseInternalSweep 1.20s cubic-bezier(0.36, 0, 0.24, 1) forwards;
}

@keyframes wiseInternalSweep {
  0% {
    transform: translateX(-360px);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    transform: translateX(580px);
    opacity: 0;
  }
}

/* PHASE 5: STAGGERED ENTRANCE FOR HOST COMPONENTS */
.wise-stagger-item {
  opacity: 0 !important;
  transform: translateY(22px) !important;
  transition: opacity 1.16s cubic-bezier(0.16, 1, 0.3, 1),
              transform 1.16s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: opacity, transform;
}

.wise-stagger-item.wise-stagger-in {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* ACCESSIBILITY: PREFERS-REDUCED-MOTION */
@media (prefers-reduced-motion: reduce) {
  #wise-curtain {
    transition: opacity 0.15s ease !important;
  }
  #wise-curtain.curtain-slide-up {
    transform: none !important;
    opacity: 0 !important;
  }
  .wise-j-left,
  .wise-j-right,
  .wise-letter,
  .wise-bottom-section {
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
    transition: none !important;
  }
  .wise-sweep-runner {
    animation: none !important;
  }
  .wise-stagger-item {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
