/* Scenes: surface → dark. Positions here; idle motion only under prefers-reduced-motion: no-preference. */
.swim { position: absolute; left: 0; will-change: transform; }
.sprite, .swim svg, .anemone svg, .jelly svg { display: block; width: 100%; height: auto; overflow: visible; }
.flip { transform: scaleX(-1); }
.tuck { position: absolute; display: block; line-height: 0; transform: translate(-50%, -50%); z-index: 1; }
.tuck .daisy { filter: drop-shadow(0 0 4px rgba(255,255,255,.6)); }
.tuck.gone { transform: translate(-50%, -50%) scale(0); opacity: 0; }

/* surface */
.sky { position: absolute; left: 0; right: 0; top: 0; height: 34%; background: linear-gradient(#FFE3A8, #FFF1CC 55%, #D3F4FA); }
.sun {
  position: absolute; top: 10%; left: 64%; width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle, #FFFDF0 0 34%, #FFE59A 52%, rgba(255,201,74,0) 72%);
  box-shadow: 0 0 90px 36px rgba(255,214,120,.55);
}
.waves { position: absolute; left: 0; width: 200%; height: 40px; top: calc(34% - 20px); }
.waves.back { opacity: .55; top: calc(34% - 26px); }
.waves path { fill: var(--wt); }
.surface::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(34% + 19px); height: 40%; z-index: -1;
  background: linear-gradient(var(--wt), transparent);
}
.float-daisy { position: absolute; left: 22%; top: calc(34% - 4px); width: 0; height: 0; }
.glints i {
  position: absolute; width: 12px; height: 12px; opacity: 0;
  background: radial-gradient(circle, #fff 0 18%, transparent 22%),
    linear-gradient(#fff, #fff) center / 1.5px 100% no-repeat,
    linear-gradient(90deg, #fff, #fff) center / 100% 1.5px no-repeat;
}
.title {
  position: absolute; left: 6%; right: 6%; top: 47%; font-size: clamp(2.5rem, 11vw, 3.4rem); color: #FFFDF6;
  text-shadow: 0 2px 18px rgba(10,70,130,.6), 0 0 3px rgba(10,70,130,.35);
}
.title.ripple-on { filter: url(#ripple); }
.cta { position: absolute; left: 0; right: 0; bottom: 9%; display: grid; place-items: center; }
.cta .pill { transition: opacity .6s ease, transform .6s ease; }
.cta .pill.leaving { opacity: 0; transform: scale(.92); pointer-events: none; }
.cta .pill.nudge { animation: nudge .5s ease; }
@keyframes nudge { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,.5); } 40% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(255,255,255,0); } }
.hint { text-align: center; font-weight: 500; font-size: .9rem; color: rgba(255,255,255,.9); text-shadow: 0 1px 8px rgba(0,40,80,.5); }
.bubbles { display: block; height: 44px; position: relative; margin-bottom: 6px; }
.bubbles i { position: absolute; left: 50%; bottom: 0; width: 8px; height: 8px; margin-left: -4px; border: 1.5px solid rgba(255,255,255,.85); border-radius: 50%; }
.bubbles i:nth-child(2) { width: 6px; height: 6px; margin-left: 2px; bottom: 14px; }
.bubbles i:nth-child(3) { width: 5px; height: 5px; margin-left: -9px; bottom: 26px; }

/* shallow */
.anemone { position: absolute; }
.anemone.side-L { transform: rotate(90deg); }
.anemone.side-R { transform: rotate(-90deg); }
.school-in { position: relative; height: 130px; }
.fish { position: absolute; }
.fish img, .fish svg { display: block; height: auto; }

/* mid */
.manta-school .mrow { position: absolute; transform: rotate(72deg); }
.manta-school .flap > * { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 14px rgba(0,25,60,.3)); }
.cruise { position: relative; }

/* deep */
.bob-slow { position: relative; }
.sardines { position: absolute; inset: 0; pointer-events: none; }
.bob-slow > .sprite, .bob-slow > svg { position: relative; z-index: 1; }
.sardine { position: absolute; left: 50%; z-index: 2; }
.sardine img, .sardine svg { display: block; height: auto; }

/* dark */
.jelly { position: relative; }
.jelly .halo {
  position: absolute; left: -35%; right: -35%; top: -25%; height: 75%; border-radius: 50%;
  background: radial-gradient(closest-side, var(--g), transparent);
}

/* companion daisies (fixed stage) */
.companion { position: absolute; left: -13px; top: -13px; width: 26px; height: 26px; line-height: 0; }
.companion .daisy { filter: drop-shadow(0 0 5px rgba(255,255,255,.7)); }
.companion.taken { visibility: hidden; }

/* ---------- idle motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .companion.moving { transition: transform 1.2s cubic-bezier(.3,.7,.2,1); }
  .tuck { transition: transform .5s ease, opacity .5s ease; }
  .waves { animation: waves 8s linear infinite; }
  .waves.back { animation-duration: 13s; animation-direction: reverse; }
  .float-daisy .tuck .daisy, .bob { animation: bob 3.4s ease-in-out infinite alternate; }
  .bob.slow { animation-duration: 4.6s; }
  .glints i { animation: glint 3.4s ease-in-out var(--dl) infinite; }
  .bubbles i { animation: rise 2.4s ease-in infinite; }
  .bubbles i:nth-child(2) { animation-delay: .8s; }
  .bubbles i:nth-child(3) { animation-delay: 1.6s; }
  .anemone > :first-child { transform-origin: 50% 100%; animation: sway 3.6s ease-in-out var(--dl, 0s) infinite alternate; }
  .school-in { animation: bob 3.8s ease-in-out infinite alternate; }
  .fish:nth-child(3n) { animation: fishwig 1.6s ease-in-out var(--dl) infinite alternate; }
  .manta-school .mrow { animation: glide 5.5s ease-in-out var(--dl) infinite alternate; }
  .manta-school .flap { animation: flap 3.4s ease-in-out var(--dl) infinite alternate; }
  .cruise > :first-child { animation: cruise 2.6s ease-in-out infinite alternate; }
  .bob-slow { animation: bobslow 6s ease-in-out infinite alternate; }
  .band-0 .sar-x { animation: sar-x0 9s ease-in-out var(--ph) infinite alternate; }
  .band-1 .sar-x { animation: sar-x1 9s ease-in-out var(--ph) infinite alternate; }
  .band-2 .sar-x { animation: sar-x2 9s ease-in-out var(--ph) infinite alternate; }
  .band-0 .sar-y { animation: sar-y0 9s ease-in-out calc(var(--ph) - 4.5s) infinite alternate; }
  .band-1 .sar-y { animation: sar-y1 9s ease-in-out calc(var(--ph) - 4.5s) infinite alternate; }
  .band-2 .sar-y { animation: sar-y2 9s ease-in-out calc(var(--ph) - 4.5s) infinite alternate; }
  .sar-f { animation: sar-f 18s steps(1, end) var(--ph) infinite; }
  .jelly { animation: bob 3s ease-in-out infinite alternate; }
  .jelly > svg { transform-origin: 50% 15%; animation: pulse 2.6s ease-in-out infinite; }
  .tuck:not(.float-daisy .tuck) .daisy { animation: wobble 4s ease-in-out infinite alternate; }
  .companion.parked .c-in { display: block; animation: bob 3.2s ease-in-out infinite alternate; }
}
@keyframes waves { to { transform: translateX(-50%); } }
@keyframes bob { from { transform: translateY(-3px); } to { transform: translateY(4px); } }
@keyframes glint { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-40px); opacity: 0; } }
@keyframes sway { from { transform: rotate(-3deg) skewX(2deg); } to { transform: rotate(3deg) skewX(-2deg); } }
@keyframes fishwig { from { transform: translateY(-3px); } to { transform: translateY(4px); } }
@keyframes glide { from { transform: rotate(66deg); } to { transform: rotate(76deg) translateX(-10px); } }
@keyframes flap { from { transform: scaleX(1); } to { transform: scaleX(.84); } }
@keyframes cruise { from { transform: translateY(-3px) rotate(-1deg); } to { transform: translateY(3px) rotate(1deg); } }
@keyframes bobslow { from { transform: translateY(-6px) rotate(-1deg); } to { transform: translateY(8px) rotate(1deg); } }
/* fixed units (no var()) so these run on the compositor; radii follow the column width, capped at 440px */
@keyframes sar-x0 { from { transform: translateX(calc(-1 * min(52vw, 230px))); } to { transform: translateX(min(52vw, 230px)); } }
@keyframes sar-x1 { from { transform: translateX(calc(-1 * min(44vw, 195px))); } to { transform: translateX(min(44vw, 195px)); } }
@keyframes sar-x2 { from { transform: translateX(calc(-1 * min(60vw, 265px))); } to { transform: translateX(min(60vw, 265px)); } }
@keyframes sar-y0 { from { transform: translateY(calc(-1 * min(32vw, 140px))); } to { transform: translateY(min(32vw, 140px)); } }
@keyframes sar-y1 { from { transform: translateY(calc(-1 * min(26vw, 115px))); } to { transform: translateY(min(26vw, 115px)); } }
@keyframes sar-y2 { from { transform: translateY(calc(-1 * min(38vw, 165px))); } to { transform: translateY(min(38vw, 165px)); } }
@keyframes sar-f { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } 100% { transform: scaleX(-1); } }

@keyframes pulse { 0%, 100% { transform: scale(1, 1); } 40% { transform: scale(.92, 1.05); } }
@keyframes wobble { from { transform: rotate(-10deg); } to { transform: rotate(12deg); } }

/* pause idle motion in sections that are off screen (toggled by scenes.js) */
section:not(.in-view) *, section:not(.in-view) *::before { animation-play-state: paused !important; }
