:root {
  --bg: #0b0b0c;
  --surface: #121214;
  --line: #222226;
  --text: #ededee;
  --muted: #8b8b93;
  --faint: #55555c;
  --accent: #ff5f1f;
  --grid: rgba(255, 255, 255, 0.025);
  --dot: rgba(255, 255, 255, 0.14);
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --sans: "Geist", system-ui, sans-serif;
}

:root[data-theme="light"] {
  --bg: #f3f2ee;
  --surface: #eae9e4;
  --line: #d6d4cd;
  --text: #121212;
  --muted: #5f5f66;
  --faint: #9a9a9f;
  --accent: #e2490c;
  --grid: rgba(0, 0, 0, 0.035);
  --dot: rgba(0, 0, 0, 0.16);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 96px 96px;
}

body {
  font-family: var(--sans);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #000; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* Interactive background + cursor readout */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.hud {
  position: fixed;
  left: 20px;
  bottom: 18px;
  z-index: 5;
  display: flex;
  gap: 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  pointer-events: none;
  user-select: none;
}
.hud b { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.hud-hint::before { content: "/"; margin-right: 14px; }
@media (hover: none), (max-width: 860px) { .hud { display: none; } }

/* Registration "+" marks on the stats strip */
.stats { position: relative; }
.stats::before, .stats::after {
  content: "+";
  position: absolute;
  top: -11px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1;
  color: var(--accent);
  background: var(--bg);
  padding: 4px 0;
}
.stats::before { left: -5px; }
.stats::after { right: -5px; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.logo { font-family: var(--mono); font-size: 14px; font-weight: 500; }
.logo span { color: var(--accent); }

.nav { display: flex; gap: 28px; }
.nav a { font-size: 13px; color: var(--muted); transition: color 0.15s; }
.nav a i { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--faint); margin-right: 6px; }
.nav a:hover, .nav a.active { color: var(--text); }
.nav a.active i { color: var(--accent); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.icon-btn .fill { fill: currentColor; stroke: none; }
.btn-sm {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: border-color 0.15s;
}
.btn-sm:hover { border-color: var(--text); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 64px;
  align-items: end;
  padding-top: 96px;
  padding-bottom: 64px;
}
.eyebrow { font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.hero h1 {
  font-size: clamp(56px, 9vw, 112px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.045em;
  margin: 20px 0 28px;
}
.lede { font-size: 20px; line-height: 1.5; color: var(--muted); max-width: 560px; }

.meta { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 28px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.meta li { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #3ecf6a; box-shadow: 0 0 0 3px rgba(62, 207, 106, 0.18); }

.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }
.btn {
  font-size: 14px;
  font-weight: 500;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--text); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #000; }

/* Portrait with crop-mark corners */
.portrait { position: relative; padding: 10px; }
.portrait::before, .portrait::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border: 1.5px solid var(--accent);
}
.portrait::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.portrait::after { bottom: 26px; right: 0; border-left: 0; border-top: 0; }
.portrait img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; filter: grayscale(0.15) contrast(1.05); }
.portrait figcaption { display: flex; justify-content: space-between; margin-top: 10px; font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stats div { padding: 22px 0 22px 20px; border-left: 1px solid var(--line); }
.stats div:first-child { border-left: 0; padding-left: 0; }
.stats dt { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.stats dd { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; margin-top: 4px; }

/* Sections */
.section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  padding-top: 96px;
  padding-bottom: 32px;
}
.section-label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  position: sticky;
  top: 88px;
  align-self: start;
}
.section-label i { font-style: normal; color: var(--accent); margin-right: 10px; }

.section-body > p { color: var(--muted); max-width: 640px; }
.section-body > p + p { margin-top: 16px; }
.section-body .big { font-size: 24px; line-height: 1.45; color: var(--text); letter-spacing: -0.01em; max-width: 720px; margin-bottom: 20px; }

.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.skills h3, .log time, .edu time { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.skills ul { list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }

/* Experience log */
.log { list-style: none; }
.log > li, .edu {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.log > li:first-child { border-top: 0; padding-top: 0; }
.log time, .edu time { padding-top: 4px; }
.log h3, .edu h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.log h3 span, .edu h3 span { display: block; font-size: 14px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.log p, .edu p { color: var(--muted); font-size: 15px; margin-top: 10px; }
.log ul { margin-top: 12px; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.log ul li { position: relative; padding-left: 18px; color: var(--muted); font-size: 15px; }
.log ul li::before { content: "—"; position: absolute; left: 0; color: var(--faint); }
.edu { margin-top: 8px; border-top: 1px dashed var(--line); }

/* Projects */
.project {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 24px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  transition: background 0.2s;
}
.project:first-of-type { border-top: 0; padding-top: 0; }
.project:last-of-type { border-bottom: 1px solid var(--line); }
.project-num, .project-meta { font-family: var(--mono); font-size: 12px; color: var(--faint); padding-top: 5px; }
.project h3 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; transition: color 0.15s; }
.project:hover h3 { color: var(--accent); }
.project p { color: var(--muted); font-size: 15px; margin-top: 8px; max-width: 620px; }
.project .stack { font-family: var(--mono); font-size: 12px; color: var(--faint); margin-top: 14px; }

/* Contact */
.contact-line { font-size: 28px; line-height: 1.3; letter-spacing: -0.02em; color: var(--text) !important; }
.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  font-size: clamp(22px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.03em;
  border-bottom: 2px solid var(--line);
  padding-bottom: 6px;
  transition: border-color 0.15s, color 0.15s;
}
.contact-email span { color: var(--accent); transition: transform 0.2s; }
.contact-email:hover { border-color: var(--accent); }
.contact-email:hover span { transform: translateX(6px); }
.contact-links { list-style: none; display: flex; flex-wrap: wrap; gap: 28px; margin-top: 36px; font-family: var(--mono); font-size: 13px; }
.contact-links a { color: var(--muted); }
.contact-links a:hover { color: var(--text); }

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 96px;
  padding-top: 24px;
  padding-bottom: 32px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

@media (max-width: 860px) {
  .nav { display: none; }
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 56px; }
  .portrait { max-width: 260px; order: -1; }
  .section { grid-template-columns: 1fr; gap: 24px; padding-top: 72px; }
  .section-label { position: static; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .lede { font-size: 17px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats div:nth-child(3) { border-left: 0; padding-left: 0; }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .section-body .big { font-size: 20px; }
  .skills { grid-template-columns: 1fr 1fr; }
  .log > li, .edu { grid-template-columns: 1fr; gap: 6px; }
  .project { grid-template-columns: 1fr; gap: 6px; }
  .project-meta { display: none; }
  .contact-line { font-size: 22px; }
}

/* Coursework list inside the education entry */
.coursework { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; margin-top: 20px; }
.coursework h4 { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.coursework ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.coursework li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; font-size: 14px; color: var(--muted); }
.coursework code { font-family: var(--mono); font-size: 12px; color: var(--text); padding-top: 1px; }
@media (max-width: 860px) { .coursework { grid-template-columns: 1fr; } }
