/* motion.css — motion layer (Task 5): entrance, hover and reduced-motion rules.
 Tokens only. Transform and colour are the only properties animated. */

/* ---- Entrance: main.js adds [data-enter] to the reveal root, marks only the
 children it observes with .enter-pending, then swaps that for .is-revealed once
 each crosses 20% visibility. Nothing is hidden by CSS alone: without JS, or for
 any child JS did not observe, nothing is pending and everything shows.
 Revealed children animate with fill `both`, so a stagger delay shows the
 from-state instead of a fully-painted flash. ---- */

@keyframes enter {
 from {
 opacity: 0;
 transform: translateY(16px);
 }
 to {
 opacity: 1;
 transform: none;
 }
}

[data-enter] > .enter-pending:not(.is-revealed) {
 opacity: 0;
 transform: translateY(16px);
}

[data-enter] > .is-revealed {
 animation: enter var(--m-img) var(--ease-enter) both;
 animation-delay: calc(var(--i, 0) * 70ms);
}

/* ---- Hover layer: transform and colour only ---- */

.card:hover {
 transform: translateY(-2px);
}

.gallery figure:hover img {
 transform: scale(1.03);
}

.gallery img {
 transition: transform var(--m-img) var(--ease);
}

.btn:active {
 transform: scale(0.98);
 transition-duration: var(--m-press);
}

/* ---- About: each skill bar fills once when its section is revealed. The
 inline width is the resting state, so JS-disabled and reduced-motion visitors
 see the final value with no animation. ---- */

@keyframes fill-bar {
 from {
 transform: scaleX(0);
 }
 to {
 transform: scaleX(1);
 }
}

@media (prefers-reduced-motion: no-preference) {
 [data-enter] #skills.is-revealed .stat-bar__fill {
 transform-origin: left;
 animation: fill-bar var(--m-img) var(--ease-enter) both;
 }
}

/* Task 9 mounts the canvas inside #hero. Keep it behind the content and
 independent of pointer input until then. */

[data-hero-canvas] {
 position: absolute;
 inset: 0;
 width: 100%;
 height: 100%;
 pointer-events: none;
}

/* ---- Contact: the form panel's rule draws once when the section reveals ---- */

@keyframes draw-rule {
 from {
 transform: scaleX(0);
 }
 to {
 transform: scaleX(1);
 }
}

@media (prefers-reduced-motion: no-preference) {
 [data-enter] #contact.is-revealed .contact__rule {
 animation: draw-rule var(--m-img) var(--ease-enter) both;
 }
}

@media (prefers-reduced-motion: reduce) {
 [data-enter] > *,
 [data-enter] > .enter-pending,
 [data-enter] > .is-revealed {
 opacity: 1;
 transform: none;
 animation: none;
 }

 .contact__rule {
 animation: none;
 transform: none;
 }

 .card:hover,
 .btn:hover,
 .btn:active,
 .gallery figure:hover img {
 transform: none;
 }

 .gallery img {
 transition: none;
 }
}
