/* The stories demo: the scene at the top of the page (4 Dec 2026, built from the approved mock-up).
   Given: the banner in index.html. stories-scene.js plants the flowers, sends out the visitors, turns the big cloud
   into an elephant now and then, and adds "paused" to the banner while the tab is hidden, the scene is off screen
   or a story is playing.
   Gives back: a sky that is always gently moving (Zesty: "always something moving", like the Life page): drifting
   clouds, the sun glowing, two hills of grass rolling opposite ways (the Life page's two 200% wide hills, 60s and
   40s, one reversed), flowers swaying, the title's "YOU" giving a little wiggle, and one or two visitors at a time.
   Never: moves anything except with transform and opacity; moves anything with "reduce motion" switched on (a still
   scene then, with no visitors); a frog, people, a rocket, a Ferris wheel, or a face on the sun. */

/* A little less sky than before (Zesty, 4 Dec 2026), so the form sits higher; the city and the grass keep their places */
.banner{position:relative;height:clamp(370px,52vh,500px);overflow:hidden;container-type:size;
  background:linear-gradient(180deg,#5fb8f0 0%,#8fd0f6 45%,#c8ecfc 78%,#e9f8ff 100%)}
.sun{position:absolute;right:6%;top:6%;width:76px;height:76px;border-radius:50%;
  background:radial-gradient(circle at 40% 38%,#fff6b8,#ffd34d 62%,#ffbf2e);box-shadow:0 0 0 18px rgba(255,226,120,.28),0 0 0 40px rgba(255,226,120,.14);
  animation:glow 5s ease-in-out infinite alternate}
@keyframes glow{to{transform:scale(1.06)}}

/* The clouds drift right across the sky, each at its own pace; --x is where each sits when nothing moves */
.cloud{position:absolute;left:0;z-index:1;will-change:transform}   /* always behind the title (4 Dec 2026) */
.cloud svg{display:block;width:100%;height:auto;filter:drop-shadow(0 6px 0 rgba(120,170,220,.25))}
.c1{top:9%;width:170px;--x:8%;animation:drift 70s linear infinite;animation-delay:-20s}
.c2{top:22%;width:120px;--x:70%;animation:drift 95s linear infinite;animation-delay:-60s;opacity:.92}
.c3{top:3%;width:140px;--x:46%;animation:drift 85s linear infinite;animation-delay:-5s;opacity:.85}
.c-ele{top:2%;width:200px;--x:24%;animation:drift 110s linear infinite;animation-delay:-38s}
@keyframes drift{from{transform:translateX(-260px)}to{transform:translateX(calc(100cqw + 40px))}}
.ele-part{opacity:0;transition:opacity 2.4s ease}
.c-ele.is-elephant .ele-part{opacity:1}

/* New York, faint on the horizon */
.city{position:absolute;left:0;right:0;bottom:118px;height:150px;opacity:.55;pointer-events:none}
.city svg{position:absolute;left:50%;bottom:0;transform:translateX(-50%);width:min(1100px,140vw);height:100%}
/* Under the old horizon, down behind the grass (the same width as the skyline, so each building carries straight on) */
.city svg.city-base{top:100%;bottom:auto;height:96px}
.skyline{opacity:0;transition:opacity 1.4s ease}
.banner[data-city=new-york] .skyline-new-york{opacity:1}

/* The rolling grass */
.hills{position:absolute;left:0;right:0;bottom:-1px;height:190px;overflow:hidden;pointer-events:none}
.hill{position:absolute;left:0;bottom:0;width:200%;height:100%;display:block}
.hill-back{animation:roll 60s linear infinite}
.hill-front{animation:roll 40s linear infinite reverse}
@keyframes roll{to{transform:translateX(-50%)}}

/* Flowers along the front of the grass, each swaying from its stem (planted by stories-scene.js) */
.flowers{position:absolute;left:0;right:0;bottom:6px;height:90px;pointer-events:none}
.flower{position:absolute;bottom:0;width:44px;transform-origin:50% 100%;animation:sway 3.6s ease-in-out infinite alternate}
.flower svg{display:block;width:100%;height:auto}
@keyframes sway{from{transform:rotate(-6deg)}to{transform:rotate(6deg)}}

/* The title */
.title-wrap{position:absolute;left:0;right:0;top:15%;text-align:center;padding:0 16px;z-index:3}
.title{margin:0;font-family:var(--round);font-weight:900;font-size:clamp(50px,9vw,112px);line-height:1;letter-spacing:-.01em;color:#fff;
  text-shadow:0 4px 0 #5b34d6,0 10px 26px rgba(60,40,140,.35);text-wrap:balance}
/* A thin purple edge, so the white letters stay clear when a cloud drifts behind them (less sky, 4 Dec 2026) */
.title{-webkit-text-stroke:3px #5b34d6;paint-order:stroke fill}
.title .you{color:#ffd34d;display:inline-block;animation:wiggle 6s ease-in-out infinite}
@keyframes wiggle{0%,86%,100%{transform:rotate(0)}89%{transform:rotate(-5deg) scale(1.06)}93%{transform:rotate(4deg) scale(1.06)}}
.subtitle{margin:12px 0 0;font-family:var(--round);font-weight:900;font-size:clamp(18px,2.6vw,27px);color:#fff;text-shadow:0 2px 0 #5b34d6}

/* The visitors: hidden until stories-scene.js adds "go"; their paths are in parts of the scene's own size (cqw, cqh) */
.visitor{position:absolute;left:0;top:0;opacity:0;pointer-events:none;z-index:4}
.visitor svg{display:block;width:100%;height:auto}
.bee{width:54px}.bird{width:70px}.butterfly{width:46px}
.bee.go{animation:beeFly 11s ease-in-out forwards}
@keyframes beeFly{0%{opacity:0;transform:translate(-80px,66cqh)}6%{opacity:1}25%{transform:translate(22cqw,51cqh) rotate(-6deg)}
  45%{transform:translate(38cqw,72cqh) rotate(8deg)}60%{transform:translate(55cqw,56cqh) rotate(-4deg)}
  80%{transform:translate(78cqw,69cqh) rotate(6deg)}94%{opacity:1}100%{opacity:0;transform:translate(calc(100cqw + 60px),49cqh)}}
.bird.go{animation:birdFly 9s linear forwards}
@keyframes birdFly{0%{opacity:0;transform:translate(calc(100cqw + 40px),26cqh)}5%{opacity:1}
  50%{transform:translate(50cqw,17cqh)}95%{opacity:1}100%{opacity:0;transform:translate(-120px,28cqh)}}
.butterfly{width:58px}
.butterfly.go{animation:flutterBy 12s ease-in-out forwards}
@keyframes flutterBy{0%{opacity:0;transform:translate(12cqw,88cqh)}8%{opacity:1}30%{transform:translate(20cqw,67cqh)}
  55%{transform:translate(30cqw,82cqh)}80%{transform:translate(44cqw,64cqh)}92%{opacity:1}100%{opacity:0;transform:translate(52cqw,51cqh)}}
.wing{transform-box:fill-box;animation:flap .18s ease-in-out infinite alternate}
.wing.l{transform-origin:100% 80%}.wing.r{transform-origin:0% 80%}
@keyframes flap{to{transform:scaleY(.35)}}
.bwing{transform-box:fill-box;transform-origin:50% 100%;animation:bflap .25s ease-in-out infinite alternate}
@keyframes bflap{to{transform:rotate(-38deg)}}
/* The butterfly, from the side: both pairs of wings beat down from its back (the near pair a moment ahead) and it bobs
   gently as it goes, the way a butterfly flies (4 Dec 2026) */
.bwings{transform-box:view-box;transform-origin:31px 27px;animation:bbeat .26s ease-in-out infinite alternate}
.bwings.far{animation-delay:-.04s}
@keyframes bbeat{from{transform:scaleY(1)}to{transform:scaleY(-.3) skewX(-8deg)}}
.butterfly svg{animation:bbob .7s ease-in-out infinite alternate}
@keyframes bbob{from{transform:translateY(-3px) rotate(-4deg)}to{transform:translateY(4px) rotate(3deg)}}

/* Phones: a lower horizon and a smaller sun, so the title has room */
@media (max-width:520px){
  .sun{width:56px;height:56px;right:5%;top:4%}
  .city{bottom:100px;height:110px}
  .city svg.city-base{height:90px}
  .hills{height:160px}
  .title-wrap{top:24%}
}

/* Resting: everything stops where it is (while the tab is hidden, the scene is off screen or a story plays) */
.banner.paused *{animation-play-state:paused!important}

/* "Reduce motion": a still picture, every cloud in its own place, no visitors and no elephant */
@media (prefers-reduced-motion:reduce){
  .banner *{animation:none!important;transition:none!important}
  .cloud{left:var(--x)}
  .visitor{display:none}
}
