@keyframes pageEnter { from {opacity:0;transform:translateY(12px)} to {opacity:1;transform:translateY(0)} }
@keyframes traceCardFrame {
  from { opacity: 0; stroke-dashoffset: 1; }
  25% { opacity: .7; }
  75% { opacity: .7; stroke-dashoffset: 0; }
  to { opacity: 0; stroke-dashoffset: 0; }
}
.screen--quiz { animation-duration: 240ms; animation-timing-function: var(--ease-out); }
.site-shell:has(.screen--quiz:not([hidden])) .card-opening-trace path {
  stroke-dasharray: 1;
  animation: traceCardFrame 640ms var(--ease-out);
}
@keyframes flowerFloat { 0%,100% {transform:translateY(0) rotate(-5deg)} 50% {transform:translateY(-9px) rotate(3deg)} }
@keyframes growStem { from {stroke-dashoffset:480} to {stroke-dashoffset:0} }
@keyframes leafAppear { from {opacity:0;transform:scale(.7)} to {opacity:1;transform:scale(1)} }
@keyframes bloomOpen { 0% {opacity:0;scale:.06;rotate:-25deg} 70% {opacity:1;scale:1.1;rotate:3deg} 100% {opacity:1;scale:1;rotate:0deg} }
@keyframes fadeIn { from {opacity:0} to {opacity:1} }
@keyframes blink { 50% {opacity:0} }
@keyframes dodgeWiggle { 0%,100% {rotate:0deg} 25% {rotate:-6deg} 50% {rotate:5deg} 75% {rotate:-3deg} }
@keyframes hintPulse { 0%,100% {box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 22%,transparent)} 50% {box-shadow:0 0 0 8px color-mix(in srgb,var(--accent) 8%,transparent)} }
.answer-button.is-dodging { animation:dodgeWiggle .42s ease-out; }
.answer-button.is-hinted { animation:hintPulse 1.6s ease-in-out 3; }
.flower-stage.is-blooming .stem { animation:growStem 1.25s cubic-bezier(.4,0,.1,1) forwards; animation-delay:var(--flower-delay); }
.flower-stage.is-blooming .leaf { transform-box:fill-box; transform-origin:center; animation:leafAppear .85s ease-out forwards; animation-delay:calc(var(--flower-delay) + .65s); }
.flower-stage.is-blooming .bloom { animation:bloomOpen 1s cubic-bezier(.2,.8,.3,1) forwards; animation-delay:calc(var(--flower-delay) + .85s); }
.flower-stage.is-blooming .ribbon { animation:fadeIn .6s ease forwards; animation-delay:1.5s; }
.flower-stage.is-blooming .tiny-stars { animation:fadeIn .8s ease forwards; animation-delay:2s; }
.flower-stage.is-blooming .flower-group .petal-ring { transform-box:fill-box; transform-origin:center; }
.flower-stage.is-bloomed .stem { stroke-dashoffset:0; }
.flower-stage.is-bloomed .leaf,.flower-stage.is-bloomed .bloom,.flower-stage.is-bloomed .ribbon,.flower-stage.is-bloomed .tiny-stars { opacity:1; }
/* ---- Card opening: the invitation unfolds when the page first shows ---- */
@keyframes frameOpen { from { clip-path: inset(0 50% 0 50%); } to { clip-path: inset(0); } }
@keyframes cornerGlide { from { opacity: 0; } to { opacity: 1; translate: 0 0; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes twinkle { 0%, 100% { opacity: .1; scale: .8; } 50% { opacity: .85; scale: 1.15; } }
@keyframes shineSweep { from { translate: -110% 0; } to { translate: 110% 0; } }
@keyframes coverLeave { to { opacity: 0; transform: translateY(-10px) scale(1.025); } }
@keyframes cornerPulse { 50% { scale: 1.07; } }

/* the gold frame draws open from the centre, like a book opening */
.site-shell::before { animation: frameOpen 1.1s var(--ease-out) both; }
.site-shell::after { animation: frameOpen 1.1s var(--ease-out) .18s both; }
/* corner roses glide in from beyond the card edge */
.corner { animation: cornerGlide .95s var(--ease-out) .4s both; }
.corner--tl { translate: -26% -26%; }
.corner--tr { translate: 26% -26%; }
.corner--bl { translate: -26% 26%; }
.corner--br { translate: 26% 26%; }
/* cover text rises in, one line after another */
.cover-art > *, .cover-actions > * { animation: riseIn .8s var(--ease-out) both; animation-delay: calc(.5s + var(--i, 0) * .11s); }
.cover-art > :nth-child(1) { --i: 0; }
.cover-art > :nth-child(2) { --i: 1; }
.cover-art > :nth-child(3) { --i: 2; }
.cover-actions > :nth-child(1) { --i: 3; }
.cover-actions > :nth-child(2) { --i: 4; }
.cover-actions > :nth-child(3) { --i: 5; }
.cover-actions > :nth-child(4) { --i: 6; }
/* a few gold sparkles twinkle softly on the card */
.card-sparkles { position: absolute; inset: 0; }
.card-sparkles i { position: absolute; left: var(--x); top: var(--y); font-style: normal; font-size: var(--s, 14px); color: var(--accent); opacity: .1; animation: twinkle 3.4s ease-in-out var(--d) infinite; }
/* tapping "Open your surprise": a gold light sweeps across while the cover lifts away */
.card-shine { position: absolute; inset: 0; z-index: 2; opacity: 0; translate: -110% 0; background: linear-gradient(105deg, transparent 32%, color-mix(in srgb, var(--accent) 24%, transparent) 50%, transparent 68%); }
body.is-opening .card-shine { opacity: 1; animation: shineSweep .85s ease-in-out; }
body.is-opening .screen--welcome { animation: coverLeave .65s var(--ease-out) forwards; pointer-events: none; }
body.is-opening .corner { animation: cornerPulse .7s ease-in-out; }

/* After the bloom, the greeting fades in slowly (name first, then the signature); then Next appears */
.greeting-panel { opacity: 0; filter: blur(6px); scale: .96; transition: opacity 1.8s ease-out, filter 1.8s ease-out, scale 1.8s var(--ease-out); }
.greeting-panel.is-shown { opacity: 1; filter: none; scale: 1; }
.greeting-panel .signature { opacity: 0; transition: opacity 1.4s ease-out 1s; }
.greeting-panel.is-shown .signature { opacity: 1; }
.page-nav:not([hidden]) { animation: fadeIn .8s ease both; }

/* Pressing "Play our song": her note fades in softly, rising a few pixels out of a slight blur */
@keyframes noteIn { from { opacity: 0; filter: blur(5px); translate: 0 10px; } to { opacity: 1; filter: none; translate: 0 0; } }
.song-note:not([hidden]) { animation: noteIn 1.5s var(--ease-out) both; }
