/* Bagua site: ink-wash ambience, glass, the hero stage and scroll motion.
   Classes on <html>, set by the inline script and js/site.js:
     js       scripts run
     motion   no reduced-motion preference: reveals, the turning ring, the cursor aura
     io       site.js reveals sections once with IntersectionObserver
     pointer  a mouse is over the page
   Without them the page is complete and still: the hero shows the ring as a static drawing. */

/* ── Ink-wash ambience behind everything; the cursor aura shines through the glass ───────────────────── */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--ambient); }
.aura {
  position: fixed; left: 0; top: 0; z-index: 0; width: 560px; height: 560px; margin: -280px 0 0 -280px;
  border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity .8s; will-change: transform;
  background: radial-gradient(closest-side, rgba(var(--accent-rgb), .13), rgba(var(--water-rgb), .04) 60%, transparent);
}
html.pointer .aura { opacity: 1; }

/* ── Scroll progress along the bottom edge of the nav ───────────────────────────────────────────────── */
.progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; transform-origin: 0 50%;
  transform: scaleX(var(--scroll, 0)); background: var(--accent);
}
@supports (animation-timeline: scroll()) {
  .progress { animation: progress linear both; animation-timeline: scroll(root block); }
}
@keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
html:not(.js) .progress { display: none; }

/* ── Glass: rice paper over the ink wash ────────────────────────────────────────────────────────────── */
.glass {
  position: relative; isolation: isolate; border: 1px solid var(--line-2); background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(130%); backdrop-filter: blur(14px) saturate(130%);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow);
}
.glass::before { /* soft bronze light under the cursor */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -40%), rgba(var(--accent-rgb), .14), transparent 48%);
  transition: opacity .5s;
}
.glass:hover::before { opacity: 1; }

/* ── The hero stage: the eight trigrams around the app's yin-yang, behind the name ─────────────────── */
.hero { position: relative; z-index: 2; margin-top: calc(-1 * var(--nav-h)); }
.hero-stage {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; isolation: isolate; overflow: hidden;
  height: 100vh; height: 100svh; min-height: 660px; max-height: 1100px;
}
.hero-sky { position: absolute; inset: 0; z-index: -3; background: var(--sky); }
.hero-art { /* the still drawing; js/hero.js draws the turning version over the same box */
  position: absolute; z-index: -2; left: 50%; top: calc(var(--nav-h) + 2vh); width: min(74vw, 40vh); aspect-ratio: 1;
  transform: translateX(-50%); color: var(--text);
}
.hero-art svg { width: 100%; height: 100%; overflow: visible; }
.hero-art .ring path { stroke: currentColor; stroke-width: 3.4; stroke-linecap: butt; opacity: .5; }
.hero-art .hair { fill: none; stroke: currentColor; stroke-width: .5; opacity: .22; }
.hero-art .yy-ring { fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: .5; }
.hero-art .yy-yin { fill: var(--yin); }
.hero-art .yy-yang { fill: var(--yang); }
.hero-world { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; opacity: 0; transition: opacity 1.4s var(--ease); }
.hero-world.on { opacity: 1; }
.hero-art svg { transition: opacity 1.4s var(--ease); }
.hero.live .hero-art svg { opacity: 0; }
.hero-stage::after { /* keeps the copy readable and fades the stage into the page */
  content: ""; position: absolute; inset: auto 0 0; height: 56%; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--fade) 50%, var(--bg));
}
.hero-copy { position: relative; padding-bottom: clamp(100px, 12.5vh, 150px); }
.scroll-cue {
  position: absolute; right: var(--gutter); bottom: 30px; display: inline-flex; align-items: center; gap: 12px; text-decoration: none;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
}
.scroll-cue:hover { color: var(--head); }
.scroll-cue i { width: 1px; height: 42px; background: linear-gradient(var(--accent), transparent); transform-origin: top; }
html.motion .scroll-cue i { animation: cue 2.4s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); opacity: 1; } 60% { transform: scaleY(1); opacity: 1; } 100% { opacity: 0; } }

/* ── Reveals: IntersectionObserver, once (content never hides again) ──────────────────────────────── */
html.io .reveal { opacity: 0; translate: 0 30px; transition: opacity .9s var(--ease), translate .9s var(--ease); }
html.io .reveal.in { opacity: 1; translate: none; }
html.io .reveal.d1 { transition-delay: .08s; }
html.io .reveal.d2 { transition-delay: .16s; }

/* the overview phones rise into place */
html.motion .trio .phone { transition: transform 1.1s var(--ease); }
html.motion.ready .trio:not(.in) figure:not(.main) .phone { transform: translateY(40px) rotate(var(--tilt, 0deg)); }
.trio figure:first-child { --tilt: -2deg; }
.trio figure:last-child { --tilt: 2deg; }

/* a changing line pulses, as in the app */
.chain .change span::before, .feature .key i.change { animation: pulse 2.5s ease-in-out infinite; box-shadow: 0 0 10px rgba(var(--accent-rgb), .8); }

@media (max-width: 920px) {
  .scroll-cue { display: none; }
}
@media (max-width: 640px) {
  .hero-stage { min-height: 700px; }
  .hero-art { width: min(80vw, 40vh); top: calc(var(--nav-h) + 1vh); }
  .hero-copy { padding-bottom: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .progress, .aura { display: none; }
  .trio .phone { transform: none !important; }
}
