/* The home page's scroll effects and hero (media/landing.js). Plain CSS like demo.css: the
   Tailwind build only sees classes in the Rust sources, and the script builds the story's
   markup. Window illustrations reuse demo.css (`wd-` classes). Everything here falls back to
   static content: `.ls-on` is set by the script, so without it nothing is hidden or pinned. */

/* Nothing may widen the page sideways; iOS ignores this on body alone, hence html too. */
html, body { overflow-x: clip; }

.ls-bleed { margin-inline: calc(50% - 50vw); }

/* Hero */
.ls-hero { position: relative; isolation: isolate; }
.ls-glow {
  position: absolute;
  inset: -6rem calc(50% - 50vw) -10rem;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38% 46% at 30% 32%, #2a4a8a55, transparent 70%),
    radial-gradient(34% 42% at 72% 30%, #5a2f8a45, transparent 70%),
    radial-gradient(40% 40% at 50% 80%, #1d6b6230, transparent 70%);
  background-size: 120% 120%;
  background-position: 0% 0%;
  animation: ls-breathe 14s ease-in-out infinite alternate;
}
.ls-grid {
  position: absolute;
  inset: -6rem calc(50% - 50vw) 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(#ffffff08 1px, transparent 1px),
    linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(60% 70% at 50% 35%, #000 20%, transparent 75%);
}
/* The glow drifts inside its own box: moving the box itself pushed it past the screen edge. */
@keyframes ls-breathe {
  to { background-position: 100% 100%; }
}

.ls-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.85rem 0.35rem 0.4rem;
  border: 1px solid #2f343c;
  border-radius: 999px;
  background: #15171bcc;
  color: #c9ced6;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s;
}
.ls-pill:hover { border-color: #9aa1ab; color: #e8eaed; }
.ls-pill b {
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #4c8dff, #a78bfa);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ls-shine {
  background: linear-gradient(100deg, #e8eaed 10%, #9fc0ff 35%, #c9b3ff 55%, #e8eaed 80%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: ls-shine 7s ease-in-out infinite;
}
@keyframes ls-shine {
  0%, 100% { background-position: 100% 0; }
  50% { background-position: 0% 0; }
}

/* Hero words rise in on load, one after another. */
span.ls-rise { display: inline-block; }
.ls-rise {
  animation: ls-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms + 80ms);
}
@keyframes ls-rise {
  from { opacity: 0; transform: translateY(0.45em); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

.ls-cue {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: #9aa1ab;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}
.ls-cue:hover { color: #e8eaed; }
.ls-mouse { position: relative; width: 22px; height: 34px; border: 2px solid currentColor; border-radius: 12px; }
.ls-mouse::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: currentColor;
  animation: ls-wheel 1.8s ease-in-out infinite;
}
@keyframes ls-wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(9px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* Manifesto: words light up as it scrolls past. */
.ls-words { position: relative; }
.ls-words-inner { padding: 6rem 0; }
.ls-words-text {
  max-width: 52rem;
  margin: 0 auto;
  font-size: clamp(1.7rem, 4vw, 3.1rem);
  font-weight: 650;
  line-height: 1.22;
  letter-spacing: -0.035em;
  color: #e8eaed;
}
.ls-words-text strong { font-weight: 700; }
.ls-on .ls-words { height: 150svh; }
.ls-on .ls-words-inner {
  position: sticky;
  top: 0;
  display: grid;
  height: 100svh;
  place-items: center;
  padding: 0;
}
.ls-on .ls-words-text span {
  opacity: calc(0.16 + var(--lit, 0) * 0.84);
  transition: opacity 0.15s linear;
}
.ls-on .ls-words-text strong span {
  background: linear-gradient(100deg, #9fc0ff, #c9b3ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* The story: a pinned display, played by scrolling. */
.ls-story { position: relative; }
.ls-pin { padding: 3rem 1rem; }
.ls-captions { display: grid; gap: 1.6rem; width: 100%; max-width: 46rem; margin: 0 auto 2rem; padding: 0; list-style: none; text-align: center; }
.ls-caption h3 {
  font-size: clamp(1.5rem, 3.2vw, 2.4rem);
  font-weight: 680;
  line-height: 1.12;
  letter-spacing: -0.045em;
}
.ls-caption p { margin-top: 0.55rem; color: #9aa1ab; font-size: clamp(0.92rem, 1.4vw, 1.05rem); line-height: 1.55; }
.ls-caption .ls-kicker {
  margin: 0 0 0.6rem;
  color: #9aa1ab;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.ls-kicker em {
  margin-left: 0.4rem;
  padding: 0.08rem 0.35rem;
  border: 1px solid #3a404a;
  border-radius: 0.3rem;
  font-style: normal;
}

.ls-stage-wrap {
  width: min(100%, 76rem, calc((100svh - 17rem) * 1.75));
  margin: 0 auto;
  padding: 0.55rem;
  border: 1px solid #262a31;
  border-radius: 1.1rem;
  background: #15171b;
  box-shadow: 0 40px 140px #000a, 0 0 0 1px #ffffff05 inset;
}
.ls-screen {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 0.7rem;
  background:
    radial-gradient(110% 90% at 12% 0%, #1c2a46 0%, transparent 55%),
    radial-gradient(90% 80% at 95% 100%, #2b1d40 0%, transparent 60%),
    #0d0f13;
  user-select: none;
  -webkit-user-select: none;
}
.ls-screen .wd-win { cursor: default; transform-origin: 50% 50%; }
.ls-screen .wd-hint.is-gone { opacity: 0; translate: -50% 8px; }
.ls-fallback { display: block; width: 100%; height: 100%; object-fit: cover; }

.ls-drawer {
  position: absolute;
  top: 24px;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: clamp(150px, 22%, 240px);
  padding: 12px;
  border-right: 1px solid #ffffff1a;
  background: #13161bdd;
  box-shadow: 20px 0 60px #0008;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateX(-108%);
}
.ls-drawer p { margin: 2px 0 0; color: #9aa1ab; font-size: 10px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; }
.ls-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ls-tile {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 7px 4px;
  border: 1px solid #2b3038;
  border-radius: 8px;
  background: #1a1d22;
  color: #c9ced6;
  font-size: 10px;
  font-weight: 650;
  transition: border-color 0.2s, background 0.2s;
}
.ls-tile svg { width: 28px; height: 14px; fill: currentColor; opacity: 0.85; }
.ls-tile.is-on { border-color: #d5dce6; background: #262a31; color: #fff; box-shadow: 0 0 18px #d5dce633; }
.ls-dlist { display: grid; gap: 4px; }
.ls-dlist span {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 6px;
  background: #1a1d22;
  color: #c9ced6;
  font-size: 10px;
  font-weight: 600;
}
.ls-dlist i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }

.ls-cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 40;
  width: 20px;
  height: 24px;
  opacity: 0;
  fill: #fff;
  stroke: #000;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 6px #0009);
  pointer-events: none;
  transform-origin: 2px 2px;
}
.ls-ripple {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 35;
  width: 44px;
  height: 44px;
  border: 2px solid #d5dce6;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.ls-rail { display: none; }

.ls-on .ls-story { height: 560svh; }
.ls-on .ls-pin {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100svh;
  padding: 1.5rem 1rem;
}
.ls-on .ls-captions { position: relative; display: block; height: 7.5rem; margin-bottom: 1.4rem; }
.ls-on .ls-caption {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(14px);
  filter: blur(6px);
  transition: opacity 0.45s, transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.45s;
  pointer-events: none;
}
.ls-on .ls-caption.is-active { opacity: 1; transform: none; filter: none; pointer-events: auto; }
.ls-on .ls-rail {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1.1rem;
}
.ls-rail i { position: relative; width: 2.4rem; height: 3px; overflow: hidden; border-radius: 2px; background: #262a31; }
.ls-rail i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #d5dce6;
  transform: scaleX(var(--fill, 0));
  transform-origin: left;
}

/* Reveals */
.ls-on [data-reveal] {
  opacity: 0;
  transform: translateY(28px) scale(0.985);
  filter: blur(6px);
  transition:
    opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
    filter 0.8s;
  transition-delay: var(--d, 0ms);
}
.ls-on [data-reveal].is-in { opacity: 1; transform: none; filter: none; }
.ls-on [data-reveal="zoom"] { transform: scale(0.92); }

/* Numbers */
.ls-num {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  background: linear-gradient(180deg, #fff, #8d96a3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

/* Bento cards with a pointer spotlight. */
.ls-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #262a31;
  border-radius: 1.1rem;
  background: #15171b;
  transition: border-color 0.3s, transform 0.3s;
}
.ls-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), #9fc0ff1c, transparent 45%);
  transition: opacity 0.3s;
  pointer-events: none;
}
.ls-card:hover { border-color: #3a404a; }
.ls-card:hover::before { opacity: 1; }
.ls-card > * { position: relative; z-index: 1; }

/* Workspaces card: nine dots, one lit, sliding along. */
.ls-spaces { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.ls-spaces i { height: 34px; border: 1px solid #2b3038; border-radius: 6px; background: #1a1d22; animation: ls-space 9s steps(1) infinite; animation-delay: calc(var(--i) * 1s - 9s); }
@keyframes ls-space {
  0% { background: linear-gradient(135deg, #4c8dff66, #a78bfa55); border-color: #9fc0ff; }
  11.1%, 100% { background: #1a1d22; border-color: #2b3038; }
}

/* A scroll-linked tilt for the big figures, where the browser can do it without script. */
@supports (animation-timeline: view()) {
  .ls-tilt {
    animation: ls-tilt linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 45%;
  }
  @keyframes ls-tilt {
    from { transform: perspective(1400px) rotateX(14deg) scale(0.94); opacity: 0.4; }
    to { transform: none; opacity: 1; }
  }
}

@media (max-width: 639px) {
  .ls-screen { aspect-ratio: 4 / 3; }
  .ls-stage-wrap { padding: 0.35rem; border-radius: 0.9rem; width: min(100%, calc((100svh - 19rem) * 1.33)); }
  .ls-on .ls-captions { height: 9.5rem; }
  .ls-on .ls-story { height: 480svh; }
  .ls-screen .wd-menubar > span:not(.wd-menu-right) { display: none; }
  .ls-screen .wd-body { padding: 6px; gap: 4px; }
  .ls-screen .wd-title { height: 16px; }
  .ls-screen .wd-title span { font-size: 9px; line-height: 16px; }
  .ls-screen .wd-terminal { font-size: 8px; }
  .ls-drawer { width: 46%; padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .ls-glow, .ls-shine, .ls-rise, .ls-mouse::after, .ls-spaces i { animation: none; }
  .ls-on [data-reveal] { transform: none; filter: none; transition: opacity 0.3s; }
  .ls-on .ls-caption { transform: none; filter: none; transition: opacity 0.2s; }
  .ls-tilt { animation: none !important; }
}
