/* ═══════════════════════════════════════════════════════════════════════════
 * ATMOSPHERE — Xaviour's blue light, depth and ambient life.
 *
 * Every value here is restrained on purpose. Light is used to say "look here",
 * never for decoration: a bloom behind the product moments, an edge highlight
 * on the surfaces that matter, and a slow drift so the page breathes. All of it
 * collapses under prefers-reduced-motion and prefers-reduced-transparency.
 * ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --glow: rgba(18, 101, 242, 0.13);
  --glow-soft: rgba(18, 101, 242, 0.07);
  --glow-edge: rgba(18, 101, 242, 0.16);
}

/* ─────────── 1 · The dark→light transition ───────────
   A long, gradual resolve rather than a band: the night lifts through a blue
   half-light before it becomes the page. The blue is carried *into* the light
   scene below the join, so the transition reads as spill, not as a seam. */
.hero-seam {
  height: 300px;
  background:
    radial-gradient(80% 120% at 50% 108%, rgba(18, 101, 242, 0.16), transparent 66%),
    linear-gradient(180deg,
      transparent 0%,
      rgba(247, 248, 245, 0.06) 40%,
      rgba(247, 248, 245, 0.4) 70%,
      rgba(247, 248, 245, 0.88) 88%,
      var(--app) 100%);
}

/* The light spilling down into the product scene. */
.seam-bloom {
  position: absolute;
  inset: auto 0 -140px;
  z-index: 5;
  height: 260px;
  background: radial-gradient(50% 100% at 50% 0%, rgba(18, 101, 242, 0.13), transparent 74%);
  filter: blur(40px);
  pointer-events: none;
}

/* ─────────── 2 · Illumination behind the product moments ───────────
   A wide, very low-alpha wash centred on whatever the eye should land on. */
.aura {
  position: absolute;
  z-index: 0;
  left: 50%;
  translate: -50% 0;
  width: min(1180px, 128vw);
  aspect-ratio: 1 / 0.62;
  background: radial-gradient(closest-side, var(--glow), var(--glow-soft) 46%, transparent 72%);
  filter: blur(16px);
  pointer-events: none;
  opacity: 0;
}

/* Scroll drives opacity directly (see initAtmosphere); the transition is only a
   smoother for the first paint and for the reduced-motion lit state. */
.aura { transition: opacity 900ms cubic-bezier(0.22, 1, 0.36, 1); }
.aura.lit { opacity: 1; }

/* The stage sits in blue air: a wide wash behind the headline and the deck, so
   the product surfaces read as lit objects rather than paper on grey. */
.aura-stage {
  top: -4%;
  width: min(1500px, 150vw);
  --glow: rgba(18, 101, 242, 0.16);
  --glow-soft: rgba(18, 101, 242, 0.06);
}

.aura-ask { top: 14%; --glow: rgba(56, 128, 255, 0.2); --glow-soft: rgba(56, 128, 255, 0.09); }
.aura-close { top: -6%; --glow: rgba(56, 128, 255, 0.17); --glow-soft: rgba(56, 128, 255, 0.07); }

/* A second, tighter pool directly under the deck — the brightest point of the
   light scene is the decision you're actually looking at. */
.aura-deck {
  top: 50%;
  translate: -50% -50%;
  width: min(900px, 96vw);
  aspect-ratio: 1 / 0.42;
  --glow: rgba(18, 101, 242, 0.13);
  --glow-soft: rgba(18, 101, 242, 0.045);
}

/* The light scene itself carries a faint blue floor. */
.scene-light {
  background:
    radial-gradient(circle at 52% -20%, rgba(255, 255, 255, 0.98), transparent 46%),
    radial-gradient(120% 70% at 50% 108%, rgba(18, 101, 242, 0.06), transparent 70%),
    var(--app);
}

.stage .wrap, .ask .wrap { position: relative; z-index: 1; }

/* ─────────── 3 · Edge light on the surfaces that matter ───────────
   A bright top edge plus a blue-tinted ground shadow: the card catches light
   from above and sits in blue air, rather than floating on flat grey. */
.card,
.dc,
.alerts,
.cta-card,
.ask-frame {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 1px 2px rgba(20, 34, 62, 0.05),
    0 14px 34px -14px rgba(20, 40, 82, 0.16),
    0 30px 70px -40px rgba(18, 101, 242, 0.3);
}

/* The active decision is the brightest object in the light scene. */
.deck-slide:not(.is-peek) .dc {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 2px 4px rgba(20, 34, 62, 0.05),
    0 20px 44px -18px rgba(20, 40, 82, 0.2),
    0 40px 90px -46px rgba(18, 101, 242, 0.45);
}

/* Dark-scene surfaces catch a cooler, inner light instead. */
.cta-card, .ask-frame {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -30px 60px -50px rgba(56, 128, 255, 0.7),
    0 30px 80px -30px rgba(0, 0, 0, 0.55);
}

/* ─────────── 4 · The highlight that runs as a section arrives ───────────
   A single pass of light across the top edge — it reads as the surface being
   lit, and it only ever plays once, on entry. */
.reveal.is-in .lightpass,
.lightpass {
  position: absolute;
  inset: 0 0 auto;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

.lightpass::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 55%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(18, 101, 242, 0.09), transparent);
  transform: skewX(-14deg);
}

.is-in > .lightpass::after { animation: light-pass 1500ms cubic-bezier(0.22, 1, 0.36, 1) 120ms both; }

@keyframes light-pass {
  from { left: -60%; }
  to { left: 130%; }
}

/* ─────────── 5 · Ambient life ───────────
   Two very slow, very faint drifts. Deliberately far away from the 0.2Hz band
   that reads as pulsing, and low enough in alpha never to fight the text. */
.ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient i {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
}

.ambient .a1 {
  top: -12%;
  left: -6%;
  width: 46%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(18, 101, 242, 0.3), transparent 68%);
  animation: drift-a 34s ease-in-out infinite;
}

.ambient .a2 {
  bottom: -18%;
  right: -8%;
  width: 52%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(78, 140, 255, 0.22), transparent 68%);
  animation: drift-b 43s ease-in-out infinite;
}

@keyframes drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(7%, 5%, 0) scale(1.1); }
}

@keyframes drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.06); }
  50% { transform: translate3d(-6%, -4%, 0) scale(1); }
}

/* The hero's stars breathe rather than sit still. */
.stars { animation: star-breathe 26s ease-in-out infinite; }

@keyframes star-breathe {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.95; }
}

/* ─────────── 6 · Depth on scroll ───────────
   Parallax is applied to background layers only, by JS writing --par. Content
   never moves, so nothing reflows and reading is never disturbed. */
.orb, .ambient, .aura { will-change: transform; }
.orb { transform: translate3d(0, calc(var(--par, 0) * 34px), 0); }
.ambient { transform: translate3d(0, calc(var(--par, 0) * -18px), 0); }

/* A hairline of blue where the light stage meets the dark scenes. */
.scene-light + .scene-night,
.scene-light + .scene-close { border-top: 1px solid rgba(18, 101, 242, 0.22); }

/* ─────────── Accessibility ─────────── */
@media (prefers-reduced-motion: reduce) {
  .ambient .a1, .ambient .a2, .stars { animation: none; }
  .aura { transition: none; }
  .is-in > .lightpass::after { animation: none; opacity: 0; }
  .orb, .ambient { transform: none; }
}

/* Four chips don't fit a phone: two rows of two, still one tap to the detail. */
@media (max-width: 620px) {
  .alerts { margin-top: 20px; padding: 18px 16px 14px; border-radius: 20px; }
  .alerts-row { grid-template-columns: 1fr 1fr; }
  .alerts-line { font-size: 0.94rem; }
  .live-pop { padding: 16px; }
}

/* Reduced transparency is about legibility of content sitting *on* glass, so the
   surfaces go solid and the blur goes away. The background light stays: it is
   behind everything and never has text on top of it. */
@media (prefers-reduced-transparency: reduce) {
  .aura { opacity: 0.55; }
  .ambient i { opacity: 0.3; }
  .alerts,
  .live-pop,
  .segmented,
  .card {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Higher contrast removes decorative light entirely. */
@media (prefers-contrast: more) {
  .ambient, .aura, .seam-bloom { display: none; }
}
