/* Spellsail sea world + voyage map (N6a). Used by scene.js and map.js. Transform/opacity animations only. */
:root {
  /* Scene palette. Contrast notes (WCAG, ratio):
     text on --foam/#fff: --text #14212b 16.4, #075a75 7.7. Text on --sun: #14212b 11.8. On --sand: #14212b 12.5.
     On --sea-1: #14212b 7.8 (white only 2.1 - never white text on sea-1). On --sea-2: #14212b 5.6.
     White on --sea-3 (= --accent #0a7aa0) 4.9, on #075a75 7.7. --coral is decor only (never errors); #14212b on it 6.4.
     Rule: never put text straight on the moving scene; use a solid --foam / white card behind it. */
  --sky-top: #7fcdea;
  --sky-bottom: #dff4fb;
  --sky: #a9def0;
  --sea-1: #5cc0dc;
  --sea-2: #2fa3c9;
  --sea-3: #0a7aa0;
  --foam: #ffffff;
  --sand: #f4dfa8;
  --sun: #ffd84d;
  --coral: #ff7a5c;
  --sea-deep: #075a75;
}

/* ---------- scene ---------- */
.sx-scene { position: absolute; inset: 0; overflow: hidden; pointer-events: none; contain: layout paint; --sx-w: 1024px; }
.sx-scene.sx-fixed { position: fixed; z-index: -1; }
.sx-scene.sx-band { position: relative; inset: auto; width: 100%; height: clamp(120px, 18vh, 160px); border-radius: 22px; }
.sx-sky { position: absolute; inset: 0; background: linear-gradient(var(--sky-top), var(--sky-bottom) 78%); }
.sx-sun { position: absolute; top: 5%; right: 9%; width: clamp(80px, 11vw, 140px); aspect-ratio: 1; }
.sx-band .sx-sun { top: 6%; right: 26%; width: 48px; }
.sx-sun svg, .sx-cloud svg, .sx-gull svg, .sx-dock svg, .sx-isle svg { display: block; width: 100%; height: 100%; }
.sx-rays { transform-origin: 0 0; animation: sx-spin 70s linear infinite; }
.sx-cloud { position: absolute; left: 0; width: clamp(110px, 15vw, 190px); opacity: 0.96; animation: sx-drift 120s linear infinite; will-change: transform; }
.sx-cloud1 { animation-duration: 110s; animation-delay: -25s; }
.sx-cloud2 { animation-duration: 150s; animation-delay: -90s; width: clamp(80px, 11vw, 140px); }
.sx-cloud3 { animation-duration: 95s; animation-delay: -60s; width: clamp(90px, 12vw, 150px); }
.sx-band .sx-cloud { width: 72px; }
.sx-gull { position: absolute; left: 0; top: 0; width: 34px; height: 17px; opacity: 0; }
.sx-gull.sx-flying { opacity: 1; }
.sx-gull.sx-flying .sx-wing { transform-box: fill-box; transform-origin: 50% 90%; animation: sx-flap 0.55s ease-in-out infinite alternate; }

.sx-wave { position: absolute; left: 0; right: 0; bottom: 0; overflow: hidden; }
.sx-wave-run { width: 200%; height: 100%; animation: sx-slide 30s linear infinite; will-change: transform; }
.sx-wave svg { display: block; width: 100%; height: 100%; }
.sx-wave1 { height: 46%; }
.sx-wave2 { height: 34%; }
.sx-wave2 .sx-wave-run { animation-duration: 21s; animation-direction: reverse; }
.sx-wave3 { height: 21%; }
.sx-wave3 .sx-wave-run { animation-duration: 14s; }
.sx-band .sx-wave1 { height: 64%; }
.sx-band .sx-wave2 { height: 47%; }
.sx-band .sx-wave3 { height: 28%; }

.sx-track { position: absolute; left: 0; right: 0; bottom: 20%; }
.sx-band .sx-track { bottom: 20%; }
.sx-route { position: absolute; left: 62px; right: 66px; bottom: 33%; border-top: 5px dotted rgba(255, 255, 255, 0.9); }
.sx-dock { position: absolute; left: 6px; bottom: 25%; width: 52px; height: 44px; }
.sx-isle { position: absolute; right: 6px; bottom: 25%; width: 62px; height: 50px; }

/* ---------- boat ---------- */
.sx-boat { position: absolute; left: 0; top: 0; will-change: transform; }
.sx-boat-flip, .sx-boat-rock, .sx-boat-bob { position: absolute; inset: 0; }
.sx-boat-rock { transform-origin: 50% 92%; }
.sx-boat svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sx-boat-bob { transform-origin: 50% 92%; }
.sx-bob-on .sx-boat-bob { animation: sx-bob 3.4s ease-in-out infinite; }
.sx-foam { position: absolute; left: 4%; right: 4%; bottom: -3%; height: 9%; border-radius: 50%; background: rgba(255, 255, 255, 0.8); }
.sx-boat-fx { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.sx-drop { position: absolute; left: 8%; bottom: 4%; border-radius: 50%; background: #fff; opacity: 0; }
.sx-streak { position: absolute; left: -6%; height: 4px; border-radius: 2px; background: #fff; transform-origin: 100% 50%; opacity: 0; }
.sx-sail-main, .sx-sail-jib { transform-box: fill-box; }
.sx-sail-main { transform-origin: 0 50%; }
.sx-sail-jib { transform-origin: 100% 50%; }
.sx-filling .sx-sail-main { animation: sx-fill 0.9s ease-in-out infinite alternate; }
.sx-filling .sx-sail-jib { animation: sx-fill 0.9s ease-in-out 0.15s infinite alternate; }

/* ---------- voyage map ---------- */
.sx-map { position: relative; width: 100%; max-width: 1280px; margin: 0 auto; border-radius: 28px; overflow: hidden; background: var(--sea-1); box-shadow: inset 0 0 0 4px var(--foam), 0 6px 0 var(--sea-3); contain: layout paint; }
.sx-map-svg { display: block; }
.sx-chart-dots { fill: none; stroke: rgba(255, 255, 255, 0.95); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 0.1 13; }
.sx-chart-dots.is-lit { stroke: var(--sun); stroke-width: 8; }
.sx-swirl { fill: none; stroke: #fff; stroke-opacity: 0.4; stroke-width: 4; stroke-linecap: round; }
.sx-buoy-body { fill: #fff; stroke: var(--sea-deep); stroke-width: 4; }
.sx-buoy-num { font: 700 19px Andika, "Comic Neue", system-ui, sans-serif; fill: var(--sea-deep); text-anchor: middle; }
.sx-buoy-band { fill: var(--coral); }
.sx-buoy-wake { fill: rgba(255, 255, 255, 0.55); }
.sx-buoy.is-lit .sx-buoy-body { fill: var(--sun); }
.sx-buoy.is-lit .sx-buoy-num { fill: #14212b; }
.sx-buoy .sx-shine { opacity: 0; }
.sx-buoy.is-lit .sx-shine { opacity: 1; }
.sx-buoy { transform-box: fill-box; transform-origin: 50% 50%; }
.sx-buoy.is-pop { animation: sx-pop 0.7s cubic-bezier(.3, 1.6, .5, 1); }
.sx-ring { fill: none; stroke: var(--sun); stroke-width: 4; opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; }
.sx-buoy.is-current .sx-ring { opacity: 1; animation: sx-ping 1.8s ease-out infinite; }
.sx-twinkle { transform-box: fill-box; transform-origin: 50% 50%; }
.sx-buoy.is-current .sx-twinkle { animation: sx-twinkle 1.6s ease-in-out infinite; }
.sx-place-label { font: 700 18px Andika, "Comic Neue", system-ui, sans-serif; fill: #14212b; text-anchor: middle; }
.sx-place-pill { fill: #fff; stroke: var(--sea-deep); stroke-width: 3; }
.sx-island-art { transform-box: fill-box; transform-origin: 50% 90%; }
.sx-island-art.is-bounce { animation: sx-pop 0.9s cubic-bezier(.3, 1.6, .5, 1); }
.sx-spark { position: absolute; width: 18px; height: 18px; pointer-events: none; opacity: 0; }

/* ---------- keyframes ---------- */
@keyframes sx-slide { to { transform: translate3d(-50%, 0, 0); } }
@keyframes sx-drift { from { transform: translate3d(-220px, 0, 0); } to { transform: translate3d(var(--sx-w), 0, 0); } }
@keyframes sx-spin { to { transform: rotate(360deg); } }
@keyframes sx-flap { from { transform: scaleY(1); } to { transform: scaleY(0.4); } }
@keyframes sx-bob { 0%, 100% { transform: translate3d(0, 0, 0) rotate(-1.6deg); } 50% { transform: translate3d(0, -4px, 0) rotate(1.6deg); } }
@keyframes sx-fill { from { transform: scaleX(1); } to { transform: scaleX(1.16); } }
@keyframes sx-pop { 0% { transform: scale(1); } 40% { transform: scale(1.4); } 100% { transform: scale(1); } }
@keyframes sx-ping { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes sx-twinkle { 0%, 100% { transform: scale(0.6); opacity: 0.4; } 50% { transform: scale(1.1); opacity: 1; } }

/* Pause everything while the tab is hidden or the integrator calls scene.pause(). */
.sx-hidden .sx-scene *, .sx-hidden .sx-map *, .sx-hidden .sx-boat *, .sx-scene.sx-paused * { animation-play-state: paused !important; }

/* Reduced motion: no loops. Sails stay gently filled. */
@media (prefers-reduced-motion: reduce) {
  .sx-rays, .sx-cloud, .sx-wave-run, .sx-bob-on .sx-boat-bob, .sx-gull .sx-wing,
  .sx-buoy.is-current .sx-ring, .sx-buoy.is-current .sx-twinkle { animation: none !important; }
  .sx-filling .sx-sail-main, .sx-filling .sx-sail-jib { animation: none !important; transform: scaleX(1.1); }
  .sx-cloud1 { left: 12%; }
  .sx-cloud2 { left: 48%; }
  .sx-cloud3 { left: 74%; }
  .sx-buoy.is-pop, .sx-island-art.is-bounce { animation: sx-fade 0.4s ease-out; }
  .sx-buoy.is-current .sx-ring { opacity: 0.8; }
}
@keyframes sx-fade { from { opacity: 0.3; } to { opacity: 1; } }
