:root {
  --bg: #05070a;
  --text: #eef2f6;
  --muted: #7d8794;
  --accent: #4ade80;
  --str: #67e8f9;
  --border: #1a2028;
  --mono: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 28px; }
header {
  position: sticky; top: 0; z-index: 10; height: 60px;
  background: rgba(5,7,10,0.75); backdrop-filter: blur(10px);
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border);
}
.header-inner { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.brand { font-weight: 600; color: var(--text); text-decoration: none; font-size: 0.9rem; font-family: var(--mono); }
nav a { color: var(--muted); text-decoration: none; margin-left: 22px; font-size: 0.85rem; font-family: var(--mono); }
nav a:hover { color: var(--accent); }
nav a::before { content: "./"; color: var(--border); }

/* Fixed page-wide canvas */
canvas#bg { position: fixed; inset: 0; z-index: -1; width: 100vw; height: 100vh; }

.hero {
  position: relative;
  height: 100vh;
  min-height: 640px;
  display: flex;
  align-items: center;
}
.hero-content { position: relative; z-index: 2; max-width: 1040px; margin: 0 auto; padding: 0 28px; width: 100%; }
.hero-content-split { display: flex; align-items: center; gap: 56px; }
.hero-text { flex: 1; min-width: 0; }
.hero-headshot {
  width: 200px; height: 250px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 4px;
  background: rgba(5,7,10,0.5);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-family: var(--mono); font-size: 0.8rem; text-align: center;
}
.hero-prompt {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 6px;
}
.hero-prompt .arrow { color: var(--accent); }
.hero-name {
  font-family: var(--mono);
  font-size: clamp(2.4rem, 7vw, 5rem);
  max-width: 100%;
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  border-right: 3px solid var(--accent);
  display: inline-block;
  overflow: hidden;
  width: 0;
  animation: typing 1.6s steps(13, end) 0.4s forwards, caret 0.8s step-end infinite;
}
@keyframes typing { from { width: 0; } to { width: 13ch; } }
@keyframes caret { 50% { border-color: transparent; } }

.hero-role { color: var(--str); font-size: 0.9rem; margin: 20px 0 10px; font-family: var(--mono); }
.hero-role::before { content: "// "; color: var(--muted); }
.hero-sub { color: var(--muted); max-width: 44ch; font-size: 1rem; margin: 0 0 28px; }
.scroll-hint { position: absolute; bottom: 28px; left: 28px; z-index: 2; font-size: 0.78rem; color: var(--muted); font-family: var(--mono); }

.section { padding: 88px 0; border-top: 1px solid var(--border); background: rgba(5,7,10,0.72); }
h2 { font-size: 1.3rem; font-weight: 700; margin: 0 0 34px; font-family: var(--mono); }
h2::before { content: "> "; color: var(--accent); }

/* Research tile grid */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.project-tile {
  display: block; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  transition: border-color .15s;
}
.project-tile:hover { border-color: var(--accent); }
.project-tile-media {
  aspect-ratio: 16/10; background: #0a0e14; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-family: var(--mono); font-size: 0.78rem; text-align: center; padding: 10px;
}
.project-tile-body { padding: 16px 18px; }
.project-tile-name { font-family: var(--mono); font-weight: 700; font-size: 0.96rem; margin: 0 0 6px; }
.project-tile-meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin: 0; }
.project-tile-meta .dim { color: var(--str); }

.research-block { display: grid; grid-template-columns: 340px 1fr; gap: 40px; }
.media-ph {
  border: 1px solid var(--border); border-radius: 4px; aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 16px;
  font-family: var(--mono); font-size: 0.85rem;
}
.field-row { display: grid; grid-template-columns: 190px 1fr; gap: 4px 16px; margin: 6px 0; font-size: 0.9rem; font-family: var(--mono); }
.field-label { white-space: nowrap; color: var(--muted); }
.field-row span:last-child { color: var(--str); }
.research-title { font-size: 1.05rem; margin: 0 0 16px; color: var(--muted); font-family: var(--mono); }

.back-link { display: inline-block; font-family: var(--mono); font-size: 0.85rem; color: var(--muted); text-decoration: none; margin-bottom: 28px; }
.back-link:hover { color: var(--accent); }
.back-link::before { content: "< "; }

.course-stack { display: flex; flex-direction: column; max-width: 500px; font-family: var(--mono); }
.course-row { display: flex; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.course-row:last-child { border-bottom: none; }
.course-row::before { content: "- "; color: var(--muted); }

.btn {
  display: inline-block; background: var(--accent); color: #04120a; font-weight: 700;
  padding: 12px 22px; border-radius: 4px; text-decoration: none; font-size: 0.88rem;
  font-family: var(--mono);
}
.btn:hover { opacity: 0.88; }
.btn::before { content: "$ "; opacity: 0.6; }

.cv-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; margin-top: 40px; }
.cv-row { padding: 16px 0; border-top: 1px solid var(--border); }
.cv-row:first-child { border-top: none; }
.cv-role { font-weight: 600; }
.cv-org { color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; font-family: var(--mono); }
.skill-pills { display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--mono); }
.skill-pill { font-size: 0.76rem; border: 1px solid var(--border); border-radius: 3px; padding: 4px 9px; color: var(--str); }

.contact-row { display: flex; gap: 32px; flex-wrap: wrap; font-size: 0.9rem; font-family: var(--mono); }
a.plain { color: var(--accent); text-decoration: none; }

/* Project detail page */
.project-hero { padding: 64px 0 40px; border-top: none; }
.project-title { font-family: var(--mono); font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; margin: 0 0 10px; }
.project-tagline { color: var(--muted); font-size: 1rem; max-width: 60ch; margin: 0; }
.project-media { border: 1px solid var(--border); border-radius: 6px; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; color: var(--muted); font-family: var(--mono); font-size: 0.85rem; margin: 30px 0 0; }
.meta-strip { display: flex; flex-wrap: wrap; gap: 28px; margin: 24px 0 0; font-family: var(--mono); font-size: 0.85rem; }
.meta-strip div { color: var(--muted); }
.meta-strip strong { color: var(--str); display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 3px; }
.prose { max-width: 68ch; font-size: 0.98rem; }
.prose h3 { font-family: var(--mono); font-size: 1rem; margin: 34px 0 12px; color: var(--text); }
.prose p { color: var(--text); margin: 0 0 16px; }
.stack-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

@media (max-width: 760px) {
  .research-block, .cv-layout { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .hero { height: 92vh; }
  .hero-content-split { flex-direction: column-reverse; align-items: flex-start; gap: 28px; }
  .hero-headshot { width: 140px; height: 175px; }
}
