/* Seaside scene (seaside.js draws it): an animated beach behind the page. Light = day, dark = night.
   Everything that moves uses transform or opacity only, at a calm pace; with reduced motion the scene stands still.
   Colours: the --sc-* names below; a theme may override them. */
.sc { --sc-sky-top:#5fbdf0; --sc-sky-low:#d8f3fb; --sc-sun:#ffefa8; --sc-sun-glow:rgba(255,196,64,.6); --sc-moon:#eef3f8; --sc-star:#fff;
      --sc-cloud:rgba(255,255,255,.95); --sc-gull:#3f5a6b; --sc-land:#74bf8f; --sc-land-2:#58a979; --sc-lh:#fbfaf6; --sc-lh-band:#e0404b; --sc-lamp:#ffd77a;
      --sc-sea-deep:#0b79a6; --sc-sea-far:#5cc9dc; --sc-sea-mid:#2bb0cf; --sc-sea-near:#1292b8; --sc-crest:rgba(255,255,255,.8); --sc-glint:rgba(255,246,190,1);
      --sc-foam:rgba(255,255,255,.95); --sc-sand-wet:#e0c078; --sc-sand:#f9dfa0; --sc-sand-2:#f0cd85; --sc-grass:#8cbb4c;
      --sc-trunk:#b07f45; --sc-trunk-ring:#8c6234; --sc-frond:#35a85c; --sc-frond-2:#228a48; --sc-shrub:#4cb565; --sc-shrub-2:#37994f; --sc-coco:#7a5532;
      --sc-umb-a:#f2603f; --sc-umb-b:#12a396; --sc-umb-c:#fbb02d; --sc-umb-w:#fffaf0; --sc-wood:#b88b5c; --sc-towel:#f7d6d0;
      --sc-glass:rgba(255,255,255,.7); --sc-drink:#ff9322; --sc-drink-2:#f4454f; --sc-lemon:#ffdf35; --sc-hull:#2d4b63; --sc-sail:#fffdf6; --sc-flag:#e0404b; --sc-ring:#ee4536;
      --sc-night:0;
      position:fixed; inset:0; z-index:0; overflow:hidden; pointer-events:none; contain:strict;
      background:linear-gradient(180deg, var(--sc-sky-top) 0%, var(--sc-sky-low) 55%, var(--sc-sky-low) 100%); }
@media (prefers-color-scheme:dark) {
  .sc { --sc-sky-top:#06143a; --sc-sky-low:#24508a; --sc-sun-glow:rgba(0,0,0,0); --sc-cloud:rgba(160,185,225,.2); --sc-gull:#9fb3c2;
        --sc-land:#1f4a56; --sc-land-2:#1a404b; --sc-lh:#c9d2da; --sc-lh-band:#b04a53;
        --sc-sea-deep:#0a2b4a; --sc-sea-far:#25598a; --sc-sea-mid:#1b4a78; --sc-sea-near:#143d66; --sc-crest:rgba(200,225,255,.42); --sc-glint:rgba(235,243,255,.9);
        --sc-foam:rgba(215,232,250,.6); --sc-sand-wet:#4b4638; --sc-sand:#5d5340; --sc-sand-2:#524938; --sc-grass:#4a6a3c;
        --sc-trunk:#5f4a33; --sc-trunk-ring:#4a3a29; --sc-frond:#25573f; --sc-frond-2:#1d4834; --sc-shrub:#28573a; --sc-shrub-2:#21492f; --sc-coco:#33281f;
        --sc-umb-a:#a3544a; --sc-umb-b:#2f7672; --sc-umb-c:#9c7a3e; --sc-umb-w:#8d9196; --sc-wood:#5a4836; --sc-towel:#6d5a5a;
        --sc-glass:rgba(220,230,240,.35); --sc-drink:#cf7a2c; --sc-drink-2:#bd474d; --sc-lemon:#cdb642; --sc-hull:#0d1a26; --sc-sail:#a9b5c0; --sc-flag:#b04a53; --sc-ring:#b04b43;
        --sc-night:1; }
}
.sc > * { position:absolute; }
.sc svg { display:block; overflow:visible; }

/* sky: sun by day; moon and stars by night */
.sc-sun { right:calc(16% - clamp(64px,11vw,118px) * .6); top:calc(9vh - clamp(64px,11vw,118px) * .6); width:calc(clamp(64px,11vw,118px) * 2.2); aspect-ratio:1; border-radius:50%;
          background:radial-gradient(circle, var(--sc-sun) 0 22.5%, var(--sc-sun-glow) 25%, transparent 70%);   /* the disc and its glow in one */
          animation:sc-glow 6s ease-in-out infinite alternate; }
.sc-moon { right:17%; top:10vh; width:clamp(44px,7vw,72px); aspect-ratio:1; border-radius:50%; background:var(--sc-moon);
           box-shadow:0 0 48px 16px rgba(220,232,250,.3); display:none; }
.sc-moon::after { content:""; position:absolute; inset:0; border-radius:50%;
                  background:radial-gradient(circle at 34% 40%, rgba(130,150,180,.2) 0 9%, transparent 10%), radial-gradient(circle at 62% 62%, rgba(130,150,180,.16) 0 13%, transparent 14%),
                             radial-gradient(circle at 58% 30%, rgba(130,150,180,.14) 0 6%, transparent 7%); }
.sc-stars { inset:0 0 50% 0; display:none; animation:sc-twinkle 3.5s ease-in-out infinite alternate;
  background-image:radial-gradient(1.5px 1.5px at 12% 18%, var(--sc-star), transparent 60%), radial-gradient(1px 1px at 27% 8%, var(--sc-star), transparent 60%),
    radial-gradient(1.5px 1.5px at 44% 26%, var(--sc-star), transparent 60%), radial-gradient(1px 1px at 58% 12%, var(--sc-star), transparent 60%),
    radial-gradient(1px 1px at 70% 34%, var(--sc-star), transparent 60%), radial-gradient(1px 1px at 91% 6%, var(--sc-star), transparent 60%),
    radial-gradient(1px 1px at 6% 40%, var(--sc-star), transparent 60%), radial-gradient(1.5px 1.5px at 35% 44%, var(--sc-star), transparent 60%),
    radial-gradient(1px 1px at 52% 52%, var(--sc-star), transparent 60%), radial-gradient(1px 1px at 96% 30%, var(--sc-star), transparent 60%),
    radial-gradient(1px 1px at 20% 60%, var(--sc-star), transparent 60%), radial-gradient(1.5px 1.5px at 66% 4%, var(--sc-star), transparent 60%); }
@media (prefers-color-scheme:dark) {
  .sc-sun, .sc-gull { display:none; }
  .sc-moon, .sc-stars { display:block; }
}
@keyframes sc-glow { from { transform:scale(1); } to { transform:scale(1.12); } }
@keyframes sc-twinkle { from { opacity:.4; } to { opacity:1; } }

/* clouds and gulls cross the sky slowly */
.sc-cloud { left:0; height:34px; width:140px; border-radius:40px; background:var(--sc-cloud); filter:blur(1px); animation:sc-cross linear infinite; }
.sc-cloud::before, .sc-cloud::after { content:""; position:absolute; background:inherit; border-radius:50%; }
.sc-cloud::before { width:60px; height:60px; left:24px; top:-30px; }
.sc-cloud::after { width:46px; height:46px; left:72px; top:-19px; }
.sc-cloud.sc-c1 { top:13vh; animation-duration:80s; animation-delay:-23s; }
.sc-cloud.sc-c2 { top:23vh; animation-duration:110s; animation-delay:-70s; opacity:.8; --cs:.7; }
.sc-cloud.sc-c3 { top:6vh; animation-duration:135s; animation-delay:-9s; opacity:.65; --cs:.85; }
@keyframes sc-cross { from { transform:translateX(-220px) scale(var(--cs,1)); } to { transform:translateX(calc(100vw + 60px)) scale(var(--cs,1)); } }
.sc-gull { left:-40px; top:20vh; width:26px; color:var(--sc-gull); opacity:.85; animation:sc-fly 40s linear infinite; }
.sc-gull.sc-g2 { top:25vh; width:19px; animation-duration:48s; animation-delay:-18s; }
.sc-gull path { transform-box:fill-box; transform-origin:50% 60%; animation:sc-flap .9s ease-in-out infinite alternate; }
@keyframes sc-fly { 0% { transform:translate(0,0); } 25% { transform:translate(28vw,-4vh); } 50% { transform:translate(55vw,1vh); } 75% { transform:translate(84vw,-5vh); } 100% { transform:translate(112vw,1vh); } }
@keyframes sc-flap { from { transform:scaleY(1); } to { transform:scaleY(.55); } }

/* headland with a lighthouse whose lamp glows at night */
.sc-lamp { opacity:calc(var(--sc-night) * .9); animation:sc-lamp 5s ease-in-out infinite; transform-box:fill-box; transform-origin:center; }
@keyframes sc-lamp { 0%, 60%, 100% { transform:scale(.6); } 75% { transform:scale(1.25); } }

/* sea: wave bands drift sideways at different speeds and rise and fall a little */
.sc-sea { left:0; right:0; bottom:0; background:linear-gradient(180deg, var(--sc-sea-far), var(--sc-sea-deep)); }
.sc-wave { left:0; width:100%; animation:sc-bob 4.5s ease-in-out infinite alternate; }
.sc-wave svg { position:absolute; left:0; top:0; animation:sc-drift linear infinite; will-change:transform; }
@keyframes sc-drift { from { transform:translate3d(0,0,0); } to { transform:translate3d(calc(var(--p) * -1px),0,0); } }
@keyframes sc-bob { from { transform:translateY(0); } to { transform:translateY(var(--bob,3px)); } }
.sc-glint { animation:sc-glint 2.4s ease-in-out infinite alternate; }
@keyframes sc-glint { from { opacity:.15; } to { opacity:.9; } }

/* boats sail along the horizon and rock gently; the buoy bobs */
.sc-boat { left:0; animation:sc-sail linear infinite; }
.sc-boat svg { transform-origin:50% 90%; animation:sc-rock 3.6s ease-in-out infinite alternate; }
.sc-boat.sc-rev { animation-direction:reverse; }
.sc-boat.sc-moored { animation:none; }                     /* at anchor: it only rocks */
.sc-boat.sc-rev svg { scale:-1 1; }
.sc-boat .sc-light { opacity:var(--sc-night); }
@keyframes sc-sail { from { transform:translateX(-120px); } to { transform:translateX(calc(100vw + 40px)); } }
@keyframes sc-rock { from { transform:rotate(-4deg) translateY(0); } to { transform:rotate(4deg) translateY(2.5px); } }
.sc-buoy svg { transform-origin:50% 100%; animation:sc-rock 2.8s ease-in-out infinite alternate; }

/* beach: the shore washes in and out, palm fronds and umbrellas sway a little */
.sc-beach { left:0; top:0; }
.sc-wash { animation:sc-wash 4.5s ease-in-out infinite alternate; }
.sc-wash.sc-w2 { animation-duration:6s; animation-delay:-3s; }
@keyframes sc-wash { from { transform:translateY(-8px); opacity:.45; } to { transform:translateY(2px); opacity:1; } }
.sc-sway { transform-box:view-box; animation:sc-sway 4.5s ease-in-out infinite alternate; }
@keyframes sc-sway { from { transform:rotate(-4.5deg); } to { transform:rotate(4deg); } }
.sc-flutter { transform-box:view-box; animation:sc-flutter 3.5s ease-in-out infinite alternate; }
@keyframes sc-flutter { from { transform:rotate(-2deg); } to { transform:rotate(2deg); } }
.sc-fairy { opacity:var(--sc-night); }              /* string lights between the palms, lit at night */
.sc-fairy circle { animation:sc-twinkle 2.8s ease-in-out infinite alternate; }
.sc-fairy circle:nth-child(3n) { animation-delay:-1.1s; } .sc-fairy circle:nth-child(3n+1) { animation-delay:-2s; }

/* the sound button (seaside-sound.js): bottom left, in the style of the back-to-top button (its colours when the page
   has them); the waves in the icon show when the sound is on, a cross when it is off */
.sc-snd { position:fixed; z-index:60; left:calc(16px + env(safe-area-inset-left, 0px)); bottom:calc(16px + max(var(--btt-lift, 0px), env(safe-area-inset-bottom, 0px)));
          width:44px; height:44px; padding:0; margin:0; border-radius:50%; display:grid; place-items:center; cursor:pointer;
          background:var(--btt-bg, rgba(11,110,138,.62)); color:var(--btt-fg, #fff); border:1px solid var(--btt-line, rgba(255,255,255,.45));
          -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px); box-shadow:0 4px 14px rgba(0,0,0,.18); transition:background .15s ease, translate .15s ease; }
.sc-snd svg { display:block; }
.sc-snd .sc-w, .sc-snd[aria-pressed="true"] .sc-x { display:none; }
.sc-snd[aria-pressed="true"] .sc-w { display:inline; }
.sc-snd:focus-visible { outline:3px solid var(--btt-focus, #f2b04f); outline-offset:2px; }
@media (hover:hover) { .sc-snd:hover { translate:0 -1px; background:var(--btt-bg-hover, rgba(11,110,138,.8)); } }
@media (min-width:860px) { .sc-snd { width:48px; height:48px; left:calc(24px + env(safe-area-inset-left, 0px)); bottom:calc(24px + max(var(--btt-lift, 0px), env(safe-area-inset-bottom, 0px))); } }

@media (prefers-reduced-motion:reduce) {
  .sc *, .sc *::before, .sc *::after { animation:none !important; }
}
