/**
 * NADIR Visuals Lab — matches index.html tokens & atmosphere
 */
:root {
  --bg: #0b0c0f;
  --bg2: #121419;
  --bg3: #1a1d24;
  --border: #2a2e37;
  --border2: #3a414d;
  --accent: #db4722;
  --accent2: #c96d36;
  --accent-bright: #d88949;
  --red: #ff2b2b;
  --amber: #ffb14a;
  --green: #10b981;
  --text: #f3f5f7;
  --text2: #c6ced7;
  --text3: #97a1ad;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --display: "Plus Jakarta Sans", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
  --elev-shadow: 0 20px 56px rgba(0, 0, 0, 0.45);
  --nav-h: 64px;
  --vl-max: 1240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body.vl {
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 90, 42, 0.09), transparent 34%),
    radial-gradient(circle at 88% 0%, rgba(255, 154, 82, 0.06), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(255, 43, 43, 0.04), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.vl::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* Nav — index parity */
.vl-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 12, 15, 0.84);
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}

.vl-nav-logo {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.vl-nav-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.vl-nav-mark span {
  font-size: 12px;
  font-weight: 800;
  color: var(--bg);
}

.vl-nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.vl-nav-links a {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text2);
  text-decoration: none;
  transition: color 0.2s;
}

.vl-nav-links a:hover,
.vl-nav-links a.is-active { color: var(--text); }

.vl-nav-actions { display: flex; gap: 12px; align-items: center; }

.vl-btn-ghost {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text2);
  text-decoration: none;
  padding: 8px 16px;
}

.vl-btn-primary {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #17191d;
  background: linear-gradient(135deg, #cf3e1f, #da5528 55%, #c96d36);
  border: 1px solid rgba(216, 137, 73, 0.6);
  padding: 9px 20px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(207, 62, 31, 0.22);
}

/* Sub-nav sticky */
.vl-subnav {
  position: sticky;
  top: var(--nav-h);
  z-index: 900;
  background: rgba(11, 12, 15, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 48px;
  overflow-x: auto;
}

.vl-subnav-inner {
  max-width: var(--vl-max);
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 0;
  min-width: max-content;
}

.vl-subnav a {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text3);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.vl-subnav a:hover,
.vl-subnav a.is-active {
  color: var(--text);
  border-color: var(--border);
  background: var(--bg2);
}

.vl-subnav a.is-active {
  border-color: rgba(219, 71, 34, 0.45);
  color: var(--accent-bright);
}

/* Layout */
.vl-wrap {
  max-width: var(--vl-max);
  margin: 0 auto;
  padding: 0 48px;
}

.vl-hero {
  padding: calc(var(--nav-h) + 48px) 48px 56px;
  position: relative;
}

.vl-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 90, 42, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 90, 42, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 75%);
  pointer-events: none;
}

.vl-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--accent-bright);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.vl-eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent-bright);
}

.vl-hero h1 {
  font-family: var(--display);
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  max-width: 14ch;
  margin-bottom: 20px;
  text-wrap: balance;
}

.vl-hero .vl-wrap {
  position: relative;
  z-index: 1;
  max-width: var(--vl-max);
}

.vl-hero p {
  color: var(--text2);
  max-width: 58ch;
  font-size: 17px;
}

.vl-section {
  padding: 80px 0;
  border-top: 1px solid transparent;
}

.vl-section h2 {
  font-family: var(--display);
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.vl-section-desc {
  color: var(--text2);
  max-width: 56ch;
  margin-bottom: 40px;
  line-height: 1.7;
}

.vl-accent-bar {
  height: 2px;
  background: linear-gradient(90deg, #8b0e0e, #de3d00 34%, #f97316 65%, #fbbf24 82%, #fde68a);
  border-radius: 1px;
  margin-bottom: 32px;
  opacity: 0.85;
}

/* Cards */
.vl-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--elev-shadow);
}

.vl-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 4px;
}

.vl-card-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  margin-bottom: 12px;
}

.vl-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.vl-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

/* Perception videos */
.vl-video-main {
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border2);
  background: #000;
  margin-bottom: 16px;
}

.vl-video-main video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.vl-video-main.is-error::after {
  content: "Video unavailable — check deployment assets";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  padding: 24px;
  text-align: center;
}

.vl-video-main {
  position: relative;
}

.vl-video-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.vl-video-tab {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
}

.vl-video-tab.is-active {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: rgba(219, 71, 34, 0.1);
}

.vl-video-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.2s, border-color 0.2s;
}

.vl-video-thumb.is-active,
.vl-video-thumb:hover {
  opacity: 1;
  border-color: var(--accent2);
}

.vl-video-thumb video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: none;
}

/* Charts — intrinsic height, no horizontal stretch */
.vl-chart-grid canvas,
.vl-card canvas {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: auto;
}

/* Compare slider */
.vl-compare-block {
  margin-bottom: 48px;
}

.vl-compare-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.vl-compare-head h3 {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
}

.vl-compare-labels {
  display: flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.vl-compare-labels .without { color: var(--red); }
.vl-compare-labels .with { color: var(--green); }

.vl-compare-stage {
  position: relative;
  height: 340px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border2);
  background: var(--bg3);
  user-select: none;
  touch-action: none;
  --reveal: 50%;
}

.vl-compare-stage canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
}

/* Left = WITHOUT NADIR; right = WITH NADIR (full scene under reveal) */
.vl-compare-reveal {
  position: absolute;
  inset: 0;
  z-index: 2;
  clip-path: inset(0 calc(100% - var(--reveal)) 0 0);
  pointer-events: none;
}

.vl-compare-layer--after {
  z-index: 1;
}

.vl-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  z-index: 4;
  transform: translateX(-50%);
  box-shadow: 0 0 20px rgba(219, 71, 34, 0.6);
}

.vl-compare-handle::after {
  content: "◀ ▶";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  letter-spacing: -2px;
  background: var(--accent);
  color: var(--bg);
  padding: 8px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.vl-compare-slider {
  width: 100%;
  margin-top: 12px;
  accent-color: var(--accent);
}

.vl-compare-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.vl-stat {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg2);
}

.vl-stat-val {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-bright);
}

.vl-stat-lbl {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

/* Network */
.vl-network-wrap {
  height: 420px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg2);
  overflow: hidden;
}

.vl-network-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Math panel */
.vl-math-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.vl-formula {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--accent-bright);
  padding: 16px;
  background: var(--bg3);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.vl-formula.dim { color: var(--text3); }

/* 3D drift standalone */
.vl-scene-wrap {
  height: 380px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: linear-gradient(180deg, var(--bg3), var(--bg));
  overflow: hidden;
}

.vl-scene-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.vl-scene-controls {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.vl-scene-controls label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.vl-scene-controls input[type="range"] {
  width: 140px;
  accent-color: var(--accent);
}

@media (max-width: 900px) {
  .vl-nav { padding: 0 24px; }
  .vl-nav-links { display: none; }
  .vl-wrap, .vl-hero, .vl-subnav { padding-left: 24px; padding-right: 24px; }
  .vl-grid-2, .vl-grid-4, .vl-math-row, .vl-compare-stats { grid-template-columns: 1fr; }
  .vl-compare-stage { height: 260px; }
}
