/* Motion layer — scroll reveals, hero, micro-interactions */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --reveal-duration: 0.68s;
}

@keyframes backdrop-drift {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  40% {
    transform: translate(-4%, 3%) scale(1.04);
  }
  70% {
    transform: translate(3%, -2%) scale(0.98);
  }
}

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

body.is-loaded .scroll-progress-bar {
  animation: scroll-shimmer 2.8s ease-in-out infinite;
}

/* --- Page load: header + hero cascade --- */
body:not(.is-loaded) .site-header {
  transform: translateY(-100%);
  opacity: 0;
}

body.is-loaded .site-header {
  transform: translateY(0);
  opacity: 1;
  box-shadow: 0 0 0 1px var(--site-header-load-ring);
}

body:not(.is-loaded) .hero-copy > *,
body:not(.is-loaded) .hero-visual,
body:not(.is-loaded) .stats-row .stat {
  opacity: 0;
  transform: translateY(24px);
  filter: blur(8px);
}

body.is-loaded .hero-copy > * {
  animation: hero-rise 0.62s var(--ease-out-expo) forwards;
}

body.is-loaded .hero-copy > *:nth-child(1) {
  animation-delay: 0.06s;
}

body.is-loaded .hero-copy > *:nth-child(2) {
  animation-delay: 0.12s;
}

body.is-loaded .hero-copy > *:nth-child(3) {
  animation-delay: 0.18s;
}

body.is-loaded .hero-copy > *:nth-child(4) {
  animation-delay: 0.24s;
}

body.is-loaded .hero-visual {
  animation: hero-photo-in 0.72s var(--ease-out-expo) 0.1s forwards;
}

body.is-loaded .stats-row .stat:nth-child(1) {
  animation: hero-rise 0.58s var(--ease-out-expo) 0.35s forwards;
}

body.is-loaded .stats-row .stat:nth-child(2) {
  animation: hero-rise 0.58s var(--ease-out-expo) 0.42s forwards;
}

body.is-loaded .stats-row .stat:nth-child(3) {
  animation: hero-rise 0.58s var(--ease-out-expo) 0.49s forwards;
}

body.is-loaded .stats-row .stat:nth-child(4) {
  animation: hero-rise 0.58s var(--ease-out-expo) 0.56s forwards;
}

@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes hero-photo-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96) rotate(-1deg);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
    filter: blur(0);
  }
}

/* Hero aurora blobs */
.hero {
  isolation: isolate;
}

.hero-aurora {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-aurora::before,
.hero-aurora::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: aurora-float 14s ease-in-out infinite;
}

.hero-aurora::before {
  width: min(420px, 55vw);
  height: min(420px, 55vw);
  background: radial-gradient(circle, rgba(135, 80, 247, 0.55) 0%, transparent 68%);
  top: -12%;
  right: 5%;
  animation-delay: 0s;
}

.hero-aurora::after {
  width: min(340px, 45vw);
  height: min(340px, 45vw);
  background: radial-gradient(circle, rgba(192, 132, 252, 0.35) 0%, transparent 70%);
  bottom: 10%;
  left: -5%;
  animation-delay: -4s;
  animation-duration: 18s;
}

@keyframes aurora-float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(4%, -6%) scale(1.06);
  }
  66% {
    transform: translate(-5%, 4%) scale(0.96);
  }
}

/* Eyebrow pulse dot */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  animation: pulse-dot 2.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.25);
    opacity: 0.85;
  }
}

/* Animated gradient text */
.text-gradient-shift {
  display: inline-block;
  background: linear-gradient(
    110deg,
    #9d6aff 0%,
    #d4c4ff 28%,
    #b794f6 48%,
    #7c4dff 72%,
    #c4a5ff 100%
  );
  background-size: 240% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-flow 9s ease-in-out infinite alternate;
}

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

/* Hero portrait float */
body.is-loaded .hero-photo-wrap {
  animation: portrait-float 7s ease-in-out 1.2s infinite;
}

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

/* Button shine sweep */
.btn-shine::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 36%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 64%
  );
  transform: translateX(-120%) skewX(-12deg);
  transition: transform 0.65s var(--ease-out-expo);
  pointer-events: none;
}

.btn-shine:hover::after {
  transform: translateX(120%) skewX(-12deg);
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(32px) scale(0.985);
  filter: blur(6px);
  transition:
    opacity var(--reveal-duration) var(--ease-out-expo),
    transform var(--reveal-duration) var(--ease-out-expo),
    filter calc(var(--reveal-duration) * 0.85) var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform, filter;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* Title line mask — editorial reveal */
.section-head h2,
.testimonials-head h2,
.col-title {
  transition: clip-path 1.05s var(--ease-out-expo), opacity 0.8s ease;
  transition-delay: var(--reveal-delay, 0s);
}

.section-head.reveal:not(.is-visible) h2,
.testimonials-head.reveal:not(.is-visible) h2,
.col-title.reveal:not(.is-visible) {
  clip-path: inset(0 100% 0 0);
}

.section-head.reveal.is-visible h2,
.testimonials-head.reveal.is-visible h2,
.col-title.reveal.is-visible {
  clip-path: inset(0 0 0 0);
}

/* Section titles: subtle underline draw */
.section-head h2,
.col-title {
  position: relative;
}

.section-head.center h2::after,
.testimonials-head h2::after {
  content: "";
  display: block;
  width: 0;
  height: 3px;
  margin: 0.6rem auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transition: width 1s var(--ease-out-expo);
}

.section-head.reveal.is-visible h2::after,
.testimonials-head.reveal.is-visible h2::after {
  width: min(120px, 40%);
}

.col-title::after {
  content: "";
  display: block;
  width: 0;
  height: 3px;
  margin-top: 0.5rem;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  transition: width 0.9s var(--ease-out-expo);
}

.col-title.reveal.is-visible::after {
  width: 48px;
}

/* Nav link hover shimmer */
@media (min-width: 1024px) {
  .nav-list a {
    position: relative;
  }

  .nav-list a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), #c084fc);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.35s var(--ease-out-expo);
  }

  .nav-list a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
  }
}

/* Skill icon orbit glow */
.skill-icon {
  transition: transform 0.45s var(--ease-out-expo), box-shadow 0.35s ease;
}

.skill-card:hover .skill-icon {
  transform: scale(1.08) rotate(-6deg);
  box-shadow: 0 0 24px rgba(135, 80, 247, 0.35);
}

/* Testimonial quote breathe */
.testimonial-card.is-visible .quote-icon {
  animation: quote-pop 0.7s var(--ease-out-expo) both;
}

@keyframes quote-pop {
  from {
    transform: scale(0.5) rotate(-12deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

/* Work grid filter transition */
.work-card.is-hiding,
.repo-card.is-hiding {
  opacity: 0;
  transform: scale(0.94) translateY(12px);
  filter: blur(6px);
  pointer-events: none;
}

.work-card.is-entering,
.repo-card.is-entering {
  animation: work-enter 0.4s var(--ease-out-expo) forwards;
}

@keyframes work-enter {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(24px);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

/* Cursor glow (desktop) */
.cursor-glow {
  display: none;
}

@media (pointer: fine) and (min-width: 900px) {
  .cursor-glow {
    display: block;
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 50;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(135, 80, 247, 0.14) 0%, transparent 68%);
    opacity: 0;
    transition: opacity 0.4s ease;
    will-change: transform;
  }

  body.is-loaded .cursor-glow {
    opacity: 0.85;
  }
}

/* Magnetic buttons: smooth return */
.magnetic {
  transition: transform 0.25s var(--ease-out-expo);
}

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

  body.is-loaded .scroll-progress-bar {
    animation: none !important;
  }

  .section-head h2,
  .testimonials-head h2,
  .col-title {
    clip-path: none !important;
  }

  .timeline-item::before {
    transform: scaleY(1) !important;
  }

  html {
    scroll-behavior: auto;
  }

  body:not(.is-loaded) .site-header,
  body:not(.is-loaded) .hero-copy > *,
  body:not(.is-loaded) .hero-visual,
  body:not(.is-loaded) .stats-row .stat {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
  }

  body.is-loaded .hero-photo-wrap {
    animation: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }

  .cursor-glow {
    display: none !important;
  }

  .hero-aurora::before,
  .hero-aurora::after {
    animation: none;
  }

  .text-gradient-shift {
    animation: none;
    background-position: 0 center;
  }

}
