/* ============================================================
   GUARDIFY — PRELOADER
   ============================================================ */

body.loading { overflow: hidden; }

/* ── Overlay ─────────────────────────────────────────────────── */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0a0614;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pl-bg-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 50%,
    rgba(124, 58, 237, 0.22) 0%,
    transparent 70%);
  animation: glow-breathe 2.4s ease-in-out infinite alternate;
}
@keyframes glow-breathe {
  from { opacity: 0.5; transform: scale(0.95); }
  to   { opacity: 1;   transform: scale(1.05); }
}

/* ── Center ──────────────────────────────────────────────────── */
.pl-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* ── Logo wrap ───────────────────────────────────────────────── */
.pl-logo-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Morph glow blob behind logo */
.pl-logo-wrap::before {
  content: '';
  position: absolute;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(124,58,237,0.35) 0%, transparent 70%);
  border-radius: 50%;
  animation: blob-morph 3s ease-in-out infinite alternate;
}
@keyframes blob-morph {
  0%   { transform: scale(1)    rotate(0deg);   opacity: 0.6; }
  33%  { transform: scale(1.3)  rotate(60deg);  opacity: 1;   }
  66%  { transform: scale(0.9)  rotate(120deg); opacity: 0.7; }
  100% { transform: scale(1.2)  rotate(180deg); opacity: 1;   }
}

/* Spinning rings */
.pl-ring {
  position: absolute;
  border-radius: 50%;
}
.pl-ring-1 {
  width: 140px;
  height: 140px;
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-top-color: rgba(168, 85, 247, 0.8);
  border-right-color: rgba(168, 85, 247, 0.3);
  animation: ring-spin 1.6s linear infinite;
}
.pl-ring-2 {
  width: 112px;
  height: 112px;
  border: 1px solid rgba(124, 58, 237, 0.1);
  border-bottom-color: rgba(232, 121, 249, 0.6);
  border-left-color: rgba(232, 121, 249, 0.2);
  animation: ring-spin 2.2s linear infinite reverse;
}
@keyframes ring-spin { to { transform: rotate(360deg); } }

/* SVG hex */
.pl-hex {
  width: 84px;
  height: 84px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 14px rgba(124,58,237,0.7));
  animation:
    logo-pop   0.6s cubic-bezier(0.34,1.56,0.64,1) 0.15s both,
    hex-breathe 2.8s ease-in-out 1.2s infinite alternate;
}
@keyframes logo-pop {
  from { opacity: 0; transform: scale(0.55) rotate(-15deg); }
  to   { opacity: 1; transform: scale(1)    rotate(0deg); }
}
@keyframes hex-breathe {
  from { filter: drop-shadow(0 0 14px rgba(124,58,237,0.6)); transform: scale(1); }
  to   { filter: drop-shadow(0 0 28px rgba(168,85,247,0.95)); transform: scale(1.06); }
}

.pl-hex-outer {
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: draw-stroke 0.85s cubic-bezier(0.4,0,0.2,1) 0.2s forwards;
}
.pl-hex-inner {
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: draw-stroke 0.7s ease 0.6s forwards;
}
@keyframes draw-stroke { to { stroke-dashoffset: 0; } }

.pl-hex-icon {
  animation:
    icon-fade   0.4s ease 0.9s both,
    icon-pulse  2.4s ease-in-out 1.5s infinite alternate;
}
@keyframes icon-fade {
  from { opacity: 0; transform-origin: 50px 50px; transform: scale(0.4) rotate(20deg); }
  to   { opacity: 1; transform-origin: 50px 50px; transform: scale(1)   rotate(0deg); }
}
@keyframes icon-pulse {
  from { opacity: 0.8; }
  to   { opacity: 1; }
}

/* ── Brand ───────────────────────────────────────────────────── */
.pl-brand {
  text-align: center;
  animation: brand-up 0.55s cubic-bezier(0.4,0,0.2,1) 0.75s both;
}
@keyframes brand-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pl-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(34px, 5vw, 50px);
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #ffffff 20%, #a855f7 60%, #e879f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  animation: name-shimmer 3s ease-in-out 1.5s infinite alternate;
}
@keyframes name-shimmer {
  from { filter: brightness(1); }
  to   { filter: brightness(1.25); }
}

.pl-sub {
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(168, 85, 247, 0.55);
  margin-top: 9px;
  animation: sub-fade 0.6s ease 1.1s both;
}
@keyframes sub-fade {
  from { opacity: 0; letter-spacing: 0.4em; }
  to   { opacity: 1; letter-spacing: 0.25em; }
}

/* ── Progress bar ────────────────────────────────────────────── */
.pl-progress {
  width: 190px;
  height: 2px;
  background: rgba(124,58,237,0.12);
  border-radius: 2px;
  overflow: hidden;
  animation: brand-up 0.4s ease 1s both;
}

.pl-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #7c3aed, #a855f7, #e879f9);
  box-shadow: 0 0 10px rgba(168,85,247,0.8), 0 0 20px rgba(168,85,247,0.3);
  transition: width 0.1s linear;
  position: relative;
}
/* Travelling shine on bar */
.pl-progress-fill::after {
  content: '';
  position: absolute;
  right: -20px; top: 0; bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: bar-shine 0.9s ease-in-out infinite;
}
@keyframes bar-shine {
  0%,100% { opacity: 0; }
  50%     { opacity: 1; }
}

/* ── Morph transition OUT — iris wipe from center ─────────────── */
.preloader.pl-exit {
  animation: iris-out 0.75s cubic-bezier(0.76,0,0.24,1) forwards;
}
@keyframes iris-out {
  0%   { clip-path: circle(100% at 50% 50%); opacity: 1; }
  100% { clip-path: circle(0%   at 50% 50%); opacity: 0; }
}

/* ── Page entrance ───────────────────────────────────────────── */
body.loading .navbar,
body.loading section,
body.loading footer { visibility: hidden !important; }

body.loaded .navbar,
body.loaded section,
body.loaded footer {
  visibility: visible;
  animation: page-in 0.55s ease both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
