/* ============================================================
   APEX · vibetribe.studio/apex
   A 3D, scroll-driven tour of the real Apex screens.

   Contract with apex.js: without the .motion class (no JS, the
   ?motion=off hook, or reduced motion) every scene renders as a
   flat, finished screen in normal flow. apex.js adds html.motion,
   which turns each scene into a sticky, scroll-scrubbed 3D stage.
   ============================================================ */
:root {
  --bg: #030305;
  --bg-2: #0a0a0d;
  --card: #121216;
  --card-2: #1a1a1f;

  --border: rgba(255, 255, 255, 0.10);
  --border-2: rgba(255, 255, 255, 0.20);

  --text: #ffffff;
  --text-2: #a7a7b3;
  --text-3: #75757f;
  --text-4: #52525b;
  --on-accent: #000000;

  --accent: #e4e4e7;
  --accent-2: #ffffff;

  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, 0.12);
  --red: #f87171;
  --blue: #60a5fa;

  /* The Apex app's violet accent (hsl 258 90% 70%) */
  --apex: #976ef7;
  --apex-2: #b49cfa;
  --apex-3: #d3c6fd;
  --apex-bg: rgba(151, 110, 247, 0.14);
  --apex-line: rgba(151, 110, 247, 0.42);

  --tint-1: rgba(255, 255, 255, 0.03);
  --tint-2: rgba(255, 255, 255, 0.07);
  --tint-3: rgba(255, 255, 255, 0.12);
  --tint-4: rgba(255, 255, 255, 0.20);

  --font-display: "Inter", -apple-system, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;

  --header-h: 64px;
  --gutter: max(32px, calc((100vw - 1320px) / 2 + 32px));
  --modal-accent: var(--apex);
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* clip (not hidden) so position: sticky keeps working */
body { overflow-x: clip; padding-top: var(--header-h); }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 70% 0%, rgba(151, 110, 247, 0.12), transparent 65%),
    radial-gradient(50% 45% at 0% 100%, rgba(96, 165, 250, 0.06), transparent 60%),
    radial-gradient(40% 40% at 100% 70%, rgba(151, 110, 247, 0.06), transparent 60%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
main { position: relative; z-index: 1; }
section { scroll-margin-top: var(--header-h); }

/* Lenis smooth scroll */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ============================================================
   SHARED PIECES
   ============================================================ */
.shell {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 32px;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow .pip {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--apex);
  box-shadow: 0 0 0 4px var(--apex-bg);
}
.eyebrow .pip.green { background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.accent {
  background: linear-gradient(100deg, var(--apex-3) 0%, var(--apex) 55%, var(--blue) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid var(--border-2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.btn:hover { background: var(--tint-2); border-color: var(--tint-4); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 14px; height: 14px; }
.btn.primary { background: var(--accent-2); color: var(--on-accent); border-color: var(--accent-2); font-weight: 600; }
.btn.apex {
  background: var(--apex);
  border-color: var(--apex);
  color: #0d0f17;
  font-weight: 600;
  box-shadow: 0 12px 34px -10px rgba(151, 110, 247, 0.8);
}
.btn.apex:hover { background: var(--apex-2); border-color: var(--apex-2); }
.btn.apex svg { transition: transform 0.25s var(--ease-out); }
.btn.apex:hover svg { transform: translateX(3px); }
.btn:focus-visible, .reach-out:focus-visible { outline: 2px solid var(--apex-2); outline-offset: 3px; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(5, 5, 8, 0.6);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-2);
}
.nav .brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); font-weight: 600; }
.nav .brand-mark { height: 30px; width: auto; display: block; }
.nav .brand-mark .vibe-fill { fill: var(--text); }
.nav .brand-mark .vibe-text { fill: var(--bg); }
.nav .brand-mark .tribe-text { fill: var(--text); }
.nav .brand-mark .frame { stroke: var(--text); fill: none; }
.nav .crumb { display: inline-flex; align-items: center; gap: 7px; color: var(--apex-3); }
.nav .crumb-mark { width: 16px; height: 16px; }
.reach-out {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--tint-1);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.reach-out:hover { background: var(--tint-2); border-color: var(--tint-4); }
.reach-out .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-bg);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.progress {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--apex), var(--blue));
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.motion .progress { display: block; }

/* ============================================================
   3D STAGES
   A .fit box holds a fixed-size .stage, scaled by --s (set in JS)
   so the 1280 x 800 app window keeps its proportions at any width.
   The stage owns the perspective; .cam / .rig / .spin are nested
   3D groups the timelines move independently.
   ============================================================ */
.fit { position: relative; --s: 0.5; }
.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--w) * 1px);
  height: calc(var(--h) * 1px);
  transform: translate(-50%, -50%) scale(var(--s));
  perspective: 2600px;
  perspective-origin: 50% 40%;
}
.cam, .rig, .spin {
  position: absolute;
  left: 0;
  top: 0;
  width: 1280px;
  height: 800px;
  transform-style: preserve-3d;
}
.stage > .cam, .stage > .rig { left: calc(50% - 640px); top: calc(50% - 400px); }

.floor {
  position: absolute;
  left: -520px;
  right: -520px;
  top: -380px;
  bottom: -380px;
  transform: translateZ(-90px);
  pointer-events: none;
  background-image:
    radial-gradient(closest-side, rgba(151, 110, 247, 0.22), transparent 70%),
    linear-gradient(rgba(151, 110, 247, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(151, 110, 247, 0.16) 1px, transparent 1px);
  background-size: 100% 100%, 64px 64px, 64px 64px;
  background-position: center, center, center;
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
  opacity: 0.6;
}

/* ============================================================
   HERO
   ============================================================ */
.hero { position: relative; padding: 72px 0 40px; }
.hero .pin { position: relative; }
.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 32px;
  text-align: center;
}
.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(46px, 7.4vw, 104px);
  line-height: 0.98;
  letter-spacing: -0.05em;
  font-weight: 500;
  margin: 22px 0 0;
  padding-bottom: 0.06em;
}
.hero-copy h1 .ln { display: inline-block; }
.hero-copy .lede {
  margin: 24px auto 0;
  max-width: 640px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-2);
}
.cta-row { display: flex; gap: 12px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.hero-fit { height: clamp(320px, 56vw, 780px); margin-top: 24px; }
.hero-fit .rig { transform: rotateX(12deg) scale(0.92); }
.hero-beat {
  max-width: 620px;
  margin: 24px auto 0;
  padding: 0 32px;
  text-align: center;
}
.hero-beat h2, .copy h2 {
  font-family: var(--font-display);
  font-size: clamp(32px, 3.6vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 500;
  margin: 18px 0 0;
  padding-bottom: 0.06em;
}
.hero-beat p, .copy .beat {
  margin: 18px 0 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-2);
}
.tags, .scroll-hint { display: none; }

/* ============================================================
   SCENES (static layout first)
   ============================================================ */
.scene { position: relative; padding: 96px 0; }
/* The 3D floors reach past the stage; clip sideways (clip keeps sticky working) */
.hero, .scene { overflow-x: clip; }
.scene .pin {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 32px;
}
.scene .fit { height: clamp(320px, 46vw, 680px); }
.copy { position: relative; z-index: 2; }
.beats { margin-top: 4px; }

/* ============================================================
   MOTION LAYOUT: sticky, full-viewport stages
   ============================================================ */
.motion .hero,
.motion .scene { height: var(--len); padding: 0; }
.motion .hero .pin,
.motion .scene .pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  margin-top: calc(var(--header-h) * -1);
  padding-top: var(--header-h);
  overflow: hidden;
}
.motion .scene .pin {
  max-width: none;
  padding-left: var(--gutter);
  padding-right: 0;
  gap: 24px;
}
.motion .scene .fit { height: 100%; }

.motion .hero-copy {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--header-h) + clamp(28px, 6vh, 72px));
}
.motion .hero-fit {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--header-h);
  bottom: 0;
  height: auto;
  margin: 0;
}
.motion .hero-fit .rig { transform: none; }
.motion .hero-beat {
  position: absolute;
  z-index: 2;
  left: var(--gutter);
  top: calc(var(--header-h) + 5vh);
  max-width: 400px;
  margin: 0;
  padding: 0;
  text-align: left;
  visibility: hidden;
}
.motion .hero-beat h2 { font-size: clamp(30px, 3vw, 44px); }
.motion .hero-beat p { font-size: 15.5px; }

.motion .beats { display: grid; }
.motion .beat { grid-area: 1 / 1; }

/* Hero callouts, positioned each frame from anchors inside the 3D layers */
.motion .tags { display: block; position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.tag {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  visibility: hidden;
  will-change: transform;
}
.tag[data-side="r"] { flex-direction: row-reverse; }
.tag-box {
  display: block;
  padding: 11px 15px;
  border-radius: 12px;
  background: rgba(10, 10, 16, 0.78);
  border: 1px solid rgba(151, 110, 247, 0.4);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.85);
}
.tag-box b { display: block; font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.tag-box small { display: block; margin-top: 3px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.tag-line { width: 44px; height: 1px; background: linear-gradient(90deg, rgba(151, 110, 247, 0.15), rgba(151, 110, 247, 0.95)); }
.tag[data-side="r"] .tag-line { background: linear-gradient(270deg, rgba(151, 110, 247, 0.15), rgba(151, 110, 247, 0.95)); }
.tag-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--apex-3);
  box-shadow: 0 0 0 4px rgba(151, 110, 247, 0.3), 0 0 16px rgba(151, 110, 247, 0.9);
}
.anc { position: absolute; left: 0; top: 0; width: 1px; height: 1px; pointer-events: none; }
.db-kpis .anc { left: 0; top: 0; }
.wp .anc { left: 0; top: 100%; }
.others .anc { left: 0; top: 50%; }
.load .anc, .risk .anc, .doit .anc { left: 100%; top: 50%; }

.motion .scroll-hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-3);
}
.scroll-hint i {
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, var(--apex), transparent);
  animation: hint 1.8s ease-in-out infinite;
  transform-origin: top;
}
@keyframes hint { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

.motion .caret { display: inline-block; }

/* ============================================================
   INTEGRATIONS CORE
   ============================================================ */
.ig-core {
  position: absolute;
  left: 640px;
  top: 420px;
  width: 0;
  height: 0;
  visibility: hidden;
  transform-style: preserve-3d;
}
.ig-core svg {
  position: absolute;
  left: -70px;
  top: -70px;
  width: 140px;
  height: 140px;
  padding: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #1d1932, #0a0a12 70%);
  border: 1px solid rgba(151, 110, 247, 0.5);
  box-shadow: 0 0 80px 10px rgba(151, 110, 247, 0.45), inset 0 0 30px rgba(151, 110, 247, 0.35);
}
.ig-ring {
  position: absolute;
  left: -150px;
  top: -150px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  border: 1px dashed rgba(151, 110, 247, 0.4);
  animation: spin 18s linear infinite;
}
.ig-ring.r2 { left: -230px; top: -230px; width: 460px; height: 460px; border-style: solid; border-color: rgba(151, 110, 247, 0.16); animation-duration: 30s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   CTA + WALL
   ============================================================ */
.cta { position: relative; padding: 150px 0 120px; text-align: center; overflow: hidden; }
.cta-glow {
  position: absolute;
  left: 50%;
  top: 34%;
  width: 1000px;
  height: 700px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(closest-side, rgba(151, 110, 247, 0.24), transparent),
    radial-gradient(40% 40% at 70% 60%, rgba(96, 165, 250, 0.1), transparent);
  pointer-events: none;
}
.cta-inner { display: flex; flex-direction: column; align-items: center; }
.cta h2 {
  font-family: var(--font-display);
  font-size: clamp(44px, 7vw, 96px);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 500;
  margin: 22px 0 0;
  padding-bottom: 0.06em;
}
.cta p { margin: 26px auto 0; max-width: 560px; font-size: 18px; line-height: 1.6; color: var(--text-2); }
.cta-actions { display: flex; gap: 14px; margin-top: 40px; flex-wrap: wrap; justify-content: center; }

.wall-fit { height: clamp(260px, 42vw, 640px); margin-top: 56px; }
.wall { perspective: 1500px; perspective-origin: 50% 50%; }
.wall-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: translateZ(1150px);
}
.wall-slot {
  position: absolute;
  left: -208px;
  top: -130px;
  width: 416px;
  height: 260px;
  transform-style: preserve-3d;
  transform: translateY(var(--y)) rotateY(var(--a)) translateZ(-1150px);
}
.wall-item {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  transform-style: preserve-3d;
}
.wall-item .a-win {
  transform: scale(0.325);
  transform-origin: 0 0;
  pointer-events: none;
}
.wall-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 35%);
  pointer-events: none;
}

.stats {
  margin: 72px auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  max-width: 860px;
  padding-top: 36px;
  border-top: 1px solid var(--tint-2);
}
.stat { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.stat-n {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, #a1a1aa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-l {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  max-width: 220px;
  line-height: 1.6;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer { position: relative; z-index: 1; padding: 36px 0 56px; border-top: 1px solid var(--tint-2); }
footer .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
}
footer .right { display: inline-flex; gap: 22px; align-items: center; flex-wrap: wrap; }
footer a { transition: color 0.2s ease; }
footer a:hover, footer a[aria-current="page"] { color: var(--text); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 899px) {
  .shell { padding: 0 20px; }
  .nav { font-size: 10px; gap: 12px; }
  .nav .brand-label { display: none; }
  .reach-out { padding: 8px 14px; font-size: 10px; letter-spacing: 0.16em; }

  .hero { padding-top: 48px; }
  .hero-copy { padding: 0 20px; }
  .hero-copy .lede { font-size: 16px; }
  .hero-fit { height: 62vw; }

  .scene { padding: 64px 0; }
  .scene .pin { grid-template-columns: 1fr; gap: 20px; padding: 0 20px; }
  .scene .fit { height: 64vw; margin: 0 -20px; }
  .hero-beat h2, .copy h2 { font-size: 30px; }
  .hero-beat p, .copy .beat { font-size: 15.5px; }

  .motion .scene .pin {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 6px;
    padding: calc(var(--header-h) + 22px) 20px 8px;
  }
  .motion .scene .fit { height: auto; margin: 0 -20px; }
  .motion .copy h2 { font-size: 27px; margin-top: 12px; }
  .motion .copy .beat { font-size: 14.5px; margin-top: 10px; }

  .motion .hero-copy { top: calc(var(--header-h) + 28px); }
  .motion .hero-copy h1 { font-size: 46px; }
  .motion .hero-beat { left: 20px; right: 20px; top: calc(var(--header-h) + 22px); max-width: none; }
  .motion .hero-beat h2 { font-size: 27px; }
  .motion .hero-beat p { font-size: 14.5px; margin-top: 10px; }
  .motion .tags { display: none; }

  .cta { padding: 110px 0 96px; }
  .cta p { font-size: 16px; }
  .wall-fit { height: 46vw; margin-top: 40px; }
  .stats { grid-template-columns: 1fr; gap: 26px; margin-top: 56px; }
  footer .shell { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .reach-out .dot, .scroll-hint i, .ig-ring, .caret { animation: none; }
}
