/* AverX homepage — direction J · "Vision".
   Visual reference: design/averx-home.html. Spec: design/BRIEF.md.
   No inline styles anywhere (keeps the CSP strict: style-src has no 'unsafe-inline'). */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg: #F5F6FA;
  --surface: #FFFFFF;
  --ink: #111433;
  --muted: #4C5070;
  --subtle: #5F6380;
  --border: #E4E5EE;
  --border-2: #E8E9F1;
  --accent: #4201FF;
  --accent-soft: #EEEAFE;
  --label: #5A4BD1;

  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --font-hand: "Caveat", cursive;

  --max: 1280px;
  --gutter: 32px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

/* ── Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 10;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 700;
}
.skip-link:focus { top: 16px; color: #fff; }

.eyebrow {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--label);
}
.h2 {
  font-weight: 800; font-size: clamp(36px, 4.4vw, 58px);
  line-height: 1.02; letter-spacing: -0.045em;
}
.accent { color: var(--accent); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; border-radius: 14px; min-height: 44px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -12px rgba(66, 1, 255, .5); }
.btn--dark { background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 15px; }
.btn--primary { background: var(--accent); color: #fff; padding: 17px 28px; font-size: 17px; }
.btn--secondary { background: var(--surface); border: 1px solid #DDDFEA; color: var(--ink); padding: 17px 28px; font-size: 17px; }
.btn--dark:hover, .btn--primary:hover { color: #fff; }
.btn--secondary:hover { color: var(--ink); }

/* ── Header ─────────────────────────────────────────────── */
.site-header .wrap {
  padding-top: 22px; padding-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo:hover { color: var(--ink); }
.logo-tile {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px;
}
.logo-word { font-weight: 800; font-size: 22px; letter-spacing: -0.03em; }
.nav { display: flex; gap: 32px; font-size: 15px; font-weight: 600; flex-wrap: wrap; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--ink); }

/* ── Hero ───────────────────────────────────────────────── */
.hero .wrap {
  padding-top: 70px; padding-bottom: 110px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 56px;
}
.hero-copy { flex: 999 1 520px; min-width: 0; }
.hero-copy .eyebrow { margin-bottom: 28px; animation: fade 1s ease both; }
.hero-title {
  font-weight: 800; font-size: clamp(56px, 7.4vw, 112px);
  line-height: .96; letter-spacing: -0.055em;
}
.hero-title .line { display: block; animation: up 1s var(--ease-out) both; }
.hero-title .line:nth-child(1) { animation-delay: .1s; }
.hero-title .line:nth-child(2) { animation-delay: .25s; }
.next { position: relative; display: inline-block; color: var(--accent); }
.next::after {
  content: ""; position: absolute; left: 0; right: .12em; bottom: .02em; height: .07em;
  border-radius: 99px; background: var(--accent); transform-origin: left;
  animation: underline .8s cubic-bezier(.6, 0, .2, 1) 1s both;
}
.hero-lede {
  margin-top: 34px; max-width: 520px; font-size: 20px; line-height: 1.55; color: var(--muted);
  animation: up 1s ease .5s both;
}
.hero-actions { margin-top: 38px; display: flex; gap: 12px; flex-wrap: wrap; animation: up 1s ease .65s both; }

.hero-visual {
  flex: 1 1 540px; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  animation: fade 1.2s ease .3s both;
}

/* ── Vision animation ───────────────────────────────────── */
/* The panel is a 540×600 design canvas that scales as one unit.
   --u is one design pixel; everything inside is sized in --u so
   the art keeps its proportions at any width (no layout shift). */
.vision {
  position: relative; width: 540px; max-width: 100%; aspect-ratio: 540 / 600;
  container-type: inline-size;
  animation: dream 9s ease-in-out infinite;
}
.vision * { --u: calc(100cqw / 540); }
.vision-glow {
  position: absolute; inset: 7.4%; border-radius: 50%; background: #DCD4FF;
  filter: blur(70px); animation: glowpulse 9s ease-in-out infinite;
}
.vision-frame {
  position: absolute; inset: 0; border-radius: 40px; overflow: hidden;
  -webkit-mask-image:
    linear-gradient(to right, transparent 0%, #000 4%, #000 96%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 4%, #000 96%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0%, #000 4%, #000 96%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 4%, #000 96%, transparent 100%);
  mask-composite: intersect;
}
.stage {
  position: absolute; inset: 0; opacity: 0; filter: blur(6px);
  transition: opacity 2.2s ease, filter 2.2s ease;
}
.stage.is-active { opacity: .95; filter: blur(0); }
.stage-live { position: absolute; inset: 0; }

/* Stage 0 · sketch on graph paper */
.stage--sketch {
  background-color: #FCFCFF;
  background-image:
    linear-gradient(#D9D5F0 1px, transparent 1px), linear-gradient(90deg, #D9D5F0 1px, transparent 1px),
    linear-gradient(#ECEAF7 1px, transparent 1px), linear-gradient(90deg, #ECEAF7 1px, transparent 1px);
  background-size: 18.52% 16.67%, 18.52% 16.67%, 3.704% 3.333%, 3.704% 3.333%;
}
.sketch-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sketch-svg g { fill: none; stroke: #55536D; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sk { stroke-dasharray: var(--l); animation: sketch var(--d) ease-in-out var(--t) both; }
.sk--accent { stroke: var(--accent); }
.sk-1 { --l: 1200; --d: 2.6s; --t: .6s; }
.sk-2 { --l: 190; --d: .8s; --t: 2.6s; }
.sk-3 { --l: 110; --d: .7s; --t: 3.1s; }
.sk-4 { --l: 180; --d: .8s; --t: 3.5s; }
.sk-5 { --l: 610; --d: 1.3s; --t: 4s; }
.sk-6 { --l: 220; --d: 1s; --t: 5s; }
.sk-7 { --l: 320; --d: .9s; --t: 5.6s; }
.sk-8 { --l: 150; --d: .8s; --t: 6.1s; }
.note { position: absolute; font-family: var(--font-hand); line-height: 1.25; white-space: nowrap; }
.note--idea {
  left: 68.89%; top: 29.67%; font-weight: 700; font-size: calc(28 * var(--u)); color: var(--accent);
  animation: note .8s ease 6.4s both;
}
.note--launch {
  left: 40%; top: 73%; font-weight: 500; font-size: calc(20 * var(--u)); color: #55536D;
  animation: note .8s ease 6s both;
}

/* Stage 1 · code */
.stage--code { background: #171344; }
.code-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 3.704% 3.333%;
}
.code {
  position: absolute; left: 10.37%; right: 7.4%; top: 25%;
  font-family: var(--font-mono); font-size: calc(15 * var(--u)); line-height: 2.05; color: #E4E2F5;
}
.code-bar { display: flex; align-items: center; gap: calc(7 * var(--u)); margin-bottom: calc(18 * var(--u)); }
.code-dot { width: calc(10 * var(--u)); height: calc(10 * var(--u)); border-radius: 50%; }
.code-dot:nth-child(1) { background: #FF5F57; }
.code-dot:nth-child(2) { background: #FEBC2E; }
.code-dot:nth-child(3) { background: #28C840; }
.code-file { margin-left: calc(10 * var(--u)); font-size: calc(12 * var(--u)); line-height: 1; color: #8C88B5; }
.cl {
  overflow: hidden; white-space: nowrap; width: 0;
  animation: codeType var(--d) steps(var(--n)) var(--t) both;
}
.cl--in { padding-left: calc(20 * var(--u)); }
.cl-1 { --w: 33ch; --n: 33; --d: .9s; --t: .8s; color: #8C88B5; }
.cl-2 { --w: 30ch; --n: 30; --d: .9s; --t: 1.6s; }
.cl-3 { --w: 24ch; --n: 24; --d: .8s; --t: 2.4s; }
.cl-4 { --w: 32ch; --n: 32; --d: .9s; --t: 3.1s; }
.cl-5 { --w: 32ch; --n: 32; --d: .9s; --t: 3.9s; }
.cl-6 { --w: 16ch; --n: 16; --d: .6s; --t: 4.7s; }
.cl-7 { --w: 4ch;  --n: 4;  --d: .3s; --t: 5.3s; }
.cl-8 { --w: 20ch; --n: 20; --d: .7s; --t: 5.8s; margin-top: calc(10 * var(--u)); }
.c-kw { color: #C9BEFF; }
.c-str { color: #9DE7BE; }
.c-val { color: #FFB98A; }
.cursor {
  display: inline-block; width: calc(9 * var(--u)); height: calc(17 * var(--u));
  vertical-align: calc(-3 * var(--u)); background: #C9BEFF;
  animation: blink 1s steps(1) infinite;
}

/* Stage 2 · product */
.stage--product {
  background: linear-gradient(180deg, #131036 0%, #2A1F73 40%, #6A55D6 68%, #D9CFFB 86%, #F2EEFC 100%);
}
.star { position: absolute; border-radius: 50%; background: #fff; animation: twinkle 3s ease-in-out infinite; }
.star-1 { left: 20%; top: 12%; width: 3px; height: 3px; }
.star-2 { left: 70%; top: 9%;  width: 2px; height: 2px; animation-duration: 4s; animation-delay: 1s; }
.star-3 { left: 84%; top: 24%; width: 2px; height: 2px; animation-duration: 3.6s; animation-delay: .4s; }
.sun {
  position: absolute; left: 50%; bottom: 20%;
  width: 33.33%; height: 15%; transform: translateX(-50%);
  border-radius: 999px 999px 0 0; background: #FFF4E6;
  box-shadow: 0 0 calc(90 * var(--u)) calc(40 * var(--u)) rgba(255, 228, 204, .6);
}
.hills { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 33.33%; }
.product {
  position: absolute; left: 50%; top: 23.33%; width: 44.44%; margin-left: -22.22%;
  animation: prodIn 1.4s var(--ease-out) .8s both;
}
.product-card {
  background: #fff; border-radius: calc(22 * var(--u)); padding: calc(18 * var(--u));
  box-shadow: 0 calc(40 * var(--u)) calc(80 * var(--u)) calc(-30 * var(--u)) rgba(10, 8, 40, .7);
  color: var(--ink);
}
.product-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: calc(12 * var(--u)); border-bottom: 1px solid #EEEFF5;
}
.product-who { display: flex; align-items: center; gap: calc(10 * var(--u)); }
.product-avatar { width: calc(32 * var(--u)); height: calc(32 * var(--u)); border-radius: 50%; background: #E4DEFF; }
.product-title { font-size: calc(13 * var(--u)); font-weight: 800; }
.product-by { font-size: calc(11 * var(--u)); color: var(--subtle); }
.product-live {
  font-size: calc(11 * var(--u)); font-weight: 700; color: #157A43; background: #DDF5E7;
  border-radius: 999px; padding: calc(4 * var(--u)) calc(8 * var(--u));
}
.product-chart {
  margin-top: calc(14 * var(--u)); height: calc(96 * var(--u)); border-radius: calc(14 * var(--u));
  background: var(--bg); padding: calc(12 * var(--u));
  display: flex; align-items: flex-end; gap: calc(7 * var(--u));
}
.bar { flex: 1; border-radius: calc(4 * var(--u)); transform-origin: bottom; animation: prodBar 1.2s ease var(--t) both; }
.bar-1 { height: 26%;  background: #D9D3FF; --t: 1.8s; }
.bar-2 { height: 38%;  background: #C3B8FF; --t: 2s; }
.bar-3 { height: 34%;  background: #C3B8FF; --t: 2.2s; }
.bar-4 { height: 62%;  background: #9C88FF; --t: 2.4s; }
.bar-5 { height: 78%;  background: #7258FF; --t: 2.6s; }
.bar-6 { height: 100%; background: var(--accent); --t: 2.8s; }
.product-btn {
  margin-top: calc(14 * var(--u)); height: calc(40 * var(--u)); border-radius: calc(12 * var(--u));
  background: var(--accent); color: #fff; font-size: calc(13 * var(--u)); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Pills — driven by the same timer as the stages (script.js) */
.pills {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.pill {
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--subtle);
  transition: background 1.2s ease, color 1.2s ease, border-color 1.2s ease;
}
.pill.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill-arrow { color: #A3A6BD; }

/* ── How it works ───────────────────────────────────────── */
.band { background: var(--surface); border-top: 1px solid var(--border-2); border-bottom: 1px solid var(--border-2); }
.section .wrap { padding-top: 120px; padding-bottom: 120px; }
.how-head { text-align: center; max-width: 680px; margin: 0 auto 64px; }
.how-head .eyebrow { margin-bottom: 14px; }
.track { position: relative; height: 2px; background: var(--border-2); margin: 0 8% 48px; }
.track-dot {
  position: absolute; top: -5px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 6px rgba(66, 1, 255, .12);
  animation: glide 5s ease-in-out infinite alternate;
}
.steps { display: flex; flex-wrap: wrap; gap: 20px; list-style: none; margin: 0; padding: 0; }
.step { flex: 1 1 300px; padding: 0 12px; }
.step-num { font-family: var(--font-mono); font-size: 13px; color: var(--label); }
.step h3 { margin: 14px 0 10px; font-weight: 800; font-size: 26px; letter-spacing: -0.03em; }
.step p { font-size: 16px; line-height: 1.6; color: var(--muted); }

/* ── Pillars ────────────────────────────────────────────── */
.pillars-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end;
  gap: 24px; margin-bottom: 48px;
}
.pillars-head p { max-width: 420px; font-size: 18px; line-height: 1.6; color: var(--muted); }
.cards { display: flex; flex-wrap: wrap; gap: 20px; }
.card {
  flex: 1 1 300px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 34px; display: flex; flex-direction: column; gap: 16px;
  transition: transform .3s ease, border-color .3s ease;
}
.card:hover { transform: translateY(-6px); border-color: #CFC6FF; }
.card-icon {
  width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.card-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card-title { margin-top: 14px; }
.card-title h3 { font-weight: 800; font-size: 30px; letter-spacing: -0.035em; }
.card-title p {
  margin-top: 6px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--label);
}
.card > p { font-size: 16px; line-height: 1.6; color: var(--muted); }

/* ── Why AverX ──────────────────────────────────────────── */
.why .wrap { padding-bottom: 120px; }
.why-panel {
  border-radius: 32px; color: #fff;
  background: linear-gradient(135deg, #171344 0%, #2A1F73 55%, #4E3BB8 100%);
  padding: clamp(44px, 6vw, 80px);
  display: flex; flex-wrap: wrap; gap: 56px; align-items: center;
}
.why-copy { flex: 3 1 480px; min-width: 0; }
.why-copy .eyebrow { margin-bottom: 14px; color: #C9BEFF; }
.why-copy h2 {
  margin-bottom: 24px; font-weight: 800; font-size: clamp(34px, 4vw, 52px);
  line-height: 1.05; letter-spacing: -0.045em;
}
.why-copy p { font-size: 18px; line-height: 1.65; color: #DCD6FA; }
.why-copy p + p { margin-top: 16px; }
.stats { flex: 2 1 300px; display: flex; flex-wrap: wrap; gap: 14px; }
.stat {
  flex: 1 1 140px; border-radius: 20px; padding: 26px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
}
.stat-num { font-weight: 800; font-size: 54px; letter-spacing: -0.05em; line-height: 1; }
.stat-label { margin-top: 10px; font-size: 14px; color: #DCD6FA; }

/* ── Early access (contact CTA, no data collection) ─────── */
.cta { background: var(--surface); border-top: 1px solid var(--border-2); }
.cta .wrap { max-width: calc(760px + 2 * var(--gutter)); padding-top: 130px; padding-bottom: 130px; text-align: center; }
.cta h2 { font-weight: 800; font-size: clamp(40px, 5.4vw, 74px); line-height: 1; letter-spacing: -0.05em; }
.cta-lede { margin: 22px auto 0; max-width: 480px; font-size: 18px; line-height: 1.6; color: var(--muted); }
.cta-actions { margin-top: 40px; display: flex; justify-content: center; }
.cta-note { margin-top: 18px; font-size: 14px; color: var(--subtle); }

/* ── Footer ─────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border-2); }
.site-footer .wrap {
  padding-top: 34px; padding-bottom: 34px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px;
  font-size: 14px; color: var(--subtle);
}
.site-footer a { color: var(--subtle); }
.site-footer a:hover { color: var(--accent); }

/* ── Phone ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav { order: 3; width: 100%; gap: 22px; font-size: 14px; }
  .hero .wrap { padding-top: 40px; padding-bottom: 80px; }
  .section .wrap { padding-top: 88px; padding-bottom: 88px; }
  .cta .wrap { padding-top: 96px; padding-bottom: 96px; }
  .why .wrap { padding-bottom: 88px; }
  .card { padding: 28px; }
}

/* ── Keyframes ──────────────────────────────────────────── */
@keyframes up { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes twinkle { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
@keyframes dream { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes glowpulse { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: .85; transform: scale(1.06); } }
@keyframes sketch { from { stroke-dashoffset: var(--l); } to { stroke-dashoffset: 0; } }
@keyframes note { from { opacity: 0; transform: rotate(-6deg) scale(.8); } to { opacity: 1; transform: rotate(-6deg) scale(1); } }
@keyframes codeType { from { width: 0; } to { width: var(--w); } }
@keyframes prodIn { from { opacity: 0; transform: translateY(24px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes prodBar { from { transform: scaleY(.1); } to { transform: scaleY(1); } }
@keyframes underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes glide { 0% { left: 0%; } 100% { left: 100%; } }

/* ── Reduced motion: no animation or transition anywhere ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* Final states for anything whose resting style is the animation's start. */
  .note--idea, .note--launch { transform: rotate(-6deg); }
  .cl { width: var(--w); }
}
