/* ===========================================================
   Einsum Research — high-end quant landing
   =========================================================== */

/* Computer Modern (LaTeX serif) — extracted from vanta.sigma.
   Used for typeset math so equations read like a paper. */
@font-face {
  font-family: "CMUSerif";
  src: url("fonts/cmu-serif.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg:        #070809;
  --bg-soft:   #0c0e11;
  --ink:       #eef1f6;
  --ink-soft:  #9aa4b2;
  --ink-dim:   #5c6573;
  --line:      rgba(255,255,255,0.08);
  --line-2:    rgba(255,255,255,0.14);
  --accent:    #5b8cff;
  --accent-2:  #9fb4ff;
  --glow:      rgba(91,140,255,0.35);
  /* translucent "film" surfaces — flip from white-on-dark to black-on-light */
  --surface:     rgba(255,255,255,0.03);
  --surface-2:   rgba(255,255,255,0.06);
  --row-hover:   rgba(255,255,255,0.02);
  --card-shadow: rgba(0,0,0,0.8);
  /* veil = base colour of the vanta vignette / nav scrim */
  --veil-65:   rgba(5,6,8,0.65);
  --veil-85:   rgba(5,6,8,0.85);
  --veil-35:   rgba(5,6,8,0.35);
  --scrim:     rgba(7,8,9,0.6);
  --sel-ink:   #04060c;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Display face for headlines — kept distinct from the body sans.
     Plan A: precise neo-grotesque (Geist). Plan B was the serif "Newsreader". */
  --display: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --maxw: 1440px;
  --pad: clamp(24px, 6vw, 112px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- light theme (driven by time of day) ---------- */
[data-theme="light"] {
  color-scheme: light;
  --bg:        #eef1f6;
  --bg-soft:   #e3e8f0;
  --ink:       #111827;
  --ink-soft:  #4b5563;
  --ink-dim:   #97a0b0;
  --line:      rgba(17,24,39,0.10);
  --line-2:    rgba(17,24,39,0.16);
  --accent:    #2f5fe0;
  --accent-2:  #3a5bd0;
  --glow:      rgba(47,95,224,0.20);
  --surface:     rgba(17,24,39,0.04);
  --surface-2:   rgba(17,24,39,0.07);
  --row-hover:   rgba(17,24,39,0.035);
  --card-shadow: rgba(17,24,39,0.18);
  --veil-65:   rgba(228,233,240,0.70);
  --veil-85:   rgba(228,233,240,0.92);
  --veil-35:   rgba(228,233,240,0.40);
  --scrim:     rgba(238,241,246,0.72);
  --sel-ink:   #ffffff;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  letter-spacing: 0.01em;
  transition: background .6s var(--ease), color .6s var(--ease);
}

::selection { background: var(--accent); color: var(--sel-ink); }

a { color: inherit; text-decoration: none; }

/* Keyboard focus ring — visible for tab/keyboard users, not on mouse click. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------- background layers ---------- */
#vanta-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
}
/* vignette + top fade over the vanta canvas for depth */
#vanta-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 0%, transparent 40%, var(--veil-65) 100%),
    linear-gradient(180deg, var(--veil-35) 0%, transparent 22%, transparent 70%, var(--veil-85) 100%);
  pointer-events: none;
  transition: background .6s var(--ease);
}
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--pad);
  transition: background .4s var(--ease), backdrop-filter .4s var(--ease), border-color .4s var(--ease), padding .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: var(--scrim);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
  padding-top: 16px;
  padding-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
/* Σ drawn from the CMU serif (same glyph the old sigma.png was traced from),
   so the mark is real text — crisp at any DPI, theme-aware, no image. */
.brand-mark {
  font-family: "CMUSerif", "Times New Roman", serif;
  font-size: 30px;
  line-height: 1;
  display: block;
  color: var(--ink);
  /* soft signal-blue glow; --ink + --glow both flip with the theme */
  text-shadow: 0 0 14px var(--glow);
  transition: text-shadow .3s var(--ease), color .3s var(--ease);
  user-select: none;
}
.brand:hover .brand-mark { text-shadow: 0 0 20px var(--accent); }
.brand-mark-sm { font-size: 22px; opacity: 0.9; }
.brand-name {
  font-weight: 600;
  letter-spacing: 0.18em;
  font-size: 0.92rem;
}
.brand-thin { font-weight: 300; color: var(--ink-soft); margin-left: 0.35em; }

.nav-links { display: flex; align-items: center; gap: clamp(18px, 3vw, 40px); }
.nav-links a {
  position: relative;
  font-size: 0.86rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  transition: color .25s var(--ease);
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -5px;
  height: 1px;
  background: var(--accent-2);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh; /* avoid mobile address-bar jump; vh is the fallback */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  /* reserve vertical room for the fixed nav (~75px tall) so the eyebrow never
     slips under the brand on short/narrow screens. 128px → ~53px clearance
     below the nav on the worst case; symmetric so content stays centered. */
  padding: 128px var(--pad);
}
/* soft aurora behind the hero text — drifts up on scroll (parallax) */
.hero::before {
  content: "";
  position: absolute;
  top: 38%; left: 50%;
  width: min(900px, 90vw); height: min(560px, 60vh);
  transform: translate(-50%, calc(-50% + var(--py, 0px)));
  background: radial-gradient(closest-side, rgba(91,140,255,0.16), transparent 72%);
  filter: blur(20px);
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}
.hero-inner { max-width: min(1400px, 94vw); margin: 0 auto; will-change: transform, opacity; }
.eyebrow {
  font-family: var(--mono);
  font-size: clamp(0.88rem, 1.1vw, 1.02rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 34px;
}
.headline {
  font-family: var(--display);
  font-size: clamp(2.8rem, 6.4vw, 5.2rem);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -0.022em;
  margin-bottom: 30px;
  text-wrap: balance;
}
.headline em {
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* italic overhang gets clipped by the text bg-box — pad the trailing edge */
  padding-right: 0.12em;
  margin-right: -0.08em;
}
.sub {
  font-size: clamp(0.98rem, 1.25vw, 1.15rem);
  color: var(--ink-soft);
  max-width: 600px;
  margin: 0 auto 42px;
  font-weight: 300;
  line-height: 1.65;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-bottom: 60px; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 14px 28px;
  border-radius: 100px;
  border: 1px solid transparent;
  overflow: hidden;
  isolation: isolate;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease),
              border-color .3s var(--ease), background .3s var(--ease);
}
.btn > span { position: relative; z-index: 1; }
.btn-arrow { font-family: var(--mono); transition: transform .3s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(4px); }

/* accent-tinted "glass" — same material language as the cards, not a loud CTA */
.btn-primary {
  background: linear-gradient(180deg, rgba(91,140,255,0.16), rgba(91,140,255,0.05));
  border-color: rgba(127,165,255,0.42);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary .btn-arrow { color: var(--accent-2); }
/* faint sheen sweep on hover */
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(115deg, transparent 36%, rgba(159,180,255,0.16) 50%, transparent 64%);
  transform: translateX(-130%);
  transition: transform .8s var(--ease);
}
.btn-primary:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(91,140,255,0.24), rgba(91,140,255,0.09));
  box-shadow: 0 16px 42px -20px var(--glow), inset 0 1px 0 rgba(255,255,255,0.14);
}
.btn-primary:hover::before { transform: translateX(130%); }

.btn-ghost {
  border-color: var(--line-2);
  color: var(--ink-soft);
  background: linear-gradient(180deg, var(--surface), transparent);
}
.btn-ghost:hover {
  border-color: var(--line-2);
  color: var(--ink);
  background: linear-gradient(180deg, var(--surface-2), transparent);
}
.btn-lg { padding: 17px 36px; font-family: var(--mono); font-size: 1rem; letter-spacing: 0.04em; }

.tensor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 0 0;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  border-top: 1px solid var(--line);
}
.tensor-eq {
  font-family: "CMUSerif", "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(1.4rem, 2.6vw, 1.95rem);
  color: var(--ink);
  line-height: 1;
  letter-spacing: 0.01em;
}
.tensor-eq sub { font-style: italic; font-size: 0.62em; }
.tensor-eq .ein { color: var(--accent-2); }
.tensor-note {
  font-family: var(--mono);
  color: var(--ink-dim);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.scroll-hint {
  position: absolute;
  bottom: 34px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.scroll-line {
  width: 1px; height: 48px;
  background: linear-gradient(180deg, var(--ink-dim), transparent);
  position: relative; overflow: hidden;
}
.scroll-line::after {
  content: ""; position: absolute; inset: 0;
  height: 40%; background: var(--accent-2);
  animation: scrollPulse 2.4s var(--ease) infinite;
}
@keyframes scrollPulse { 0%{transform:translateY(-100%)} 60%,100%{transform:translateY(300%)} }

/* ---------- generic section ---------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(120px, 19vh, 240px) var(--pad);
}
.section-head {
  text-align: left;
  max-width: 880px;
  margin: 0 0 84px;
}
.kicker {
  font-family: var(--mono);
  font-size: clamp(0.86rem, 1vw, 0.98rem);
  letter-spacing: 0.22em;
  color: var(--accent-2);
  text-transform: uppercase;
  display: block;
  margin-bottom: 24px;
}
.section-head h2, .cta-h {
  font-family: var(--display);
  font-size: clamp(2.1rem, 4.8vw, 3.8rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

/* ---------- approach cards ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.card {
  position: relative;
  padding: 52px 40px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--surface), transparent);
  overflow: hidden;
  transition: border-color .4s var(--ease), transform .4s var(--ease), box-shadow .4s var(--ease);
}
/* hairline gradient along the top edge */
.card::after {
  content: "";
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-2), transparent);
}
.card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 0% 0%, var(--glow), transparent 55%);
  opacity: 0; transition: opacity .5s var(--ease);
  pointer-events: none;
}
.card:hover {
  border-color: var(--line-2);
  transform: translateY(-6px);
  box-shadow: 0 30px 60px -30px var(--card-shadow);
}
.card:hover::before { opacity: 0.5; }
.card-idx {
  font-family: "CMUSerif", "Times New Roman", serif;
  font-style: italic;
  font-size: 1.7rem;
  color: var(--accent-2);
  display: block;
  margin-bottom: 24px;
  opacity: 0.85;
}
.card-idx sub { font-size: 0.6em; }
.card h3 { font-size: 1.3rem; font-weight: 600; margin-bottom: 14px; }
.card p { color: var(--ink-soft); font-size: 0.98rem; font-weight: 300; }

/* ---------- research rows ---------- */
.rows { border-top: 1px solid var(--line); }
.row {
  display: grid;
  grid-template-columns: 240px 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 40px 8px;
  border-bottom: 1px solid var(--line);
  transition: background .35s var(--ease);
}
.row:hover { background: var(--row-hover); }
.row-tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--accent-2);
  text-transform: uppercase;
}
.row-title { font-size: clamp(1.05rem, 2vw, 1.5rem); font-weight: 400; color: var(--ink); }
/* Quiet marker — the rows are statements, not links, so it stays put. */
.row-arrow { font-family: var(--mono); color: var(--ink-dim); }

/* ---------- firm ---------- */
.firm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px, 6vw, 90px); align-items: start; }
.firm .section-head { margin: 0; text-align: left; max-width: none; }
.firm-body p { color: var(--ink-soft); font-weight: 300; font-size: 1.05rem; margin-bottom: 20px; }
.firm-quiet {
  font-family: var(--mono);
  font-size: 0.95rem !important;
  color: var(--accent-2) !important;
  border-left: 2px solid var(--accent);
  padding-left: 18px;
  margin-top: 28px !important;
  line-height: 1.7;
}
.firm-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.firm-tags li {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--ink-soft);
}

/* ---------- cta ---------- */
.cta { text-align: left; }
.cta-h { margin: 0 0 44px; max-width: 760px; }
.cta .btn { margin: 0; }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 500; letter-spacing: 0.05em; }
.footer-meta { display: flex; align-items: center; gap: 12px; color: var(--ink-dim); font-size: 0.84rem; font-family: var(--mono); }
.footer-meta .dot { opacity: 0.5; }
.footer-link { background: none; border: none; color: var(--ink-dim); font-family: var(--mono); font-size: 0.84rem; cursor: pointer; transition: color .25s var(--ease); }
.footer-link:hover { color: var(--accent-2); }

/* ---------- reveal animation ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(46px) scale(0.985);
  filter: blur(6px);
  transition: opacity 1.1s var(--ease), transform 1.2s var(--ease), filter 1s var(--ease);
  will-change: opacity, transform, filter;
}
[data-reveal].in { opacity: 1; transform: none; filter: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .nav-links a:not(.nav-cta) { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .firm-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr auto; }
  .row-tag { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; filter: none; transition: none; }
  .scroll-line::after { animation: none; }
}
