/* Shared public motion: light, staggered, and quiet whenever it leaves the screen. */
.rapunzel-motion :is(.button,.icon-button,.hero-save-link,.studio-choice,.studio-explore,.save-story,.article-tool,.photo-pin,.back-to-top,.garden-links a,.chapter-link > summary,.chapter-link-all){
    transition:transform .24s ease,translate .24s ease,background-color .24s ease,border-color .24s ease,color .24s ease,box-shadow .24s ease;
}
.rapunzel-motion :is(.text-link,.story-link,.footer-about-link,.studio-explore) > span,
.rapunzel-motion :is(.chapter-arrow,.garden-links a > b,.hero-actions .button > span),
.rapunzel-motion :is(.icon-button,.save-story,.hero-save-link,.article-tool) > svg{
    transition:transform .28s cubic-bezier(.2,.8,.2,1);
}
.rapunzel-motion :is(.article-card,.chapter-feature){
    transition:translate .3s cubic-bezier(.2,.8,.2,1),box-shadow .3s ease,border-color .3s ease;
}
.rapunzel-motion .stack-image img{transition:transform .4s ease}
.rapunzel-motion .studio-swatch{transition:transform .25s ease,box-shadow .25s ease}

/* Press feedback is available on touch screens as well as with a mouse. */
.rapunzel-motion :is(.button,.icon-button,.hero-save-link,.studio-choice,.save-story,.article-tool,.photo-pin,.back-to-top,.garden-links a,.chapter-link > summary,.chapter-link-all):active{
    transform:translateY(1px) scale(.97);
}
.rapunzel-motion .studio-choice[aria-pressed=true] .studio-swatch{transform:scale(1.09);box-shadow:0 0 0 3px #b79bcf29}
.rapunzel-motion :is(.text-link,.story-link,.footer-about-link,.studio-explore):focus-visible > span,
.rapunzel-motion .hero-actions .button:focus-visible > span{transform:translate(3px,-3px)}
.rapunzel-motion :is(.chapter-link > summary,.chapter-link-all):focus-visible .chapter-arrow{transform:translate(3px,-3px)}

@media(hover:hover) and (pointer:fine){
    .rapunzel-motion :is(.button,.studio-choice,.article-tool,.photo-pin,.back-to-top):hover{transform:translateY(-3px)}
    .rapunzel-motion :is(.icon-button,.hero-save-link):hover > svg{transform:rotate(-8deg) translateY(-1px)}
    .rapunzel-motion .save-story:hover > svg{transform:rotate(8deg) scale(1.08)}
    .rapunzel-motion :is(.text-link,.story-link,.footer-about-link,.studio-explore):hover > span,
    .rapunzel-motion .hero-actions .button:hover > span{transform:translate(3px,-3px)}
    .rapunzel-motion :is(.chapter-link > summary,.chapter-link-all):hover .chapter-arrow,
    .rapunzel-motion .garden-links a:hover > b{transform:translate(3px,-3px)}
    .rapunzel-motion :is(.article-card,.chapter-feature):hover{translate:0 -5px;box-shadow:0 15px 32px #67427612;border-color:#d2bedc}
    .rapunzel-motion .story-stack-item:hover .stack-image img{transform:scale(1.05)}
    .rapunzel-motion .studio-choice:hover .studio-swatch{transform:translateY(-2px) rotate(-7deg)}
}

/* A warm sweep catches the primary invitation without moving its hit area. */
.rapunzel-motion .hero-actions .button-gold{position:relative;isolation:isolate;overflow:hidden}
.rapunzel-motion .hero-actions .button-gold::after{
    content:"";position:absolute;inset:-45% auto -45% -60%;width:36%;pointer-events:none;z-index:-1;
    background:linear-gradient(90deg,transparent,#fff9d969,transparent);transform:translateX(-150%) rotate(24deg);
    animation:rapunzel-golden-sweep 7.6s ease-in-out infinite;animation-play-state:paused;
}
.rapunzel-motion[data-site-motion=active] .hero-actions .button-gold[data-motion-visible=true]::after{animation-play-state:running}

/* Purely decorative motifs have independent rhythms, so the page never bobs as one. */
.rapunzel-motion [data-motion-ornament]{
    display:inline-block;transform-origin:50% 70%;
    animation:rapunzel-motif-drift var(--ornament-duration,5.5s) ease-in-out var(--ornament-delay,0s) infinite;
    animation-play-state:paused;
}
.rapunzel-motion :is(.heading-spark,.footer-wish > span,.hero-kicker > span){animation-name:rapunzel-star-breathe}
.rapunzel-motion :is(.garden-flower,.note-flower,.hero-bottom-flower){animation-name:rapunzel-flower-turn;transform-origin:50% 50%}
.rapunzel-motion .note-braid{animation-name:rapunzel-braid-drift;transform-origin:50% 0}
.rapunzel-motion[data-site-motion=active] [data-motion-ornament][data-motion-visible=true]{animation-play-state:running}
.rapunzel-motion [data-motion-panel]::before,.rapunzel-motion .article-heading-grid[data-motion-panel]::after{
    animation:rapunzel-star-breathe 5.8s ease-in-out infinite;animation-play-state:paused;
}
.rapunzel-motion[data-site-motion=active] [data-motion-panel][data-motion-visible=true]::before,
.rapunzel-motion[data-site-motion=active] .article-heading-grid[data-motion-visible=true]::after{animation-play-state:running}

/* The observer adds this only after an element is visible; SSR is never hidden. */
.rapunzel-motion .motion-arrive{animation:rapunzel-arrive .6s cubic-bezier(.2,.8,.2,1) var(--arrival-delay,0s) both}
.rapunzel-motion[data-site-motion=paused] .motion-arrive{animation-play-state:paused}

@keyframes rapunzel-arrive{from{opacity:.78;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}
@keyframes rapunzel-motif-drift{0%,100%{translate:0 0;rotate:-4deg}50%{translate:0 -3px;rotate:5deg}}
@keyframes rapunzel-star-breathe{0%,100%{scale:.95;opacity:.78;rotate:-5deg}50%{scale:1.07;opacity:1;rotate:8deg}}
@keyframes rapunzel-flower-turn{0%,100%{translate:0 0;rotate:-5deg}50%{translate:0 -4px;rotate:5deg}}
@keyframes rapunzel-braid-drift{0%,100%{rotate:-2deg;translate:0 0}50%{rotate:2deg;translate:0 -3px}}
@keyframes rapunzel-golden-sweep{0%,68%{transform:translateX(-150%) rotate(24deg)}88%,100%{transform:translateX(600%) rotate(24deg)}}

@media(prefers-reduced-motion:reduce){
    .rapunzel-motion [data-motion-ornament],.rapunzel-motion .motion-arrive,
    .rapunzel-motion [data-motion-panel]::before,.rapunzel-motion .article-heading-grid[data-motion-panel]::after,
    .rapunzel-motion .hero-actions .button-gold::after{animation:none!important}
    .rapunzel-motion :is(.button,.icon-button,.hero-save-link,.studio-choice,.studio-explore,.save-story,.article-tool,.photo-pin,.back-to-top,.garden-links a,.chapter-link > summary,.chapter-link-all,.article-card,.chapter-feature,.studio-swatch){transition:none!important}
    .rapunzel-motion :is(.article-card,.chapter-feature):hover{translate:none}
    .rapunzel-motion :is(.button,.icon-button,.hero-save-link,.studio-choice,.save-story,.article-tool,.photo-pin,.back-to-top,.garden-links a,.chapter-link > summary,.chapter-link-all):is(:hover,:active){transform:none}
    .rapunzel-motion :is(.text-link,.story-link,.footer-about-link,.studio-explore,.hero-actions .button) > span,
    .rapunzel-motion :is(.chapter-arrow,.garden-links a > b,.studio-swatch),
    .rapunzel-motion :is(.icon-button,.save-story,.hero-save-link,.article-tool) > svg{transition:none!important;transform:none!important}
}
