/* Motion (D-042): short, decorative, and only when the user has not asked for less.
   Nothing repeats for longer than 5 seconds (WCAG 2.2.2). Without motion every
   element is shown in its final state. */

@layer motion {
@media (prefers-reduced-motion: no-preference) {
  .bar i { transform-origin: left; animation: run-in 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .ranking tbody tr {
    &:nth-child(2) .bar i { animation-delay: 0.06s; }
    &:nth-child(3) .bar i { animation-delay: 0.12s; }
    &:nth-child(4) .bar i { animation-delay: 0.18s; }
    &:nth-child(n + 5) .bar i { animation-delay: 0.24s; }
  }
  .mark { animation: marker 0.8s ease 0.25s both; }
  .stride {
    background: linear-gradient(90deg, transparent, var(--orange) 30%, var(--orange) 70%, transparent) no-repeat;
    background-size: 35% 100%;
    animation: stride 2.8s ease-in-out 0.3s 1 both;
  }
  .live-dot { animation: pulse 1.4s ease-in-out 3; }

  /* An article's reading progress: a thin orange line under the header that follows the
     scroll. Pure CSS (scroll-driven animation); browsers without it show nothing. */
  @supports (animation-timeline: scroll()) {
    .reading-progress {
      position: fixed; inset: 0 0 auto; height: 3px; z-index: 20; pointer-events: none;
      background: var(--orange); transform-origin: left; transform: scaleX(0);
      animation: read-through linear both; animation-timeline: scroll(root block);
    }
  }
}

@keyframes read-through { to { transform: scaleX(1); } }

/* Menu underlines and the row's left line (D-042, owner 2026-12-03): short hover
   transitions started by the
   user, so they run even when less motion is asked for; nothing moves on its own. */
:is(.sections, .utility) a { transition: background-size 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), color 0.2s ease; }
:is(.catalog, .nutrition) tbody tr {
  transition: background-color 0.2s;
  & > :first-child { transition: background-size 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); }
}

/* The logo's dot takes one stride when the logo is hovered or focused (started by the
   user, under 1 s). */
.logo:is(:hover, :focus-visible)::after { animation: dot-stride 0.6s cubic-bezier(0.3, 0.7, 0.4, 1); }

@keyframes dot-stride {
  0% { transform: translateY(0) scale(1, 1); }
  35% { transform: translateY(-0.32em) scale(0.9, 1.12); }
  60% { transform: translateY(0) scale(1.28, 0.72); }
  78% { transform: translateY(-0.05em) scale(0.94, 1.06); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes run-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes marker { from { background-size: 0% 0.38em; } to { background-size: 100% 0.38em; } }
@keyframes stride { from { background-position: -40% 0; opacity: 1; } 90% { opacity: 1; } to { background-position: 140% 0; opacity: 0; } }
@keyframes pulse { 50% { opacity: 0.3; } }
}
