/* control */
/* r8 motion control: pause button + pausing of loops (scripts add data-motion; without it nothing here applies) */
.mx-toggle{display:grid;place-items:center;width:44px;height:44px;padding:0;flex:none;border:1px solid #bdc8ae;border-radius:50%;background:var(--cream);color:var(--forest)}
.mx-toggle[hidden]{display:none}
.mx-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.mx-play,[data-motion=paused] .mx-pause{display:none}
[data-motion=paused] .mx-play{display:inline}
.mx-toggle{touch-action:manipulation}
/* small phones: the button takes 53px of the header row; tighter side padding keeps the whole language name visible (zh, ru) */
@media(max-width:375px){.mx-toggle:not([hidden])+.language-switch select{padding-left:8px;padding-right:27px}.mx-toggle:not([hidden])+.language-switch>svg{right:9px}}
/* enlarged text: the language box gives way, so the menu button never leaves the screen */
@media(max-width:650px){.mx-toggle:not([hidden])+.language-switch{flex-shrink:1;min-width:0}.mx-toggle:not([hidden])+.language-switch select{max-width:100%}}
@media(min-width:651px){.mx-toggle{position:fixed;right:max(18px,env(safe-area-inset-right));bottom:max(18px,env(safe-area-inset-bottom));z-index:25;box-shadow:0 3px 16px #162e2933}}
html[data-motion=paused] *,html[data-motion=paused] *:before,html[data-motion=paused] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
html[data-motion=hidden] *,html[data-motion=hidden] *:before,html[data-motion=hidden] *:after{animation-play-state:paused!important}
[data-mx-rest] :is(.hero-image,.polaroid,.ar-badge-star,.atmo-sticker){animation-play-state:paused!important}
@media print{.mx-toggle{display:none}*,*:before,*:after{animation:none!important;transition:none!important}}
/* Pieces that slide in sideways must never widen the page (phones would zoom out and fixed buttons would jump). */
html[data-motion] main{overflow-x:clip}
/* The hero text moves in with the page itself (two lines in the head set data-mx-hero or data-mx-done before the first paint).
   Without data-mx-hero the entrance of styles.css stays exactly as it is, so a late motion.css never restarts it.
   Branches: swing aside when motion.css was there before the first paint (data-mx-early), otherwise fade in. After pause: never again. */
@keyframes mx-fade{from{opacity:0}}
html:not([data-mx-hero]) .hero-copy>*{animation-name:content-arrive;animation-duration:.8s;animation-timing-function:ease-out}
html:not([data-mx-early]) .hero:before,html:not([data-mx-early]) .hero:after{animation:mx-fade .8s ease-out backwards}
html[data-mx-done] .hero-copy>*,html[data-mx-done] .hero:before,html[data-mx-done] .hero:after{animation:none!important}
/* core */
/* r8 motion-core: scroll story for The Zookeeper Thailand. Loads in <head> after styles.css.
   Mobile first: the base rules are the phone version, wider screens are added in min-width blocks.
   Nothing here hides content by itself: .mc-wait / .mc-soft / .mc-line are added by motion-core.js,
   only to things that are still below the screen. Content boxes move by transform, opacity or clip-path. */

/* ---------- Hero: transform only, from first paint (replaces content-arrive, which started at opacity 0) ---------- */
@keyframes mc-hero-in{from{transform:translateY(34px)}to{transform:none}}
@keyframes mc-hero-pop{0%{transform:translateY(40px) rotate(-2.5deg) scale(.94)}60%{transform:translateY(0) rotate(.5deg) scale(1)}100%{transform:none}}
.hero-copy>*{animation-name:mc-hero-in;animation-duration:.8s;animation-timing-function:cubic-bezier(.2,.8,.2,1)}
.hero-copy>h1{animation-name:mc-hero-pop;animation-duration:1s;transform-origin:0 100%}

/* two branches swing aside, as if you walk in under the treehouse; they rest in the corners */
@keyframes mc-part-l{from{transform:translate(0,4%) rotate(14deg) scale(1.35)}to{transform:translate(-46%,-40%) rotate(-6deg)}}
@keyframes mc-part-r{from{transform:scaleX(-1) translate(0,4%) rotate(14deg) scale(1.35)}to{transform:scaleX(-1) translate(-46%,-40%) rotate(-6deg)}}
.hero:before,.hero:after{content:'';position:absolute;z-index:-1;top:0;width:62vw;aspect-ratio:1;pointer-events:none;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M0 0C60 40 120 90 185 170' fill='none' stroke='%231f2e21' stroke-width='5' stroke-linecap='round'/%3E%3Cg fill='%232f4a31'%3E%3Cpath d='M30 20c50-30 90-10 100 20-40 14-80 8-100-20Z'/%3E%3Cpath d='M75 58c50-26 88-4 95 28-40 10-76 2-95-28Z'/%3E%3Cpath d='M120 105c44-12 70 12 72 42-36 2-62-12-72-42Z'/%3E%3C/g%3E%3Cg fill='%23587045'%3E%3Cpath d='M22 18c-20 46 0 84 32 92 12-40 4-74-32-92Z'/%3E%3Cpath d='M66 52c-22 44-4 82 26 92 14-38 8-72-26-92Z'/%3E%3Cpath d='M114 100c-18 40 2 74 34 82 10-36 0-64-34-82Z'/%3E%3C/g%3E%3C/svg%3E") 0 0/100% 100% no-repeat}
.hero:before{left:0;transform:translate(-46%,-40%) rotate(-6deg);animation:mc-part-l 1.7s cubic-bezier(.3,.8,.2,1) backwards}
.hero:after{right:0;transform:scaleX(-1) translate(-46%,-40%) rotate(-6deg);animation:mc-part-r 1.9s cubic-bezier(.3,.8,.2,1) backwards}

/* sideways entrances never widen the page (clip is not a scroll container, so sticky and scrolling are untouched) */
html[data-motion] main>section,html[data-motion] .site-footer{overflow-x:clip}

/* ---------- Waiting states (added by JS, below the screen only) ---------- */
html[data-motion=on] .mc-wait{opacity:0!important}
html[data-motion=on] .mc-soft{transform:translateY(22px)}
html[data-motion=on] .mc-line:after{clip-path:inset(-6px 100% -6px 0)}
html[data-motion=on] .mc-line.mc-drawn:after{clip-path:inset(-6px 0 -6px 0);transition:clip-path .9s cubic-bezier(.5,0,.2,1) .25s}

/* ---------- Falling leaves: one layer per leaf on phones, an extra sway on wide screens ---------- */
.mc-leaves{position:absolute;inset:0;z-index:-1;overflow:hidden;pointer-events:none;contain:strict}
.mc-leaf{position:absolute;top:0;height:100%;width:24px;transform:translateY(-12%);animation:mc-fall var(--d) linear var(--w) infinite}
.mc-leaf i{display:block;width:var(--s);height:var(--s);border-radius:0 100% 0 100%;background:var(--c);opacity:.75}
@keyframes mc-fall{0%{transform:translate(-14px,-12%) rotate(-3deg)}25%{transform:translate(14px,17%) rotate(3deg)}50%{transform:translate(-14px,47%) rotate(-3deg)}75%{transform:translate(14px,76%) rotate(3deg)}100%{transform:translate(-14px,106%) rotate(-3deg)}}
@keyframes mc-sway{from{transform:rotate(-60deg)}to{transform:rotate(70deg)}}

/* ---------- Paw that walks down the empty right margin with you (svh: no jump when the URL bar folds) ---------- */
.mc-trail{position:fixed;z-index:20;right:max(2px,env(safe-area-inset-right));top:calc(96px + env(safe-area-inset-top));width:14px;height:calc(100vh - 206px);height:calc(100svh - 206px);pointer-events:none;color:var(--orange)}
.mc-trail:before{content:'';position:absolute;inset:0 6px;border-radius:2px;background:#3447351f}
.mc-trail i{position:absolute;inset:0 6px;border-radius:2px;background:currentColor;transform:scaleY(0);transform-origin:0 0}
.mc-trail b{position:absolute;top:-7px;left:0;width:14px;height:14px}
.mc-paw{display:block;fill:currentColor}

/* ---------- Paw prints that walk over the seams between sections ---------- */
.mc-rel{position:relative}
.mc-paws{position:absolute;top:6px;left:0;right:0;height:40px;overflow:hidden;pointer-events:none;color:#587045}
.mc-paws svg{position:absolute;left:var(--x);top:var(--y);width:17px;height:17px;opacity:.26;transform:rotate(var(--r))}
.experiences .mc-paws{color:#f4a05b}

/* ---------- Loops stop when paused, when the tab is hidden and when the section is off screen ---------- */
html[data-motion=paused] :is(.hero-image,.polaroid,.ar-badge-star,.atmo-sticker,.mc-leaf,.mc-leaf i),
html[data-motion=hidden] :is(.hero-image,.polaroid,.ar-badge-star,.atmo-sticker,.mc-leaf,.mc-leaf i),
html[data-motion] :is(.mc-away,.mc-busy) :is(.hero-image,.polaroid,.ar-badge-star,.atmo-sticker,.mc-leaf,.mc-leaf i){animation-play-state:paused!important}
/* Data saver or a small processor: no endless decoration */
.mc-lite :is(.hero-image,.polaroid,.ar-badge-star,.atmo-sticker){animation:none!important}
.mc-away .mc-leaves{display:none}
html[data-motion=paused] :is(.hero-copy>*,.hero:before,.hero:after){animation:none!important}
html:not([data-motion=on],[data-motion=hidden]) :is(.mc-leaves,.mc-trail){display:none}

@media(max-width:900px){.mc-trail.mc-aside{visibility:hidden}}
/* phones: the small line above the title stays still (7 layers); the hours must move with the buttons or they cross */
@media(max-width:650px){.hero-copy>:first-child{animation:none}}
@media(min-width:651px){
  .hero:before,.hero:after{width:min(46vw,480px)}
  .mc-paws{top:14px;height:52px}
  .mc-paws svg{width:22px;height:22px}
}
@media(min-width:901px){
  .mc-leaf i{animation:mc-sway calc(var(--d)/5) ease-in-out infinite alternate}
  .mc-trail{width:22px;right:10px}
  .mc-trail:before,.mc-trail i{inset:0 10px}
  .mc-trail b{width:22px;height:22px;top:-11px}
}
/* too low for a margin track: phone in landscape */
@media(max-height:480px){.mc-trail{display:none!important}}
@media(prefers-reduced-motion:reduce){
  .hero-copy>*,.hero:before,.hero:after{animation:none!important}
  html[data-motion] .mc-wait{opacity:1!important}html[data-motion] .mc-soft{transform:none!important}html[data-motion] .mc-line:after{clip-path:none!important}
  .mc-leaves,.mc-trail{display:none}
}
@media print{
  html[data-motion] .mc-wait{opacity:1!important}
  html[data-motion] .mc-soft{transform:none!important}
  html[data-motion] .mc-line:after{clip-path:none!important}
  .mc-leaves,.mc-trail,.mc-paws,.hero:before,.hero:after{display:none!important}
}
/* play */
/* The Zookeeper r8: motion-play (interaction). Mobile first: the base rules are for fingers, mouse and wide screens add to
   them. Everything is gated by html[data-motion], so without JS or with reduced motion nothing here applies.
   Only transform-type properties, opacity and clip-path move. No loops. */

/* Header tucks up on scroll. Its real height never changes, so nothing below it moves.
   Never move .header-inner or .brand: that would isolate the logo's multiply blend and show its white box. */
html[data-motion="on"] .site-header{transition:translate .35s cubic-bezier(.3,.9,.3,1)}
html[data-motion="on"] .brand-mark{transition:translate .35s cubic-bezier(.3,.9,.3,1),scale .35s cubic-bezier(.3,1.5,.5,1)}
html[data-motion] .site-header.mp-small:not(:has(>.mobile-nav:not([hidden]))){translate:0 -10px}
html[data-motion] .site-header.mp-small:not(:has(>.mobile-nav:not([hidden]))) .brand-mark{scale:.88}
html[data-motion] .brand-mark{transform-origin:0 50%}
@media(min-width:901px){
html[data-motion] .site-header.mp-small:not(:has(>.mobile-nav:not([hidden]))){translate:0 -16px}
html[data-motion] .site-header.mp-small:not(:has(>.mobile-nav:not([hidden]))) :is(.brand-mark,.header-inner>:not(.brand)){translate:0 8px}
html[data-motion="on"] .header-inner>:not(.brand,.button,.menu-toggle){transition:translate .35s cubic-bezier(.3,.9,.3,1)}
}
/* Phones: a solid header instead of a blurred one, so nothing is re-blurred while it moves and no text shows through */
@media(max-width:900px){html[data-motion] .site-header{background:#faf5e5;backdrop-filter:none;-webkit-backdrop-filter:none}}

/* Buttons: squash on press, light sweep on hover */
html[data-motion="on"] .button{transition:background .2s,transform .2s,box-shadow .2s,border-color .2s,translate .35s cubic-bezier(.3,.9,.3,1),scale .18s cubic-bezier(.3,1.8,.5,1)}
html[data-motion="on"] :is(.filter,.ar-toggle,.menu-toggle,.dialog-close){transition:background .2s,color .2s,transform .2s,translate .35s cubic-bezier(.3,.9,.3,1),scale .18s cubic-bezier(.3,1.8,.5,1)}
html[data-motion="on"] :is(.button,.filter,.ar-toggle,.menu-toggle,.dialog-close):active{scale:.95}
html[data-motion] .button-orange{position:relative}
html[data-motion] .button-orange::after{content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none;background:#fff8e64d;clip-path:polygon(-30% 0,-12% 0,-22% 100%,-40% 100%)}
@media(hover:hover) and (pointer:fine){
html[data-motion="on"] .button-orange:hover::after{clip-path:polygon(125% 0,143% 0,133% 100%,115% 100%);transition:clip-path .6s ease-out}
html[data-motion="on"] .button:hover>.icon{animation:mp-nudge .5s ease-out}
html[data-motion="on"] .guidelines-card:hover .guidelines-icon,html[data-motion="on"] .welfare-card:hover .icon,html[data-motion="on"] .price-card:hover>.icon{animation:mp-wiggle .6s ease-out}
html[data-motion="on"] .price-card:hover>.price-badge{animation:mp-nudge .5s ease-out}
html[data-motion="on"] .ar-chip:hover .ar-emoji{animation:mp-hop .6s ease-out}
html[data-motion="on"] .reviews-card:hover::before{animation:mp-nudge .5s ease-out}
}
@keyframes mp-nudge{40%{scale:1.14}70%{scale:.96}}
@keyframes mp-wiggle{20%{rotate:-13deg}45%{rotate:10deg}70%{rotate:-5deg}}
@keyframes mp-hop{30%{translate:0 -9px;scale:1.08}60%{translate:0 0;scale:1.05 .93}}

/* Touch: the card in the middle of the screen comes alive by itself while scrolling */
@media not all and (hover:hover) and (pointer:fine){
html[data-motion] .mp-tap{-webkit-tap-highlight-color:transparent}
html[data-motion="on"] .mp-card :is(.animal-photo,.ar-photo,.activity-photo) img{transition:transform .6s,scale .8s cubic-bezier(.2,.9,.3,1)}
html[data-motion="on"] .mp-card :is(.photo-label,.ar-badge,.activity-highlight,.guidelines-icon,.price-badge,.icon){transition:scale .45s cubic-bezier(.3,1.8,.5,1)}
html[data-motion="on"] .mp-focus :is(.animal-photo,.ar-photo,.activity-photo) img{scale:1.09}
html[data-motion="on"] .mp-focus :is(.photo-label,.ar-badge,.activity-highlight){scale:1.12}
html[data-motion="on"] .mp-focus :is(.guidelines-icon,.price-badge),html[data-motion="on"] .price-card.mp-focus>.icon{scale:1.18}
}

/* Cards: 3D tilt (mouse only). JS drives rotate and the --mp-* values; at rest they are all 0. */
@media(hover:hover) and (pointer:fine){
html[data-motion] :is(.animal-grid,.ar-stars,.activity-grid){perspective:1100px}
html[data-motion] .mp-tilt :is(.animal-photo,.ar-photo,.activity-photo) img{translate:calc(var(--mp-x,0)*-7px) calc(var(--mp-y,0)*-7px);scale:calc(1 + var(--mp-p,0)*.05)}
html[data-motion] .mp-tilt :is(.photo-label,.ar-badge,.ar-activity,.activity-highlight){translate:calc(var(--mp-x,0)*8px) calc(var(--mp-y,0)*6px)}
}

/* Token coin: the back face only shows while it is turned around, so the 1 is never mirrored. */
html[data-motion] .token-head{perspective:500px}
html[data-motion] .token-coin{position:relative;transform-style:preserve-3d}
html[data-motion] .token-coin::after{content:'\2605';position:absolute;inset:0;display:grid;place-items:center;border-radius:50%;background:var(--orange);box-shadow:inset 0 0 0 4px var(--cream);transform:rotateY(180deg) translateZ(1px);backface-visibility:hidden}

/* Dialog: soft entrance, and an exit in browsers with discrete transitions (others close at once) */
html[data-motion="on"] #animal-dialog{transition:opacity .22s ease,translate .3s cubic-bezier(.2,.9,.3,1),scale .3s cubic-bezier(.2,.9,.3,1),display .22s allow-discrete,overlay .22s allow-discrete}
html[data-motion="on"] #animal-dialog:not([open]){opacity:0;translate:0 14px;scale:.98;pointer-events:none}
@starting-style{
html[data-motion="on"] #animal-dialog[open]{opacity:0;translate:0 26px;scale:.95}
}
/* The blurred backdrop only fades on wide screens (fading a blur is expensive on phones) */
@media(min-width:901px){
html[data-motion="on"] #animal-dialog::backdrop{transition:opacity .22s ease,display .22s allow-discrete,overlay .22s allow-discrete}
html[data-motion="on"] #animal-dialog:not([open])::backdrop{opacity:0}
@starting-style{html[data-motion="on"] #animal-dialog[open]::backdrop{opacity:0}}
}

/* Phone review strip: native swipe and snap; the card in the middle is full size */
@media(max-width:650px){
html[data-motion="on"] .mp-snap .reviews-card{scale:.955;transition:scale .4s cubic-bezier(.3,1.4,.5,1)}
html[data-motion="on"] .mp-snap .mp-focus .reviews-card{scale:1}
}
/* Phone review strip: position bar drawn on the note below it, so no element or space is added */
@media(max-width:650px){
html[data-motion] .reviews-note{position:relative}
html[data-motion] .reviews-note:is(.mp-bar)::before,html[data-motion] .reviews-note:is(.mp-bar)::after{content:'';position:absolute;left:0;right:0;top:-8px;height:3px;border-radius:3px;background:#34473524}
html[data-motion] .reviews-note:is(.mp-bar)::after{background:var(--orange);transform-origin:0 50%;transform:scaleX(var(--mp-rev,.14))}
}

/* Paw pop on click */
.mp-paw{position:fixed;z-index:60;width:20px;height:20px;margin:-10px 0 0 -10px;pointer-events:none;color:#a94c16;fill:#df8137;stroke:currentColor;stroke-width:1.2}
@media print{.mp-paw{display:none}}
