/* Playful layer: permanent motion and interaction on top of site.css. Everything is disabled under prefers-reduced-motion. */

/* Fun backgrounds */
body { background-image: radial-gradient(circle at 1px 1px, rgba(58, 61, 114, 0.07) 1px, transparent 0); background-size: 26px 26px; transition: background-color 0.8s ease; }
body[data-bg="sky"] { background-color: #f0fbfe; }
body[data-bg="pink"] { background-color: #fff3f7; }
body[data-bg="yellow"] { background-color: #fff8e6; }
body[data-bg="green"] { background-color: #f4fbee; }
body[data-bg="purple"] { background-color: #f8f2ff; }
.section:not(.bg-indigo), .hero { background-color: transparent; }
.bg-white { background: rgba(255, 255, 255, 0.72); }

/* Custom cursor (fine pointers only) */
.cursor-dot, .cursor-ring { position: fixed; top: 0; left: 0; z-index: 200; pointer-events: none; border-radius: 50%; opacity: 0; transition: opacity 0.3s, scale 0.3s var(--ease), background 0.3s, border-color 0.3s; }
.cursor-dot { width: 10px; height: 10px; margin: -5px 0 0 -5px; background: var(--pink); }
.cursor-ring { width: 42px; height: 42px; margin: -21px 0 0 -21px; border: 2.5px solid var(--indigo); mix-blend-mode: multiply; }
body.has-cursor .cursor-dot, body.has-cursor .cursor-ring { opacity: 1; }
body.cursor-hover .cursor-ring { scale: 1.65; border-color: var(--pink); background: rgba(254, 73, 128, 0.12); }
body.cursor-down .cursor-ring { scale: 0.7; }

/* Click bursts and trail */
.burst, .spark { position: fixed; z-index: 180; pointer-events: none; }
.burst { width: 22px; height: 22px; margin: -11px 0 0 -11px; animation: burst 0.9s cubic-bezier(0.2, 0.8, 0.3, 1) forwards; }
@keyframes burst { 0% { transform: translate(0, 0) scale(0.2) rotate(0deg); opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(1) rotate(var(--r)); opacity: 0; } }
.spark { width: 12px; height: 12px; margin: -6px 0 0 -6px; animation: spark 0.8s ease-out forwards; }
@keyframes spark { from { transform: scale(1) rotate(0); opacity: 0.9; } to { transform: translateY(18px) scale(0) rotate(160deg); opacity: 0; } }

/* Scroll progress with walking footprints */
.scroll-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: 5px; background: rgba(58, 61, 114, 0.08); }
.scroll-progress i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, var(--yellow), var(--pink), var(--purple), var(--sky), var(--green)); background-size: 300% 100%; animation: hue 6s linear infinite; }
@keyframes hue { to { background-position: 300% 0; } }
.walker { position: fixed; top: 2px; left: 0; z-index: 61; width: 22px; height: 22px; color: var(--pink); transform: translateX(-30px); }

/* Intro curtain (home, once per session) */
.intro { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: var(--yellow); }
.intro-inner { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.intro-steps { display: flex; gap: 0.8rem; }
.intro-steps svg { width: 2.4rem; height: 2.4rem; opacity: 0; }
.intro-steps svg:nth-child(odd) { color: var(--pink); transform: rotate(-12deg) translateY(6px); }
.intro-steps svg:nth-child(even) { color: var(--indigo); transform: rotate(12deg) translateY(-6px); }
.intro b { font-family: var(--font-head); font-size: clamp(1.8rem, 5vw, 3rem); color: var(--indigo); }
.intro.is-done { pointer-events: none; }

/* Hero playground */
.hero { min-height: calc(100vh - 4.6rem); display: flex; align-items: center; }
.hero h1 .w { display: inline-block; white-space: nowrap; }
.hero h1 .ch { display: inline-block; transform-origin: 50% 90%; cursor: default; }
.hero h1.ready .ch { transition: transform 0.35s cubic-bezier(0.34, 1.8, 0.64, 1), color 0.3s; }
.hero h1.ready .ch:hover { transform: translateY(-14px) rotate(-8deg) scale(1.15); color: var(--yellow); }
.hero h1 .accent .ch:hover { color: var(--sky); }
.doodle { position: absolute; z-index: 1; pointer-events: none; will-change: transform; }
.doodle svg { width: 100%; height: 100%; overflow: visible; }
.d-sun { animation: spin 22s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.d-cloud { animation: cloud 18s ease-in-out infinite alternate; }
@keyframes cloud { from { translate: -30px 0; } to { translate: 40px 0; } }
.d-balloon { animation: balloon 7s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes balloon { 0%, 100% { translate: 0 0; rotate: -4deg; } 50% { translate: 0 -24px; rotate: 5deg; } }
.d-plane { animation: plane 14s linear infinite; }
@keyframes plane { 0% { translate: -12vw 30px; rotate: 8deg; opacity: 0; } 8% { opacity: 1; } 50% { translate: 45vw -40px; rotate: -6deg; } 92% { opacity: 1; } 100% { translate: 105vw 10px; rotate: 10deg; opacity: 0; } }
.d-wiggle { animation: wiggle 3.5s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { rotate: -6deg; } 50% { rotate: 6deg; } }
.d-bounce { animation: bounce 2.6s cubic-bezier(0.5, 0, 0.5, 1) infinite; }
@keyframes bounce { 0%, 100% { translate: 0 0; } 50% { translate: 0 -18px; } }
.d-pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { scale: 1; } 50% { scale: 1.18; } }
.d-draw path { stroke-dasharray: 400; stroke-dashoffset: 400; animation: drawloop 5s ease-in-out infinite; }
@keyframes drawloop { 0% { stroke-dashoffset: 400; } 45%, 60% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -400; } }
.hero-book { animation: bookfloat 6s ease-in-out infinite; }
@keyframes bookfloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
.hero-play-hint { position: absolute; left: 50%; bottom: 1.4rem; z-index: 3; display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.9rem; border-radius: 999px; background: #fff; color: var(--indigo); font-size: 0.85rem; font-weight: 600; box-shadow: var(--shadow-sm); transform: translateX(-50%); animation: bounce 2.4s ease-in-out infinite; }
.hero-play-hint svg { width: 1rem; height: 1rem; color: var(--pink); }

/* Marquee ribbon */
.marquee { position: relative; z-index: 5; overflow: hidden; padding: 1.1rem 0; background: var(--indigo); transform: rotate(-2deg); margin: -1rem -2rem 0; box-shadow: 0 18px 30px -20px rgba(42, 44, 88, 0.6); }
.marquee.alt { background: var(--pink); transform: rotate(1.5deg); }
.marquee-track { display: flex; width: max-content; gap: 1rem; animation: marquee 32s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-item { display: inline-flex; align-items: center; gap: 1rem; color: #fff; font-family: var(--font-head); font-size: clamp(1.4rem, 3vw, 2.2rem); white-space: nowrap; }
.marquee-item svg { width: 1.6rem; height: 1.6rem; color: var(--yellow); animation: spin 6s linear infinite; }
.marquee.alt .marquee-item svg { color: #fff; }

/* Footprints trail */
.trail { position: relative; height: 84px; margin: -0.5rem 0 1.2rem; }
.trail svg.trail-path { position: absolute; inset: 0; width: 100%; height: 100%; }
.trail .fp { position: absolute; width: 28px; height: 28px; opacity: 0; transform: scale(0.3); transition: opacity 0.3s, transform 0.4s cubic-bezier(0.34, 1.8, 0.64, 1); }
.trail .fp.on { opacity: 1; transform: scale(1) rotate(var(--r, 0deg)); }
.trail .fp:nth-child(odd) { color: var(--pink); }
.trail .fp:nth-child(even) { color: var(--indigo); }

/* Jelly buttons, magnetic, ripple */
.btn { position: relative; overflow: hidden; will-change: transform; }
.btn:active { transform: scale(0.94) !important; }
.btn .ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.5); transform: scale(0); animation: ripple 0.6s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.btn-primary:hover { animation: jelly 0.6s; }
@keyframes jelly { 0%, 100% { scale: 1 1; } 30% { scale: 1.08 0.92; } 50% { scale: 0.95 1.05; } 70% { scale: 1.03 0.97; } }

/* Cards come alive */
[data-tilt-card] { transform-style: preserve-3d; }
.momento img, .act, .resource, .slot, .stat, .prep, .event-list li { will-change: transform; }
.momento:hover img { animation: wobble 0.8s ease; }
@keyframes wobble { 0%, 100% { rotate: 0deg; } 25% { rotate: -3deg; scale: 1.04; } 50% { rotate: 2deg; } 75% { rotate: -1deg; } }
.momento .num { animation: pulse 2.6s ease-in-out infinite; animation-delay: calc(var(--n, 0) * 0.3s); }
.resource .r-ico { animation: wiggle 4s ease-in-out infinite; }
.sticker { cursor: grab; }
.sticker:active { cursor: grabbing; }
.kicker { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; }
.kicker::before { content: ""; width: 0.7rem; height: 0.7rem; border-radius: 3px; background: currentColor; animation: spin 4s linear infinite; }
.section h2 .hl { position: relative; z-index: 0; white-space: nowrap; }
.section h2 .hl::after { content: ""; position: absolute; left: -0.1em; right: -0.1em; bottom: 0.08em; z-index: -1; height: 0.38em; border-radius: 0.2em; background: var(--yellow); opacity: 0.55; transform: scaleX(0); transform-origin: left; transition: transform 0.9s var(--ease) 0.3s; }
.section h2.in .hl::after, .section .in h2 .hl::after, .hl.in::after { transform: scaleX(1); }
.hl.in::after { transform: scaleX(1); }

/* Animated waves */
.wave path { animation: wavemove 8s ease-in-out infinite alternate; }
@keyframes wavemove { from { transform: translateX(0); } to { transform: translateX(-40px); } }
.wave { overflow: visible; }

/* Ritual autoplay bar */
.ritual-autoplay { height: 4px; margin-top: 1rem; border-radius: 4px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.ritual-autoplay i { display: block; height: 100%; width: 0; background: var(--yellow); }

/* Playful home widget: how do you feel today */
.feel-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; margin-top: 2rem; }
.feel-strip button { width: 6.4rem; padding: 0.4rem; border: 0; border-radius: 22px; background: #fff; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform 0.35s cubic-bezier(0.34, 1.8, 0.64, 1), box-shadow 0.3s; }
.feel-strip button:hover { transform: translateY(-10px) rotate(-4deg) scale(1.08); box-shadow: var(--shadow); }
.feel-strip button[aria-pressed="true"] { outline: 4px solid var(--pink); transform: scale(1.12); }
.feel-strip img { border-radius: 16px; }
.feel-reply { min-height: 2.2rem; margin-top: 1.2rem; text-align: center; font-family: var(--font-head); font-size: clamp(1.3rem, 2.6vw, 1.8rem); color: var(--pink); }

/* Bubbles to pop */
.bubbles { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bubble { position: absolute; bottom: -80px; border: 0; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.95), var(--c) 70%); opacity: 0.75; pointer-events: auto; cursor: pointer; animation: rise var(--t, 14s) linear infinite; animation-delay: var(--delay, 0s); }
.bubble.pop { animation: popbubble 0.35s ease-out forwards; }
@keyframes rise { 0% { transform: translate(0, 0); } 50% { transform: translate(30px, -55vh); } 100% { transform: translate(-20px, -115vh); } }
@keyframes popbubble { to { transform: scale(1.8); opacity: 0; } }

@media (pointer: coarse) { .cursor-dot, .cursor-ring { display: none; } }
@media (max-width: 860px) {
  .hero { min-height: auto; }
  .doodle.hide-sm { display: none; }
  .marquee { margin: 0 -1rem; }
  .hero-play-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .intro, .cursor-dot, .cursor-ring, .walker, .bubbles, .d-plane { display: none !important; }
  .marquee-track { animation: none; flex-wrap: wrap; }
}
.section > .wrap, .hero > .wrap, .page-hero > .wrap { position: relative; z-index: 2; }
