/* ──────────────────────────────────────────────────────────────
   STACK-MOTION — the "DataStack" signature layer (batch 1)
   Loaded AFTER frost-motion.css on the three homepages.
   Replaces the hero's generic glass card + particle orb with a
   3D stack of slabs that lands, follows the cursor and spreads
   apart as you scroll; adds the decode slogan, self-drawing
   principle numerals and button press ripples.

   Budget (see commit 26bcd1a): transform/opacity only, no
   backdrop-filter on anything that moves, every loop paused
   off-screen, prefers-reduced-motion gets the end state.
   ────────────────────────────────────────────────────────────── */

:root{
  --spring: cubic-bezier(.34,1.56,.64,1);
  --prism-solid: linear-gradient(135deg,#ffc2e0 0%,#ff8fc4 45%,#ff5fa8 75%,#d6336c 100%);
}

/* ── 1. HERO: copy sits on the bare ground — no glass card ───── */
.hero-panel{position:relative}
.hero .hero-copy{max-width:560px}

/* ── 2. THE STACK ──────────────────────────────────────────── */
.stack-hero{
  position:absolute;z-index:2;
  top:50%;right:max(2vw, calc((100vw - var(--max-w)) / 2 - 60px));
  width:min(44vw,560px);height:min(44vw,560px);
  transform:translateY(-46%);
  pointer-events:none;
}
.stack-scene{
  position:absolute;inset:0;
  perspective:1600px;
}
/* static dot-grid floor the stack stands on: no animation, painted once */
.stack-floor{
  position:absolute;left:-30%;right:-30%;top:34%;height:110%;
  background-image:radial-gradient(circle,rgba(255,143,196,.32) 1.2px,transparent 1.6px);
  background-size:26px 26px;
  transform:rotateX(64deg) rotateZ(-42deg);
  -webkit-mask:radial-gradient(closest-side,#000 30%,transparent 100%);
          mask:radial-gradient(closest-side,#000 30%,transparent 100%);
  opacity:.7;
}
.stack-glow{
  position:absolute;left:12%;right:12%;top:22%;bottom:12%;border-radius:50%;
  background:radial-gradient(closest-side,rgba(255,95,168,.28),rgba(214,51,108,.08) 60%,transparent);
}
.stack-rig{
  position:absolute;inset:0;transform-style:preserve-3d;
  /* --tx/--ty: pointer tilt, --sp: scroll spread 0→1 (set by JS) */
  transform:
    rotateX(calc(58deg + var(--ty,0) * 6deg - var(--sp,0) * 8deg))
    rotateZ(calc(-42deg + var(--tx,0) * 8deg + var(--sp,0) * 10deg));
}
.slab{
  --gap:calc(min(5.4vw,68px) + var(--sp,0) * min(6vw,80px));
  position:absolute;left:19%;top:19%;width:62%;height:62%;
  border-radius:24px;
  transform-style:preserve-3d;
  transform:translateZ(calc(var(--i) * var(--gap)));
  background:linear-gradient(140deg,rgba(255,255,255,.10),rgba(255,255,255,.015) 60%),#1a1620;
  border:1px solid rgba(255,255,255,.12);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.12);
}
/* faux thickness: one offset edge plate per slab, static */
.slab::before{
  content:'';position:absolute;inset:0;border-radius:inherit;
  background:#0f0d13;border:1px solid rgba(255,255,255,.06);
  transform:translateZ(-10px);
}
.slab-lbl{
  position:absolute;left:7%;bottom:7%;
  font:500 clamp(10px,1vw,13px)/1 var(--font-mono);
  letter-spacing:.14em;text-transform:uppercase;color:var(--text-2);
}
.slab-lbl b{color:#ff5fa8;font-weight:500;margin-right:.7em}
.slab-top{background:var(--prism-solid);border-color:rgba(255,255,255,.4)}
.slab-top::before{background:#a8264f}
.slab-top .slab-lbl,.slab-top .slab-lbl b{color:var(--bg)}
.slab-mark{
  position:absolute;right:8%;top:6%;
  font:700 clamp(36px,4.6vw,64px)/1 var(--font-head);letter-spacing:-.045em;color:var(--bg);
}
/* landing — one-shot, staggered bottom → top */
.stack-ready .slab{animation:slabLand 1100ms var(--spring) backwards;animation-delay:calc(250ms + var(--i) * 170ms)}
@keyframes slabLand{
  from{transform:translateZ(calc(var(--i) * var(--gap) + 900px));opacity:0}
  45%{opacity:1}
}
/* data packets climbing the core */
.pkt{
  position:absolute;left:calc(50% - 4px);top:calc(50% - 4px);width:8px;height:8px;border-radius:50%;
  background:#ff5fa8;box-shadow:0 0 14px #ff5fa8;opacity:0;
  animation:pktClimb 2.6s linear infinite;animation-delay:calc(1.6s + var(--d) * 650ms);
}
@keyframes pktClimb{
  0%{transform:translateZ(0);opacity:0}
  15%,85%{opacity:1}
  100%{transform:translateZ(calc(3 * min(5.4vw,68px)));opacity:0}
}
.stack-paused .pkt{animation-play-state:paused}

@media(max-width:960px){
  /* beside the stacked headline; JS sets --stack-top from the h1's position */
  .stack-hero{
    top:var(--stack-top,38%);right:-2vw;
    width:min(54vw,340px);height:min(54vw,340px);
    transform:translateY(-50%);
  }
  .slab-lbl{display:none}
}

/* ── 3. DECODE SLOGAN ──────────────────────────────────────── */
.hero-slogan .dc{font-family:var(--font-mono);font-weight:500;opacity:.75}

/* ── 4. PRINCIPLE NUMERALS that draw themselves ─────────────── */
.principle-num.drawn{padding-top:0;width:52px;height:40px}
.principle-num svg{display:block;width:52px;height:40px;overflow:visible}
.principle-num text{
  font:700 34px/1 var(--font-head);letter-spacing:-.03em;
  fill:url(#pfPrismGrad);fill-opacity:0;
  stroke:#ff5fa8;stroke-width:1;stroke-dasharray:170;stroke-dashoffset:170;
}
.principle-num.go text{
  animation:numDraw 1100ms var(--ease-out) forwards,numFill 500ms ease forwards;
  animation-delay:calc(var(--n,0) * 140ms + 250ms),calc(var(--n,0) * 140ms + 1050ms);
}
@keyframes numDraw{to{stroke-dashoffset:0}}
@keyframes numFill{to{fill-opacity:1;stroke-opacity:0}}

/* ── 5. BUTTONS: readable label on the prism + press ripple ──── */
/* #fff7f0 on the prism measured 1.4–4.4:1; the page ground passes 4.3–13:1 */
.btn-primary,
.nav-links a.nav-cta,
.nav-links a.nav-cta:hover{color:var(--bg)}
.btn,.nav-cta,.btn-hire{position:relative;overflow:hidden}
.press-ripple{
  position:absolute;width:12px;height:12px;margin:-6px 0 0 -6px;border-radius:50%;
  background:rgba(255,255,255,.5);pointer-events:none;
  animation:pressRipple 650ms var(--ease-out) forwards;
}
.btn-secondary .press-ripple,.btn-hire .press-ripple{background:rgba(255,95,168,.4)}
@keyframes pressRipple{from{transform:scale(0);opacity:1}to{transform:scale(28);opacity:0}}

/* ── 6. REVEALS without the blur filter ────────────────────────
   Animating filter:blur on every revealed block is a per-frame
   repaint; opacity + rise alone reads the same at this speed.   */
.will-reveal,.revealed{filter:none}

/* ── reduced motion: final states, nothing moves ─────────────── */
@media(prefers-reduced-motion:reduce){
  .stack-ready .slab{animation:none}
  .pkt{display:none}
  .principle-num text{fill-opacity:1;stroke-opacity:0;stroke-dashoffset:0;animation:none!important}
  .press-ripple{display:none}
}

/* ══════════════════════════════════════════════════════════════
   BATCH 2 — the rest of the page becomes a stack
   ══════════════════════════════════════════════════════════════ */

/* ── 7. SOLID LAYERED SURFACES (replace frosted glass) ─────────
   Each card is an opaque slab with two thinner plates peeking out
   beneath it — the stack motif at card scale. No backdrop-filter
   anywhere on the homepage except the referral modal.           */
:root{
  --slab:      #18151d;
  --slab-edge: rgba(255,255,255,.09);
  --slab-plates:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 6px 0 -2px #131017, 0 6px 0 -1px rgba(255,255,255,.07),
    0 12px 0 -5px #0f0d12, 0 12px 0 -4px rgba(255,255,255,.045),
    0 26px 40px -20px rgba(0,0,0,.85);
}
.nav,.nav.scrolled{
  backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
  background:rgba(14,12,17,.97);
  border-color:var(--slab-edge);
}
.cap-card,.principle,.testimonial-card,.hire-card{
  backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
  background:linear-gradient(165deg,rgba(255,255,255,.045),rgba(255,255,255,0) 45%),var(--slab);
  border:1px solid var(--slab-edge);
  box-shadow:var(--slab-plates);
}
.principle:hover{box-shadow:var(--slab-plates)}
.btn-secondary,.btn-hire{
  backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
  background:var(--slab);
}
/* the cards sit on the section, the plates need room below them */
.capabilities{margin-bottom:48px}
.principles{gap:18px}

/* ── 8. STACKED SECTIONS ─────────────────────────────────────
   Sections pile onto each other with plain position:sticky (no
   scroll-jacking). JS sets --stick (≤0 for sections taller than
   the viewport, so they scroll fully before sticking), the scale
   origin and the dim overlay of the section being covered.      */
.stack-sec{
  position:sticky!important;top:var(--stick,0px);z-index:1;
  border-radius:28px 28px 0 0;
  border-top:1px solid var(--slab-edge)!important;
  box-shadow:0 -1px 0 rgba(255,255,255,.04),0 -28px 50px -18px rgba(0,0,0,.75);
  transform-origin:50% var(--origin,0px);
  transform:scale(var(--s,1));
}
.stack-sec.stack-live{will-change:transform}
.stack-dim{
  position:absolute;inset:0;border-radius:inherit;pointer-events:none;z-index:50;
  background:#050407;opacity:var(--dim,0);
}
.stack-sec .stack-tab{
  position:absolute;top:18px;right:clamp(16px,3vw,32px);z-index:3;
  font:500 .68rem/1 var(--font-mono);letter-spacing:.14em;text-transform:uppercase;color:var(--text-3);
}
.footer{position:relative;z-index:2}
@media(max-width:640px){
  .stack-sec{border-radius:20px 20px 0 0}
  .stack-sec .stack-tab{top:14px}
}

/* ── 9. FACTS STRIP — odometer digits ────────────────────────── */
.facts-sec{background:var(--bg);padding:56px 0 64px}
.facts{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}
.fact{
  padding:22px 20px 20px;border-radius:var(--radius);
  background:linear-gradient(165deg,rgba(255,255,255,.04),rgba(255,255,255,0) 45%),var(--slab);
  border:1px solid var(--slab-edge);box-shadow:var(--slab-plates);
}
.fact-n{
  display:flex;align-items:flex-end;height:1em;overflow:hidden;
  font:700 clamp(2.2rem,4.4vw,3rem)/1 var(--font-head);letter-spacing:-.03em;
  color:#ff8fc4;
}
.fact-d{display:inline-block;height:1em;overflow:hidden}
.fact-d i{display:flex;flex-direction:column;font-style:normal;
  transition:transform 1400ms cubic-bezier(.34,1.3,.64,1);transition-delay:var(--dl,0ms)}
.fact-d b,.fact-n>.fact-c{display:block;height:1em;font-weight:700;
  background:linear-gradient(135deg,#ffc2e0,#ff5fa8);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}
.fact-u{font-size:.45em;margin:0 0 .18em .18em;color:var(--text-2);-webkit-text-fill-color:var(--text-2)}
.fact-l{margin-top:12px;font:400 .7rem/1.45 var(--font-mono);letter-spacing:.08em;text-transform:uppercase;color:var(--text-3)}
@media(max-width:760px){.facts{grid-template-columns:repeat(2,1fr)}}

/* ── 10. STATUS TERMINAL (replaces the chip row) ─────────────── */
.hero-term{
  max-width:430px;border-radius:var(--radius);overflow:hidden;
  background:#16131b;border:1px solid var(--slab-edge);box-shadow:var(--slab-plates);
  animation:revealUp var(--dur-base) var(--ease-out) 440ms both;
}
.term-bar{display:flex;align-items:center;gap:7px;padding:10px 14px;border-bottom:1px solid var(--slab-edge)}
.term-bar i{width:9px;height:9px;border-radius:50%;background:rgba(255,255,255,.14)}
.term-bar span{margin-left:auto;font:400 .68rem/1 var(--font-mono);color:var(--text-3)}
.term-out{margin:0;padding:12px 16px 14px;min-height:7.2em;
  font:400 .78rem/1.75 var(--font-mono);color:var(--text-2);white-space:pre;overflow:hidden}
.term-out .tp{color:#ff5fa8}.term-out .tk{color:var(--text)}.term-out .tok{color:#3ed6a0}.term-out .tv{color:#4db8f0}
.term-caret{display:inline-block;width:.6em;height:1.1em;vertical-align:-.22em;background:#ff5fa8;animation:termBlink 1s steps(1) infinite}
@keyframes termBlink{50%{opacity:0}}
.term-paused .term-caret{animation-play-state:paused}
.pf-sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:640px){.term-out{font-size:.72rem}}

@media(prefers-reduced-motion:reduce){
  .fact-d i{transition:none}
  .term-caret,.hero-term{animation:none}
  .stack-sec{transform:none}
  .stack-dim{display:none}
}
