/* Scene styling and keyframes for the hero animation of /features/two-factor.html,
   "Mateo's close call". Every animated element's resting style IS its final pose; the
   keyframes only animate towards it (fill-mode both), so a scene shown without animation
   (reduced motion) is complete. Keyframes run only while their scene carries .is-active.
   Timing: an element's timing class sets --tf-at (its start) and, for a flight, the
   --tf-dx / --tf-dy offset it flies in from. */

.tf-ink { color: var(--anim-ink); }
.tf-friend { color: var(--brand-2); }
.tf-brand { color: var(--brand-1); }
.tf-warm { color: var(--anim-warm); }
.tf-love { color: var(--anim-love); }
.tf-alert { color: var(--anim-alert); }
.tf-muted { color: var(--anim-muted); }
.tf-line { fill: var(--anim-muted); opacity: 0.7; }
.tf-line-ink { fill: var(--anim-ink); }
.tf-glow-soft { fill: var(--anim-warm-soft); }
.tf-floor { fill: var(--anim-muted); opacity: 0.35; }
.tf-beam, .tf-halo { fill: none; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; }
.tf-halo { stroke: var(--anim-warm-soft); stroke-width: 12; }
.tf-beam { stroke: var(--anim-warm); stroke-width: 3; }
.tf-beam-alert { stroke: var(--anim-alert); }
.tf-face-out, .tf-face-mid, .tf-gone, .tf-ringing, .tf-into, .tf-mid { opacity: 0; }
.tf-pop, .tf-fly, .tf-gone, .tf-drop, .tf-into, .tf-grow { transform-box: fill-box; transform-origin: center; }
.tf-grow { transform-origin: 0 50%; }
.tf-body { transform-box: fill-box; transform-origin: 50% 100%; }
.tf-buzz { transform-box: fill-box; transform-origin: 50% 50%; }

@keyframes tf-fade-in { from { opacity: 0; } }
@keyframes tf-fade-out { from { opacity: 1; } }
/* Shown only between two moments: in at the start, out at the end. */
@keyframes tf-mid { 0% { opacity: 0; } 14%, 86% { opacity: 1; } 100% { opacity: 0; } }
/* Gone for a while, then back: out at the start, in again at the end. */
@keyframes tf-away { 0% { opacity: 1; } 14%, 86% { opacity: 0; } 100% { opacity: 1; } }
@keyframes tf-pop { from { transform: scale(0); opacity: 0; } 50% { opacity: 1; } }
/* A thing flying to where it lands; each element names its own start offset. */
@keyframes tf-fly { from { transform: translate(var(--tf-dx, 0), var(--tf-dy, 0)) scale(0.4); opacity: 0; } 20% { opacity: 1; } }
/* A thing flying into a container and disappearing inside it. */
@keyframes tf-into { 0% { transform: translate(var(--tf-dx, 0), var(--tf-dy, 0)); opacity: 0; } 15% { opacity: 1; } 80% { transform: none; opacity: 1; } 100% { transform: translateY(14px) scale(0.6); opacity: 0; } }
/* Leaving: shrinks and fades to nothing. */
@keyframes tf-gone { from { transform: none; opacity: 1; } to { transform: scale(0.3); opacity: 0; } }
@keyframes tf-drop { from { transform: translateY(-70px); opacity: 0; } 30% { opacity: 1; } }
@keyframes tf-grow { from { transform: scaleX(0); } }
@keyframes tf-draw { from { stroke-dashoffset: 100; } }
@keyframes tf-hop { 0%, 100% { transform: none; } 40% { transform: translateY(-9px); } 70% { transform: translateY(2px); } }
@keyframes tf-giggle { 0%, 40%, 80%, 100% { transform: none; } 20% { transform: translateY(-6px) rotate(-2deg); } 60% { transform: translateY(-5px) rotate(2deg); } }
@keyframes tf-shake { 0%, 100% { transform: none; } 20% { transform: rotate(-4deg); } 40% { transform: rotate(4deg); } 60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); } }
@keyframes tf-buzz { 0%, 100% { transform: none; } 10%, 30%, 50%, 70%, 90% { transform: rotate(-6deg); } 20%, 40%, 60%, 80% { transform: rotate(6deg); } }
@keyframes tf-ring { 0% { opacity: 0; } 20%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* Springy entrances overshoot through the easing, not through extra keyframes. */
.is-active .tf-pop { animation: tf-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) var(--tf-at, 0s) both; }
.is-active .tf-fly { animation: tf-fly 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) var(--tf-at, 0s) both; }
.is-active .tf-drop { animation: tf-drop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) var(--tf-at, 0s) both; }
.is-active .tf-grow { animation: tf-grow 0.4s ease var(--tf-at, 0s) both; }
.is-active .tf-into { animation: tf-into 1.1s ease-in-out var(--tf-at, 0s) both; }
.is-active .tf-gone { animation: tf-gone 0.5s ease-in var(--tf-at, 1s) both; }
.is-active .tf-ringing { animation: tf-ring 1s ease var(--tf-at, 0.3s) both; }
.is-active .tf-buzzing { animation: tf-buzz 0.9s ease var(--tf-at, 0.3s) both; }
/* A face swap: the earlier face fades out as the later one fades in, at the pair's --tf-at. */
.is-active .tf-face-out { animation: tf-fade-out 0.2s ease var(--tf-at, 1s) both; }
.is-active .tf-face-in { animation: tf-fade-in 0.2s ease var(--tf-at, 1s) both; }
.is-active .tf-face-mid, .is-active .tf-mid { animation: tf-mid var(--tf-dur, 1.4s) linear var(--tf-at, 1s) both; }
.is-active .tf-away { animation: tf-away var(--tf-dur, 1.4s) linear var(--tf-at, 1s) both; }
.is-active .tf-hop { animation: tf-hop 0.5s ease-out var(--tf-at, 1s) both; }
.is-active .tf-giggle { animation: tf-giggle 0.6s ease var(--tf-at, 1s) both; }
.is-active .tf-shake { animation: tf-shake 0.4s ease var(--tf-at, 1s) both; }
.is-active .tf-beam, .is-active .tf-halo { animation: tf-draw 0.5s ease-in-out var(--tf-at, 1s) both; }

/* Scene 1, the moment: a shop website is hacked and Mateo's password, a key, flies to a stranger. */
.tf-s1-hack { --tf-at: 0.4s; }
.tf-s1-key { --tf-at: 1s; --tf-dx: -130px; --tf-dy: -10px; }
.tf-s1-k1 { --tf-at: 1.5s; }
.tf-s1-face, .tf-s1-mateo { --tf-at: 2.2s; }

/* Scene 2, the old way: the stranger uses the key on his laptop and appears inside Mateo's account. */
.tf-s2-key { --tf-at: 0.3s; }
.tf-s2-beam { --tf-at: 1s; }
.tf-s2-in { --tf-at: 1.7s; }
.tf-s2-face, .tf-s2-mateo { --tf-at: 2.2s; }

/* Scene 3, allme: the login reaches Mateo's phone as a question, and he taps Deny. */
.tf-s3-beam { --tf-at: 0.4s; }
.tf-s3-phone, .tf-s3-ring { --tf-at: 1s; }
.tf-s3-ask { --tf-at: 1.2s; }
.tf-s3-deny { --tf-at: 2.4s; }
.tf-s3-face, .tf-s3-mateo { --tf-at: 2.8s; }

/* Scene 4, the payoff: the stranger's screen stays locked, and Mateo laughs over his coffee. */
.tf-s4-lock { --tf-at: 0.4s; }
.tf-s4-no { --tf-at: 0.8s; }
.tf-s4-stranger { --tf-at: 1s; }
.tf-s4-face, .tf-s4-mateo { --tf-at: 1.8s; }
.tf-s4-check { --tf-at: 2s; }
.tf-s4-heart { --tf-at: 2.3s; }
.tf-s4-k1 { --tf-at: 2.4s; }
.tf-s4-k2 { --tf-at: 2.5s; }
