/* ─────────────────────────────────────────────────────────
   YUTING ZHU — PORTFOLIO
   animations.css
   ───────────────────────────────────────────────────────── */

/* ── Keyframes ───────────────────────────────────────────── */

@keyframes wordReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

@keyframes scrollLinePulse {
  0%, 100% { opacity: 0.3; transform: scaleY(1); }
  50%       { opacity: 0.8; transform: scaleY(1.1); }
}

/* ── Scroll-triggered: base state ────────────────────────── */
.animate-in {
  opacity: 0;
  transform: translateY(36px);
  transition:
    opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* When observer adds .is-visible */
.animate-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delay for list rows (each row enters independently) */
.projects-list .project-row:nth-child(1) { transition-delay: 0ms; }
.projects-list .project-row:nth-child(2) { transition-delay: 40ms; }
.projects-list .project-row:nth-child(3) { transition-delay: 80ms; }
.projects-list .project-row:nth-child(4) { transition-delay: 0ms; }
.projects-list .project-row:nth-child(5) { transition-delay: 40ms; }
.projects-list .project-row:nth-child(6) { transition-delay: 80ms; }
.projects-list .project-row:nth-child(7) { transition-delay: 0ms; }

/* About text stagger */
.about-text-col .animate-in:nth-child(1) { transition-delay: 0ms; }
.about-text-col .animate-in:nth-child(2) { transition-delay: 120ms; }
.about-text-col .animate-in:nth-child(3) { transition-delay: 240ms; }
.about-text-col .animate-in:nth-child(4) { transition-delay: 360ms; }

/* ── Hero label + sub fade ───────────────────────────────── */
#heroLabel {
  animation: fadeInUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

#heroSub {
  animation: fadeInUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 1.3s forwards;
}

/* ── Project detail page animations ─────────────────────── */
.proj-header .proj-category-tag,
.proj-header .proj-title,
.proj-header .proj-intro,
.proj-header .proj-ext-link,
.proj-header .proj-meta {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.proj-header .proj-category-tag { animation-delay: 0.1s; }
.proj-header .proj-title         { animation-delay: 0.25s; }
.proj-header .proj-intro         { animation-delay: 0.4s; }
.proj-header .proj-ext-link      { animation-delay: 0.55s; }
.proj-header .proj-meta          { animation-delay: 0.5s; }

/* ── Page transitions ────────────────────────────────────── */
body {
  animation: pageFadeIn 0.5s ease forwards;
}

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

/* Fade-out before navigation (applied by JS) */
body.is-leaving {
  animation: pageFadeOut 0.3s ease forwards;
}

@keyframes pageFadeOut {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ── Image hover overlays ────────────────────────────────── */
.project-row-img {
  position: relative;
}

.project-row-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.4s ease;
  pointer-events: none;
}

.project-row:not(.project-row--tbd) .project-row-link:hover .project-row-img::after {
  background: rgba(0, 0, 0, 0.03);
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-in {
    opacity: 1;
    transform: none;
  }

  .hero-title .word {
    opacity: 1;
    transform: none;
  }

  #heroLabel,
  #heroSub {
    opacity: 1;
  }

  .hero-scroll-cue {
    opacity: 0.4;
  }

  .proj-header .proj-category-tag,
  .proj-header .proj-title,
  .proj-header .proj-intro,
  .proj-header .proj-ext-link,
  .proj-header .proj-meta {
    opacity: 1;
    transform: none;
  }
}
