/* ============================================================
 * Scroll journey layer — ported from the OWH proposal engine.
 * Loads AFTER homepage.css. Fixed layered ground, sticky-left
 * statement columns, the pinned Protocol scrub, entry reveals.
 * ============================================================ */

/* ---------- ground: root paints obsidian, body is transparent so the
   fixed negative-z layers show through. body overflow-x:hidden would make
   body a scroll container and kill position:sticky, so clip on html. ---------- */
html { background: var(--obsidian); overflow-x: clip; }
body { background: transparent; overflow-x: visible; }
html.menu-open { overflow: hidden; }

.bgp {
  position: fixed; inset: 0; z-index: -4; pointer-events: none;
  background: var(--obsidian) url(assets/hero-studio.jpg) center/cover no-repeat;
  filter: grayscale(1) contrast(1.05);
}
.bgs {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, rgba(11,11,12,0.82), rgba(11,11,12,0.9));
}
canvas.orb { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: var(--orb-alpha, 1); }

/* ---------- section chassis: sticky statement left, detail right ---------- */
.sgrid { display: grid; grid-template-columns: minmax(0, 0.85fr) 1px minmax(0, 1.15fr); gap: 0 56px; align-items: start; }
.sl { position: sticky; top: 112px; display: flex; flex-direction: column; }
.sl .eyebrow { margin-bottom: 18px; }
.sl .h-sec { margin-bottom: 18px; }
.sl .sub { max-width: 420px; }
.shair { align-self: stretch; background: linear-gradient(transparent, var(--hairline-gold) 12%, var(--hairline-gold) 88%, transparent); }
.sr { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* about: centred lead, then the photo and copy side by side */
.about-head { text-align: center; max-width: 880px; margin: 0 auto 64px; }
.about .about-head .about-lead { font-size: clamp(26px, 2.7vw, 38px); line-height: 1.22; max-width: none; margin: 0; text-wrap: balance; }
.about-grid { display: grid; grid-template-columns: 0.85fr 1fr; gap: 56px; align-items: center; }
.about-copy p:last-of-type { margin-bottom: 28px; }
/* dashboard: a little smaller */
.cmd-demo { width: min(100%, 980px); }
/* faq: list fills the right column */
.sgrid .faq-list { max-width: none; margin: 0; }
.faq-q { padding: 22px 4px; }

/* ---------- FAQ: height-agnostic accordion (grid-rows), no JS measuring ---------- */
.faq-a { max-height: none; overflow: visible; display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--dur-slow) var(--ease-out); }
.faq-item.open .faq-a { grid-template-rows: 1fr; }
.faq-a-in { min-height: 0; overflow: hidden; }

/* ---------- pinned Protocol: N beats over N+1 viewports ---------- */
.pin { position: relative; height: calc((var(--beats, 4) + 1) * 100svh); padding: 0; }
.pin-inner { position: sticky; top: 0; height: 100svh; display: flex; align-items: center; overflow: hidden; }
.pin-wrap { width: 100%; height: 100%; }   /* flex item: fill, don't shrink to (absolute-only) content */
.pin-body { position: relative; height: 100%; display: flex; align-items: center; }
.pinhead { position: absolute; top: 112px; left: 0; right: 0; text-align: center; }
.pinhead .eyebrow.center, .pinhead .eyebrow { justify-content: center; display: flex; }
.pinhead .eyebrow { margin-bottom: 14px; }
.pinhead .h-sec { margin: 0; font-size: clamp(28px, 3.2vw, 44px); }
.beats { position: relative; width: 100%; min-height: min(52svh, 460px); margin-top: 8svh; }
/* one centred column, set inside the orb */
.beat {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 18px; opacity: 0; will-change: opacity, transform; pointer-events: none;
}
.beat.live { pointer-events: auto; }
/* soft darkening behind the copy so it reads over the wiring; sized to the orb's inner two-thirds */
.beat::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: min(64vmin, 620px); height: min(64vmin, 620px);
  transform: translate(-50%, -50%); border-radius: 50%; z-index: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(11,11,12,0.62), rgba(11,11,12,0.3) 62%, transparent);
}
.beat .l, .beat .r { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.beat-num {
  position: absolute; left: 50%; top: -58px; transform: translateX(-50%); z-index: 0; user-select: none;
  font-weight: 900; font-size: 170px; line-height: 0.7; letter-spacing: -0.05em; color: rgba(201,168,76,0.08);
}
.beat-h { position: relative; z-index: 1; margin: 0; font-size: clamp(40px, 5vw, 72px); font-weight: 800; letter-spacing: -0.035em; line-height: 0.96; }
.beat-tag { position: relative; z-index: 1; margin: 0; font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: clamp(22px, 2.3vw, 32px); color: var(--gold); letter-spacing: 0; }
.beat-p { margin: 0; max-width: 34ch; font-size: clamp(16px, 1.3vw, 18px); line-height: 1.65; color: var(--ivory); text-wrap: pretty; }
.pinfoot { position: absolute; left: 0; right: 0; bottom: 28px; display: flex; justify-content: space-between; align-items: center; }
.pinfoot .eyebrow { margin: 0; color: var(--ash); }
.dots { display: flex; gap: 7px; }
.dots i { display: block; width: 5px; height: 5px; border-radius: 99px; background: var(--slate); transition: background 200ms ease; }
.dots i.on { background: var(--gold); }

/* ---------- entry reveals (one-way, non-gestural: CSS transition is fine) ---------- */
.io { opacity: 0; transform: translateY(10px); transition: opacity 600ms ease, transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.io.inview { opacity: 1; transform: none; }
.sr > .io:nth-child(2) { transition-delay: 80ms; }
.sr > .io:nth-child(3) { transition-delay: 160ms; }
/* engine cards keep their hover lift once revealed */
.engine.io.inview { transition: opacity 600ms ease, transform var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out); }
.engine.io.inview:hover { transform: translateY(-3px); }
.engine-beam.io.inview { transition: opacity 600ms ease, transform var(--dur-base) var(--ease-out); }
.engine-beam.io.inview:hover { transform: translateY(-3px); }

/* ---------- tablets and phones: statements unstick, the pin unwinds ---------- */
@media (max-width: 980px) {
  .sgrid { grid-template-columns: 1fr; gap: 28px; }
  .shair { height: 1px; width: 100%; background: linear-gradient(90deg, var(--hairline-gold), transparent); }
  .sl { position: static; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-photo { aspect-ratio: 16/10; }
  .about-head { margin-bottom: 40px; }
  .engines-grid { grid-template-columns: 1fr 1fr; }
  .sr > .io { transition-delay: 0ms; }
  .pin { height: auto; padding: 96px 0; }
  .pin-inner { position: static; height: auto; display: block; overflow: visible; }
  .pin-wrap, .pin-body { height: auto; display: block; }
  .pinhead { position: static; margin-bottom: 44px; }
  .beats { min-height: 0; margin: 0; display: flex; flex-direction: column; gap: 64px; }
  .beat { position: static; opacity: 1 !important; transform: none !important; pointer-events: auto; gap: 14px; }
  .beat::before { display: none; }
  .beat-num { font-size: 130px; top: -52px; }
  .pinfoot { display: none; }
}
@media (max-width: 760px) {
  .engines-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .pin { padding: 72px 0; }
  .beats { gap: 48px; }
}

/* ---------- reduced motion: everything visible, nothing pinned or scrubbed ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .io { opacity: 1; transform: none; transition: opacity 200ms ease; }
  .pin { height: auto; padding: 96px 0; }
  .pin-inner { position: static; height: auto; display: block; overflow: visible; }
  .pin-wrap, .pin-body { height: auto; display: block; }
  .pinhead { position: static; margin-bottom: 44px; }
  .beats { min-height: 0; margin: 0; display: flex; flex-direction: column; gap: 64px; }
  .beat { position: static; opacity: 1 !important; transform: none !important; pointer-events: auto; }
  .pinfoot { display: none; }
  .faq-a { transition: none; }
}
