/* ==========================================================================
   MOTION LAYER — portfolio2026  (pure CSS, no JS dependency)
   Reveal runs as a load animation that always completes to a visible state,
   so content can never get stuck hidden — even if the page re-renders.
   ========================================================================== */

:root { --m-ease: cubic-bezier(0.2, 0.8, 0.2, 1); }

@keyframes m-rise {
  from { opacity: 0; translate: 0 20px; }
  to   { opacity: 1; translate: 0 0; }
}

/* ---- Entrance: sections rise + fade in, with a light cascade ---- */
section { animation: m-rise 0.55s var(--m-ease) both; }
section:nth-of-type(2)   { animation-delay: 0.05s; }
section:nth-of-type(3)   { animation-delay: 0.10s; }
section:nth-of-type(4)   { animation-delay: 0.15s; }
section:nth-of-type(n+5) { animation-delay: 0.18s; }

/* No entrance motion on the title area (the top section of each page). */
section:first-of-type { animation: none; }

/* ---- Project card hover: lift, deepen shadow, slow image zoom ----
   Grid cards are anchors whose media wrapper is aspect-ratio:4/3. */
a:has(> div[style*="aspect-ratio:4/3"]) {
  transition: transform 0.22s var(--m-ease), box-shadow 0.22s ease, border-color 0.22s ease;
}
a:has(> div[style*="aspect-ratio:4/3"]):hover {
  transform: translateY(-5px);
  box-shadow: 0 22px 44px -20px rgba(40, 30, 20, 0.28);
}
a:has(> div[style*="aspect-ratio:4/3"]) img {
  transition: transform 0.5s var(--m-ease);
}
a:has(> div[style*="aspect-ratio:4/3"]):hover img {
  transform: scale(1.045);
}

/* ---- Nav: underline wipes in from the left on hover ---- */
header nav a { position: relative; }
header nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s var(--m-ease);
}
header nav a:hover::after { transform: scaleX(1); }

/* ---- Respect reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  section { animation: none; }
  a:has(> div[style*="aspect-ratio:4/3"]),
  a:has(> div[style*="aspect-ratio:4/3"]) img,
  header nav a::after { transition: none; }
}
