/* ══════════════════════════════════════════
   KEYFRAME DEFINITIONS
══════════════════════════════════════════ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes floatX {
  0%,
  100% {
    transform: translateX(0px) rotate(0deg);
  }
  50% {
    transform: translateX(8px) rotate(3deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes borderSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes bounceDown {
  0%,
  100% {
    transform: translateY(0) translateX(-50%);
  }
  50% {
    transform: translateY(8px) translateX(-50%);
  }
}

@keyframes progressFill {
  from {
    width: 0%;
  }
}

@keyframes particleDrift {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0.6;
  }
  33% {
    transform: translateY(-30px) translateX(15px) rotate(120deg);
    opacity: 0.9;
  }
  66% {
    transform: translateY(-10px) translateX(-10px) rotate(240deg);
    opacity: 0.5;
  }
  100% {
    transform: translateY(0) translateX(0) rotate(360deg);
    opacity: 0.6;
  }
}

@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  0%,
  100% {
    border-color: var(--color-accent);
  }
  50% {
    border-color: transparent;
  }
}

@keyframes scrollProgress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes slideInOverlay {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* ══════════════════════════════════════════
   SCROLL-TRIGGERED ANIMATION CLASSES
   Applied by IntersectionObserver in JS
══════════════════════════════════════════ */

.anim-target {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.anim-target.from-left {
  transform: translateX(-30px);
}
.anim-target.from-right {
  transform: translateX(30px);
}
.anim-target.scale-up {
  transform: scale(0.88);
}

.anim-target.visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* Stagger delays */
.stagger-1 {
  transition-delay: 0.05s !important;
}
.stagger-2 {
  transition-delay: 0.1s !important;
}
.stagger-3 {
  transition-delay: 0.15s !important;
}
.stagger-4 {
  transition-delay: 0.2s !important;
}
.stagger-5 {
  transition-delay: 0.25s !important;
}
.stagger-6 {
  transition-delay: 0.3s !important;
}

/* ══════════════════════════════════════════
   CONTINUOUS ANIMATIONS
══════════════════════════════════════════ */

.float-anim {
  animation: floatY 3.5s ease-in-out infinite;
}
.float-anim-slow {
  animation: floatY 5s ease-in-out infinite;
}
.float-anim-x {
  animation: floatX 4s ease-in-out infinite;
}
.pulse-anim {
  animation: pulse 2.5s ease-in-out infinite;
}

.shimmer-text {
  background: linear-gradient(
    90deg,
    var(--color-accent) 20%,
    var(--color-accent-light) 40%,
    #e6ffed 50%,
    var(--color-accent-light) 60%,
    var(--color-accent) 80%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3.5s linear infinite;
}

.gradient-text {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ══════════════════════════════════════════
   SKILL BAR ANIMATION
══════════════════════════════════════════ */

.skill-bar__fill {
  height: 100%;
  background: var(--grad-gold);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.skill-bar__fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: rgba(255, 255, 255, 0.25);
  animation: shimmer 2.5s ease infinite;
}

/* ══════════════════════════════════════════
   PRELOADER
══════════════════════════════════════════ */

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

#preloader {
  position: fixed;
  inset: 0;
  background: var(--color-bg-darkest);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

.preloader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.preloader__logo {
  line-height: 1;
}

.preloader__logo-text {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-text-dim);
  letter-spacing: -0.02em;
}

.preloader__logo-text span {
  color: var(--color-accent);
  text-shadow: 0 0 24px rgba(57, 211, 83, 0.6);
}

.preloader__bar {
  width: 200px;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.preloader__bar-fill {
  height: 100%;
  background: var(--grad-gold);
  border-radius: var(--radius-full);
  animation: progressFill 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  width: 100%;
}

.preloader__terminal {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  color: var(--color-text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.preloader__cursor {
  color: var(--color-accent);
  animation: cursorBlink 1s step-end infinite;
  font-weight: 700;
}

/* ══════════════════════════════════════════
   REDUCE MOTION
══════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim-target {
    opacity: 1;
    transform: none;
  }
}


/* ═══════════════════════════════════
   LIGHTBOX STYLES
═══════════════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(1, 4, 9, 0.95);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lightbox.active {
  display: flex;
  opacity: 1;
}
.lightbox__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}
.lightbox__image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 25px 100px rgba(0,0,0,0.5);
}
.lightbox__close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 44px;
  height: 44px;
  background: rgba(57, 211, 83, 0.15);
  border: 1px solid rgba(57, 211, 83, 0.3);
  border-radius: 50%;
  color: var(--color-text);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.lightbox__close:hover {
  background: rgba(57, 211, 83, 0.35);
  transform: rotate(90deg);
}
.lightbox__caption {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(57, 211, 83, 0.15);
  border: 1px solid rgba(57, 211, 83, 0.3);
  border-radius: 50%;
  color: var(--color-text);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.lightbox__nav:hover {
  background: rgba(57, 211, 83, 0.35);
}
.lightbox__nav--prev { left: -80px; }
.lightbox__nav--next { right: -80px; }

@media (max-width: 767px) {
  .lightbox__nav { width: 40px; height: 40px; font-size: 1.2rem; }
  .lightbox__nav--prev { left: 10px; }
  .lightbox__nav--next { right: 10px; }
  .lightbox__close { top: 10px; right: 10px; }
}