/* ============================================================
   PixelHoard — "How It Works" immersive experience
   VR-style first-person guided walkthrough.
   Loads AFTER styles.css (reuses tokens, nav, buttons).
   ============================================================ */

.xp-body { background: #05070e; color: var(--on-night); overflow-x: hidden; }

/* full-bleed stage that slides under the transparent nav */
.xp {
  position: relative;
  min-height: 100dvh;
  margin-top: calc(-1 * var(--nav-h));
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ---------- ambient background ---------- */
.xp-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.xp-bg-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transform: scale(1.04);
  transition: opacity 1.1s var(--ease);
}
.xp-bg-video.ready { opacity: 1; }

/* ---- animated CSS scene (always-on motion; covered when a video loads) ---- */
.xp-scene {
  position: absolute; inset: 0; overflow: hidden;
  background: linear-gradient(180deg, #060a18 0%, #0b1430 46%, #081024 100%);
}
.xp-aurora {
  position: absolute; border-radius: 50%; filter: blur(70px);
  mix-blend-mode: screen; will-change: transform; opacity: .55;
}
.xp-aurora.a1 { width: 62vw; height: 62vw; left: -12vw; top: -16vw;
  background: radial-gradient(circle, #2f6bff 0%, transparent 66%); animation: xpAuroraA 26s ease-in-out infinite alternate; }
.xp-aurora.a2 { width: 56vw; height: 56vw; right: -14vw; top: -8vw;
  background: radial-gradient(circle, #7c5cff 0%, transparent 66%); animation: xpAuroraB 33s ease-in-out infinite alternate; }
.xp-aurora.a3 { width: 70vw; height: 70vw; left: 18vw; bottom: -30vw; opacity: .42;
  background: radial-gradient(circle, #16c79a 0%, transparent 62%); animation: xpAuroraC 30s ease-in-out infinite alternate; }

/* moving perspective grid floor — strong sense of motion + depth */
.xp-floor {
  position: absolute; left: 50%; bottom: -12%; width: 260%; height: 78%;
  transform: translateX(-50%) perspective(560px) rotateX(70deg);
  background-image:
    linear-gradient(rgba(120,160,255,.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,160,255,.16) 1px, transparent 1px);
  background-size: 62px 62px;
  mask-image: radial-gradient(72% 82% at 50% 100%, #000 6%, transparent 74%);
  -webkit-mask-image: radial-gradient(72% 82% at 50% 100%, #000 6%, transparent 74%);
  opacity: .85; animation: xpFloor 7s linear infinite;
}

/* drifting particle dust — two layers at different speeds for parallax */
.xp-particles { position: absolute; inset: -40% 0 0 0; opacity: .55;
  background-image: radial-gradient(1.6px 1.6px at 50% 50%, rgba(255,255,255,.7), transparent 60%);
  background-size: 96px 96px; animation: xpDust 20s linear infinite; }
.xp-particles::after { content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(1.2px 1.2px at 30% 70%, rgba(170,205,255,.6), transparent 60%);
  background-size: 150px 150px; animation: xpDust 34s linear infinite; }

/* slow diagonal light sweep */
.xp-sweep { position: absolute; inset: -20%;
  background: linear-gradient(115deg, transparent 38%, rgba(150,180,255,.07) 49%, transparent 60%);
  animation: xpSweep 13s ease-in-out infinite; }

/* VR vignette + cinematic grade */
.xp-vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 95% at 50% 36%, transparent 38%, rgba(3,5,12,.55) 72%, rgba(3,5,12,.92) 100%),
    linear-gradient(180deg, rgba(3,5,12,.62), rgba(3,5,12,.18) 26%, rgba(3,5,12,.5) 64%, rgba(3,5,12,.94));
}
.xp-grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- over-the-shoulder figure (you, in the headset) ---------- */
.xp-figure {
  position: fixed; left: 50%; bottom: 0; z-index: 2;
  width: min(640px, 92vw); transform: translateX(-50%);
  pointer-events: none;
  filter: drop-shadow(0 -8px 50px rgba(70,120,255,.28));
  animation: xpBreathe 7s ease-in-out infinite;
}
.xp-figure svg { width: 100%; height: auto; display: block; }
@media (max-height: 720px) { .xp-figure { width: min(520px, 86vw); opacity: .9; } }

/* ---------- stage ---------- */
.xp-stage {
  position: relative; z-index: 3; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--nav-h) + 26px) 5% 210px;
  text-align: center;
}

/* phase rail */
.xp-rail { display: flex; gap: 8px; align-items: center; margin-bottom: 30px; opacity: .96; }
.xp-rail .seg {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 15px; border-radius: 999px; font-size: .76rem; font-weight: 700;
  letter-spacing: .04em; color: var(--on-night-soft);
  background: rgba(140,170,255,.08); border: 1px solid rgba(140,170,255,.16);
  transition: .45s var(--ease); backdrop-filter: blur(6px);
}
.xp-rail .seg .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .6; }
.xp-rail .seg.on { color: #fff; background: rgba(47,107,255,.24); border-color: rgba(120,160,255,.5); box-shadow: 0 8px 24px rgba(47,107,255,.3); }
.xp-rail .seg.on .d { opacity: 1; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.xp-rail .arrow { color: rgba(170,190,255,.4); }
@media (max-width: 620px) { .xp-rail .seg { padding: 7px 11px; font-size: .68rem; } .xp-rail .seg .lbl { display: none; } }

/* steps */
.xp-steps { position: relative; width: min(940px, 100%); }
.xp-step {
  position: absolute; inset: 0; margin: auto;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .5s var(--ease), visibility .5s;
}
.xp-step.active { opacity: 1; visibility: visible; pointer-events: auto; position: relative; }
.xp-eyebrow {
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 15px; border-radius: 999px;
  font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  background: rgba(120,160,255,.12); border: 1px solid rgba(140,170,255,.26); color: #b9ccff;
  backdrop-filter: blur(6px);
}
.xp-step h2 {
  font-size: clamp(1.9rem, 4.4vw, 3.4rem); line-height: 1.06; max-width: 18ch;
  background: var(--grad-hero-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.xp-step h2 .hl { background: linear-gradient(120deg, #6f9bff, #38d6f5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.xp-step .xp-lead { font-size: clamp(1rem, 1.7vw, 1.18rem); color: var(--on-night-soft); max-width: 52ch; }

/* keynote entrance — children stagger in when their step is active */
.xp-step [data-anim] {
  opacity: 0; transform: translateY(42px);
  transition: opacity .7s var(--ease), transform .8s var(--spring);
  transition-delay: calc(var(--i, 0) * 110ms);
}
.xp-step [data-anim="left"]  { transform: translateX(-54px); }
.xp-step [data-anim="right"] { transform: translateX(54px); }
.xp-step [data-anim="scale"] { transform: scale(.86); }
.xp-step [data-anim="blur"]  { filter: blur(10px); transition: opacity .7s, transform .8s var(--spring), filter .7s; }
.xp-step.active [data-anim] { opacity: 1; transform: none; filter: none; }

/* ---------- 3D depth ---------- */
.xp-steps { perspective: 1400px; }
.xp-step { transform-style: preserve-3d; }
/* visuals fly in from depth, rotating into place */
.xp-step [data-anim="card3d"] {
  opacity: 0;
  transform: translateY(30px) translateZ(-120px) rotateX(12deg) rotateY(-20deg);
  transform-origin: 50% 65%;
}
.xp-step.active [data-anim="card3d"] { opacity: 1; transform: none; }
/* pointer-driven head-look tilt (set via JS), self-perspective so it always reads 3D */
.xp-tilt {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .35s var(--ease); will-change: transform;
}

/* ---------- immersive / fullscreen mode ---------- */
body.xp-immersive .nav,
body.xp-immersive .footer { display: none !important; }
body.xp-immersive .xp { margin-top: 0; }
body.xp-immersive .xp-stage { padding-top: 38px; }
body.xp-immersive .xp-exit { top: 16px; }
/* native fullscreen backdrop */
.xp:fullscreen, html:fullscreen, body:fullscreen { background: #05070e; }

/* ---------- mock device / panels inside steps ---------- */
.xp-visual { width: min(460px, 100%); margin-top: 8px; }
.xp-visual.wide { width: min(720px, 100%); }

.glass {
  background: linear-gradient(170deg, rgba(22,34,68,.86), rgba(10,18,42,.92));
  border: 1px solid rgba(140,170,255,.22); border-radius: 22px;
  box-shadow: 0 36px 90px rgba(3,8,24,.66), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(10px); text-align: left; overflow: hidden;
}

/* phone frame */
.xp-phone { width: 300px; margin: 0 auto; border-radius: 34px; padding: 12px;
  background: linear-gradient(160deg, #1a2540, #0d1730); border: 1px solid rgba(140,170,255,.22);
  box-shadow: 0 40px 90px rgba(3,8,24,.7); }
.xp-phone .screen { border-radius: 24px; background: #0a1326; overflow: hidden; }
.xp-phone .bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid rgba(140,170,255,.12); font-size: .76rem; color: var(--on-night-soft); }
.xp-phone .bar .back { width: 8px; height: 8px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.xp-phone .body { padding: 16px; }

/* form rows */
.mock-field { margin-bottom: 13px; }
.mock-field label { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #93a6cc; margin-bottom: 6px; }
.mock-input { display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-radius: 12px; background: rgba(120,160,255,.08); border: 1px solid rgba(140,170,255,.2); font-size: .9rem; color: #eaf0ff; }
.mock-input.tall { align-items: flex-start; min-height: 56px; }
.mock-input .muted { color: #7d8fb5; }
.mock-row { display: flex; gap: 10px; }
.mock-row .mock-field { flex: 1; }

/* checkbox list (choose screens) */
.mock-list { display: grid; gap: 9px; }
.mock-list .item { display: flex; align-items: center; gap: 11px; padding: 12px 13px; border-radius: 13px; background: rgba(120,160,255,.07); border: 1px solid rgba(140,170,255,.16); }
.mock-list .item .chk { width: 22px; height: 22px; border-radius: 7px; border: 2px solid rgba(140,170,255,.4); flex: none; display: grid; place-items: center; color: #fff; }
.mock-list .item.sel .chk { background: var(--grad-blue); border-color: transparent; }
.mock-list .item .nm { font-weight: 600; font-size: .9rem; color: #fff; }
.mock-list .item .sub { font-size: .72rem; color: #8294ba; }
.mock-list .item .spacer { margin-left: auto; }
.pin { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(47,107,255,.18); color: #8fb3ff; }

/* creative thumb */
.mock-thumb { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 16/9; background: #0a1326; margin-bottom: 13px; }
.mock-thumb video, .mock-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mock-thumb .play { position: absolute; inset: 0; display: grid; place-items: center; }
.mock-thumb .play span { width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.4); backdrop-filter: blur(4px); display: grid; place-items: center; border: 1px solid rgba(255,255,255,.4); }
.mock-thumb .badge { position: absolute; top: 9px; left: 9px; font-size: .64rem; font-weight: 800; letter-spacing: .06em; padding: 4px 9px; border-radius: 7px; background: rgba(0,0,0,.55); color: #fff; }

/* checkout */
.mock-line { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px dashed rgba(140,170,255,.18); font-size: .9rem; color: var(--on-night-soft); }
.mock-line:last-of-type { border-bottom: 0; }
.mock-line b { color: #fff; }
.mock-total { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 13px; border-top: 1px solid rgba(140,170,255,.28); }
.mock-total .t { font-size: .8rem; color: #8294ba; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.mock-total .v { font-family: "Plus Jakarta Sans"; font-size: 1.7rem; font-weight: 800; color: #fff; }
.mock-btn { margin-top: 14px; width: 100%; text-align: center; padding: 13px; border-radius: 13px; font-weight: 700; font-family: "Plus Jakarta Sans"; background: var(--grad-cta); color: #fff; box-shadow: var(--shadow-cta); }
.mock-btn.blue { background: var(--grad-blue); box-shadow: var(--shadow-blue); }

/* status chip */
.mock-status { display: flex; align-items: center; gap: 13px; padding: 18px; }
.mock-status .ring { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(245,166,35,.3); border-top-color: #f5a623; flex: none; animation: xpSpin 1.1s linear infinite; }
.mock-status .ring.ok { border-color: rgba(22,199,154,.35); border-top-color: #16c79a; animation: none; display: grid; place-items: center; color: #6ff0c4; }
.mock-status h4 { font-size: 1rem; color: #fff; margin: 0 0 2px; }
.mock-status p { font-size: .82rem; color: #8294ba; margin: 0; }

/* admin queue */
.mock-admin .head { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid rgba(140,170,255,.14); }
.mock-admin .dot { width: 9px; height: 9px; border-radius: 50%; }
.mock-admin .dot.r { background: #ff5f57; } .mock-admin .dot.y { background: #febc2e; } .mock-admin .dot.g { background: #28c840; }
.mock-admin .ttl { margin-left: 6px; font-size: .8rem; color: var(--on-night-soft); }
.mock-admin .rows { padding: 12px 16px; display: grid; gap: 9px; }
.mock-arow { display: flex; align-items: center; gap: 12px; padding: 13px; border-radius: 13px; background: rgba(120,160,255,.06); border: 1px solid rgba(140,170,255,.14); }
.mock-arow.focus { border-color: rgba(120,160,255,.45); background: rgba(47,107,255,.12); box-shadow: 0 0 0 1px rgba(120,160,255,.25); }
.mock-arow .thumb { width: 56px; height: 36px; border-radius: 8px; overflow: hidden; flex: none; background: #0a1326; }
.mock-arow .thumb img, .mock-arow .thumb video { width: 100%; height: 100%; object-fit: cover; }
.mock-arow .meta { min-width: 0; }
.mock-arow .meta .nm { font-weight: 700; font-size: .88rem; color: #fff; }
.mock-arow .meta .sub { font-size: .73rem; color: #8294ba; }
.mock-arow .st { margin-left: auto; font-size: .66rem; font-weight: 800; letter-spacing: .04em; padding: 5px 10px; border-radius: 8px; white-space: nowrap; transition: .35s; }
.st-pending { background: rgba(245,166,35,.16); color: #ffd27a; }
.st-live { background: rgba(22,199,154,.18); color: #6ff0c4; }
.mock-actions { display: flex; gap: 9px; padding: 0 16px 16px; }
.mock-actions .a { flex: 1; text-align: center; padding: 11px; border-radius: 11px; font-weight: 700; font-size: .85rem; font-family: "Plus Jakarta Sans"; transition: transform .15s, box-shadow .2s; }
.mock-actions .reject { background: rgba(255,77,77,.12); color: #ff9b9b; border: 1px solid rgba(255,77,77,.28); }
.mock-actions .approve { background: var(--grad-blue); color: #fff; box-shadow: var(--shadow-blue); position: relative; }
.mock-actions .approve.press { transform: scale(.94); box-shadow: 0 6px 16px rgba(47,107,255,.5); }

/* fake cursor for the approve animation */
.xp-cursor {
  position: absolute; z-index: 6; width: 26px; height: 26px; left: 0; top: 0;
  opacity: 0; pointer-events: none; transform: translate(-40px, 40px);
  transition: transform 1s var(--ease), opacity .4s;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.5));
}
.xp-cursor svg { width: 100%; height: 100%; }

/* ---------- controls ---------- */
.xp-controls {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 5;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 12px; border-radius: 999px;
  background: rgba(8,14,32,.6); border: 1px solid rgba(140,170,255,.2); backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(3,8,24,.6);
}
.xp-back {
  background: transparent; border: 0; color: var(--on-night-soft); cursor: pointer;
  font: 600 .92rem "Inter", sans-serif; padding: 10px 16px; border-radius: 999px; transition: .2s;
  display: inline-flex; align-items: center; gap: 7px;
}
.xp-back:hover { color: #fff; background: rgba(140,170,255,.1); }
.xp-back[disabled] { opacity: .3; cursor: default; }
.xp-dots { display: flex; gap: 8px; }
.xp-dots .dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(140,170,255,.3); transition: .35s var(--spring); cursor: pointer; }
.xp-dots .dot.on { background: var(--cyan); width: 26px; border-radius: 6px; box-shadow: 0 0 12px rgba(56,214,245,.6); }
.xp-next { padding: 12px 24px; }
@media (max-width: 520px) { .xp-controls { gap: 10px; width: calc(100% - 28px); justify-content: space-between; } .xp-next { padding: 12px 18px; } }

/* skip / exit top-right */
.xp-exit {
  position: fixed; top: calc(var(--nav-h) + 8px); right: 5%; z-index: 6;
  font-size: .82rem; color: var(--on-night-soft); display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px; background: rgba(8,14,32,.5);
  border: 1px solid rgba(140,170,255,.18); backdrop-filter: blur(8px); transition: .2s;
}
.xp-exit:hover { color: #fff; border-color: rgba(140,170,255,.4); }

/* ---------- full-screen TV finale ---------- */
.xp-finale {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 50%, #0a0f1e, #000 80%);
  opacity: 0; visibility: hidden; transition: opacity .7s var(--ease), visibility .7s;
}
.xp-finale.show { opacity: 1; visibility: visible; }
.tv {
  position: relative; width: min(94vw, 168vh); aspect-ratio: 16/9;
  transform: scale(.92); transition: transform .8s var(--spring);
  padding: clamp(12px, 1.6vw, 26px); border-radius: clamp(14px, 1.8vw, 26px);
  background: linear-gradient(160deg, #20242e, #0a0c12 70%);
  box-shadow: 0 50px 120px rgba(0,0,0,.8), inset 0 2px 0 rgba(255,255,255,.08), inset 0 -3px 8px rgba(0,0,0,.6);
  border: 1px solid #2c313d;
}
.xp-finale.show .tv { transform: scale(1); }
.tv::after { /* subtle screen glow */ content: ""; position: absolute; inset: 6%; box-shadow: 0 0 120px 10px rgba(70,120,255,.18); border-radius: 8px; pointer-events: none; }
.tv-screen { width: 100%; height: 100%; border-radius: clamp(6px, .8vw, 12px); overflow: hidden; background: #000; position: relative; }
.tv-screen video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tv-scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(rgba(255,255,255,.025) 0 2px, transparent 2px 4px); mix-blend-mode: overlay; }
.tv-live { position: absolute; top: 16px; left: 16px; z-index: 2; display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); font-size: .78rem; font-weight: 800; letter-spacing: .06em; color: #fff; }
.tv-live .d { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: livePulse 1.6s infinite; }
.tv-foot { position: absolute; left: 50%; bottom: -2%; transform: translateX(-50%); width: 18%; height: 10px; background: linear-gradient(180deg,#2c313d,#10131a); border-radius: 0 0 8px 8px; }
.esc-hint {
  position: fixed; top: 22px; right: 26px; z-index: 10000;
  font-size: .82rem; font-weight: 600; color: rgba(255,255,255,.82);
  display: inline-flex; align-items: center; gap: 9px; padding: 9px 15px; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); backdrop-filter: blur(8px);
  animation: xpHintPulse 2.6s ease-in-out infinite;
}
.esc-hint kbd { font: 700 .74rem "Inter", sans-serif; padding: 3px 7px; border-radius: 6px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); }
.tv-replay { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 10000; display: flex; gap: 12px; }

/* ---------- keyframes ---------- */
@keyframes xpAuroraA { from { transform: translate(0,0) scale(1); } to { transform: translate(9vw, 7vh) scale(1.18); } }
@keyframes xpAuroraB { from { transform: translate(0,0) scale(1); } to { transform: translate(-8vw, 9vh) scale(1.12); } }
@keyframes xpAuroraC { from { transform: translate(0,0) scale(1); } to { transform: translate(6vw, -7vh) scale(1.22); } }
@keyframes xpFloor { from { background-position: 0 0; } to { background-position: 0 62px; } }
@keyframes xpDust { from { background-position: 0 0; } to { background-position: 0 -680px; } }
@keyframes xpSweep { 0%,100% { transform: translateX(-26%); } 50% { transform: translateX(26%); } }
@keyframes xpBreathe { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-8px); } }
@keyframes xpSpin { to { transform: rotate(360deg); } }
@keyframes xpHintPulse { 0%,100% { opacity: .7; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .xp-aurora, .xp-floor, .xp-particles, .xp-particles::after, .xp-sweep,
  .xp-figure, .mock-status .ring, .esc-hint { animation: none !important; }
  .xp-bg-video { transition: none; }
  .xp-step [data-anim] { transition: opacity .3s ease; transform: none !important; filter: none !important; }
}
