/* =========================================================================
   animations.css
   Page transitions + reveal motion
   ========================================================================= */

/* ----- Page transition curtain (Fabrica-style) ------------------------- */

.page-transition {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #0a0a0a;
  transform: translateY(100%);
  transition: transform 0.7s cubic-bezier(0.77, 0, 0.175, 1);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  will-change: transform;
}

.page-transition.is-covering {
  transform: translateY(0);
  pointer-events: auto;
}

.page-transition.is-exiting {
  transform: translateY(-100%);
  pointer-events: auto;
}

.page-transition-label {
  font-family: Inter, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: rgba(255, 255, 255, 0.75);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
  transition-delay: 0.25s;
}

.page-transition.is-covering .page-transition-label {
  opacity: 1;
  transform: translateY(0);
}

.page-transition.is-exiting .page-transition-label {
  opacity: 0;
  transition-delay: 0s;
}

/* ----- Outgoing content: .wrapbackground (and other top-level content
   blocks inside <main>) slides up by 50vh, finishing exactly when the
   black curtain has fully covered the page. The .footer-spacer stays
   still so the fixed dark footer behind it is unaffected. ----- */

main.is-leaving > .wrapbackground,
main.is-leaving > section:not(.footer-spacer),
main.is-leaving > article,
main.is-leaving > .hero,
body > header.is-leaving {
  transform: translateY(-50vh) !important;
  transition: transform 0.7s cubic-bezier(0.77, 0, 0.175, 1) !important;
  will-change: transform;
}

/* ----- Reduced-motion: hide the curtain entirely ----------------------- */

@media (prefers-reduced-motion: reduce) {
  .page-transition,
  .page-transition-label {
    transition: none !important;
    animation: none !important;
  }
  /* Keep the curtain off-screen so it never shows for reduced-motion users.
     transitions.js also short-circuits its own timing in this mode. */
  .page-transition.is-covering,
  .page-transition.is-exiting {
    transform: translateY(100%) !important;
  }
  /* Skip the parallax exit slide for reduced-motion users. */
  main.is-leaving > .wrapbackground,
  main.is-leaving > section:not(.footer-spacer),
  main.is-leaving > article,
  main.is-leaving > .hero,
  body > header.is-leaving {
    transform: none !important;
    transition: none !important;
  }
  /* Disable reveal motion so content is instantly visible. */
  .reveal,
  .hero-title,
  .hero-hook,
  .hero-aside,
  .page-label,
  .content,
  .article-top,
  .article-hero,
  .article-body,
  .card {
    transition: none !important;
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ----- Screen-reader only utility used for live page-change announcements */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----- Active nav link state ------------------------------------------ */

header .nav a.is-active,
.menu-overlay a.is-active {
  color: #0a0a0a;
  font-weight: 600;
}

/* Hide outline for the programmatically-focused <main>, but keep focus
   visible for keyboard users. */
main:focus {
  outline: none;
}
main:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.15);
  outline-offset: 4px;
}
