:root {
  --paper: #f6f2ea;
  --paper-warm: #fffaf1;
  --ink: #20241f;
  --ink-muted: #6d7169;
  --line: #20241f24;
  --line-strong: #20241f47;
  --accent: #2f5d50;
  --accent-soft: #dce8e1;
  --terracotta: #9a4f33;
  --glow-a: #dfe3da;
  --glow-b: #efe8db;
  --card-a: #f3f1ea;
  --card-b: #eceee6;
  --spot: #2f5d5014;
  --shadow: #20241f2e;
  --bid: #2f5d50;
  --ask: #9a4f33;

  --serif: "Crimson Text", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;

  --sidebar-width: 190px;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: light;
}

/* Night: same paper-and-ink system, inverted. */
:root[data-theme="dark"] {
  --paper: #121511;
  --paper-warm: #181c17;
  --ink: #e9e5da;
  --ink-muted: #9da296;
  --line: #e9e5da1c;
  --line-strong: #e9e5da3d;
  --accent: #8fc2ad;
  --accent-soft: #1d3a30;
  --terracotta: #dc9270;
  --glow-a: #1c2a24;
  --glow-b: #1e1c17;
  --card-a: #161a15;
  --card-b: #141814;
  --spot: #8fc2ad14;
  --shadow: #00000080;
  --bid: #8fc2ad;
  --ask: #dc9270;
  color-scheme: dark;
}

html { transition: background-color .4s; }
body, .sidebar, .topbar, .art-card, .palette__box, .chips span, .btn, .filter {
  transition-property: background-color, color, border-color, box-shadow, transform, opacity;
  transition-duration: .4s;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(60vw 50vh at 78% 22%, var(--glow-a) 0%, transparent 70%),
    radial-gradient(50vw 60vh at 10% 90%, var(--glow-b) 0%, transparent 70%);
  background-attachment: fixed;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
::selection { background: var(--accent-soft); color: var(--ink); }

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  font: 12px var(--mono);
}
.skip:focus { left: 8px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 56px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--paper-warm) 55%, transparent);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar__nav a {
  font: 400 12px/1 var(--mono);
  color: var(--ink-muted);
  text-decoration: none;
  transition: color .2s;
}
.sidebar__nav a:hover,
.sidebar__nav a.active {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--paper-warm) 60%, transparent);
  color: var(--ink-muted);
  font: 400 12px/1 var(--mono);
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}
.btn:hover,
.btn:focus-visible {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.btn--side { align-self: flex-start; }

/* ---------- Layout ---------- */
.page { margin-left: var(--sidebar-width); }

.panel {
  min-height: 100vh;
  min-height: 100svh;
  padding: 96px var(--gutter);
  scroll-snap-align: start;
}

.eyebrow {
  margin: 0 0 6px;
  font: 400 11px/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--terracotta);
}
.eyebrow--spaced { margin-top: 72px; }

.section-title {
  margin: 0 0 40px;
  font: 500 30px/1.1 var(--serif);
}

.meta {
  margin: 0;
  font: 400 12px/1.6 var(--mono);
  color: var(--terracotta);
}
.meta a { text-decoration: none; }
.meta a:hover { text-decoration: underline; }

h3 {
  margin: 4px 0 2px;
  font: 600 19px/1.25 var(--serif);
}

ul {
  margin: 14px 0 0;
  padding-left: 18px;
}
li, .body {
  font: 400 13px/1.75 var(--sans);
  color: var(--ink-muted);
}
li + li { margin-top: 6px; }
li::marker { color: var(--line-strong); }

/* ---------- Art card (shared) ---------- */
.art-card {
  margin: 0;
  padding: 14px;
  background: linear-gradient(160deg, var(--paper-warm), var(--card-a) 60%, var(--card-b));
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow:
    0 30px 60px -20px var(--shadow),
    0 12px 24px -12px #20241f1f;
}
.art-card__inner {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  border: 1px solid var(--line);
  overflow: hidden;
}
.art-card__caption {
  position: absolute;
  left: 14px;
  bottom: 10px;
  font: 400 10px/1 var(--mono);
  color: var(--ink-muted);
  letter-spacing: .04em;
}


/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: center;
  gap: clamp(32px, 5vw, 80px);
}

.hero__name {
  margin: 0 0 28px;
  font: 500 clamp(64px, 8.6vw, 116px)/.92 var(--serif);
  letter-spacing: -.01em;
}

.hero__lede,
.hero__loc {
  max-width: 34ch;
  margin: 0 0 18px;
  font: 400 14px/1.7 var(--mono);
  color: var(--ink-muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 360px;
  margin-top: 26px;
}

.hero__art { aspect-ratio: 1.12 / 1; }


/* ---------- Experience ---------- */
.experience {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}

.experience__art {
  position: sticky;
  top: 20vh;
  height: 60vh;
}
.art-card--tall { height: 100%; }


.job { padding: 0 0 34px; }
.job + .job { padding-top: 30px; border-top: 1px solid var(--line); }

/* ---------- Education / Skills ---------- */
.cols {
  display: grid;
  gap: 0;
}
.cols--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.col { padding: 0 32px; }
.col:first-child { padding-left: 0; }
.col + .col { border-left: 1px solid var(--line); }

.sub {
  margin: 4px 0 0;
  font: 400 12px/1.6 var(--sans);
  color: var(--ink-muted);
}
.cols--4 h3 { margin-bottom: 8px; }
.cols--4 .body { margin: 0; }

/* ---------- Projects ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.project {
  padding: 30px 40px 34px 0;
  border-bottom: 1px solid var(--line);
  transition: background .25s;
}
/* script.js marks the visible cards that sit in the right column. */
.project.is-right {
  padding: 30px 0 34px 40px;
  border-left: 1px solid var(--line);
}
.project--featured {
  grid-column: 1 / -1;
  padding-right: 0;
}
.project--featured h3 { font-size: 24px; }
.project.project--featured .body { max-width: 80ch; }
.project .body { margin: 10px 0 0; max-width: 56ch; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 14px 0 0;
}
.links a {
  font: 400 12px/1 var(--mono);
  color: var(--accent);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.links a:hover { border-bottom-color: var(--accent); }

/* ---------- Contact ---------- */
.contact {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.contact__row {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 56px;
}
.contact__row a {
  display: inline-block;
  margin-top: 6px;
  font: 400 14px/1.4 var(--sans);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.contact__row a:hover { color: var(--accent); }

.footnote {
  margin: 96px 0 0;
  font: 400 11px/1 var(--mono);
  color: var(--ink-muted);
}

/* ---------- Reveal ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s ease, transform .7s ease;
}
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Mobile top bar ---------- */
.topbar { display: none; }

@media (max-width: 1100px) {
  .cols--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 32px; }
  .cols--4 .col:nth-child(3) { padding-left: 0; border-left: 0; }
}

@media (max-width: 860px) {
  html { scroll-snap-type: none; }

  .topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    height: 56px;
    padding: 0 16px;
    background: color-mix(in srgb, var(--paper-warm) 85%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px -16px #20241f40;
  }
  .topbar__name {
    font: 500 20px/1 var(--serif);
    opacity: 0;
    transition: opacity .3s;
  }
  body.scrolled .topbar__name { opacity: 1; }

  .menu-btn {
    display: grid;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 12px 8px;
    margin-left: -8px;
    border: 0;
    background: none;
    cursor: pointer;
  }
  .menu-btn span {
    display: block;
    height: 2px;
    background: var(--ink);
    transition: transform .25s, opacity .25s;
  }
  body.menu-open .menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.menu-open .menu-btn span:nth-child(2) { opacity: 0; }
  body.menu-open .menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .sidebar {
    inset: 56px 0 auto 0;
    width: auto;
    height: auto;
    gap: 28px;
    padding: 28px 16px 32px;
    background: var(--paper-warm);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    transform: translateY(-110%);
    visibility: hidden;
    transition: transform .3s ease, visibility .3s;
  }
  body.menu-open .sidebar { transform: none; visibility: visible; }
  .sidebar__nav a { font-size: 15px; padding: 6px 0; }

  .page { margin-left: 0; }
  .panel { min-height: 0; padding: 88px 16px 64px; }
  .hero { min-height: 100svh; padding-top: 104px; }

  .hero,
  .experience { grid-template-columns: 1fr; }
  .hero__art { aspect-ratio: 1.05 / 1; }

  .experience__art { position: relative; top: 0; height: 280px; order: 2; }

  .cols--2,
  .cols--3 { grid-template-columns: 1fr; row-gap: 32px; }
  .cols--3 .col + .col { padding-top: 32px; border-top: 1px solid var(--line); }
  .col, .col:first-child { padding: 0; border-left: 0 !important; }
  .cols--2 .col + .col { padding-top: 32px; border-top: 1px solid var(--line); }

  .grid { grid-template-columns: 1fr; }
  .project,
  .project.is-right { padding: 26px 0 28px; border-left: 0; }

  .contact__row { flex-direction: column; gap: 22px; }
}

@media (max-width: 480px) {
  .cols--4 { grid-template-columns: 1fr; }
  .cols--4 .col { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ================= Interactive pieces ================= */

kbd {
  display: inline-block;
  min-width: 18px;
  margin: 0 2px;
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--paper-warm);
  font: 500 10px/1.2 var(--mono);
  color: var(--ink);
  text-align: center;
}

/* Sidebar numbers and hint */
.sidebar__nav a { display: flex; align-items: baseline; gap: 10px; }
.sidebar__nav .num {
  font-size: 9px;
  color: var(--line-strong);
  transition: color .2s;
}
.sidebar__nav a.active .num,
.sidebar__nav a:hover .num { color: var(--terracotta); }
.sidebar__nav a.active { transform: translateX(4px); }
.sidebar__nav a { transition: color .2s, transform .25s; }

.kbd-btn {
  border: 0;
  background: none;
  padding: 0;
  font: 400 11px/1 var(--mono);
  color: var(--ink-muted);
  cursor: pointer;
}
.sidebar__foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: -28px;
}
.sidebar__hint:hover { color: var(--ink); }

/* Typed line */
.hero__typed {
  margin: 0 0 18px;
  font: 400 13px/1.6 var(--mono);
  color: var(--ink);
}
.hero__prompt { color: var(--terracotta); margin-right: 4px; }
#typed { color: var(--accent); }
.caret {
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--ink);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Art cards: hints and drag */
.art-card__hint {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 1;
  padding: 3px 6px;
  background: var(--paper-warm);
  font: 400 10px/1 var(--mono);
  color: var(--ink-muted);
  opacity: .7;
  transition: opacity .4s;
}
.art-card__inner.touched .art-card__hint { opacity: 0; }
.hero__art .art-card__inner {
  cursor: grab;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body.is-dragging { -webkit-user-select: none; user-select: none; cursor: grabbing; }
.hero__art .art-card__inner.dragging { cursor: grabbing; }
.art-card { transition: transform .5s cubic-bezier(.2, .7, .2, 1), box-shadow .5s; }
.hero__art { transform-style: preserve-3d; will-change: transform; }

/* Skill chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
}
.chips span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-warm) 70%, transparent);
  font: 400 11px/1 var(--mono);
  color: var(--ink-muted);
  transition: border-color .2s, color .2s, background .2s, transform .2s;
}
.chips span:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* Project filters */
.projects__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 40px;
}
.projects__head .section-title { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font: 400 11px/1 var(--mono);
  color: var(--ink-muted);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.filter:hover { color: var(--ink); border-color: var(--ink); }
.filter[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.project {
  position: relative;
  transition: background .3s, opacity .35s, transform .35s;
}
.project::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent-soft);
  opacity: 0;
  transition: opacity .3s;
}
.project h3 { transition: color .2s; }
.project:hover h3 { color: var(--accent); }
.project.is-hidden { display: none; }
.js .project.is-entering { opacity: 0; transform: translateY(8px); }
.project.flash::before { opacity: 1; background: var(--accent-soft); }
.grid { isolation: isolate; }

.stars {
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: var(--ink-muted);
}
.stars:empty { display: none; }

.empty {
  margin: 24px 0 0;
  font: 400 12px/1 var(--mono);
  color: var(--ink-muted);
}

/* Copy buttons */
.copy {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  font: 400 14px/1.4 var(--sans);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}
.copy__tag {
  font: 400 10px/1 var(--mono);
  color: var(--ink-muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .2s, transform .2s;
}
.copy:hover { color: var(--accent); }
.copy:hover .copy__tag,
.copy:focus-visible .copy__tag { opacity: 1; transform: none; }
.footnote kbd { font-size: 9px; }

/* Command palette */
.palette {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: start center;
  padding: 14vh 16px 16px;
}
.palette[hidden] { display: none; }
.palette__backdrop {
  position: absolute;
  inset: 0;
  background: #20241f33;
  backdrop-filter: blur(3px);
  animation: fade .2s ease;
}
.palette__box {
  position: relative;
  width: min(560px, 100%);
  background: var(--paper-warm);
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 80px -30px #20241f66;
  animation: pop .22s cubic-bezier(.2, .8, .2, 1);
}
.palette__input {
  width: 100%;
  padding: 18px 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font: 400 16px/1.2 var(--mono);
  color: var(--ink);
  outline: none;
}
.palette__list {
  max-height: min(360px, 50vh);
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}
.palette__list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 10px 14px;
  font: 400 13px/1.3 var(--sans);
  color: var(--ink);
  cursor: pointer;
}
.palette__list li + li { margin-top: 0; }
.palette__list li small {
  font: 400 10px/1 var(--mono);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.palette__list li[aria-selected="true"] { background: var(--accent-soft); }
.palette__list li[aria-selected="true"] small { color: var(--accent); }
.palette__foot {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font: 400 10px/1 var(--mono);
  color: var(--ink-muted);
}
.palette__foot kbd { margin-right: 2px; }
.palette__foot kbd + kbd { margin-left: 0; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 70;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--paper);
  font: 400 12px/1 var(--mono);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }

@media (max-width: 860px) {
  .topbar__search { margin-left: auto; padding: 10px 4px; font-size: 12px; }
  .sidebar__hint { display: none; }
  .sidebar__foot { margin-top: 0; }
  .sidebar__nav a.active { transform: none; }
  .art-card__hint { display: none; }
  .palette { padding-top: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .project, .art-card { transition: none; }
}

/* ================= Round 3: theme, timeline, stats, lab ================= */

/* Theme toggle */
.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  font: 400 11px/1 var(--mono);
  color: var(--ink-muted);
  cursor: pointer;
}
.theme-btn:hover { color: var(--ink); }
.theme-btn__icon {
  width: 14px;
  height: 14px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  transition: transform .5s;
}
:root[data-theme="dark"] .theme-btn__icon { transform: rotate(180deg); }

/* Hero name scramble keeps its width */
.scramble { display: inline-block; white-space: pre; }

/* Experience timeline */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before,
.timeline__fill {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  width: 1px;
  background: var(--line-strong);
}
.timeline::before { bottom: 0; }
.timeline__fill {
  height: calc(var(--fill, 0) * (100% - 6px));
  background: var(--terracotta);
}
.job { position: relative; }
.job::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 6px;
  width: 9px;
  height: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  transition: background .3s, border-color .3s, transform .3s;
}
.job + .job::before { top: 36px; }
.job.passed::before {
  background: var(--terracotta);
  border-color: var(--terracotta);
  transform: scale(1.15);
}

/* Stats strip */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 56px;
  border-top: 1px solid var(--line);
}
.stats > div {
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  padding: 22px 24px;
}
.stats > div:first-child { padding-left: 0; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats dt {
  font: 400 11px/1.4 var(--mono);
  color: var(--ink-muted);
}
.stats dd {
  margin: 0;
  font: 500 44px/1 var(--serif);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* Lab */
.lab__intro {
  max-width: 60ch;
  margin: -24px 0 36px;
  font: 400 13px/1.75 var(--sans);
  color: var(--ink-muted);
}
.lab-card {
  margin: 0 0 28px;
  padding: 24px 26px 22px;
  background: linear-gradient(160deg, var(--paper-warm), var(--card-a));
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px -36px var(--shadow);
}
.lab-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 20px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.lab-card__head h3 { margin: 0; font-size: 22px; }
.lab-card__head .meta a { color: var(--terracotta); }

.lab__note {
  margin: 16px 0 0;
  max-width: 82ch;
  font: 400 12px/1.7 var(--sans);
  color: var(--ink-muted);
}
.lab__note a { color: var(--accent); text-decoration: none; font-family: var(--mono); }
.lab__note a:hover { text-decoration: underline; }

/* Order book */
.ob {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 28px;
}
.ob pre {
  margin: 0;
  font: 400 12px/1.55 var(--mono);
  font-variant-ligatures: none;
  white-space: pre;
  overflow: hidden;
}
.ob__cols {
  display: grid;
  grid-template-columns: 9ch 7ch 1fr;
  gap: 0 1ch;
  font-variant-ligatures: none;
  margin-bottom: 6px;
  font: 400 10px/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.ob__cols span:nth-child(-n+2) { text-align: right; }
.ob__cols span:nth-child(3) { padding-left: 1ch; }
.ob__cols { font-size: 12px; }
.ob__cols span { font-size: 10px; }
.ob__asks { color: var(--ask); min-height: calc(7 * 1.55em); }
.ob__bids { color: var(--bid); min-height: calc(7 * 1.55em); }
.ob__asks .mine, .ob__bids .mine { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.ob__spread {
  margin: 6px 0;
  padding: 6px 0;
  border-top: 1px dashed var(--line-strong);
  border-bottom: 1px dashed var(--line-strong);
  font: 400 11px/1.3 var(--mono);
  color: var(--ink-muted);
}
.ob .flash-row { animation: rowflash .6s ease; }
@keyframes rowflash { from { background: var(--accent-soft); } }

.ob__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 14px;
}
.ob__stats div { display: flex; flex-direction: column-reverse; gap: 4px; }
.ob__stats dt { font: 400 10px/1 var(--mono); color: var(--ink-muted); text-transform: uppercase; letter-spacing: .06em; }
.ob__stats dd { margin: 0; font: 500 22px/1 var(--serif); font-variant-numeric: tabular-nums; }
.ob__spark { color: var(--ink); opacity: .8; margin-bottom: 12px !important; }
.ob__label {
  margin: 0 0 4px;
  font: 400 10px/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.ob__tape { color: var(--ink-muted); min-height: calc(8 * 1.55em); }
.ob__tape b { font-weight: 500; }
.ob__tape .buy { color: var(--bid); }
.ob__tape .sell { color: var(--ask); }

.ob__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.seg { display: inline-flex; border: 1px solid var(--line-strong); }
.seg__btn {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  font: 400 12px/1 var(--mono);
  color: var(--ink-muted);
  cursor: pointer;
}
.seg__btn[data-side="buy"][aria-pressed="true"] { background: var(--bid); color: var(--paper); }
.seg__btn[data-side="sell"][aria-pressed="true"] { background: var(--ask); color: var(--paper); }

.field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  font: 400 10px/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.field input {
  width: 8ch;
  border: 0;
  background: transparent;
  font: 400 14px/1 var(--mono);
  color: var(--ink);
  outline: none;
}
.field:focus-within { border-color: var(--ink); }
.btn--solid { background: var(--ink); color: var(--paper); border-color: var(--ink); cursor: pointer; }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); }
button.btn { cursor: pointer; }

.ob__toggles { display: inline-flex; gap: 8px; margin-left: auto; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font: 400 11px/1 var(--mono);
  color: var(--ink-muted);
  cursor: pointer;
}
.toggle::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid currentColor;
}
.toggle[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }
.toggle[aria-pressed="true"]::before { background: var(--accent); border-color: var(--accent); }
#ob-kill[aria-pressed="true"] { color: var(--ask); border-color: var(--ask); }
#ob-kill[aria-pressed="true"]::before { background: var(--ask); border-color: var(--ask); animation: blink 1s steps(1) infinite; }

/* Commit heatmap */
.heat__scroll { overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.heat__months,
.heat__grid {
  display: grid;
  grid-template-columns: repeat(53, minmax(14px, 1fr));
  font: 400 12px/1 var(--mono);
  min-width: calc(53 * 14px);
}
.heat__months {
  height: 16px;
  font-size: 10px;
  color: var(--ink-muted);
}
.heat__months span { white-space: nowrap; }
.heat__grid {
  grid-template-rows: repeat(7, 1.5em);
  grid-auto-flow: column;
}
.heat__grid span {
  display: grid;
  place-items: center;
  color: var(--accent);
  cursor: default;
  border-radius: 2px;
  transition: background .15s, transform .15s;
}
.heat__grid span[data-l="0"] { color: var(--line-strong); }
.heat__grid span[data-l="1"] { opacity: .55; }
.heat__grid span[data-l="2"] { opacity: .75; }
.heat__grid span:hover,
.heat__grid span:focus-visible { background: var(--accent-soft); transform: scale(1.4); outline: none; opacity: 1; }
.heat__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 14px;
}
.heat__readout,
.heat__legend {
  margin: 0;
  font: 400 11px/1.4 var(--mono);
  color: var(--ink-muted);
}
.heat__readout b { color: var(--ink); font-weight: 500; }
.heat__legend span { margin: 0 3px; color: var(--accent); }

@media (max-width: 1100px) {
  .ob { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .stats dd { font-size: 34px; }
  .stats > div { padding: 18px 16px; }
  .lab-card { padding: 18px 16px; }
  .ob__toggles { margin-left: 0; }
  .ob__stats dd { font-size: 18px; }
  .timeline { padding-left: 22px; }
  .job::before { left: -22px; }
}

@media (prefers-reduced-motion: reduce) {
  .ob .flash-row { animation: none; }
  #ob-kill[aria-pressed="true"]::before { animation: none; }
}

/* ================= Round 4: canvas art ================= */

.art-card { -webkit-user-select: none; user-select: none; }
body.is-dragging, body.is-dragging * { -webkit-user-select: none !important; user-select: none !important; }

.art-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.hero__art .art-card__inner { touch-action: pan-y; }

.art-card__caption { z-index: 1; margin: 0; font-variant-numeric: tabular-nums; }
.art-card__home {
  position: absolute;
  right: 12px;
  bottom: 6px;
  z-index: 2;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  background: var(--paper-warm);
  font: 400 10px/1 var(--mono);
  color: var(--ink);
  cursor: pointer;
}
.art-card__home:hover { background: var(--ink); color: var(--paper); }
.art-card__home[hidden] { display: none; }

.experience__art .art-card__caption { right: 14px; }

@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr; }
  .stats > div { padding: 16px 0; }
  .stats > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .experience__art { height: 420px; }
}

/* ================= Round 5: focus and proof ================= */

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--paper-warm) 70%, transparent);
  font: 400 12px/1.3 var(--mono);
  color: var(--ink);
}
.status__dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
}
.status__dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: ping 2s ease-out infinite;
}
@keyframes ping { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

.hero__name { margin-bottom: 10px; }
.hero__role {
  margin: 0 0 22px;
  font: 400 italic clamp(22px, 2.2vw, 30px)/1.2 var(--serif);
  color: var(--terracotta);
}

.degree { max-width: 70ch; }
.degree .sub { font-size: 13px; margin-top: 6px; color: var(--ink); }
.degree .sub--quiet { color: var(--ink-muted); font-size: 12px; }

.more {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.more__list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.more__list li {
  margin: 0;
  padding: 7px 0;
  font: 400 13px/1.6 var(--sans);
  color: var(--ink-muted);
}
.more__list li + li { margin-top: 0; border-top: 1px dashed var(--line); }
.more__list span {
  display: inline-block;
  min-width: 15ch;
  margin-right: 10px;
  font: 600 15px/1.4 var(--serif);
  color: var(--ink);
}
.more__list a {
  margin-left: 6px;
  font: 400 11px/1 var(--mono);
  color: var(--accent);
  text-decoration: none;
}
.more__list a:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .status { font-size: 11px; }
  .more__list span { display: block; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .status__dot::after { animation: none; }
}
