/* LineageLens — global styles */
:root {
  --bg: #0D1117;
  --bg-1: #010409;
  --bg-2: #161B22;
  --bg-3: #1C2128;
  --border: #30363D;
  --border-muted: #21262D;
  --text: #E6EDF3;
  --text-muted: #8B949E;
  --text-dim: #6E7681;

  /* Mode accents */
  --solo: #58A6FF;
  --solo-dim: rgba(88,166,255,0.12);
  --team: #3FB950;
  --team-dim: rgba(63,185,80,0.12);
  --ent: #A371F7;
  --ent-dim: rgba(163,113,247,0.14);

  /* Risk */
  --red: #F85149;
  --yellow: #D29922;
  --green: #3FB950;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius: 8px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  background: #0D1117; /* base fallback so scroll-bg has a home */
}
body {
  background: transparent; /* #scroll-bg handles the ambient colour */
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ===== SCROLL BACKGROUND LAYER ===== */
#scroll-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: #0D1117;
  will-change: background;
}

/* ===== SCROLL PROGRESS BAR ===== */
#scroll-progress {
  position: fixed;
  top: 0; left: 0; height: 2px;
  z-index: 9999;
  pointer-events: none;
  background: linear-gradient(90deg, var(--solo), var(--team), var(--ent));
  box-shadow: 0 0 10px rgba(88,166,255,0.6);
  transition: width 80ms linear;
}

/* ===== CURSOR SPOTLIGHT ===== */
#cursor-spot {
  position: fixed;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(88,166,255,0.055) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  transition: left 0.12s ease, top 0.12s ease;
}

/* ===== SECTION NAV DOTS ===== */
#section-nav {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
#section-nav a {
  display: block;
  width: 6px;
  border-radius: 3px;
  background: var(--border);
  transition: height 0.3s cubic-bezier(0.22,1,0.36,1), background 0.3s ease, box-shadow 0.3s ease;
  height: 6px;
}
#section-nav a.active {
  height: 20px;
  background: var(--solo);
  box-shadow: 0 0 8px rgba(88,166,255,0.6);
}
@media (max-width: 900px) { #section-nav { display: none; } }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

.mono { font-family: var(--mono); font-feature-settings: "calt" 0; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }

/* Layout */
.container { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.narrow { max-width: 960px; margin: 0 auto; padding: 0 32px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13,17,23,0.82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-muted);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  max-width: 1240px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--solo), var(--ent));
  position: relative; overflow: hidden;
}
.brand-mark::before, .brand-mark::after {
  content: ''; position: absolute; inset: 3px; border-radius: 3px;
  background: var(--bg);
}
.brand-mark::after { inset: 6px; background: linear-gradient(135deg, var(--solo), var(--ent)); }
.nav-links { display: flex; gap: 28px; font-size: 14px; color: var(--text-muted); }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }
.nav-cta { display: flex; gap: 10px; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 6px;
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: all 120ms ease;
  white-space: nowrap;
}
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #fff; }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--bg-2); }
.btn-ghost:hover { background: var(--bg-3); border-color: #484F58; }
.btn-mode {
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent);
}
.btn-mode:hover { background: color-mix(in oklab, var(--accent) 18%, transparent); }
.btn-lg { padding: 12px 22px; font-size: 15px; }

/* Sections */
section { padding: 96px 0; border-top: 1px solid var(--border-muted); }
section:first-of-type { border-top: none; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 5px 10px; border: 1px solid var(--border); border-radius: 100px;
  background: var(--bg-2);
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent, var(--solo)); }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; color: var(--text); }
h1 { font-size: 56px; letter-spacing: -0.035em; line-height: 1.02; }
h2 { font-size: 40px; letter-spacing: -0.03em; }
h3 { font-size: 22px; letter-spacing: -0.015em; }
h4 { font-size: 16px; }
p { color: var(--text-muted); }
.lead { font-size: 19px; color: var(--text-muted); line-height: 1.5; max-width: 640px; }

/* Cards */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 150ms ease, transform 150ms ease;
}
.card:hover { border-color: var(--border); }
.card-accent {
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 8%, var(--bg-2)) 0%, var(--bg-2) 60%);
  border-color: color-mix(in oklab, var(--accent) 25%, var(--border-muted));
}

/* Utility */
.row { display: flex; gap: 16px; align-items: center; }
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px;
  padding: 3px 8px; border-radius: 4px;
  background: var(--bg-3); color: var(--text-muted);
  border: 1px solid var(--border-muted);
}
.tag-accent {
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 35%, transparent);
}

/* Grid background for hero */
.grid-bg {
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(var(--border-muted) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-muted) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 70%);
  opacity: 0.4;
  pointer-events: none;
}

/* Mode theme helpers */
.theme-solo { --accent: var(--solo); --accent-dim: var(--solo-dim); }
.theme-team { --accent: var(--team); --accent-dim: var(--team-dim); }
.theme-ent  { --accent: var(--ent);  --accent-dim: var(--ent-dim); }

/* Footer */
footer { border-top: 1px solid var(--border-muted); padding: 64px 0 48px; background: rgba(1,4,9,0.88); }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 48px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }
.footer-heading { font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.footer-bottom {
  margin-top: 48px; padding-top: 24px;
  border-top: 1px solid var(--border-muted);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-dim);
}

/* Code chrome */
.code-window {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
}
.code-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-muted);
  background: var(--bg-2);
  font-size: 12px; color: var(--text-muted);
}
.code-dots { display: flex; gap: 6px; margin-right: 8px; }
.code-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-3); }
.code-body { padding: 16px 18px; line-height: 1.7; }
.tok-kw { color: #FF7B72; }
.tok-fn { color: #D2A8FF; }
.tok-str { color: #A5D6FF; }
.tok-com { color: #7D8590; font-style: italic; }
.tok-num { color: #79C0FF; }
.tok-var { color: #FFA657; }

/* Tweaks panel */
.tweaks-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; width: 280px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  font-size: 13px;
}
.tweaks-panel h4 {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 12px;
}
.tweak-group { margin-bottom: 14px; }
.tweak-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.tweak-opts { display: flex; gap: 6px; flex-wrap: wrap; }
.tweak-opt {
  padding: 5px 10px; border: 1px solid var(--border); border-radius: 5px;
  font-size: 12px; background: var(--bg-3); cursor: pointer;
}
.tweak-opt.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Responsive */
@media (max-width: 900px) {
  h1 { font-size: 40px; }
  h2 { font-size: 30px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
  section { padding: 64px 0; }
}

/* ===== SCROLL REVEAL ANIMATIONS ===== */
@keyframes revealUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes revealScale {
  from { opacity: 0; transform: scale(0.96) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* Elements start hidden, animate in when .is-visible is added */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children in grids */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-stagger.is-visible > *:nth-child(1)  { transition-delay: 0ms; }
.reveal-stagger.is-visible > *:nth-child(2)  { transition-delay: 80ms; }
.reveal-stagger.is-visible > *:nth-child(3)  { transition-delay: 160ms; }
.reveal-stagger.is-visible > *:nth-child(4)  { transition-delay: 240ms; }
.reveal-stagger.is-visible > *:nth-child(5)  { transition-delay: 320ms; }
.reveal-stagger.is-visible > *:nth-child(6)  { transition-delay: 400ms; }
.reveal-stagger.is-visible > *:nth-child(7)  { transition-delay: 480ms; }
.reveal-stagger.is-visible > *:nth-child(8)  { transition-delay: 560ms; }
.reveal-stagger.is-visible > *:nth-child(9)  { transition-delay: 640ms; }
.reveal-stagger.is-visible > *:nth-child(10) { transition-delay: 720ms; }
.reveal-stagger.is-visible > *:nth-child(11) { transition-delay: 800ms; }
.reveal-stagger.is-visible > *:nth-child(12) { transition-delay: 880ms; }
.reveal-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ===== PREMIUM CARD HOVER ===== */
.card {
  position: relative;
  transition: border-color 0.3s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s ease;
}
.card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25), 0 0 1px rgba(255,255,255,0.05);
}

/* ===== NAV LINK UNDERLINE ===== */
.nav-links a {
  position: relative;
  transition: color 0.25s ease;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 2px;
  background: var(--solo);
  border-radius: 1px;
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* ===== BUTTON SHINE SWEEP ===== */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease, box-shadow 0.3s ease;
}
.btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transition: left 0.5s ease;
  pointer-events: none;
}
.btn:hover::after {
  left: 120%;
}
.btn:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.btn:active {
  transform: scale(0.97);
}

/* ===== SECTION DIVIDER GLOW ===== */
section {
  position: relative;
}
section::before {
  content: '';
  position: absolute;
  top: -1px; left: 50%;
  transform: translateX(-50%);
  width: min(600px, 60%); height: 1px;
  background: linear-gradient(90deg, transparent, var(--solo), var(--ent), transparent);
  opacity: 0.25;
  pointer-events: none;
}
section:first-of-type::before { display: none; }

/* ===== EYEBROW SHIMMER ===== */
.eyebrow {
  background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 6s ease-in-out infinite;
}

/* ===== CODE WINDOW HOVER ===== */
.code-window {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
}
.code-window:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.4), 0 0 1px rgba(255,255,255,0.06);
}

/* ===== FOOTER LINK HOVER ===== */
.footer-links a {
  transition: color 0.2s ease, transform 0.2s ease;
  display: inline-block;
}
.footer-links a:hover {
  color: var(--text);
  transform: translateX(4px);
}
