/* ============================================================
   VELNOR — landing page (draft v1)
   Tokens mirror DESIGN.md. OKLCH throughout. Register: brand.
   ============================================================ */

:root {
  /* Color */
  --bg:           oklch(1 0 0);
  --surface:      oklch(0.975 0.006 150);
  --surface-2:    oklch(0.955 0.008 150);
  --ink:          oklch(0.22 0.018 155);
  --ink-soft:     oklch(0.31 0.016 155);
  --muted:        oklch(0.46 0.012 155);
  --primary:      oklch(0.34 0.075 152);
  --primary-deep: oklch(0.27 0.06 152);
  --accent:       oklch(0.82 0.13 78);
  --line:         oklch(0.90 0.006 150);
  --line-strong:  oklch(0.84 0.008 150);
  --focus:        oklch(0.34 0.075 152);

  /* Type */
  --font: "Hanken Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --step--1: 0.875rem;
  --step-0:  1.0625rem;            /* 17px body */
  --lead:    clamp(1.125rem, 1.04rem + 0.42vw, 1.375rem);
  --h3:      clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --h2:      clamp(1.75rem, 1.32rem + 1.9vw, 2.75rem);
  --display: clamp(2.75rem, 1.7rem + 4.6vw, 5.25rem);

  /* Space — 4pt base, fluid sections */
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --section-y: clamp(4rem, 2.8rem + 5.6vw, 7.5rem);
  --wrap: 72rem;

  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);

  /* Z-index scale */
  --z-sticky: 100;
  --z-overlay: 200;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.08; text-wrap: balance; font-weight: 800; letter-spacing: -0.02em; }
p { text-wrap: pretty; }
a { color: inherit; }
em { font-style: italic; }
strong { font-weight: 600; }

img, svg { display: block; max-width: 100%; }

::selection { background: oklch(0.82 0.13 78 / 0.35); }

:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--bg);
  padding: var(--space-3) var(--space-4); z-index: var(--z-overlay);
  border-radius: 0 0 6px 0; text-decoration: none; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- Layout primitives ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1.25rem, 0.6rem + 2.6vw, 2.5rem); }
/* Containers stay full-wrap so every left edge aligns to one gutter;
   text width is capped on the text elements themselves, left-anchored. */
.measure, .measure-wide { max-width: none; }

.section { padding-block: var(--section-y); }
.section-surface { background: var(--surface); border-block: 1px solid var(--line); }

.section-title { font-size: var(--h2); color: var(--ink); max-width: 20ch; }
.section-lead {
  font-size: var(--lead); line-height: 1.5; color: var(--ink-soft);
  font-weight: 400; margin-top: var(--space-6); max-width: 46ch;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: oklch(1 0 0 / 0.82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; gap: var(--space-6);
  min-height: 4.25rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.mark { width: 1.6rem; height: 1.6rem; color: var(--primary); overflow: visible; }
.mark-star { fill: var(--accent); }
.wordmark { font-weight: 800; font-size: 1.22rem; letter-spacing: -0.03em; }

.site-nav { display: flex; gap: clamp(1rem, 0.4rem + 1.6vw, 2rem); margin-left: auto; }
.site-nav a {
  text-decoration: none; color: var(--muted); font-weight: 500; font-size: var(--step--1);
  padding-block: 0.4rem; position: relative; transition: color 160ms var(--ease-out-quart);
}
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1.5px;
  background: var(--primary); transition: right 220ms var(--ease-out-quart);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::after { right: 0; }

.header-cta { margin-left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.875rem; padding: 0.7rem 1.25rem;
  font-weight: 600; font-size: var(--step-0); text-decoration: none;
  border-radius: 8px; border: 1px solid transparent;
  transition: background 180ms var(--ease-out-quart), transform 140ms var(--ease-out-quart),
              border-color 180ms var(--ease-out-quart), color 180ms var(--ease-out-quart);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: oklch(0.99 0.01 150); }
.btn-primary:hover { background: var(--primary-deep); }
.btn-quiet { color: var(--ink); border-color: var(--line-strong); background: transparent; }
.btn-quiet:hover { border-color: var(--ink); background: oklch(0.34 0.075 152 / 0.04); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(4.5rem, 3rem + 8vw, 9rem) var(--section-y); }
.hero > .wrap { position: relative; z-index: 1; }
.hero-aura {
  position: absolute; top: 50%; right: clamp(-5rem, -8rem + 14vw, 5rem);
  transform: translateY(-52%);
  width: clamp(22rem, 38vw, 36rem); aspect-ratio: 1;
  color: var(--primary); pointer-events: none;
}
.hero-aura svg { width: 100%; height: 100%; }
.aura-chevron { opacity: 0.09; }
.aura-chevron-2 { opacity: 0.055; }
.aura-star { fill: var(--accent); opacity: 0.85; }
@media (max-width: 820px) { .hero-aura { opacity: 0.6; right: -6rem; } }
@media (max-width: 560px) { .hero-aura { display: none; } }

/* ---------- Small-screen header ---------- */
@media (max-width: 640px) {
  .site-nav { display: none; }
  .header-cta { margin-left: auto; }
  .header-inner { gap: var(--space-4); min-height: 3.75rem; }
}
.hero-kicker {
  font-size: var(--step--1); font-weight: 600; color: var(--primary);
  letter-spacing: 0.04em; display: inline-flex; align-items: center; gap: 0.5rem;
}
.hero-kicker::before {
  content: ""; width: 1.4rem; height: 1px; background: var(--accent);
}
.hero-title {
  font-size: var(--display); letter-spacing: -0.035em; line-height: 0.98;
  margin-top: var(--space-6); max-width: 16ch;
}
.hero-lead {
  font-size: var(--lead); line-height: 1.5; color: var(--ink-soft); font-weight: 400;
  margin-top: var(--space-8); max-width: 54ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-8); }
.hero-note {
  margin-top: var(--space-6); color: var(--muted); font-size: var(--step--1);
  padding-top: var(--space-4); border-top: 1px solid var(--line);
  max-width: 40ch;
}

/* ---------- Problem: ruled list ---------- */
.ruled-list { list-style: none; padding-left: 0; margin-top: var(--space-12); }
.ruled-row { padding-block: var(--space-8); border-top: 1px solid var(--line); }
.ruled-row:last-child { border-bottom: 1px solid var(--line); }
.ruled-body h3 { font-size: var(--h3); color: var(--ink); margin-bottom: var(--space-3); }
.ruled-body p { color: var(--muted); max-width: 62ch; line-height: 1.62; }
.ruled-body em { color: var(--ink-soft); }

/* ---------- Difference: two moats ---------- */
.moats {
  margin-top: var(--space-12);
  display: grid; gap: clamp(1.5rem, 0.5rem + 3vw, 3.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}
.moat { padding-top: var(--space-6); border-top: 2px solid var(--primary); }
.moat-tag {
  font-size: var(--step--1); font-weight: 600; color: var(--primary);
  letter-spacing: 0.01em; margin-bottom: var(--space-4);
}
.moat h3 { font-size: var(--h3); color: var(--ink); margin-bottom: var(--space-3); }
.moat p { color: var(--muted); line-height: 1.62; }

/* ---------- How: facts ---------- */
.facts {
  margin-top: var(--space-12);
  display: grid; gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  border-top: 1px solid var(--line);
}
.fact { padding: var(--space-8) clamp(0rem, 2vw, 1.75rem) var(--space-6) 0; border-top: 1px solid transparent; }
.fact dt { font-size: var(--step--1); color: var(--muted); font-weight: 500; }
.fact dd { margin-top: var(--space-3); }
.fact .num {
  font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem); font-weight: 800;
  color: var(--ink); letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
  display: inline-block;
}
.fact p { margin-top: var(--space-3); color: var(--muted); font-size: var(--step--1); line-height: 1.5; max-width: 30ch; }

/* ---------- Verticals: split ---------- */
.split {
  margin-top: var(--space-12);
  display: grid; gap: clamp(1.5rem, 0.4rem + 3.4vw, 4rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}
.vertical { padding-top: var(--space-6); border-top: 1px solid var(--line-strong); }
.vertical h3 { font-size: var(--h3); color: var(--ink); }
.vertical-sub { color: var(--ink-soft); margin-top: var(--space-3); max-width: 38ch; }
.tile-list { list-style: none; padding: 0; margin-top: var(--space-6); display: grid; gap: 0; }
.tile-list li {
  padding-block: var(--space-3); border-top: 1px solid var(--line);
  color: var(--ink); font-weight: 500; display: flex; align-items: center; gap: 0.6rem;
}
.tile-list li::before {
  content: ""; flex: none; width: 0.4rem; height: 0.4rem; border-radius: 50%;
  background: var(--accent);
}
.vertical-note { margin-top: var(--space-4); color: var(--muted); font-size: var(--step--1); }

/* ---------- Closing CTA ---------- */
.cta { padding-block: clamp(4.5rem, 3rem + 7vw, 8rem); background: var(--surface); border-top: 1px solid var(--line); }
.cta-inner { margin-inline: auto; text-align: center; display: flex; flex-direction: column; align-items: center; }
.cta .section-lead { margin-inline: auto; max-width: 48ch; }
.cta-mark { width: 2.4rem; height: 2.4rem; color: var(--primary); overflow: visible; margin-bottom: var(--space-6); }
.cta .hero-actions { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: var(--space-12) var(--space-8); }
.footer-inner { display: flex; flex-wrap: wrap; gap: var(--space-8); justify-content: space-between; align-items: start; }
.footer-line { color: var(--muted); margin-top: var(--space-4); font-size: var(--step--1); max-width: 32ch; }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--space-6); }
.footer-nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: var(--step--1); transition: color 160ms; }
.footer-nav a:hover { color: var(--ink); }
.footer-legal {
  display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-8); justify-content: space-between;
  margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.8125rem;
}

/* ---------- Reveal motion (progressive enhancement) ---------- */
/* Content is visible by default. Only when JS is active AND motion is allowed
   do we set the pre-reveal state, so no-JS / reduced-motion / headless renders
   never ship blank. */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal { opacity: 0; transform: translateY(14px); }
  html.js .reveal.in {
    opacity: 1; transform: none;
    transition: opacity 620ms var(--ease-out-expo), transform 620ms var(--ease-out-expo);
  }
  /* hero stagger via index */
  .hero .reveal.in { transition-delay: calc(var(--i, 0) * 70ms); }
}

/* ============================================================
   Product scene — pinned scroll tease (chat console + Pulse)
   ============================================================ */
.stage-track { position: relative; height: 300vh; background: var(--bg); }
.stage {
  position: sticky; top: 0; min-height: 100vh; height: 100svh;
  display: grid; place-items: center; overflow: hidden;
  padding-block: var(--space-12);
}
.stage-inner { display: flex; flex-direction: column; align-items: center; gap: var(--space-8); }

.stage-copy { position: relative; height: 2.4rem; width: 100%; text-align: center; }
.stage-step {
  position: absolute; inset: 0; margin: auto; height: max-content;
  font-size: var(--lead); font-weight: 600; color: var(--primary);
  letter-spacing: -0.01em; opacity: 0;
}
.stage-step[data-step="2"] { opacity: 1; }   /* default/no-JS shows final caption */

/* Console card */
.console {
  width: min(60rem, 100%);
  border: 1px solid var(--line-strong); border-radius: 16px;
  background: var(--bg); overflow: hidden;
  box-shadow: 0 1px 2px oklch(0.22 0.04 155 / 0.06),
              0 24px 50px -28px oklch(0.22 0.06 155 / 0.40);
}

/* Two consoles side by side (gym left, dance right) */
.consoles { display: flex; gap: clamp(1rem, 2.2vw, 2rem); width: 100%; align-items: flex-start; justify-content: center; }
.consoles .console { width: auto; flex: 1 1 0; min-width: 0; max-width: 38rem; }
.consoles .console-body { grid-template-columns: 1fr; }
.consoles .chat { border-right: none; border-bottom: 1px solid var(--line); }
@media (max-width: 900px) {
  .consoles { flex-direction: column; align-items: center; }
  .consoles .console { flex: none; width: 100%; max-width: 34rem; }
}
.console-bar {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface);
}
.console-dots { display: inline-flex; gap: 0.4rem; }
.console-dots i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--line-strong); }
.console-title { display: inline-flex; align-items: center; gap: 0.5rem; font-size: var(--step--1); color: var(--muted); font-weight: 600; }
.console-title .mark { width: 1.1rem; height: 1.1rem; color: var(--primary); }

.console-body { display: grid; grid-template-columns: 1.05fr 0.95fr; min-height: 21rem; }
.chat { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); border-right: 1px solid var(--line); justify-content: flex-start; }
.msg { max-width: 94%; font-size: 0.95rem; line-height: 1.45; }
.msg-text { display: inline; }
.msg-user {
  align-self: flex-end; background: var(--primary); color: oklch(0.99 0.01 150);
  padding: 0.7rem 0.95rem; border-radius: 14px 14px 4px 14px;
}
.msg-user .msg-text::after { content: ""; }
.msg-ai {
  align-self: flex-start; display: flex; gap: 0.6rem; align-items: flex-start;
  background: var(--surface-2); color: var(--ink);
  padding: 0.7rem 0.95rem; border-radius: 14px 14px 14px 4px;
}
.msg-avatar { flex: none; }
.msg-avatar svg { width: 1.15rem; height: 1.15rem; color: var(--primary); }

.pulse { padding: var(--space-6); background: var(--surface); display: flex; flex-direction: column; gap: var(--space-4); }
.pulse-head { display: flex; align-items: center; gap: 0.5rem; font-size: var(--step--1); color: var(--muted); font-weight: 600; }
.pulse-trend {
  margin-left: auto; font-size: 0.7rem; font-weight: 600; color: var(--primary);
  background: oklch(0.34 0.075 152 / 0.10); padding: 0.1rem 0.5rem; border-radius: 999px;
}

/* generated charts */
.chart { margin: 0; min-width: 0; }
.chart-cap { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.5rem; }
.chart-delta { color: var(--primary); font-weight: 600; margin-left: 0.35rem; }
.chart-heat .heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.heat i { height: 15px; border-radius: 3px; background: var(--primary); opacity: var(--cell, 1); }

.chart-ring .ring { position: relative; width: 80px; height: 80px; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring-track { fill: none; stroke: var(--line); stroke-width: 7; }
.ring-fill { fill: none; stroke: var(--primary); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0.14; }
.ring-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.pulse-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: end; }
.chart-bars .bars { display: flex; align-items: flex-end; gap: 5px; height: 58px; }
.bars i {
  flex: 1; height: 100%; background: var(--primary); border-radius: 3px 3px 0 0;
  transform: scaleY(var(--h, 1)); transform-origin: bottom;   /* default: full height */
}
.bars i:last-child { background: var(--accent); }

.pulse-tiles { display: grid; grid-template-columns: 1fr; gap: 0.5rem; align-content: end; }
.tile {
  border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.75rem;
  background: var(--bg); display: flex; flex-direction: column; gap: 0.2rem;
}
.tile-label { font-size: 0.72rem; color: var(--muted); }
.tile-num { font-size: clamp(1.15rem, 1rem + 0.5vw, 1.4rem); font-weight: 800; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Driven states: applied only when JS confirms it can drive (html.scene)
   AND motion is allowed. Default (no .scene) is the fully-visible final state. */
@media (prefers-reduced-motion: no-preference) {
  html.scene .stage-step { opacity: 0; transition: opacity 480ms var(--ease-out-quart); }
  html.scene .stage-step.active { opacity: 1; }

  html.scene .console .msg-user { opacity: 0; }
  html.scene .console .msg-user.typed { opacity: 1; transition: opacity 200ms var(--ease-out-quart); }

  html.scene .console .msg-ai { opacity: 0; transform: translateY(10px); }
  html.scene .console .msg-ai.in { opacity: 1; transform: none; transition: opacity 520ms var(--ease-out-expo), transform 520ms var(--ease-out-expo); }

  html.scene .console .tile { opacity: 0; transform: translateY(12px); }
  html.scene .console .tile.in { opacity: 1; transform: none; transition: opacity 480ms var(--ease-out-expo), transform 480ms var(--ease-out-expo); }

  /* charts generate, driven by scroll via --heat / --ring / --grow on .pulse */
  html.scene .pulse .heat i { opacity: calc(var(--cell, 1) * clamp(0, calc(var(--heat, 0) * 34 - var(--i, 0)), 1)); }
  html.scene .pulse .ring-fill { stroke-dashoffset: calc(1 - 0.86 * var(--ring, 0)); }
  html.scene .pulse .bars i { transform: scaleY(calc(var(--grow, 0) * var(--h, 1))); }
}

/* Responsive: stack console body, shrink the pinned track */
@media (max-width: 760px) {
  .console-body { grid-template-columns: 1fr; }
  .chat { border-right: none; border-bottom: 1px solid var(--line); }
  .stage-track { height: 280vh; }
  .pulse-tiles { grid-template-columns: 1fr 1fr; }
}

/* Reduced motion / no pinning: collapse the track to a normal card display */
@media (prefers-reduced-motion: reduce) {
  .stage-track { height: auto; }
  .stage { position: static; min-height: 0; height: auto; padding-block: var(--section-y); }
}


/* ---------- Vertical media (full-color, warm, quiet) ---------- */
.vertical-media {
  margin: 0 0 var(--space-6);
  border-radius: 12px; overflow: hidden; position: relative;
  background: var(--surface-2);
}
.vertical-media::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px;
  box-shadow: inset 0 0 0 1px oklch(0.22 0.018 155 / 0.06); pointer-events: none;
}
.vertical-media img {
  width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  filter: saturate(1.03);
}

/* ---------- Verticals expansion ("more coming") ---------- */
.vert-more { margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid var(--line); }
.vert-more-label { font-size: var(--step--1); color: var(--muted); font-weight: 500; margin-bottom: var(--space-4); }
.vert-tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.vert-tags li {
  font-size: var(--step--1); font-weight: 500; color: var(--ink-soft);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.35rem 0.85rem;
}
.vert-tags li.vert-tags-more { color: var(--primary); border-color: var(--primary); }
