/* =====================================================================
   Landslide scene — decorative background (plugin/landslide-scene.php, assets/js/scene.js)
   Variants: .ls-dark  stormy night, animated  (heroes, auth panel)  -> mode .ls-contained
             .ls-light soft daytime, static     (page background)    -> mode .ls-page
   .ls-page is absolutely positioned inside a .ls-host-page area and scrolls with it, so it is
   never composited (a fixed layer under the content forced every card onto its own layer).
   Performance: only transform/opacity animate, and only on HTML layers (.ls-fx, clouds, rain,
   mist, flash). Nothing inside the mountains <svg> animates except the stepped beacon.
   Accessibility: aria-hidden, pointer-events none, pause button (scene.js), reduced motion,
   hidden in print and forced-colors.
   ===================================================================== */

.ls-scene {
  --ls-m1: #2b3170; --ls-m2: #1c2153; --ls-m3: #10142f; --ls-tree: #0a0d22;
  --ls-soil-1: #b45309; --ls-soil-2: #6b3410; --ls-soil-line: rgba(255, 214, 170, .28);
  --ls-debris: #4a2810; --ls-rock: #5a3214; --ls-dust: rgba(217, 119, 6, .26);
  --ls-haze-1: rgba(99, 102, 241, 0); --ls-haze-2: rgba(124, 58, 237, .22);
  --ls-cloud: rgba(165, 180, 252, .12);
  --ls-rain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg stroke='%23c7d2fe' stroke-linecap='round' stroke-width='1.2'%3E%3Cpath d='M20 10l-6 22' opacity='.55'/%3E%3Cpath d='M70 40l-6 22' opacity='.35'/%3E%3Cpath d='M130 4l-6 22' opacity='.5'/%3E%3Cpath d='M160 70l-6 22' opacity='.4'/%3E%3Cpath d='M40 96l-6 22' opacity='.45'/%3E%3Cpath d='M100 120l-6 22' opacity='.55'/%3E%3Cpath d='M150 150l-6 22' opacity='.3'/%3E%3Cpath d='M10 150l-6 22' opacity='.4'/%3E%3Cpath d='M86 76l-5 18' opacity='.3'/%3E%3C/g%3E%3C/svg%3E");
  --ls-mist: rgba(199, 210, 254, .10);
  --ls-sign: #f59e0b; --ls-sign-mark: #1f1300; --ls-pole: #3b4275; --ls-panel: #4f46e5;
  --ls-beacon: #f43f5e; --ls-ping: rgba(244, 63, 94, .55);
  --ls-land-h: clamp(150px, 46%, 300px);

  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  z-index: 0;
  contain: layout paint style;
}
.ls-page { z-index: -1; }
.ls-host-page { position: relative; }

/* keep the scene behind hero / panel content (theme.css sets `.site-hero > *` to relative) */
.site-hero > .ls-scene, .auth-brand > .ls-scene { position: absolute; z-index: 0; }

/* ---------- light variant (static page background) ---------- */
.ls-light {
  --ls-m1: #e3e7f7; --ls-m2: #d3d9f1; --ls-m3: #c3cbeb; --ls-tree: #aeb8e0;
  --ls-soil-1: #e9c391; --ls-soil-2: #cf9a62; --ls-soil-line: rgba(255, 255, 255, .55);
  --ls-debris: #b39478; --ls-rock: #a8754a; --ls-dust: rgba(217, 119, 6, .14);
  --ls-haze-1: rgba(255, 255, 255, 0); --ls-haze-2: rgba(255, 255, 255, .55);
  --ls-cloud: rgb(var(--p-brand-200) / .35);
  --ls-mist: rgba(255, 255, 255, .55);
  --ls-sign: #fbbf24; --ls-sign-mark: #7c2d12; --ls-pole: #9aa5d6; --ls-panel: #818cf8;
  --ls-beacon: #e11d48; --ls-ping: rgba(225, 29, 72, .35);
  --ls-land-h: clamp(120px, 24vh, 240px);
}

/* ---------- sky & glow ---------- */
.ls-sky { position: absolute; inset: 0; }
.ls-light .ls-sky {
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(199, 210, 254, .65), transparent 60%),
    radial-gradient(700px 380px at 0% 10%, rgba(186, 230, 253, .45), transparent 60%),
    linear-gradient(180deg, #eef1fb 0%, #f4f6fb 55%, #eef1f9 100%);
}
.ls-glow { position: absolute; inset: auto 0 0 0; height: 60%; }
.ls-dark .ls-glow { background: radial-gradient(60% 70% at 62% 100%, rgba(245, 158, 11, .12), transparent 70%); }

/* ---------- clouds ---------- */
.ls-clouds { position: absolute; inset: 0 0 auto 0; height: 60%; }
.ls-cloud { position: absolute; left: 0; fill: var(--ls-cloud); }
.ls-cloud-1 { top: 6%;  width: 220px; }
.ls-cloud-2 { top: 18%; width: 320px; opacity: .8; }
.ls-cloud-3 { top: 2%;  width: 160px; opacity: .7; }
.ls-cloud-4 { top: 30%; width: 260px; opacity: .55; }
/* drifting (animated scenes only) */
.ls-contained .ls-cloud { animation: ls-drift linear infinite; }
.ls-contained .ls-cloud-1 { animation-duration: 95s;  animation-delay: -10s; }
.ls-contained .ls-cloud-2 { animation-duration: 140s; animation-delay: -70s; }
.ls-contained .ls-cloud-3 { animation-duration: 80s;  animation-delay: -45s; }
.ls-contained .ls-cloud-4 { animation-duration: 120s; animation-delay: -100s; }
@keyframes ls-drift {
  from { transform: translateX(-360px); }
  to   { transform: translateX(calc(100vw + 40px)); }
}
/* static positions (fixed page background) */
.ls-page .ls-clouds { inset: 96px 0 auto 0; height: 45%; }
.ls-page .ls-cloud-1 { left: 6%; }
.ls-page .ls-cloud-2 { left: 58%; }
.ls-page .ls-cloud-3 { left: 34%; }
.ls-page .ls-cloud-4 { left: 80%; }

/* ---------- lightning (dark only): soft, top-right, one flash per cycle ---------- */
.ls-flash { position: absolute; top: 0; right: 0; width: 60%; height: 70%; background: radial-gradient(75% 78% at 67% 0%, rgba(224, 231, 255, .38), rgba(224, 231, 255, 0) 70%); opacity: 0; animation: ls-flash 11s infinite; }
.ls-bolt { position: absolute; top: 4%; left: 70%; width: 30px; fill: #e0e7ff; opacity: 0; animation: ls-flash 11s infinite; }
@keyframes ls-flash {
  0%, 86%, 100% { opacity: 0; }
  87% { opacity: .75; }
  90% { opacity: 0; }
}

/* ---------- rain (dark only); calmer over the left text column ---------- */
.ls-rain {
  position: absolute; inset: 0; overflow: hidden; opacity: .75;
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, .35) 0 45%, #000 80%), linear-gradient(180deg, #000 70%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, .35) 0 45%, #000 80%), linear-gradient(180deg, #000 70%, transparent);
  mask-composite: intersect;
}
.ls-rain span {
  position: absolute; left: 0; right: -60px; top: -180px; bottom: 0;
  background-image: var(--ls-rain); background-size: 180px 180px;
  animation: ls-rain .7s linear infinite;
}
@keyframes ls-rain {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-49px, 180px, 0); }
}

/* ---------- land ---------- */
.ls-land { position: absolute; left: 0; right: 0; bottom: 0; height: var(--ls-land-h); container-type: size; }
.ls-art { position: absolute; inset: 0; }
.ls-mountains { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ls-m1 { fill: var(--ls-m1); }
.ls-m2 { fill: var(--ls-m2); }
.ls-m3 { fill: var(--ls-m3); }
.ls-trees path { fill: var(--ls-tree); }
.ls-stop-soil-1 { stop-color: var(--ls-soil-1); }
.ls-stop-soil-2 { stop-color: var(--ls-soil-2); }
.ls-stop-haze-1 { stop-color: var(--ls-haze-1); }
.ls-stop-haze-2 { stop-color: var(--ls-haze-2); }
.ls-scar { opacity: .95; }
.ls-scar-lines { fill: none; stroke: var(--ls-soil-line); stroke-width: 1.2; stroke-linecap: round; opacity: .7; }
.ls-debris path, .ls-debris circle { fill: var(--ls-debris); }

/* warning sign */
.ls-sign rect:first-child { fill: var(--ls-pole); }
.ls-sign-face { fill: var(--ls-sign); stroke: rgba(0, 0, 0, .18); stroke-width: 1.5; stroke-linejoin: round; }
.ls-sign-mark { fill: var(--ls-sign-mark); }

/* sensor tower */
.ls-pole { fill: none; stroke: var(--ls-pole); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ls-box { fill: var(--ls-pole); }
.ls-panel { fill: var(--ls-panel); opacity: .9; }
.ls-beacon { fill: var(--ls-beacon); }
.ls-contained .ls-beacon { animation: ls-blink 1.6s steps(1, end) infinite; }
@keyframes ls-blink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: .25; } }

/* ---------- moving parts on their own HTML layer ----------
   .ls-fx reproduces the SVG's "xMidYMax slice" box, so viewBox coordinates map to % of .ls-fx */
.ls-fx {
  position: absolute; left: 50%; bottom: 0;
  width: max(100cqw, 450cqh); aspect-ratio: 1440 / 320;
  transform: translateX(-50%);
  container-type: size;
}
.ls-fx > i { position: absolute; display: block; }
.ls-fx-rock {
  width: calc(22 / 1440 * 100cqw); aspect-ratio: 22 / 20;
  background: var(--ls-rock);
  clip-path: polygon(0 30%, 40% 0, 85% 15%, 100% 65%, 64% 100%, 15% 90%);
  opacity: 0; animation: ls-roll 7.5s cubic-bezier(.45, .05, .7, .6) infinite;
}
.ls-fx-rock.r1 { left: 52.36%; top: 46.875%; }
.ls-fx-rock.r2 { left: 53.19%; top: 50.94%; width: calc(18 / 1440 * 100cqw); animation-delay: 2.5s; }
.ls-fx-rock.r3 { left: 51.94%; top: 50%; width: calc(15 / 1440 * 100cqw); animation-delay: 5s; animation-duration: 8.5s; }
@keyframes ls-roll {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  6%   { opacity: 1; }
  45%  { transform: translate(6.667cqw, 28.75cqh) rotate(260deg); }
  80%  { opacity: 1; transform: translate(13.61cqw, 41.25cqh) rotate(560deg); }
  92%, 100% { opacity: 0; transform: translate(16.11cqw, 42.5cqh) rotate(620deg); }
}
.ls-fx-dust { border-radius: 50%; background: radial-gradient(closest-side, var(--ls-dust), transparent); animation: ls-dust 4.5s ease-in-out infinite; }
.ls-fx-dust.d1 { left: 66.6%; top: 85.6%; width: calc(92 / 1440 * 100cqw); aspect-ratio: 92 / 24; }
.ls-fx-dust.d2 { left: 65.69%; top: 85%; width: calc(48 / 1440 * 100cqw); aspect-ratio: 48 / 16; animation-delay: -2s; }
@keyframes ls-dust {
  0%, 100% { opacity: .5; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
.ls-fx-ping {
  left: 41.94%; top: 36.875%; width: calc(12 / 1440 * 100cqw); min-width: 8px; aspect-ratio: 1;
  border: 2px solid var(--ls-ping); border-radius: 50%;
  opacity: 0; animation: ls-ping 2.8s ease-out infinite;
}
.ls-fx-ping.p2 { animation-delay: 1.4s; }
@keyframes ls-ping {
  0% { opacity: .9; transform: scale(1); }
  100% { opacity: 0; transform: scale(5); }
}

/* mist drifting over the valley */
.ls-mist { position: absolute; inset: 0; overflow: hidden; }
.ls-mist span {
  position: absolute; bottom: 8%; left: -20%; width: 70%; height: 40%;
  background: radial-gradient(closest-side, var(--ls-mist), transparent);
}
.ls-mist span:nth-child(2) { left: 45%; bottom: 20%; width: 60%; height: 34%; }
.ls-contained .ls-mist span { animation: ls-mist 26s ease-in-out infinite alternate; }
.ls-contained .ls-mist span:nth-child(2) { animation-duration: 34s; animation-delay: -12s; }
@keyframes ls-mist {
  from { transform: translateX(-6%); }
  to   { transform: translateX(10%); }
}

/* ---------- static page background: scenery only ---------- */
body.has-scene { background: transparent !important; }
html.has-scene-root { background: #f4f6fb; }
.ls-page .ls-land { opacity: .75; -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 45%); mask-image: linear-gradient(180deg, transparent 0%, #000 45%); }
.ls-page .ls-sensor, .ls-page .ls-sign, .ls-page .ls-debris { display: none; }
.ls-page .ls-scar { opacity: .5; }
.ls-page .ls-scar-lines { opacity: .35; }

/* ---------- where props would collide with content ---------- */
/* home hero: stat cards and the IoT panel sit over the left/centre of the land */
.home-hero .ls-sensor, .home-hero .ls-sign, .home-hero .ls-fx-ping { display: none; }
/* auth panel: the alert-level legend sits at the bottom */
.auth-brand .ls-sign, .auth-brand .ls-fx-ping { display: none; }
@media (max-width: 1023px) {
  .auth-brand .ls-sensor { display: none; }
  .auth-brand .ls-scar, .auth-brand .ls-debris, .auth-brand .ls-fx { opacity: .55; }
}
/* compact heroes (scene.js adds .ls-compact when the hero is shorter than 420px) */
.ls-compact .ls-sign, .ls-compact .ls-sensor, .ls-compact .ls-fx-ping { display: none; }
.ls-compact .ls-scar, .ls-compact .ls-debris, .ls-compact .ls-fx { opacity: .55; }
.ls-compact .ls-bolt { top: 10%; width: 24px; }
@media (min-width: 768px) {
  /* squash instead of cropping, so the far peaks are not cut into a flat band */
  .ls-compact .ls-art { transform: scaleY(.62); transform-origin: 50% 100%; }
  .ls-compact .ls-mountains { overflow: visible; }
}

/* ---------- pause / play button (added by scene.js) ---------- */
.ls-toggle {
  position: absolute; right: 10px; top: 10px; z-index: 3;
  width: 30px; height: 30px; border-radius: 999px;
  display: grid; place-items: center;
  color: #e0e7ff; background: rgba(12, 17, 36, .45);
  border: 1px solid rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 12px; cursor: pointer; opacity: .75;
  transition: opacity .15s ease, background-color .15s ease;
}
.ls-toggle:hover, .ls-toggle:focus-visible { opacity: 1; background: rgba(12, 17, 36, .7); }
.ls-toggle:focus-visible { outline: 2px solid #e0e7ff; outline-offset: 2px; box-shadow: none; }
.auth-brand > .ls-toggle { top: auto; bottom: 16px; right: 16px; }
@media (max-width: 1023px) { .auth-brand > .ls-toggle { bottom: auto; top: 64px; right: 20px; } }
/* desktop: the brand panel can be taller than the window, keep the button on screen */
@media (min-width: 1024px) { .auth-brand > .ls-toggle { position: fixed; top: auto; right: auto; left: 16px; bottom: 16px; } }
.site-hero > .ls-toggle, .auth-brand > .ls-toggle { position: absolute; }

/* paused by the button, or off-screen (scene.js) */
html.ls-paused .ls-scene *, .ls-off * { animation-play-state: paused !important; }
html.ls-paused .ls-rain, html.ls-paused .ls-fx { visibility: hidden; }
html.ls-paused .ls-flash, html.ls-paused .ls-bolt { opacity: 0 !important; animation: none !important; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .ls-cloud-2, .ls-cloud-4 { display: none; }
  .ls-scene { --ls-land-h: clamp(110px, 38%, 200px); }
  .ls-light { --ls-land-h: clamp(90px, 18vh, 160px); }
  .ls-bolt { left: 74%; width: 22px; }
}

/* ---------- accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  .ls-scene *, .ls-scene *::before, .ls-scene *::after { animation: none !important; }
  .ls-flash, .ls-bolt, .ls-fx-rock, .ls-fx-ping { opacity: 0 !important; }
  .ls-cloud { transform: none !important; }
  .ls-cloud-1 { left: 28%; } .ls-cloud-2 { left: 50%; }
  .ls-cloud-3 { left: 66%; } .ls-cloud-4 { left: 80%; }
  .ls-toggle { display: none; }
}
@media print {
  .ls-scene, .ls-toggle { display: none !important; }
  html.has-scene-root, body.has-scene { background: #fff !important; }
}
@media (forced-colors: active) {
  .ls-scene, .ls-toggle { display: none !important; }
}
