/* ── Weird / maximal motion layer ── */

.motion-fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb-4 {
  width: 200px;
  height: 200px;
  top: 20%;
  right: 15%;
  background: radial-gradient(circle, #5f8f84 0%, transparent 70%);
  animation: orbWeird 8s ease-in-out infinite;
  filter: blur(60px);
  opacity: 0.5;
}

.orb-5 {
  width: 180px;
  height: 180px;
  bottom: 25%;
  left: 20%;
  background: radial-gradient(circle, #8aa4b4 0%, transparent 70%);
  animation: orbWeird 11s ease-in-out infinite reverse;
  filter: blur(55px);
  opacity: 0.45;
}

@keyframes orbWeird {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  25% {
    transform: translate(60px, -40px) rotate(90deg) scale(1.2);
  }
  50% {
    transform: translate(-30px, 50px) rotate(180deg) scale(0.8);
  }
  75% {
    transform: translate(40px, 30px) rotate(270deg) scale(1.1);
  }
}

.film-grain {
  position: absolute;
  inset: -50%;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 0.5s steps(6) infinite;
  pointer-events: none;
}

html.dark .film-grain {
  opacity: 0.07;
}

@keyframes grainShift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-3%, -2%);
  }
  50% {
    transform: translate(2%, 3%);
  }
  75% {
    transform: translate(-2%, 1%);
  }
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  animation: scanMove 8s linear infinite;
  opacity: 0.35;
}

html.dark .scanlines {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.02) 2px,
    rgba(255, 255, 255, 0.02) 4px
  );
}

@keyframes scanMove {
  to {
    transform: translateY(40px);
  }
}

/* Glitch hero — disabled */

/* Wobble section titles */
.section-title {
  animation: titleWobble 6s ease-in-out infinite;
}

@keyframes titleWobble {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(0.4deg) scale(1.01);
  }
  75% {
    transform: rotate(-0.4deg) scale(1.01);
  }
}

.section-title.reveal.is-visible {
  animation: titleSlideIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both,
    titleWobble 6s ease-in-out 1s infinite;
}

/* Cards — calm surface, hover handled in styles.css */
.tilt-card {
  position: relative;
  isolation: isolate;
}

.tilt-card::before,
.tilt-card::after {
  display: none;
}

.tilt-card.is-visible {
  animation: none;
}

/* Magnetic + shake on links */
.link-btn,
.btn-primary,
.btn-secondary,
.nav-link,
.btn-ghost,
.btn-icon {
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}

.link-btn:hover,
.btn-icon:hover {
  animation: microShake 0.4s ease;
}

@keyframes microShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px) rotate(-1deg);
  }
  75% {
    transform: translateX(2px) rotate(1deg);
  }
}

/* Skill tags pulse weird */
.skill-tag.is-visible {
  animation: skillPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    skillWeirdPulse 3s ease-in-out infinite;
  animation-delay: var(--reveal-delay, 0ms), calc(var(--reveal-delay, 0ms) + 0.6s);
}

@keyframes skillWeirdPulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(95, 143, 132, 0);
    filter: hue-rotate(0deg);
  }
  50% {
    box-shadow: 0 0 24px rgba(95, 143, 132, 0.22);
    filter: hue-rotate(25deg);
  }
}

/* Scroll sections — no transform here (handled by scroll-fly) */
.scroll-section {
  position: relative;
}

/* Form glow */
.form-input {
  transition: border-color 0.2s, box-shadow 0.3s, transform 0.2s;
}

.form-input:focus {
  transform: scale(1.01);
  box-shadow: 0 0 0 3px rgba(77, 118, 109, 0.2), 0 0 30px rgba(95, 143, 132, 0.25);
  animation: inputPulse 2s ease-in-out infinite;
}

@keyframes inputPulse {
  50% {
    box-shadow: 0 0 0 4px rgba(111, 143, 163, 0.18), 0 0 28px rgba(95, 143, 132, 0.18);
  }
}

/* Brand — static (no spin) */
.brand-mark,
.brand-photo {
  animation: none !important;
}

@keyframes brandSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Sidebar nav — static, no motion that blocks clicks */
.sidebar-nav .nav-link {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

.brand-mark,
.brand-photo {
  animation: none !important;
}

/* Hero eyebrow blink */
.hero-eyebrow {
  animation: eyebrowBlink 2.5s ease-in-out infinite;
}

@keyframes eyebrowBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
    letter-spacing: 0.15em;
  }
}

/* Scroll progress wild */
.scroll-progress {
  animation: progressGlow 2s ease-in-out infinite;
  height: 5px;
}

@keyframes progressGlow {
  50% {
    filter: brightness(1.4) saturate(1.5);
    box-shadow: 0 0 18px rgba(111, 143, 163, 0.35);
  }
}

/* Project placeholder spin */
.project-placeholder {
  animation: placeholderSpin 8s linear infinite;
}

@keyframes placeholderSpin {
  to {
    filter: hue-rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .motion-fx {
    display: none !important;
  }

  .tilt-card::after,
  .tilt-card.is-visible,
  .section-title,
  .hero-eyebrow,
  .brand-mark,
  .skill-tag.is-visible,
  .project-placeholder,
  .scroll-progress {
    animation: none !important;
  }

  .section,
  .hero-section {
    transform: none !important;
  }
}
