/* Title animations (see titles.js). One title, one animation. */
.title-fx { cursor: default; perspective: 600px; }
.title-fx .tw { display: inline-block; white-space: nowrap; }
.title-fx .ch { display: inline-block; transform-origin: 50% 70%; will-change: transform; }
.title-fx.is-playing .ch { animation-duration: .8s; animation-timing-function: ease-in-out; animation-delay: calc(var(--i) * 28ms); animation-fill-mode: both; }

/* Hero: a soft wave runs through the letters */
[data-anim="wave"].is-playing .ch { animation-name: t-wave; }
@keyframes t-wave { 40% { transform: translateY(-.32em) rotate(-4deg); text-shadow: 0 10px 24px rgba(255, 160, 200, .8); } }

/* About: letters jump with a little squash */
[data-anim="jump"].is-playing .ch { animation-name: t-jump; animation-duration: .7s; }
@keyframes t-jump { 30% { transform: translateY(-.45em) scale(1.05, .95); } 55% { transform: translateY(0) scale(1.12, .85); } 75% { transform: scale(.96, 1.05); } }

/* Love Journey: letters turn like pages */
[data-anim="flip"].is-playing .ch { animation-name: t-flip; animation-duration: .9s; backface-visibility: visible; }
@keyframes t-flip { 0% { transform: rotateY(0); } 60% { transform: rotateY(360deg); color: var(--rose); } 100% { transform: rotateY(360deg); } }

/* Garden: letters bloom like flowers */
[data-anim="bloom"].is-playing .ch { animation-name: t-bloom; animation-duration: .9s; }
@keyframes t-bloom { 0% { transform: scale(1); } 35% { transform: scale(.4) rotate(calc(var(--r) * 40deg)); color: #5aa85a; } 70% { transform: scale(1.3) rotate(calc(var(--r) * -12deg)); color: #e0457b; } }

/* Time Capsule: letters twinkle like stars */
[data-anim="twinkle"].is-playing .ch { animation-name: t-twinkle; animation-duration: 1.1s; animation-delay: calc((var(--r) + 1) * 260ms); }
@keyframes t-twinkle { 30% { opacity: .25; transform: scale(.85); } 60% { opacity: 1; transform: scale(1.15); text-shadow: 0 0 12px #fff, 0 0 26px #ffb3cf; color: #fff; } }

/* Together: jelly wobble */
[data-anim="jelly"].is-playing .ch { animation-name: t-jelly; }
@keyframes t-jelly { 25% { transform: scale(1.25, .75); } 45% { transform: scale(.8, 1.2); } 65% { transform: scale(1.1, .9); } 85% { transform: scale(.97, 1.03); } }

/* Listen together: letters bounce like an equalizer */
[data-anim="beat"].is-playing .ch { animation-name: t-beat; animation-duration: .45s; animation-iteration-count: 3; animation-delay: calc((var(--r) + 1) * 120ms); animation-direction: alternate; }
@keyframes t-beat { to { transform: translateY(calc(-.15em - (var(--r) + 1) * .14em)); color: #fff0f5; } }

/* Location & safety: a gentle heartbeat */
[data-anim="pulse"].is-playing .ch { animation-name: t-pulse; animation-duration: 1s; animation-delay: calc(var(--i) * 12ms); }
@keyframes t-pulse { 15% { transform: scale(1.22); color: var(--rose); } 30% { transform: scale(1); } 45% { transform: scale(1.14); } 65% { transform: scale(1); } }

/* Emergency: the title rings like a phone */
[data-anim="ring"].is-playing { animation: t-ring .9s ease-in-out; }
[data-anim="ring"].is-playing .ch { animation-name: t-ring-color; animation-delay: calc(var(--i) * 10ms); }
@keyframes t-ring { 10%, 30%, 50%, 70% { transform: rotate(-2deg) translateX(-3px); } 20%, 40%, 60%, 80% { transform: rotate(2deg) translateX(3px); } }
@keyframes t-ring-color { 30%, 70% { color: #e5484d; } }

/* Privacy: letters come into focus, like unlocking */
[data-anim="unlock"].is-playing .ch { animation-name: t-unlock; animation-duration: .9s; }
@keyframes t-unlock { 0% { filter: none; } 30% { filter: blur(5px); opacity: .4; transform: translateY(.1em); } 100% { filter: none; opacity: 1; } }

/* FAQ: a curious wobble */
[data-anim="wobble"].is-playing .ch { animation-name: t-wobble; }
@keyframes t-wobble { 25% { transform: rotate(calc(var(--r) * 22deg)) translateY(-.08em); } 50% { transform: rotate(calc(var(--r) * -14deg)); } 75% { transform: rotate(calc(var(--r) * 6deg)); } }

/* Download: a rainbow glow floats through */
[data-anim="rainbow"].is-playing .ch { animation-name: t-rainbow; animation-duration: 1.2s; }
@keyframes t-rainbow { 0% { filter: hue-rotate(0); } 50% { transform: translateY(-.2em); filter: hue-rotate(180deg) brightness(1.2); text-shadow: 0 0 18px rgba(255,255,255,.9); color: #ffd6e5; } 100% { filter: hue-rotate(360deg); } }

/* Heart bubbles */
.heart-bubble { position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none; font-size: calc(22px * var(--s)); line-height: 1;
  color: hsl(var(--h) 85% 62%); text-shadow: 0 4px 12px rgba(224, 69, 123, .35);
  transform: translate(var(--x), var(--y)) translate(-50%, -50%); animation: heart-float var(--t) cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes heart-float {
  0% { transform: translate(var(--x), var(--y)) translate(-50%, -50%) scale(.2); opacity: 0; }
  15%, 65% { opacity: 1; }
  100% { transform: translate(calc(var(--x) + var(--dx)), calc(var(--y) + var(--dy))) translate(-50%, -50%) scale(1) rotate(var(--rot)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) { .heart-bubble { display: none; } .title-fx.is-playing, .title-fx.is-playing .ch { animation: none !important; } }
