:root {
  --bg: #0b0d10;
  --fg: #e9e6df;        /* 15.6:1 on --bg */
  --text-2: #d0cdc6;    /* body copy, 12.3:1 */
  --muted: #8a919b;     /* labels, 6.1:1 */
  --line: #22272e;      /* decorative rules */
  --line-strong: #3a414b;
  --accent: #f0b44c;    /* 10.5:1 */
  --nav-h: 52px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter Tight", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: #111; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: var(--nav-h); }

/* ---------- navigation ---------- */
.sitenav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 13, 16, .88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.sitenav-inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 clamp(12px, 2.6vw, 44px);
}
.sitenav-home {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.sitenav ul {
  display: flex;
  gap: clamp(0px, 1vw, 12px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.sitenav ul a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  font-size: 15px;
  color: var(--text-2);
  transition: color .2s;
}
.sitenav ul a:hover { color: var(--accent); }

/* ---------- hero ---------- */
/* --nx1/--nx2/--ny describe the notch (fractions of the header box);
   main.js reads the same variables so the ASCII mask and the name block line up. */
.hero {
  --nx1: .40;
  --nx2: .57;
  --ny: .52;
  --ascii-fs: 13;
  position: relative;
  height: clamp(520px, 76vh, 840px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hero-id {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(var(--nx1) * 100%);
  height: calc((1 - var(--ny)) * 100%);
  padding: 0 clamp(20px, 2.6vw, 44px) clamp(24px, 5vh, 56px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* if space runs short, grow upwards, never off the bottom */
}
.name {
  margin: 0;
  font-weight: 600;
  font-size: clamp(40px, min(5.4vw, 10.5vh), 108px);
  line-height: .92;
  letter-spacing: -0.04em;
  animation: rise .9s cubic-bezier(.2, .7, .2, 1) both;
}
.name span { display: block; }
.tagline {
  margin: 1em 0 0;
  font-family: var(--mono);
  font-size: clamp(15px, 1.35vw, 22px);
  letter-spacing: .02em;
  color: var(--fg);
  white-space: nowrap;
}
.tagline span:last-child { color: var(--accent); }
.hero-sub {
  margin: .5em 0 0;
  font-size: clamp(16px, 1.15vw, 18px);
  color: var(--text-2);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-size: 16px;
  font-weight: 500;
  transition: background .2s, color .2s, border-color .2s;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #111; }
.btn-primary:hover { background: #f5c56e; border-color: #f5c56e; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- content ---------- */
.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}
section {
  padding: clamp(56px, 7vw, 96px) 0;
  border-bottom: 1px solid var(--line);
}
.kicker {
  margin: 0 0 24px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker b { color: var(--accent); font-weight: 500; }
.lead {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 46px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.025em;
  max-width: 20ch;
  text-wrap: balance;
}
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
.prose p {
  margin: 0 0 1em;
  font-size: clamp(16px, 1.2vw, 18px);
  color: var(--text-2);
  max-width: 62ch;
}
.prose p:last-child { margin-bottom: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.stat {
  padding-top: 24px;
  border-top: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-num {
  font-size: clamp(24px, 2.3vw, 32px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.stat-label { color: var(--text-2); max-width: 26ch; }

.principles .lead { margin-bottom: clamp(32px, 4vw, 48px); }
.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line-strong);
}
.pillar { padding: 28px 32px 0 0; }
.pillar + .pillar { padding-left: 32px; border-left: 1px solid var(--line); }
.pillar h3 {
  margin: 0 0 10px;
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 500;
  letter-spacing: -0.02em;
}
.pillar p { margin: 0; color: var(--text-2); max-width: 38ch; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px !important;
  font-family: var(--mono);
  font-size: 13px;
}
.meta span {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
}

.contact-note {
  margin: 20px 0 0;
  font-size: clamp(16px, 1.2vw, 18px);
  color: var(--text-2);
  max-width: 62ch;
}
.contact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 28px; }
.contact-address {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--text-2);
  user-select: all; /* one click selects the whole address for copying */
  overflow-wrap: anywhere;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- research ---------- */
#research .lead { margin-bottom: clamp(28px, 3.5vw, 44px); }
.research-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.research-card {
  padding-top: 24px;
  border-top: 1px solid var(--line-strong);
}
.research-card h3 {
  margin: 10px 0 14px;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
.research-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.research-position { color: var(--accent); }
.research-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-weight: 500;
}
.research-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.thesis { padding: clamp(48px, 6vw, 80px) 0; }
.thesis-head { margin-bottom: clamp(32px, 4vw, 48px); }
.thesis-head .lead { margin-top: 16px; max-width: 24ch; }
.thesis-part { padding: 28px 0; border-bottom: 0; border-top: 1px solid var(--line); }
.thesis-part h2 {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.thesis-part p { margin: 0 0 1em; color: var(--text-2); max-width: 66ch; }
.thesis-sources { margin: 0; padding-left: 18px; color: var(--text-2); }
.thesis-sources a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

.footer {
  padding-top: 28px;
  padding-bottom: 40px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- scroll reveal (reveal.js adds .reveal-ready; without JS everything shows) ---------- */
.reveal-ready [data-reveal="rise"] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity .8s cubic-bezier(.2, .7, .2, 1),
    transform 1s cubic-bezier(.2, .7, .2, 1);
}
.reveal-ready [data-reveal="rise"].in {
  opacity: 1;
  transform: none;
}
.reveal-ready .w { transition: opacity .2s linear; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .hero {
    --nx1: .86;
    --nx2: .95;
    --ny: .50;
    --ascii-fs: 10;
    height: max(600px, 88svh);
  }
  .name { font-size: min(13vw, 60px); }
  .tagline { white-space: normal; }
  .about-grid, .pillars { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; gap: 0; }
  .stat { padding: 20px 0; }
  .pillar, .pillar + .pillar { padding: 24px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .pillar:last-child { border-bottom: 0; }
}

@media (max-width: 420px) {
  .sitenav ul a { padding: 0 7px; font-size: 14px; }
  .sitenav-home { padding: 0 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .name { animation: none; }
}
