/* ==========================================================================
   NNP Raisins - Pure Vector Loading Animation Styles
   - Pure Navy contour glow on Light/Paper ground (zero purple)
   - Pristine white vector contour glow on Navy/Dark ground
   - Dynamic 3D perspective approach & staggered berry spring bounce
   - Clean typographic typewriter reveal
   ========================================================================== */

:root {
  --loader-paper:    #edece6;
  --loader-navy:     #1b2652;
  --loader-dusk:     #0d0b14;
}

/* -------------------------------------------------- Fullscreen Container ---- */
.nnp-preloader {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--loader-paper);
  color: var(--loader-navy);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: opacity 0.6s cubic-bezier(0.77, 0, 0.175, 1),
              transform 0.6s cubic-bezier(0.77, 0, 0.175, 1),
              visibility 0.6s;
  perspective: 1200px;
}

/* Themes */
.nnp-preloader[data-theme="paper"] {
  background-color: var(--loader-paper);
  color: var(--loader-navy);
}

.nnp-preloader[data-theme="navy"] {
  background-color: var(--loader-navy);
  color: #ffffff;
}

.nnp-preloader[data-theme="dark"],
.nnp-preloader[data-theme="dusk"] {
  background-color: var(--loader-dusk);
  color: #ffffff;
}

/* Dismissed state */
.nnp-preloader.is-dismissed {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(-20px) scale(1.02) !important;
}

/* -------------------------------------------------- Subtle Ambient Glow ---- */
.nnp-glow-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 420px;
  height: 420px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(27, 38, 82, 0.06) 0%, rgba(27, 38, 82, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.nnp-preloader[data-theme="navy"] .nnp-glow-bg,
.nnp-preloader[data-theme="dark"] .nnp-glow-bg,
.nnp-preloader[data-theme="dusk"] .nnp-glow-bg {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 75%);
}

.nnp-preloader.is-active .nnp-glow-bg {
  opacity: 1;
}

.nnp-haptic-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid rgba(27, 38, 82, 0.35);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
}

.nnp-preloader[data-theme="navy"] .nnp-haptic-ring,
.nnp-preloader[data-theme="dark"] .nnp-haptic-ring,
.nnp-preloader[data-theme="dusk"] .nnp-haptic-ring {
  border-color: rgba(255, 255, 255, 0.6);
}

.nnp-haptic-ring.pulse {
  animation: hapticWave 0.45s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes hapticWave {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0.7; border-width: 2px; }
  100% { transform: translate(-50%, -50%) scale(8); opacity: 0; border-width: 1px; }
}

/* -------------------------------------------------- Master Logo Stage ---- */
.nnp-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88%;
  max-width: 500px;
  padding: 20px;
  transform-style: preserve-3d;
}

/* Lockup: matches exact 700 / 295 master logo proportions */
.nnp-lockup {
  position: relative;
  width: 100%;
  aspect-ratio: 700 / 295;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  transition: filter 0.35s ease, transform 0.35s ease;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.05));
}

.nnp-preloader[data-theme="navy"] .nnp-lockup,
.nnp-preloader[data-theme="dark"] .nnp-lockup,
.nnp-preloader[data-theme="dusk"] .nnp-lockup {
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.35));
}

/* -------------------------------------------------- Vector Edge Contour Glow ---- */
/* Tight, crisp rim highlight hugging the vector contours (Navy on Light, White on Dark) */
.nnp-lockup.final-glow {
  animation: vectorContourGlowNavy 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes vectorContourGlowNavy {
  0% {
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.05));
    transform: scale(1);
  }
  50% {
    /* Pure Dark Blue / Navy (#1b2652) contour rim sheen — zero purple */
    filter: drop-shadow(0 0 4px rgba(27, 38, 82, 0.6)) drop-shadow(0 0 1.5px rgba(27, 38, 82, 0.9)) brightness(1.06);
    transform: scale(1.015);
  }
  100% {
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.05));
    transform: scale(1);
  }
}

.nnp-preloader[data-theme="navy"] .nnp-lockup.final-glow,
.nnp-preloader[data-theme="dark"] .nnp-lockup.final-glow,
.nnp-preloader[data-theme="dusk"] .nnp-lockup.final-glow {
  animation-name: vectorContourGlowDark;
}

@keyframes vectorContourGlowDark {
  0% {
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.35));
    transform: scale(1);
  }
  50% {
    /* Crisp white vector contour sheen */
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.85)) drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.95)) brightness(1.15);
    transform: scale(1.015);
  }
  100% {
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.35));
    transform: scale(1);
  }
}

/* -------------------------------------------------- Grape Mark (Left Column) ---- */
.nnp-mark-box {
  position: absolute;
  left: 0;
  top: 0;
  width: 37.85%; /* 265 / 700 */
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform, opacity, filter;
  z-index: 2;
}

.nnp-mark-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* Individual Grape Berries */
.nnp-berry {
  fill: currentColor;
  transform-origin: center center;
}

/* Staggered Berry Bounce Animation on Touchdown */
.nnp-mark-box.impact .nnp-berry {
  animation: berrySpring 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nnp-mark-box.impact .nnp-berry:nth-child(1) { animation-delay: 0ms; }
.nnp-mark-box.impact .nnp-berry:nth-child(2) { animation-delay: 35ms; }
.nnp-mark-box.impact .nnp-berry:nth-child(3) { animation-delay: 70ms; }
.nnp-mark-box.impact .nnp-berry:nth-child(4) { animation-delay: 40ms; }
.nnp-mark-box.impact .nnp-berry:nth-child(5) { animation-delay: 75ms; }
.nnp-mark-box.impact .nnp-berry:nth-child(6) { animation-delay: 110ms; }

@keyframes berrySpring {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.2) translateY(-2.5px); }
  100% { transform: scale(1) translateY(0); }
}

/* -------------------------------------------------- Typography (Right Column) ---- */
.nnp-text-box {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.nnp-text-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.nnp-glyph {
  fill: currentColor;
  opacity: 0;
  transition: opacity 0.12s ease-out;
  will-change: opacity;
}

/* -------------------------------------------------- Reduced Motion Fallback ---- */
@media (prefers-reduced-motion: reduce) {
  .nnp-mark-box,
  .nnp-text-box,
  .nnp-glyph,
  .nnp-berry,
  .nnp-lockup {
    transition: none !important;
    animation: none !important;
  }
  .nnp-glyph { opacity: 1 !important; }
}
