/* ============================================
   ANIMATIONS — Scandinavian Minimalist Portfolio
   Scroll-driven, Parallax, Stagger, Micro-interactions
   ============================================ */

/* =============================================
   CSS SCROLL-DRIVEN ANIMATIONS
   ============================================= */

/* Reveal from below */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  animation: reveal-up linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 100%;
}

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

/* Reveal from left */
.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  animation: reveal-from-left linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 100%;
}

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

/* Reveal from right */
.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  animation: reveal-from-right linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 100%;
}

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

/* Reveal with scale */
.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  animation: reveal-scale-up linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 100%;
}

@keyframes reveal-scale-up {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* =============================================
   PARALLAX
   ============================================= */

.parallax-slow {
  animation: parallax-shift linear both;
  animation-timeline: scroll(root);
}

@keyframes parallax-shift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-60px);
  }
}

/* =============================================
   STAGGER DELAYS
   ============================================= */

.stagger > :nth-child(1) {
  animation-delay: 0ms;
}

.stagger > :nth-child(2) {
  animation-delay: 80ms;
}

.stagger > :nth-child(3) {
  animation-delay: 160ms;
}

.stagger > :nth-child(4) {
  animation-delay: 240ms;
}

.stagger > :nth-child(5) {
  animation-delay: 320ms;
}

.stagger > :nth-child(6) {
  animation-delay: 400ms;
}

.stagger > :nth-child(7) {
  animation-delay: 480ms;
}

.stagger > :nth-child(8) {
  animation-delay: 560ms;
}

.stagger > :nth-child(9) {
  animation-delay: 640ms;
}

.stagger > :nth-child(10) {
  animation-delay: 720ms;
}

.stagger > :nth-child(11) {
  animation-delay: 800ms;
}

.stagger > :nth-child(12) {
  animation-delay: 880ms;
}

/* =============================================
   HERO ENTRANCE (PAGE LOAD)
   ============================================= */

.hero__title {
  animation: hero-title-reveal 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

@keyframes hero-title-reveal {
  from {
    opacity: 0;
    clip-path: inset(100% 0 0 0);
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    clip-path: inset(0% 0 0 0);
    transform: translateY(0);
  }
}

.hero__subtitle {
  animation: hero-subtitle-reveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

@keyframes hero-subtitle-reveal {
  from {
    opacity: 0;
    clip-path: inset(100% 0 0 0);
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    clip-path: inset(0% 0 0 0);
    transform: translateY(0);
  }
}

.hero__scroll-hint {
  animation: hero-scroll-bounce 2.4s ease-in-out 1.2s infinite;
  opacity: 0;
  animation-fill-mode: forwards;
}

@keyframes hero-scroll-bounce {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* =============================================
   PAGE LOAD ENTRANCE
   ============================================= */

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  opacity: 0;
  animation: fade-in-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.animate-in--delay-1 {
  opacity: 0;
  animation: fade-in-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.animate-in--delay-2 {
  opacity: 0;
  animation: fade-in-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.animate-in--delay-3 {
  opacity: 0;
  animation: fade-in-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.animate-in--delay-4 {
  opacity: 0;
  animation: fade-in-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.animate-in--delay-5 {
  opacity: 0;
  animation: fade-in-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

/* =============================================
   LINK UNDERLINE ANIMATION
   ============================================= */

a.link-animated {
  position: relative;
  text-decoration: none;
}

a.link-animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1.5px;
  background-color: var(--accent);
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform var(--transition-base);
}

a.link-animated:hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* =============================================
   MICRO-INTERACTIONS
   ============================================= */

/* Button hover lift */
.btn {
  transition: background-color var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast),
              transform var(--transition-fast),
              box-shadow var(--transition-fast);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

/* Card hover lift + shadow */
.card {
  transition: transform var(--transition-base),
              box-shadow var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* Principle card subtle lift */
.principle-card {
  transition: transform var(--transition-base),
              box-shadow var(--transition-base);
}

.principle-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Social link pop */
.social__link {
  transition: background-color var(--transition-fast),
              color var(--transition-fast),
              transform var(--transition-fast);
}

.social__link:hover {
  transform: translateY(-2px) scale(1.05);
}

/* Nav link subtle shift */
.nav__link {
  transition: color var(--transition-fast),
              transform var(--transition-fast);
}

.nav__link:hover {
  transform: translateY(-1px);
}

/* Image zoom on hover */
.about__image-wrapper .about__image {
  transition: transform var(--transition-slow);
}

.about__image-wrapper:hover .about__image {
  transform: scale(1.04);
}

/* Card image zoom */
.card__image img {
  transition: transform var(--transition-slow);
}

.card:hover .card__image img {
  transform: scale(1.04);
}

/* Article item slide */
.article-item {
  transition: padding-left var(--transition-base);
}

.article-item:hover {
  padding-left: var(--space-md);
}

/* =============================================
   REDUCED MOTION
   ============================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .parallax-slow {
    animation: none;
    transform: none;
  }

  .hero__title,
  .hero__subtitle {
    opacity: 1;
    transform: none;
    clip-path: none;
    animation: none;
  }

  .hero__scroll-hint {
    opacity: 1;
    animation: none;
  }

  .animate-in,
  .animate-in--delay-1,
  .animate-in--delay-2,
  .animate-in--delay-3,
  .animate-in--delay-4,
  .animate-in--delay-5 {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .btn:hover,
  .card:hover,
  .social__link:hover,
  .principle-card:hover,
  .nav__link:hover {
    transform: none;
  }

  .article-item:hover {
    padding-left: 0;
  }

  a.link-animated::after {
    transform: scaleX(1);
    transition: none;
  }

  .about__image-wrapper:hover .about__image,
  .card:hover .card__image img {
    transform: none;
  }
}
