/* Motion: initial states (only while motion is allowed), view transitions, reduced motion */

/* Hero elements wait for the intro timeline only when JS + motion are confirmed.
   A safety timer in <head> removes .motion-ok if scripts fail, so content always shows. */
.motion-ok [data-hero-in] { opacity: 0; }
.motion-ok [data-split-lines] { opacity: 0; }
.label--rules::before, .label--rules::after { transition: transform 1000ms var(--ease-out); }
.motion-ok .label--rules[data-hero-in]:not(.rules-in)::before, .motion-ok .label--rules[data-hero-in]:not(.rules-in)::after { transform: scaleX(0); }

/* School-day chapter: pinned desktop version vs. card version */
.day__mobile { display: block; }
.day__desktop { display: none; }
@media (min-width: 1024px) {
  .motion-ok .day__desktop, .js:not(.reduced-motion) .day__desktop { display: block; }
  .motion-ok .day__mobile, .js:not(.reduced-motion) .day__mobile { display: none; }
}
.day__mobile .section-head .h-2, .day__mobile .label { color: inherit; }

/* Icon micro-animations on card hover */
@keyframes ring { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(4deg); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes tilt { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-10deg) translateY(-2px); } }
.card:hover [data-icon-anim="ring"] .icon, .card:focus-within [data-icon-anim="ring"] .icon { animation: ring 700ms var(--ease-out) 1; transform-origin: 50% 10%; }
.card:hover [data-icon-anim="pop"] .icon, .card:focus-within [data-icon-anim="pop"] .icon { animation: pop 500ms var(--ease-out) 1; }
.card:hover [data-icon-anim="tilt"] .icon, .card:focus-within [data-icon-anim="tilt"] .icon { animation: tilt 600ms var(--ease-out) 1; }

/* Gentle NOW pulse — twice, then rests */
@keyframes nowPulse { 0% { box-shadow: 0 0 0 0 rgba(138,90,43,.45); } 100% { box-shadow: 0 0 0 14px rgba(138,90,43,0); } }
.stage--now.is-in .stage__dot { animation: nowPulse 1.2s var(--ease-out) 2; }

/* Cross-document page transitions (supported browsers only) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 260ms var(--ease-in-out) both vtOut; }
::view-transition-new(root) { animation: 520ms var(--ease-out) both vtIn; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-10px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(16px); } }

/* Reduced motion: everything in its final state */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
.reduced-motion *, .reduced-motion *::before, .reduced-motion *::after { animation: none !important; transition-duration: 1ms !important; }
.reduced-motion .fan .phone:nth-child(1) { transform: translateX(-50%) rotate(-9deg) translateX(-34px) !important; }
.reduced-motion .fan .phone:nth-child(2) { transform: translateX(-50%) rotate(9deg) translateX(34px) !important; }
.reduced-motion .langs.is-waiting .msg { opacity: 1; transform: none; }
.reduced-motion .wordmark { --fill: 100%; }
