/* ══════════════════════════════════════════════════════════════
   animations.css — Roshan Shrestha Portfolio
   All @keyframes, scroll-reveal classes, stagger utilities,
   hero entrance, and micro-interaction animations
══════════════════════════════════════════════════════════════ */

/* ─── KEYFRAMES ─── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeLeft {
  from { opacity: 0; transform: translateX(-22px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeRight {
  from { opacity: 0; transform: translateX(22px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
@keyframes orb-pulse {
  0%, 100% { transform: scale(1) translate(0, 0); opacity: 1; }
  50%       { transform: scale(1.12) translate(20px, -15px); opacity: 0.75; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
@keyframes scroll-drop {
  0%   { top: -100%; opacity: 1; }
  80%  { top: 100%;  opacity: 1; }
  100% { top: 100%;  opacity: 0; }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
@keyframes draw-line {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}
@keyframes count-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes nav-slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
@keyframes ripple {
  0%   { transform: scale(0); opacity: 0.4; }
  100% { transform: scale(4); opacity: 0; }
}
@keyframes tag-pop {
  0%   { transform: scale(0.8); opacity: 0; }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── NAV ENTRANCE ─── */
nav {
  animation: nav-slide-down 0.5s cubic-bezier(0.22,1,0.36,1) both;
}

/* ─── HERO ENTRANCE (staggered) ─── */
.hero-mono   { animation: fadeUp 0.65s cubic-bezier(0.22,1,0.36,1) 0.1s  both; }
.hero-name   { animation: fadeUp 0.75s cubic-bezier(0.22,1,0.36,1) 0.22s both; }
.hero-title  { animation: fadeUp 0.65s cubic-bezier(0.22,1,0.36,1) 0.36s both; }
.hero-desc   { animation: fadeUp 0.65s cubic-bezier(0.22,1,0.36,1) 0.48s both; }
.hero-ctas   { animation: fadeUp 0.65s cubic-bezier(0.22,1,0.36,1) 0.6s  both; }
.hero-stats  { animation: fadeUp 0.65s cubic-bezier(0.22,1,0.36,1) 0.75s both; }
.scroll-hint { animation: fadeIn  0.8s ease 2s both; }

/* ─── SCROLL-REVEAL BASE ─── */
/* Elements start hidden; JS adds .revealed when in viewport */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s cubic-bezier(0.22,1,0.36,1),
              transform 0.65s cubic-bezier(0.22,1,0.36,1);
  will-change: opacity, transform;
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Directional variants */
.reveal-left {
  opacity: 0;
  transform: translateX(-28px);
  transition: opacity 0.65s cubic-bezier(0.22,1,0.36,1),
              transform 0.65s cubic-bezier(0.22,1,0.36,1);
}
.reveal-left.revealed { opacity: 1; transform: translateX(0); }

.reveal-right {
  opacity: 0;
  transform: translateX(28px);
  transition: opacity 0.65s cubic-bezier(0.22,1,0.36,1),
              transform 0.65s cubic-bezier(0.22,1,0.36,1);
}
.reveal-right.revealed { opacity: 1; transform: translateX(0); }

.reveal-scale {
  opacity: 0;
  transform: scale(0.93);
  transition: opacity 0.55s cubic-bezier(0.22,1,0.36,1),
              transform 0.55s cubic-bezier(0.22,1,0.36,1);
}
.reveal-scale.revealed { opacity: 1; transform: scale(1); }

/* ─── STAGGER DELAYS (applied via JS or inline) ─── */
.stagger-1  { transition-delay: 0.05s  !important; }
.stagger-2  { transition-delay: 0.10s  !important; }
.stagger-3  { transition-delay: 0.16s  !important; }
.stagger-4  { transition-delay: 0.22s  !important; }
.stagger-5  { transition-delay: 0.28s  !important; }
.stagger-6  { transition-delay: 0.34s  !important; }
.stagger-7  { transition-delay: 0.40s  !important; }
.stagger-8  { transition-delay: 0.46s  !important; }

/* ─── SECTION EYEBROW SLIDE ─── */
.section-eyebrow.reveal {
  transform: translateX(-12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.section-eyebrow.reveal.revealed { transform: translateX(0); }

/* ─── SKILL CARD TAG STAGGER (animated on card reveal) ─── */
.skill-category.revealed .skill-tag {
  animation: tag-pop 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}
.skill-category.revealed .skill-tag:nth-child(1)  { animation-delay: 0.05s; }
.skill-category.revealed .skill-tag:nth-child(2)  { animation-delay: 0.10s; }
.skill-category.revealed .skill-tag:nth-child(3)  { animation-delay: 0.15s; }
.skill-category.revealed .skill-tag:nth-child(4)  { animation-delay: 0.20s; }
.skill-category.revealed .skill-tag:nth-child(5)  { animation-delay: 0.25s; }
.skill-category.revealed .skill-tag:nth-child(6)  { animation-delay: 0.30s; }

/* ─── TIMELINE ITEM SLIDE-IN ─── */
.timeline-item.reveal {
  transform: translateX(-16px);
  /* Explicitly list only the properties we animate — do NOT use shorthand
     'transition' here because it would override the ::before height transition
     defined in style.css, causing the accent line to misbehave */
  transition-property: opacity, transform;
  transition-duration: 0.6s;
  transition-timing-function: cubic-bezier(0.22,1,0.36,1);
}
.timeline-item.reveal.revealed {
  transform: translateX(0);
}

/* ─── PILL STAGGER IN ABOUT ─── */
.about-pills.revealed .pill {
  animation: fadeUp 0.4s cubic-bezier(0.22,1,0.36,1) both;
}
.about-pills.revealed .pill:nth-child(1) { animation-delay: 0.04s; }
.about-pills.revealed .pill:nth-child(2) { animation-delay: 0.09s; }
.about-pills.revealed .pill:nth-child(3) { animation-delay: 0.14s; }
.about-pills.revealed .pill:nth-child(4) { animation-delay: 0.19s; }
.about-pills.revealed .pill:nth-child(5) { animation-delay: 0.24s; }
.about-pills.revealed .pill:nth-child(6) { animation-delay: 0.29s; }
.about-pills.revealed .pill:nth-child(7) { animation-delay: 0.34s; }
.about-pills.revealed .pill:nth-child(8) { animation-delay: 0.39s; }

/* ─── CONTACT LINK STAGGER ─── */
.contact-links.revealed .contact-link-item {
  animation: fadeLeft 0.45s cubic-bezier(0.22,1,0.36,1) both;
}
.contact-links.revealed .contact-link-item:nth-child(1) { animation-delay: 0.05s; }
.contact-links.revealed .contact-link-item:nth-child(2) { animation-delay: 0.12s; }
.contact-links.revealed .contact-link-item:nth-child(3) { animation-delay: 0.19s; }
.contact-links.revealed .contact-link-item:nth-child(4) { animation-delay: 0.26s; }
.contact-links.revealed .contact-link-item:nth-child(5) { animation-delay: 0.33s; }

/* ─── BUTTON RIPPLE ─── */
.btn .ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  width: 60px; height: 60px;
  margin-left: -30px; margin-top: -30px;
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* ─── STAT COUNTER ANIMATION ─── */
.stat-num.counting { animation: count-up 0.5s ease both; }

/* ─── TEXT SHIMMER (loading/skeleton effect) ─── */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    var(--surface-3) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
  border-radius: 4px;
  color: transparent !important;
}

/* ─── PAGE LOADER ─── */
#page-loader {
  position: fixed;
  inset: 0;
  background: var(--surface);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
#page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-name {
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.1em;
  animation: blink 1.2s step-end infinite;
}
.loader-bar {
  width: 120px; height: 2px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.05s linear;
}

/* ─── REDUCE MOTION OVERRIDE ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .reveal-left, .reveal-right, .reveal-scale {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  #page-loader { display: none; }
  #cursor-dot, #cursor-ring { display: none; }
}
