/* Motion: the logo (pure CSS) runs when JS is on (html.js); everything that hides content waits for
   motion.js to add html.motion, so a failed script load never leaves content hidden. */
@media (prefers-reduced-motion: no-preference) {
  /* 1. Logo draws itself: the A traces in, then the K slides into place. */
  .js .site-nav .logo-a { stroke-dasharray: 200; stroke-dashoffset: 200; animation: ak-draw 1.1s var(--ease-out) .1s forwards; }
  .js .site-nav .logo-k { opacity: 0; transform: translateX(-14px); transform-box: fill-box; animation: ak-slide .6s var(--ease-out) .75s forwards; }
  @keyframes ak-draw { to { stroke-dashoffset: 0; } }
  @keyframes ak-slide { to { opacity: 1; transform: none; } }

  /* 2. Headline words rise in one by one. */
  .motion .hero-title .word { display: inline-block; opacity: 0; transform: translateY(.45em); animation: ak-rise .7s var(--ease-out) forwards; animation-delay: calc(.3s + var(--i, 0) * 70ms); }
  @keyframes ak-rise { to { opacity: 1; transform: none; } }

  /* 4. Cards wipe in at the logo's angle. */
  .motion .reveal {
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    transition: clip-path .9s var(--ease-out), transform .3s ease, background-color .4s ease;
  }
  .motion .reveal.is-in { clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%); }
  .motion .projects .reveal:nth-child(2) { transition-delay: .08s, 0s, 0s; }
  .motion .projects .reveal:nth-child(3) { transition-delay: .16s, 0s, 0s; }

  /* 6. Journey: steps light up as the line reaches them. */
  .motion .timeline-line::after { transform: scaleY(var(--progress, 0)); }
  .motion .timeline-when { opacity: 0; transform: translateY(6px); transition: opacity .4s ease, transform .4s var(--ease-out); }
  .motion .timeline-step.is-on .timeline-when { opacity: 1; transform: none; }
  .motion .timeline-mark { transform: scale(0); transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }
  .motion .timeline-step.is-on .timeline-mark { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Printing always shows everything. */
@media print {
  .motion .reveal, .js .reveal { clip-path: none !important; }
  .motion .timeline-when { opacity: 1 !important; transform: none !important; }
  .motion .timeline-mark { transform: none !important; }
  .motion .timeline-line::after { transform: none !important; }
  .site-nav, .theme-switch, #scroll-progress { display: none !important; }
}
