.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  pointer-events: none;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader__mark {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  font-weight: 800;
  animation: pulse 1.2s ease-in-out infinite;
}

body.is-loading .loader {
  pointer-events: auto;
}

body.is-ready .loader,
body:not(.is-loading) .loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body,
main {
  opacity: 1;
  visibility: visible;
}

.cursor-dot {
  position: fixed;
  z-index: 99;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(12, 12, 13, 0.5);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: width 0.2s ease, height 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.cursor-dot.is-active {
  width: 42px;
  height: 42px;
  background: rgba(200, 255, 95, 0.2);
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0);
  animation: ripple 0.72s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

:where(.brand, .nav a, .nav-cta, .btn, .contact-links a, .footer a, .project-card, .project-nav-link, .gallery img, .gallery-lightbox__button) {
  transition-property: transform, opacity, box-shadow, background, color, border-color, filter;
  transition-duration: 0.42s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity, box-shadow;
}

:where(.nav a, .nav-cta, .btn, .contact-links a, .footer a, .project-nav-link) {
  position: relative;
  overflow: hidden;
}

[data-parallax] {
  --parallax-y: 0px;
}

[data-parallax]:not(.reveal):not(.motion-reveal) {
  transform: translate3d(0, var(--parallax-y), 0);
}

.project-card img[data-parallax],
.portrait-shell img[data-parallax] {
  transform: translate3d(0, var(--parallax-y), 0) scale(1);
}

@media (hover: hover) {
  .nav a:hover,
  .nav-cta:hover,
  .contact-links a:hover,
  .footer a:hover,
  .gallery-lightbox__button:hover {
    opacity: 0.95;
    transform: translateY(-3px) scale(1.025);
    box-shadow: 0 16px 42px rgba(12, 12, 13, 0.1);
  }

  .brand:hover {
    opacity: 0.88;
    transform: translateY(-1px) scale(1.01);
    box-shadow: none;
    transition-duration: 0.3s;
  }

  .btn:hover {
    opacity: 0.96;
    transform: translateY(-5px) scale(1.025);
    box-shadow: 0 24px 54px rgba(12, 12, 13, 0.18);
  }

  .project-card:hover {
    transform: translateY(-10px) scale(1.012);
    box-shadow: 0 30px 76px rgba(12, 12, 13, 0.15);
  }

  .project-card:hover img[data-parallax],
  .portrait-shell:hover img[data-parallax] {
    transform: translate3d(0, var(--parallax-y), 0) scale(1.045);
  }

  .project-nav-link:hover {
    transform: translateY(-7px) scale(1.015);
    box-shadow: 0 28px 70px rgba(12, 12, 13, 0.13);
  }

  .gallery img:hover,
  .gallery img[data-parallax].is-visible:hover {
    transform: translate3d(0, calc(var(--parallax-y, 0px) - 6px), 0) scale(1.02);
  }
}

.brand:active,
.nav a:active,
.nav-cta:active,
.btn:active,
.contact-links a:active,
.footer a:active,
.project-card:active,
.project-nav-link:active,
.gallery img:active,
.gallery-lightbox__button:active {
  opacity: 0.78;
  transform: translateY(2px) scale(0.96);
  transition-duration: 0.26s;
}

.reveal,
.motion-reveal {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: none;
  transition-delay: var(--motion-delay, 0ms);
}

body.reveal-ready .reveal:not(.is-visible),
body.reveal-ready .motion-reveal:not(.is-visible) {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

body.reveal-ready .reveal--right:not(.is-visible) {
  transform: translate3d(0, 28px, 0);
}

.reveal.is-visible,
.motion-reveal.is-visible,
body:not(.reveal-ready) .reveal,
body:not(.reveal-ready) .motion-reveal {
  opacity: 1;
  transform: translate3d(0, var(--parallax-y, 0px), 0);
}

.gallery img[data-parallax].is-visible {
  transform: translate3d(0, var(--parallax-y, 0px), 0) scale(1);
}

@media (hover: hover) {
  .timeline article.motion-reveal.is-visible:hover,
  .skill-card.reveal.is-visible:hover,
  .skill-card.motion-reveal.is-visible:hover,
  .software-grid article.motion-reveal.is-visible:hover {
    transform: translate3d(0, -8px, 0) scale(1.01);
    box-shadow: 0 24px 64px rgba(12, 12, 13, 0.13);
  }

  .project-card.reveal.is-visible:hover,
  .project-card.motion-reveal.is-visible:hover {
    transform: translate3d(0, -10px, 0) scale(1.012);
    box-shadow: 0 30px 76px rgba(12, 12, 13, 0.15);
  }

  .gallery img[data-parallax].is-visible:hover {
    transform: translate3d(0, calc(var(--parallax-y, 0px) - 6px), 0) scale(1.02);
  }
}

@media (hover: hover) {
  html[data-theme="dark"] .nav a:hover,
  html[data-theme="dark"] .theme-toggle:hover,
  html[data-theme="dark"] .contact-links a:hover,
  html[data-theme="dark"] .footer a:hover,
  html[data-theme="dark"] .gallery-lightbox__button:hover {
    box-shadow:
      0 10px 30px rgba(255, 255, 255, 0.08),
      0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  html[data-theme="dark"] .nav-cta:hover,
  html[data-theme="dark"] .btn:hover {
    box-shadow:
      0 12px 36px rgba(255, 255, 255, 0.12),
      0 0 0 1px rgba(255, 255, 255, 0.1);
  }

  html[data-theme="dark"] .project-card:hover,
  html[data-theme="dark"] .project-card.reveal.is-visible:hover,
  html[data-theme="dark"] .project-card.motion-reveal.is-visible:hover,
  html[data-theme="dark"] .project-nav-link:hover {
    box-shadow:
      0 18px 52px rgba(255, 255, 255, 0.1),
      0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  html[data-theme="dark"] .gallery img:hover,
  html[data-theme="dark"] .gallery img[data-parallax].is-visible:hover {
    box-shadow:
      0 14px 40px rgba(255, 255, 255, 0.09),
      0 0 0 1px rgba(255, 255, 255, 0.07);
  }
}

.project-card.reveal.is-visible:active,
.project-card.motion-reveal.is-visible:active,
.gallery img[data-parallax].is-visible:active {
  opacity: 0.78;
  transform: translate3d(0, 2px, 0) scale(0.96);
  transition-duration: 0.26s;
}

body.page-enter .site-header,
body.page-enter main,
body.page-enter .footer {
  animation: pageEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.page-exit .site-header,
body.page-exit main,
body.page-exit .footer {
  opacity: 0;
  transform: translate3d(0, -16px, 0);
  transition:
    opacity 0.62s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.62s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.94);
    opacity: 0.72;
  }
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes scrollDot {
  0% {
    opacity: 0;
    transform: translate(-50%, 0);
  }
  35%,
  65% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 22px);
  }
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

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

  .cursor-dot {
    display: none;
  }

  .reveal,
  .motion-reveal,
  .reveal--right,
  [data-parallax],
  body.page-enter .site-header,
  body.page-enter main,
  body.page-enter .footer,
  body.page-exit .site-header,
  body.page-exit main,
  body.page-exit .footer {
    animation: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    transition: none !important;
  }
}

@media (max-width: 768px) {
  body:not(.reveal-ready) .reveal,
  body:not(.reveal-ready) .motion-reveal,
  body:not(.reveal-ready) .reveal--right,
  body:not(.reveal-ready) .fade-up,
  body:not(.reveal-ready) .animate-on-scroll,
  body:not(.reveal-ready) [data-parallax] {
    opacity: 1;
    visibility: visible;
    transform: none !important;
    transition-delay: 0ms;
  }
}

@media (max-width: 760px) {
  .reveal--right {
    transform: none;
  }
}
