:root {
  --bg: #121511;
  --panel: #171b15;
  --line: #2c3228;
  --text: #e6e8dc;
  --muted: #a6b09b;
  --dim: #788270;
  --lime: #d9f775;
  --lime-hover: #ecffa8;
  --accent: var(--lime);
  --ink: #1c2214;
  --grid: #252a22;
  --road: #22281f;
  --road-line: #3a4234;
  --start-line: #e8ecd9;
  --checkpoint: #4a5242;
  --racer: #f2ffcc;
  --sans: 'Geologica', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --gutter: clamp(20px, 5vw, 64px);
  color-scheme: dark;
}

/* Lime stays the fill colour; text and thin strokes switch to a darker green that holds up on paper. */
:root[data-theme=light] {
  --bg: #f4f5ee;
  --panel: #eceee3;
  --line: #d6dacb;
  --text: #171a14;
  --muted: #4f5746;
  --dim: #646d5a;
  --lime-hover: #c8ea4f;
  --accent: #4a6e00;
  --grid: #e0e3d6;
  --road: #e0e3d6;
  --road-line: #c3c9b6;
  --start-line: #2a3024;
  --checkpoint: #b4bba8;
  --racer: var(--lime);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--lime); color: var(--ink); }

.container { max-width: 1280px; margin-inline: auto; padding-inline: var(--gutter); }
.skip {
  position: fixed; top: 12px; left: 12px; z-index: 10;
  padding: 12px 16px; background: var(--lime); color: var(--ink);
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Header */
.header { display: flex; align-items: center; gap: 40px; height: 88px; }
.logo { margin-right: auto; }
/* The Y stem hangs below the M; drop the logo so the M, not the box, lines up with the nav. */
.logo svg { display: block; width: 34px; height: 34px; fill: var(--accent); transform: translateY(14%); }
.nav { display: flex; gap: 32px; font-size: 14px; color: var(--muted); }
.nav a:hover { color: var(--text); }
.settings { display: flex; align-items: center; gap: 12px; }
.languages { display: flex; gap: 2px; font: 12px var(--mono); }
.languages button, .theme { min-height: 40px; padding: 0 8px; border: 0; background: none; color: var(--dim); }
.languages button:hover, .theme:hover { color: var(--text); }
.theme { display: grid; place-items: center; }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.theme[aria-pressed=true] .icon-sun, .theme[aria-pressed=false] .icon-moon { display: none; }
.languages button[aria-pressed=true] { color: var(--text); text-decoration: underline; text-underline-offset: 6px; }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 64px;
  align-items: center;
  padding-top: 56px;
  padding-bottom: 96px;
}
.hero h1 {
  font-size: clamp(40px, 7.4vw, 94px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}
.hero h1 span { color: var(--accent); }
.bio { display: flex; gap: 20px; align-items: flex-start; margin-top: 44px; }
.bio img { width: 60px; aspect-ratio: 1; object-fit: cover; filter: grayscale(0.6); flex-shrink: 0; }
.bio p { max-width: 440px; font-size: 18px; line-height: 1.55; color: var(--muted); }
.button {
  display: inline-block;
  margin-top: 36px;
  padding: 14px 24px;
  background: var(--lime);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}
.button:hover { background: var(--lime-hover); }
/* Two lines are always reserved so the shuffling stack never pushes the layout around. */
.stack {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  height: calc(3.6em + 21px);
  overflow: hidden;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font: 12px/1.8 var(--mono);
  color: var(--dim);
}
.stack li { white-space: nowrap; transition: color 0.3s; }
.stack li:not(:last-child)::after { content: '·'; margin-inline: 0.6em; color: var(--dim); }
.stack li.is-changing { color: var(--accent); }

/* Career circuit */
.track { border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.circuit { display: block; width: 100%; height: auto; }
.circuit path { fill: none; stroke-linejoin: round; }
.circuit-grid { stroke: var(--grid); stroke-width: 0.5; }
.circuit-road { stroke: var(--road); stroke-width: 22; }
.circuit-line { stroke: var(--road-line); stroke-width: 1.5; }
.circuit-progress { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.circuit-start { stroke: var(--start-line); stroke-width: 6; stroke-dasharray: 3 3; }
.checkpoint { cursor: pointer; }
.checkpoint circle { fill: var(--checkpoint); stroke: var(--panel); stroke-width: 2; transition: fill 0.2s; }
.checkpoint text { font: 11px var(--mono); fill: var(--dim); letter-spacing: 0.06em; transition: fill 0.2s; }
.checkpoint.is-passed circle { fill: var(--accent); }
.checkpoint.is-current text, .checkpoint:hover text { fill: var(--accent); }
.racer { fill: var(--racer); filter: drop-shadow(0 0 6px var(--lime)); pointer-events: none; }

.chapters { display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); }
.chapters button {
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 12px var(--mono);
}
.chapters button + button { border-left: 1px solid var(--line); }
.chapters button:hover { color: var(--text); }
.chapters button[aria-selected=true] { background: var(--lime); color: var(--ink); }
.chapters button:focus-visible { outline-offset: -4px; }

/* Panels share one cell so switching chapters never changes the height. */
.chapter-panels { display: grid; }
.chapter { grid-area: 1 / 1; padding: 22px 24px 26px; }
.chapter[hidden] { display: block; visibility: hidden; }
.chapter h2 { font-size: 17px; font-weight: 500; }
.chapter p { margin-top: 8px; font-size: 14px; line-height: 1.65; color: var(--muted); }

/* Work */
.work { padding-top: 40px; padding-bottom: 112px; }
.work > h2 { font-size: 40px; font-weight: 500; letter-spacing: -0.035em; line-height: 1.1; margin-bottom: 40px; }
.projects li {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  grid-template-rows: auto 1fr;
  column-gap: 64px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}
.projects li:last-child { border-bottom: 1px solid var(--line); }
.projects h3 { font-size: 24px; font-weight: 500; letter-spacing: -0.025em; line-height: 1.25; }
.tag { margin-top: 10px; font: 12px var(--mono); color: var(--dim); }
.projects p { grid-column: 2; grid-row: 1 / span 2; max-width: 560px; color: var(--muted); }

/* Contact */
.contact { background: var(--lime); color: var(--ink); padding: 80px 0 32px; }
.contact :focus-visible { outline-color: var(--ink); }
.contact h2 { font-size: 18px; font-weight: 500; }
.contact-email {
  display: inline-block;
  margin: 16px 0 88px;
  font-size: clamp(26px, 7.2vw, 96px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
  overflow-wrap: anywhere;
}
.contact-email:hover { text-decoration: underline; text-decoration-thickness: 0.06em; text-underline-offset: 0.12em; }
.contact-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px solid rgb(28 34 20 / 0.25);
}
.contact-links { display: flex; gap: 32px; font-weight: 500; }
.contact-links a:hover { text-decoration: underline; text-underline-offset: 4px; }
.location { font: 12px var(--mono); color: #4d5a35; }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 56px; padding-top: 32px; padding-bottom: 72px; }
  .hero h1 { font-size: min(13vw, 96px); }
  .track { max-width: 600px; }
}

@media (max-width: 720px) {
  .header { height: 72px; gap: 24px; }
  .logo svg { width: 30px; height: 30px; }
  .settings { gap: 4px; }
  .projects li { grid-template-columns: 1fr; padding: 28px 0; }
  .projects p { grid-column: 1; grid-row: auto; margin-top: 14px; }
  .work { padding-top: 24px; padding-bottom: 80px; }
  .work > h2 { font-size: 32px; margin-bottom: 28px; }
  .contact { padding-top: 56px; }
  .contact-email { margin-bottom: 56px; }
}

@media (max-width: 480px) {
  .nav { display: none; }
  .bio { gap: 16px; margin-top: 32px; }
  .bio img { width: 52px; }
  .bio p { font-size: 16px; }
  .stack { margin-top: 40px; }
  .chapter { padding: 20px; }
  .projects h3 { font-size: 21px; }
  .contact-links { gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
