/* Homepage hero illustration (templates/illu/hero.svg): idle motion, .awake while hovered, .play per part */
.hero-scene { overflow: visible; }
.hero-scene * { pointer-events: none; }
.hero-scene .hero-star, .hero-scene .hero-lantern, .hero-scene .hero-moon-body, .hero-scene .hero-uni,
.hero-scene .hero-kid, .hero-scene .hero-book, .hero-scene .hero-hit, .hero-scene .hero-star *, .hero-scene .hero-lantern *,
.hero-scene .hero-moon-body *, .hero-scene .hero-uni *, .hero-scene .hero-kid *, .hero-scene .hero-book * { pointer-events: visiblePainted; }
.hero-scene .hero-hit { pointer-events: all; cursor: pointer; }
.hero-scene .hero-moon-body, .hero-scene .hero-uni, .hero-scene .hero-book, .hero-scene .hero-lantern, .hero-scene .hero-kid, .hero-scene .hero-star { cursor: pointer; }

.hero-scene .hero-star, .hero-scene .hero-dot, .hero-scene .hero-lantern, .hero-scene .hero-moon, .hero-scene .hero-moon-body,
.hero-scene .hero-moon-glow, .hero-scene .hero-cloudset, .hero-scene .hero-uni-head, .hero-scene .hero-uni-eye,
.hero-scene .hero-uni-spark, .hero-scene .hero-horn, .hero-scene .hero-quilt, .hero-scene .hero-teddy, .hero-scene .hero-z,
.hero-scene .hero-mg, .hero-scene .hero-book, .hero-scene .hero-shoot, .hero-scene .hero-book-glow, .hero-scene .hero-moon-smile, .hero-scene .hero-moon-grin,
.hero-scene .hero-moon-cheek {
    transform-box: fill-box; transform-origin: center;
}

/* ---------- idle ---------- */
.hero-scene .hero-star { animation: hero-twinkle 3.6s ease-in-out infinite; }
.hero-scene .hero-star:nth-of-type(2n) { animation-duration: 4.4s; animation-delay: -1.2s; }
.hero-scene .hero-star:nth-of-type(3n) { animation-duration: 3s; animation-delay: -2.1s; }
.hero-scene .hero-star:nth-of-type(5n) { animation-delay: -.6s; }
.hero-scene .hero-dot { animation: hero-dot 2.8s ease-in-out infinite; }
.hero-scene .hero-dot:nth-of-type(2n) { animation-delay: -1.4s; }
.hero-scene .hero-dot:nth-of-type(3n) { animation-delay: -.7s; }

.hero-scene .hero-lantern { transform-origin: 50% 0; animation: hero-sway 5s ease-in-out infinite; }
.hero-scene .hero-lantern-2 { animation-delay: -1.3s; animation-duration: 5.6s; }
.hero-scene .hero-lantern-3 { animation-delay: -2.6s; }
.hero-scene .hero-lantern-4 { animation-delay: -3.7s; animation-duration: 4.6s; }
.hero-scene .hero-lglow { animation: hero-pulse 3.2s ease-in-out infinite; }

.hero-scene .hero-moon-glow { animation: hero-glow 6s ease-in-out infinite; transition: opacity .5s; }
.hero-scene .hero-moon-body { transition: transform .6s cubic-bezier(.3, 1.4, .5, 1); }
.hero-scene .hero-moon-grin { opacity: 0; transform: scale(.4); transition: opacity .3s, transform .4s cubic-bezier(.3, 1.6, .5, 1); }
.hero-scene .hero-moon-smile { transition: opacity .25s; }
.hero-scene .hero-moon-cheek { transition: transform .4s, opacity .4s; }

.hero-scene .hero-cloudset { animation: hero-bob 7s ease-in-out infinite; }
.hero-scene .hero-quilt { transform-origin: 50% 100%; animation: hero-breathe 4.2s ease-in-out infinite; }
.hero-scene .hero-uni-head { transform-origin: 75% 100%; animation: hero-uni-idle 6s ease-in-out infinite; }
.hero-scene .hero-uni-eye { animation: hero-blink 5.5s ease-in-out infinite; }
.hero-scene .hero-uni-spark { opacity: .35; transform: scale(.6); }

.hero-scene .hero-z { opacity: 0; animation: hero-zrise 4.5s ease-in-out infinite; }
.hero-scene .hero-z2 { animation-delay: .7s; }
.hero-scene .hero-z3 { animation-delay: 1.4s; }

.hero-scene .hero-mg { opacity: 0; animation: hero-magic 7.2s ease-out infinite; --dx: -20px; --dy: -190px; }
.hero-scene .hero-mg1 { --dx: -36px; --dy: -200px; }
.hero-scene .hero-mg2 { --dx: 22px; --dy: -175px; animation-delay: -1.2s; }
.hero-scene .hero-mg3 { --dx: -54px; --dy: -150px; animation-delay: -2.4s; }
.hero-scene .hero-mg4 { --dx: 34px; --dy: -205px; animation-delay: -3.6s; }
.hero-scene .hero-mg5 { --dx: -10px; --dy: -165px; animation-delay: -4.8s; }
.hero-scene .hero-mg6 { --dx: -64px; --dy: -215px; animation-delay: -6s; }
.hero-scene .hero-book-glow { animation: hero-pulse 4s ease-in-out infinite; }
.hero-scene .hero-book { transform-origin: 50% 100%; transition: transform .4s cubic-bezier(.3, 1.5, .5, 1); }

/* ---------- whole scene awake (everything moves a little more). .awake is set by the script in hero.svg
   while a mouse is over the picture; on leave every awake loop finishes its current round, then it is removed.
   The -a keyframes are copies so the script can tell the awake loops apart from the idle ones. ---------- */
.hero-scene .hero-shoot { opacity: 0; }
.hero-scene.awake .hero-shoot { animation: hero-shoot-a 2.6s ease-in .2s infinite; }
.hero-scene.awake .hero-lantern { animation: hero-swing-a 2.2s ease-in-out infinite; }
.hero-scene.awake .hero-lantern-2 { animation-delay: -.5s; }
.hero-scene.awake .hero-lantern-3 { animation-delay: -1s; }
.hero-scene.awake .hero-lantern-4 { animation-delay: -1.5s; }
.hero-scene.awake .hero-lglow { animation: hero-pulse-a 1.2s ease-in-out infinite; }
.hero-scene.awake .hero-star { animation: hero-twinkle-mid-a 1.6s ease-in-out infinite; }
.hero-scene.awake .hero-star:nth-of-type(2n) { animation-delay: -.5s; }
.hero-scene.awake .hero-star:nth-of-type(3n) { animation-delay: -1s; }
.hero-scene.awake .hero-dot { animation: hero-dot-a 1.1s ease-in-out infinite; }
.hero-scene.awake .hero-moon-glow { opacity: 1; animation: hero-glow-big-a 2.4s ease-in-out infinite; }
.hero-scene.awake .hero-moon-body { animation: hero-rock-a 3s ease-in-out infinite; }
.hero-scene.awake .hero-cloudset { animation: hero-bob-big-a 3.2s ease-in-out infinite; }
.hero-scene.awake .hero-quilt { animation: hero-breathe-big-a 2.4s ease-in-out infinite; }
.hero-scene.awake .hero-teddy { animation: hero-wiggle-a 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
.hero-scene.awake .hero-uni-head { animation: hero-nod-a 2s ease-in-out infinite; }
.hero-scene.awake .hero-uni-spark { animation: hero-spark-a 1.3s ease-in-out infinite; }
.hero-scene.awake .hero-horn { animation: hero-horn-a 1.3s ease-in-out infinite; }
.hero-scene.awake .hero-z { animation: hero-zrise-big-a 2.6s ease-in-out infinite; }
.hero-scene.awake .hero-z2 { animation-delay: .7s; }
.hero-scene.awake .hero-z3 { animation-delay: 1.4s; }
.hero-scene.awake .hero-mg { animation: hero-magic-a 3.4s ease-out infinite; }
.hero-scene.awake .hero-mg2 { animation-delay: -.6s; }
.hero-scene.awake .hero-mg3 { animation-delay: -1.2s; }
.hero-scene.awake .hero-mg4 { animation-delay: -1.8s; }
.hero-scene.awake .hero-mg5 { animation-delay: -2.4s; }
.hero-scene.awake .hero-mg6 { animation-delay: -3s; }
.hero-scene.awake .hero-book { animation: hero-book-hop-a 2.4s ease-in-out infinite; }
.hero-scene.awake .hero-book-glow { animation: hero-pulse-a 1.6s ease-in-out infinite; }

/* ---------- parts: .play is set by the script in hero.svg on hover or click/tap, for a fixed time and
   with a cooldown afterwards, so nothing keeps looping or gets stuck ---------- */
.hero-scene .hero-star.play { animation: hero-twinkle-big .9s ease-in-out 2; }
.hero-scene .hero-lantern.play { animation: hero-swing 1.2s ease-in-out 2; }

.hero-scene .hero-moon.play .hero-moon-glow { animation: hero-glow-big 1s ease-in-out 2; }
.hero-scene .hero-moon.play .hero-moon-body { animation: none; transform: rotate(-8deg) scale(1.04); }
.hero-scene .hero-moon.play .hero-moon-smile { opacity: 0; }
.hero-scene .hero-moon.play .hero-moon-grin { opacity: 1; transform: scale(1); }
.hero-scene .hero-moon.play .hero-moon-cheek { transform: scale(1.25); opacity: 1; }

.hero-scene .hero-uni.play .hero-uni-head { animation: hero-nod 1s ease-in-out 2; }
.hero-scene .hero-uni.play .hero-uni-spark { animation: hero-spark .9s ease-in-out 2; }
.hero-scene .hero-uni.play .hero-horn { animation: hero-horn .9s ease-in-out 2; }

.hero-scene .hero-kid-head { transform-box: fill-box; transform-origin: 50% 90%; }
.hero-scene .hero-kid.play .hero-kid-head { animation: hero-snuggle 1.1s ease-in-out 2; }
.hero-scene .hero-kid.play .hero-teddy { animation: hero-wiggle .7s ease-in-out 3; transform-origin: 50% 100%; }
.hero-scene .hero-kid.play ~ .hero-zzz .hero-z { animation: hero-zrise-big 2.2s ease-in-out 1; }
.hero-scene .hero-kid.play ~ .hero-zzz .hero-z2 { animation-delay: .25s; }
.hero-scene .hero-kid.play ~ .hero-zzz .hero-z3 { animation-delay: .5s; }

.hero-scene .hero-bookset.play .hero-book { animation: none; transform: scale(1.06) rotate(-2deg); }
.hero-scene .hero-bookset.play .hero-book-glow { animation: hero-pulse 1.1s ease-in-out 2; }

/* ---------- keyframes ---------- */
@keyframes hero-snuggle { 0%, 100% { transform: rotate(0) translateY(0); } 30% { transform: rotate(-7deg) translateY(-2px); } 65% { transform: rotate(5deg) translateY(0); } }
@keyframes hero-shoot {
    0% { opacity: 0; transform: translate(0, 0); }
    10% { opacity: 1; }
    55% { opacity: 0; transform: translate(-190px, 77px); }
    100% { opacity: 0; transform: translate(-190px, 77px); }
}
@keyframes hero-twinkle-mid { 0%, 100% { opacity: 1; transform: scale(1.1) rotate(0); } 50% { opacity: .6; transform: scale(.8) rotate(12deg); } }
@keyframes hero-rock { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-6deg); } 70% { transform: rotate(4deg); } }
@keyframes hero-bob-big { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes hero-breathe-big { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.06); } }
@keyframes hero-book-hop { 0%, 100% { transform: translateY(0) rotate(0); } 20% { transform: translateY(-6px) rotate(-3deg); } 40% { transform: translateY(0) rotate(0); } }
@keyframes hero-twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.78); } }
@keyframes hero-twinkle-big { 0%, 100% { transform: scale(1.3) rotate(0); } 50% { transform: scale(1.75) rotate(18deg); } }
@keyframes hero-dot { 0%, 100% { opacity: .9; } 50% { opacity: .25; } }
@keyframes hero-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes hero-swing { 0%, 100% { transform: rotate(-16deg); } 50% { transform: rotate(16deg); } }
@keyframes hero-pulse { 0%, 100% { opacity: .45; } 50% { opacity: .85; } }
@keyframes hero-glow { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes hero-glow-big { 0%, 100% { opacity: 1; transform: scale(1.12); } 50% { opacity: 1; transform: scale(1.25); } }
@keyframes hero-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes hero-breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.03); } }
@keyframes hero-uni-idle { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2.5deg); } }
@keyframes hero-nod { 0%, 100% { transform: rotate(0); } 35% { transform: rotate(-9deg); } 60% { transform: rotate(2deg); } }
@keyframes hero-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes hero-spark { 0%, 100% { opacity: .5; transform: scale(.7) rotate(0); } 50% { opacity: 1; transform: scale(1.35) rotate(20deg); } }
@keyframes hero-horn { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25) drop-shadow(0 0 4px #f8de95); } }
@keyframes hero-wiggle { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-8deg); } 70% { transform: rotate(6deg); } }
@keyframes hero-zrise {
    0% { opacity: 0; transform: translate(0, 10px) scale(.8); }
    25%, 65% { opacity: .95; }
    100% { opacity: 0; transform: translate(10px, -16px) scale(1.05); }
}
@keyframes hero-zrise-big {
    0% { opacity: 0; transform: translate(0, 10px) scale(.9); }
    25%, 60% { opacity: 1; }
    100% { opacity: 0; transform: translate(22px, -40px) scale(1.45); }
}
@keyframes hero-magic {
    0% { opacity: 0; transform: translate(0, 0) scale(.4) rotate(0); }
    12% { opacity: 1; }
    70% { opacity: .9; }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(20deg); }
}

@keyframes hero-bob-big-a { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes hero-book-hop-a { 0%, 100% { transform: translateY(0) rotate(0); } 20% { transform: translateY(-6px) rotate(-3deg); } 40% { transform: translateY(0) rotate(0); } }
@keyframes hero-breathe-big-a { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.06); } }
@keyframes hero-dot-a { 0%, 100% { opacity: .9; } 50% { opacity: .25; } }
@keyframes hero-glow-big-a { 0%, 100% { opacity: 1; transform: scale(1.12); } 50% { opacity: 1; transform: scale(1.25); } }
@keyframes hero-horn-a { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25) drop-shadow(0 0 4px #f8de95); } }
@keyframes hero-magic-a {
    0% { opacity: 0; transform: translate(0, 0) scale(.4) rotate(0); }
    12% { opacity: 1; }
    70% { opacity: .9; }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(20deg); }
}
@keyframes hero-nod-a { 0%, 100% { transform: rotate(0); } 35% { transform: rotate(-9deg); } 60% { transform: rotate(2deg); } }
@keyframes hero-pulse-a { 0%, 100% { opacity: .45; } 50% { opacity: .85; } }
@keyframes hero-rock-a { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-6deg); } 70% { transform: rotate(4deg); } }
@keyframes hero-shoot-a {
    0% { opacity: 0; transform: translate(0, 0); }
    10% { opacity: 1; }
    55% { opacity: 0; transform: translate(-190px, 77px); }
    100% { opacity: 0; transform: translate(-190px, 77px); }
}
@keyframes hero-spark-a { 0%, 100% { opacity: .5; transform: scale(.7) rotate(0); } 50% { opacity: 1; transform: scale(1.35) rotate(20deg); } }
@keyframes hero-swing-a { 0%, 100% { transform: rotate(-16deg); } 50% { transform: rotate(16deg); } }
@keyframes hero-twinkle-mid-a { 0%, 100% { opacity: 1; transform: scale(1.1) rotate(0); } 50% { opacity: .6; transform: scale(.8) rotate(12deg); } }
@keyframes hero-wiggle-a { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-8deg); } 70% { transform: rotate(6deg); } }
@keyframes hero-zrise-big-a {
    0% { opacity: 0; transform: translate(0, 10px) scale(.9); }
    25%, 60% { opacity: 1; }
    100% { opacity: 0; transform: translate(22px, -40px) scale(1.45); }
}

@media (prefers-reduced-motion: reduce) {
    .hero-scene *, .hero-scene .play, .hero-scene .play * { animation: none !important; transition: none !important; }
    .hero-scene .hero-z { opacity: .85; }
    .hero-scene .hero-mg { opacity: .9; transform: translate(var(--dx), calc(var(--dy) * .55)); }
    .hero-scene .hero-uni-spark { opacity: .8; transform: none; }
}
