/* ============================================================
   WIZARDZ OF WEB — Advanced Animations v3
   "Casting Spells for Digital Success"
   ============================================================ */

/* ── GLITCH TEXT EFFECT ──────────────────────────────────── */
.glitch {
  position: relative;
  animation: glitch-skew 4s infinite linear alternate-reverse;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
}
.glitch::before {
  left: 2px;
  text-shadow: -2px 0 #00e5ff;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim 5s infinite linear alternate-reverse;
}
.glitch::after {
  left: -2px;
  text-shadow: -2px 0 #e040fb, 2px 2px #f0c040;
  animation: glitch-anim2 3s infinite linear alternate-reverse;
}
@keyframes glitch-anim {
  0%   { clip: rect(13px,9999px,73px,0); transform: skew(0.3deg); }
  10%  { clip: rect(81px,9999px,23px,0); transform: skew(0.9deg); }
  20%  { clip: rect(45px,9999px,58px,0); transform: skew(0.1deg); }
  30%  { clip: rect(9px, 9999px,95px,0); transform: skew(0.7deg); }
  40%  { clip: rect(62px,9999px,12px,0); transform: skew(0.2deg); }
  50%  { clip: rect(31px,9999px,40px,0); transform: skew(0.5deg); }
  60%  { clip: rect(77px,9999px,28px,0); transform: skew(0.4deg); }
  70%  { clip: rect(18px,9999px,86px,0); transform: skew(0.8deg); }
  80%  { clip: rect(53px,9999px,37px,0); transform: skew(0.6deg); }
  90%  { clip: rect(4px, 9999px,66px,0); transform: skew(0.3deg); }
  100% { clip: rect(89px,9999px,14px,0); transform: skew(0.1deg); }
}
@keyframes glitch-anim2 {
  0%   { clip: rect(65px,9999px,100px,0); transform: skew(0.2deg); }
  15%  { clip: rect(23px,9999px,48px,0);  transform: skew(0.6deg); }
  30%  { clip: rect(87px,9999px,5px, 0);  transform: skew(0.1deg); }
  45%  { clip: rect(10px,9999px,72px,0);  transform: skew(0.9deg); }
  60%  { clip: rect(56px,9999px,33px,0);  transform: skew(0.4deg); }
  75%  { clip: rect(38px,9999px,91px,0);  transform: skew(0.7deg); }
  90%  { clip: rect(74px,9999px,19px,0);  transform: skew(0.3deg); }
  100% { clip: rect(2px, 9999px,64px,0);  transform: skew(0.8deg); }
}
@keyframes glitch-skew {
  0%  { transform: skew(0deg); }
  10% { transform: skew(0.5deg); }
  20% { transform: skew(0deg); }
  30% { transform: skew(-0.3deg); }
  100%{ transform: skew(0deg); }
}

/* ── MORPHING SVG BLOB ───────────────────────────────────── */
.hero-blob {
  position: absolute;
  width: 600px; height: 600px;
  right: -100px; top: -100px;
  opacity: 0.04;
  z-index: 0;
  animation: blob-morph 12s ease-in-out infinite;
  background: var(--gold);
  filter: blur(60px);
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
}
@keyframes blob-morph {
  0%   { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: rotate(0deg) scale(1); }
  25%  { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; transform: rotate(90deg) scale(1.05); }
  50%  { border-radius: 50% 50% 30% 70% / 30% 30% 70% 70%; transform: rotate(180deg) scale(0.95); }
  75%  { border-radius: 70% 30% 50% 50% / 70% 50% 50% 30%; transform: rotate(270deg) scale(1.08); }
  100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: rotate(360deg) scale(1); }
}

/* ── MAGNETIC BUTTON ─────────────────────────────────────── */
.btn-magnetic {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.23,1,0.32,1), box-shadow 0.2s ease;
}
.btn-magnetic::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,0.18) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.btn-magnetic:hover::after { opacity: 1; }

/* ── NEON BORDER TRACE ───────────────────────────────────── */
.neon-trace {
  position: relative;
}
.neon-trace::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(90deg, #f0c040, #00e5ff, #7c4dff, #e040fb, #f0c040);
  background-size: 300% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: neon-trace-anim 4s linear infinite;
}
@keyframes neon-trace-anim {
  0%   { background-position: 0% 0%; }
  100% { background-position: 300% 0%; }
}

/* ── COUNT-UP NUMBER ANIMATION ───────────────────────────── */
.stat-num {
  display: inline-block;
  transition: transform 0.3s;
}
.stat-item:hover .stat-num {
  animation: stat-bounce 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes stat-bounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ── 3D CARD TILT (CSS only fallback, JS enhances) ───────── */
.card-3d {
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.23,1,0.32,1);
  will-change: transform;
}
.card-3d:hover { box-shadow: 0 40px 80px rgba(0,0,0,0.5), 0 0 60px rgba(240,192,64,0.08); }

/* ── STAGGERED LIST REVEAL ───────────────────────────────── */
.stagger-list > * {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.stagger-list.in-view > * {
  opacity: 1;
  transform: none;
}
/* Individual delays for up to 20 children */
.stagger-list.in-view > *:nth-child(1)  { transition-delay: 0.04s; }
.stagger-list.in-view > *:nth-child(2)  { transition-delay: 0.08s; }
.stagger-list.in-view > *:nth-child(3)  { transition-delay: 0.12s; }
.stagger-list.in-view > *:nth-child(4)  { transition-delay: 0.16s; }
.stagger-list.in-view > *:nth-child(5)  { transition-delay: 0.20s; }
.stagger-list.in-view > *:nth-child(6)  { transition-delay: 0.24s; }
.stagger-list.in-view > *:nth-child(7)  { transition-delay: 0.28s; }
.stagger-list.in-view > *:nth-child(8)  { transition-delay: 0.32s; }
.stagger-list.in-view > *:nth-child(9)  { transition-delay: 0.36s; }
.stagger-list.in-view > *:nth-child(10) { transition-delay: 0.40s; }
.stagger-list.in-view > *:nth-child(11) { transition-delay: 0.44s; }
.stagger-list.in-view > *:nth-child(12) { transition-delay: 0.48s; }
.stagger-list.in-view > *:nth-child(13) { transition-delay: 0.52s; }
.stagger-list.in-view > *:nth-child(14) { transition-delay: 0.56s; }
.stagger-list.in-view > *:nth-child(15) { transition-delay: 0.60s; }
.stagger-list.in-view > *:nth-child(16) { transition-delay: 0.64s; }
.stagger-list.in-view > *:nth-child(17) { transition-delay: 0.68s; }
.stagger-list.in-view > *:nth-child(18) { transition-delay: 0.72s; }
.stagger-list.in-view > *:nth-child(19) { transition-delay: 0.76s; }
.stagger-list.in-view > *:nth-child(20) { transition-delay: 0.80s; }

/* ── AURORA BACKGROUND ───────────────────────────────────── */
.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.aurora-band {
  position: absolute;
  width: 200%;
  height: 400px;
  border-radius: 50%;
  filter: blur(80px);
  animation: aurora-drift 18s ease-in-out infinite;
  mix-blend-mode: screen;
}
.aurora-band:nth-child(1) {
  top: 10%; left: -50%;
  background: radial-gradient(ellipse, rgba(124,77,255,0.07) 0%, transparent 70%);
  animation-delay: 0s;
}
.aurora-band:nth-child(2) {
  top: 40%; left: -30%;
  background: radial-gradient(ellipse, rgba(0,229,255,0.05) 0%, transparent 70%);
  animation-delay: -6s;
}
.aurora-band:nth-child(3) {
  top: 70%; left: -40%;
  background: radial-gradient(ellipse, rgba(224,64,251,0.04) 0%, transparent 70%);
  animation-delay: -12s;
}
@keyframes aurora-drift {
  0%   { transform: translateX(0%) rotate(-10deg); }
  33%  { transform: translateX(10%) rotate(0deg); }
  66%  { transform: translateX(5%) rotate(10deg); }
  100% { transform: translateX(0%) rotate(-10deg); }
}

/* ── SKILL BAR ANIMATION ─────────────────────────────────── */
.skill-bar-wrap { margin-bottom: 18px; }
.skill-bar-label {
  display: flex; justify-content: space-between;
  font-family: 'Space Mono', monospace;
  font-size: 12px; color: var(--text-dim);
  margin-bottom: 8px;
}
.skill-bar-label span { color: var(--gold); font-weight: 700; }
.skill-bar-track {
  height: 4px; background: rgba(255,255,255,0.06);
  border-radius: 4px; overflow: hidden;
}
.skill-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--cyan));
  border-radius: 4px;
  width: 0%;
  transition: width 1.4s cubic-bezier(0.22,1,0.36,1);
  box-shadow: 0 0 10px rgba(240,192,64,0.5);
}

/* ── RIPPLE EFFECT ON BUTTONS ────────────────────────────── */
.btn-ripple {
  position: relative;
  overflow: hidden;
}
.ripple-wave {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple-expand 0.6s linear;
  background: rgba(255,255,255,0.15);
  pointer-events: none;
}
@keyframes ripple-expand {
  to { transform: scale(4); opacity: 0; }
}

/* ── FLOATING CARDS ──────────────────────────────────────── */
.float-card {
  animation: float-gentle 6s ease-in-out infinite;
}
.float-card:nth-child(2) { animation-delay: -2s; }
.float-card:nth-child(3) { animation-delay: -4s; }
@keyframes float-gentle {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-8px) rotate(0.5deg); }
  66%       { transform: translateY(-4px) rotate(-0.5deg); }
}

/* ── SCANLINE OVERLAY ─────────────────────────────────────── */
.scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 10;
}

/* ── HOLOGRAPHIC SHINE ────────────────────────────────────── */
.holo-shine {
  position: relative;
  overflow: hidden;
}
.holo-shine::after {
  content: '';
  position: absolute;
  top: -100%; left: -100%;
  width: 60%; height: 300%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255,255,255,0.04) 40%,
    rgba(240,192,64,0.06) 50%,
    rgba(0,229,255,0.04) 60%,
    transparent 70%
  );
  animation: holo-sweep 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes holo-sweep {
  0%   { transform: translateX(-100%) rotate(0deg); }
  50%  { transform: translateX(300%) rotate(0deg); }
  100% { transform: translateX(-100%) rotate(0deg); }
}

/* ── PROGRESS RING (circular) ─────────────────────────────── */
.progress-ring { transform: rotate(-90deg); }
.progress-ring-circle {
  stroke-dasharray: 282;
  stroke-dashoffset: 282;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.22,1,0.36,1);
  stroke-linecap: round;
}

/* ── MATRIX RAIN CANVAS ───────────────────────────────────── */
#matrixCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  opacity: 0.025;
  pointer-events: none;
}

/* ── PARTICLE BURST ON HOVER ──────────────────────────────── */
.burst-particle {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  z-index: 9999;
  animation: burst-fly 0.8s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes burst-fly {
  0%   { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: var(--tx) scale(0); }
}

/* ── ANIMATED GRADIENT TEXT ──────────────────────────────── */
.gradient-text-anim {
  background: linear-gradient(90deg, #f0c040, #00e5ff, #7c4dff, #e040fb, #f0c040);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 3s linear infinite;
}
@keyframes gradient-shift {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* ── TYPEWRITER CURSOR BLINK ─────────────────────────────── */
.typed-cursor {
  display: inline-block;
  width: 2px; height: 1em;
  background: var(--gold);
  margin-left: 2px;
  vertical-align: middle;
  animation: cursor-blink 1s step-end infinite;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── FORM INPUT MAGIC FOCUS ──────────────────────────────── */
.form-group {
  position: relative;
}
.form-group input,
.form-group textarea,
.form-group select {
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
  transform: translateY(-1px);
}
.form-group label {
  transition: color 0.3s, letter-spacing 0.3s;
}
.form-group:focus-within label {
  color: var(--gold);
  letter-spacing: 0.08em;
}

/* ── NOTIFICATION TOAST ──────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 30px; right: 30px;
  background: rgba(10,18,40,0.95);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 16px 24px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  color: var(--text);
  z-index: 99999;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 40px rgba(240,192,64,0.15), 0 20px 60px rgba(0,0,0,0.5);
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 340px;
  display: flex; align-items: center; gap: 12px;
}
.toast.show { transform: translateX(0); }
.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast.success { border-color: #00e5ff; }
.toast.error   { border-color: #e53935; }

/* ── LOADING SPINNER ─────────────────────────────────────── */
.spell-spinner {
  width: 36px; height: 36px;
  display: inline-block;
  position: relative;
}
.spell-spinner::before,
.spell-spinner::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}
.spell-spinner::before {
  inset: 0;
  border: 2px solid rgba(240,192,64,0.15);
}
.spell-spinner::after {
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--gold);
  animation: spinner-rotate 0.8s linear infinite;
}
@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

/* ── PAGE TRANSITION ─────────────────────────────────────── */
.page-transition {
  position: fixed;
  inset: 0;
  background: #03050f;
  z-index: 99998;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.4s cubic-bezier(0.76,0,0.24,1);
  pointer-events: none;
}
.page-transition.entering { transform: scaleY(1); transform-origin: top; }
.page-transition.leaving  { transform: scaleY(0); transform-origin: bottom; }

/* ── MOUSE PARALLAX LAYER ────────────────────────────────── */
.parallax-layer {
  transition: transform 0.1s ease-out;
  will-change: transform;
}

/* ── GLOW PULSE ON ACTIVE NAV ────────────────────────────── */
nav a.active,
nav a[aria-current="page"] {
  position: relative;
}
nav a.active::after,
nav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 50%;
  transform: translateX(-50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  animation: nav-dot-pulse 2s ease-in-out infinite;
}
@keyframes nav-dot-pulse {
  0%, 100% { box-shadow: 0 0 8px var(--gold); }
  50%       { box-shadow: 0 0 18px var(--gold), 0 0 30px rgba(240,192,64,0.4); }
}
