/* ---------- Tokens ---------- */
:root {
  --mist: #EDF1F6;
  --paper: #FFFFFF;
  --ink: #121A33;
  --ink-body: #2B3452; /* running text: softer than headings, still 12:1 on white */
  --slate: #56607A;
  --cobalt: #2E4BF0;
  --ice: #BCD0FF;
  --ice-soft: #E7EDFF;
  --line: #D5DCE8;

  /* Panels that keep text legible over the neuron */
  --glass: rgba(255, 255, 255, 0.92);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --shadow-sheet: 0 1px 2px rgba(18, 26, 51, 0.04), 0 28px 56px -36px rgba(18, 26, 51, 0.3);
  --radius-sheet: var(--radius-l);
  --radius-inner: var(--radius-s);

  /* One family: DM Sans. Optical sizing tightens its letterforms at display sizes. */
  --display: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --text: "DM Sans", "Helvetica Neue", Arial, sans-serif;

  /* Type scale, ratio ~1.333 */
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: clamp(1.2rem, 1.1rem + 0.4vw, 1.42rem);
  --step-2: clamp(1.45rem, 1.25rem + 0.9vw, 1.9rem);
  --step-3: clamp(1.9rem, 1.5rem + 1.8vw, 2.6rem);
  --step-phrase: clamp(2.1rem, 1.2rem + 4.4vw, 5rem);
  --step-name: clamp(3rem, min(15.5vw, 19vh), 14.5rem);

  --gutter: clamp(16px, 4.5vw, 64px);

  /* Spacing scale (8pt grid). No other spacing values. */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;

  /* Container tiers: equal padding on all four sides */
  --pad-l: var(--space-5);   /* section panels, dialog content */
  --pad-m: 20px;             /* cards and header bars */
  --pad-s: var(--space-3);   /* boxes inside panels */

  /* Gaps inside containers */
  --gap-tight: var(--space-2);   /* heading and the line directly above/below it */
  --gap: var(--space-4);         /* heading block to body or tags */
  --gap-action: var(--space-5);  /* content to the button */
  --gap-group: var(--space-5);   /* groups inside a panel */
  --gap-list: var(--space-4);    /* cards in a list */
  --section-gap: clamp(64px, 11vh, 128px);

  --radius-l: 28px;
  --radius-s: 16px;
  --pill-h: 48px;
  --measure: 34em;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  /* Motion tokens: fast for hover/press, base for fills and reveals */
  --dur-fast: 180ms;
  --dur-base: 320ms;

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background:
    radial-gradient(120% 70% at 80% 0%, #F8FAFE 0%, rgba(248, 250, 254, 0) 60%),
    var(--mist);
  color: var(--ink);
  font-family: var(--text);
  font-size: var(--step-0);
  line-height: 1.65;
  font-feature-settings: "kern", "liga";
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
p, h1, h2, h3, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 3px;
  border-radius: 6px;
}
main:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--paper); text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Neuron field (fixed, behind everything) ---------- */
.field {
  position: fixed; left: 0; top: 0; z-index: 0;
  width: 100%; height: 100vh; height: 100lvh;
  pointer-events: none;
}
.field canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

main { position: relative; z-index: 1; }

/* ---------- Layout shell and panels ---------- */
.shell {
  width: min(100% - 2 * var(--gutter), 1320px);
  margin-inline: auto;
}

.sheet {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-sheet);
  box-shadow: var(--shadow-sheet);
  padding: var(--pad-l);
}
/* Cards and header bars use the medium tier */
.work__head, .pcard, .experience__head, .xp__card { padding: var(--pad-m); }

/* Frosted glass only where the GPU can afford it */
@media (min-width: 1024px) and (pointer: fine) {
  .sheet {
    background: rgba(255, 255, 255, 0.64);
    -webkit-backdrop-filter: blur(26px) saturate(1.5);
    backdrop-filter: blur(26px) saturate(1.5);
  }
}

.label { color: var(--slate); font-size: var(--step--1); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
  transition: background-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.nav.is-scrolled {
  background: rgba(237, 241, 246, 0.82);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 1px 0 var(--line);
}
.nav__mark {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--display); font-weight: 600; font-size: 1rem;
  letter-spacing: -0.01em; text-decoration: none;
  min-height: 44px; white-space: nowrap;
}
.nav__logo { width: 68px; height: 34px; flex: none; }
/* The name echoes the hero: heavy italic, tight tracking */
.nav__label { font-style: italic; font-weight: 800; letter-spacing: -0.055em; padding-right: 0.1em; }
.nav__links { display: flex; gap: clamp(0px, 1.6vw, 24px); }
.nav__links a {
  --inset: 8px;
  position: relative;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--inset);
  text-decoration: none; font-size: 0.95rem;
}
/* Every link is underlined; the current section is cobalt, and hover or focus adds the halo */
.nav__links a::after {
  content: ""; position: absolute; left: var(--inset); right: var(--inset); bottom: 10px;
  height: 1.5px; border-radius: 1px; background: currentColor;
  box-shadow: 0 0 calc(var(--hover) * 10px) calc(var(--hover) * 1px) rgba(61, 99, 255, calc(var(--hover) * 0.9));
}
.nav__links a[aria-current="true"] { --lit: max(1, var(--hover)); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  padding: calc(96px + 4vh) var(--gutter) clamp(40px, 8vh, 88px);
  display: grid;
  grid-template-columns: 1fr;
  align-content: space-between;
  gap: 24px;
  overflow-x: clip;
}

.hero__name {
  position: relative; z-index: 2;
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-name);
  color: var(--cobalt); /* the lit-heading blue, without the halo */
  line-height: 0.84;
  letter-spacing: -0.055em;
  margin-left: -0.04em;
  pointer-events: none;
}
.hero__line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero__line--offset { padding-left: 0.62em; }
.hero__word { display: inline-block; }
.hero__char { display: inline-block; will-change: transform; }

/* Portrait: the neuron starts hidden behind it (neuron.js anchors to this box) */
.hero__art {
  position: absolute;
  right: calc(var(--gutter) + 3vw); top: 20vh;
  width: min(30vw, 440px);
  aspect-ratio: 1;
}
.hero__portrait {
  margin: 0; border-radius: 50%; overflow: hidden;
  background: linear-gradient(160deg, #F2F5FF, #C8D3F4);
  box-shadow: 0 0 0 6px var(--paper), 0 28px 56px -28px rgba(46, 75, 240, 0.5);
}
.hero__portrait img { width: 100%; height: 100%; object-fit: cover; }
.hero__portrait-empty { display: none; }
.hero__portrait.is-empty img { display: none; }
.hero__portrait.is-empty .hero__portrait-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #7A88A6; }
.hero__portrait-empty svg { width: 40%; height: 40%; }
.hero__spin { display: none; }

.hero__intro {
  position: relative; z-index: 2;
  display: grid; gap: var(--gap); justify-items: start;
  max-width: 32rem;
}
.hero__lede {
  font-family: var(--display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.hero__tags { margin: 0; }

/* Hero call to action: an underlined text link; the arrow says it moves down the page */
.hero-link {
  --lit: var(--hover);
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px;
  font-size: var(--step-1); font-weight: 600; letter-spacing: -0.015em; text-decoration: none;
  color: rgb(calc(18 + 28 * var(--lit)) calc(26 + 49 * var(--lit)) calc(51 + 189 * var(--lit)));
  filter: drop-shadow(0 0 calc(var(--hover) * 8px) rgba(61, 99, 255, calc(var(--hover) * 0.7)));
  transition: --hover var(--dur-base) var(--ease-out);
  touch-action: manipulation;
}
.hero-link:is(:hover, :focus-visible) { --hover: 1; }
.hero-link > span {
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 100% 1.5px;
  padding-bottom: 2px;
}
.hero-link__arrow { width: 1.1em; height: 1.1em; flex: none; transition: transform var(--dur-base) var(--ease-out); }
.hero-link:is(:hover, :focus-visible) .hero-link__arrow { transform: translateY(3px); }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 var(--space-5); margin-top: calc(var(--gap-action) - var(--gap));
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

/* ---------- Section rhythm ---------- */
.thesis, .work, .about, .skills, .contact { margin-top: var(--section-gap); }
.contact { margin-bottom: var(--space-6); }

/* Text roles: one style per role, shared by every element in that role */
.section-title, .experience__title, .about__name, .modal__title {          /* Heading 1 */
  margin: 0;
  font-family: var(--display); font-weight: 700;
  font-size: var(--step-3); letter-spacing: -0.03em; line-height: 1.05;
  text-wrap: balance;
}
.pcard__title, .xp__role {                                                /* Heading 2 */
  margin: 0;
  font-family: var(--display); font-weight: 600;
  font-size: var(--step-2); letter-spacing: -0.025em; line-height: 1.1;
  text-wrap: balance;
}
.skill-group__title {                                                     /* Heading 3 */
  margin: 0;
  font-family: var(--display); font-weight: 600;
  font-size: var(--step-1); letter-spacing: -0.015em; line-height: 1.2;
}
.pcard__meta, .xp__meta, .modal__meta, .project__legend, .label {         /* Meta */
  margin: 0;
  color: var(--slate); font-size: var(--step--1); line-height: 1.5;
}

/* Pill buttons: one shape and size everywhere */
.button, .more-btn, .pcard__open {
  min-height: var(--pill-h);
  border: 1.5px solid var(--ink); border-radius: 999px;
  font: inherit; font-size: 0.95rem; font-weight: 500; line-height: 1;
}

/* ---------- Thesis ---------- */
.thesis__sheet {
  display: grid; gap: var(--gap-group);
}
.thesis__phrase {
  font-family: var(--display);
  font-weight: 300;
  font-size: var(--step-phrase);
  line-height: 1.06;
  letter-spacing: -0.035em;
  max-width: 15em;
  text-wrap: balance;
}
.thesis__phrase .word { display: inline-block; }
.thesis__note {
  max-width: var(--measure);
  color: var(--slate);
  font-size: var(--step-1);
  line-height: 1.6;
}

/* ---------- Work ---------- */
.work__head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--gap-tight) var(--space-6);
}
.work__note { color: var(--slate); max-width: 30em; }
.work__swatch { width: 22px; height: 12px; border-radius: 999px; background: var(--cobalt); flex: none; }

/* Project cards: light, scannable, open into a dialog */
.pcards {
  display: grid; gap: var(--gap-list);
  margin-top: var(--gap-list);
}
.pcard {
  container-type: inline-size;
  position: relative;
  display: grid; gap: var(--gap); align-content: start;
  height: 100%;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.pcard:has(.pcard__open:active) { transform: scale(0.99); }
.pcard__meta { display: flex; justify-content: space-between; gap: var(--space-3); }
.pcard__title { margin-top: calc(var(--gap-tight) - var(--gap)); }   /* meta sits 8 above the title */
.pcard__headline { font-weight: 600; }
.pcard__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: calc(var(--gap-action) - var(--gap));
}
@container (max-width: 400px) {
  .pcard__foot { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
}
.pcard__open {
  display: inline-flex; align-items: center; gap: var(--space-2); flex: none;
  padding: 0 var(--space-2) 0 var(--space-4);
  background: transparent; color: var(--ink);
  cursor: pointer; touch-action: manipulation;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.pcard__open svg { width: 28px; height: 28px; padding: 5px; border-radius: 50%; background: var(--ink); color: var(--paper); transition: transform var(--dur-base) var(--ease-out); }
/* The whole card is the click target */
.pcard__open::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-sheet); }
.pcard__open:focus-visible { outline-offset: 4px; }

.project__outcome { display: grid; gap: 4px; padding-left: 16px; border-left: 2px solid var(--cobalt); }
.project__outcome p:last-child { color: var(--ink-body); }
.project__outcome strong { color: var(--ink); font-weight: 700; }

.project__diagram {
  background: var(--mist);
  border-radius: var(--radius-inner);
  padding: var(--pad-s);
  align-self: start;
}
.project__diagram svg { width: 100%; height: auto; overflow: visible; }
.project__legend {
  display: flex; align-items: center; gap: var(--space-2);
  margin-top: var(--space-3);
}

/* ---------- Project dialog ---------- */
html.modal-open { overflow: hidden; }
.modal {
  position: fixed; inset: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: clamp(16px, 5vh, 56px) var(--gutter);
  border: 0; background: rgba(18, 26, 51, 0);
  color: var(--ink);
  overscroll-behavior: contain;
  transition: background-color var(--dur-base) var(--ease-out);
}
.modal[open] { display: grid; place-items: center; }
.modal::backdrop { background: transparent; }
.modal.is-open { background: rgba(18, 26, 51, 0.42); }

.modal__sheet {
  position: relative;
  width: min(100%, 1040px);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 84px; /* keep focused items clear of the sticky bar */
  background: var(--paper);
  border-radius: var(--radius-sheet);
  box-shadow: 0 40px 100px -40px rgba(18, 26, 51, 0.6);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.modal.is-open .modal__sheet { opacity: 1; transform: none; }
.modal:not(.is-open) .modal__sheet { transition-duration: var(--dur-fast); }

.modal__bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: var(--space-3) var(--pad-l);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.modal__count { color: var(--slate); font-size: var(--step--1); }
.modal__close {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--mist); color: var(--ink);
  cursor: pointer; touch-action: manipulation;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.modal__close svg { width: 22px; height: 22px; }

.modal__body {
  display: grid; gap: var(--gap-group);
  padding: var(--pad-l);
}
.modal__meta { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
.modal__head { display: grid; gap: var(--gap-tight); }
.modal__grid { display: grid; gap: var(--gap-group); }
.modal__text { display: grid; gap: var(--gap-action); align-content: start; max-width: 34rem; }
.modal__summary { font-size: var(--step-1); line-height: 1.6; color: var(--ink-body); }

.modal__nav {
  display: flex; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--pad-l) max(var(--space-3), env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.modal__step {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-4);
  border: 0; border-radius: 999px; background: transparent; color: var(--ink);
  font: inherit; font-weight: 500; cursor: pointer; touch-action: manipulation;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.modal__step svg { width: 20px; height: 20px; }
.modal__step[hidden] { display: none; }
.modal__step--next { margin-left: auto; }

.project__stack { display: grid; gap: var(--gap); }
.project__stack > div { display: grid; grid-template-columns: 4.5rem 1fr; gap: var(--space-3); align-items: start; }
.project__stack dt { color: var(--slate); font-size: var(--step--1); padding-top: 5px; }

.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.tags li {
  padding: 6px var(--space-3); border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line);
  font-size: var(--step--1); line-height: 1.3;
}
.tags li.is-status { background: var(--ice-soft); border-color: transparent; }
.tags li.is-status::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px;
  border-radius: 50%; background: var(--cobalt); vertical-align: 1px;
}
/* Interactive skills: hover, focus or tap lights the skill like the neuron
   and shows where it was used */
.skills__sheet { position: relative; }
.tags--skills li { padding: 0; border: 0; background: none; }
.skill {
  display: inline-flex; align-items: center; min-height: 36px;
  padding: 6px var(--space-3); border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: inherit; font-size: var(--step--1); line-height: 1.2; cursor: pointer; touch-action: manipulation;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
/* A small callout: "Used in" plus short project links, or a one-line note */
.skill-card {
  position: absolute; z-index: 5;
  width: max-content; max-width: min(220px, calc(100% - 2 * var(--pad-l)));
  display: grid; gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--paper); border: 1px solid rgba(61, 99, 255, 0.35); border-radius: var(--radius-s);
  box-shadow: 0 0 14px rgba(61, 99, 255, 0.2), 0 12px 24px -16px rgba(18, 26, 51, 0.4);
  font-size: var(--step--1); line-height: 1.3;
}
.skill-card[hidden], .skill-card__label[hidden] { display: none; }
.skill-card__label { margin: 0; color: var(--slate); }
.skill-card__list { display: grid; margin: 0; padding: 0; list-style: none; }
.skill-card__list button {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%;
  min-height: 36px; padding: 0; border: 0; background: none; color: var(--ink);
  font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.skill-card__list svg { width: 14px; height: 14px; flex: none; }
.skill-card__note { margin: 0; font-weight: 500; }

/* Skills beyond the first four wait behind "Show all skills" */
.skills__sheet:not(.is-expanded) .tags li.is-extra { display: none; }
@media (prefers-reduced-motion: reduce) { .skill { transition: none; } }
.text-btn {
  justify-self: start; min-height: 44px; padding: 0;
  border: 0; background: none; color: var(--cobalt);
  font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation;
}

.dg-edge { fill: none; stroke: #7A88A6; stroke-width: 1.75; }
.dg-node rect { fill: var(--paper); stroke: var(--line); stroke-width: 1.25; }
.dg-node text { fill: var(--ink); font-family: var(--text); font-size: 17px; font-weight: 500; }
.dg-node--agent rect { fill: var(--cobalt); stroke: var(--cobalt); }
.dg-node--agent text { fill: var(--paper); }
.dg-pulse { fill: var(--cobalt); }

/* ---------- About ---------- */
.more-btn {
  justify-self: start;
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 0 var(--space-2) 0 var(--space-4);
  background: transparent; color: var(--ink);
  cursor: pointer; touch-action: manipulation;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.more-btn svg { width: 28px; height: 28px; padding: 5px; border-radius: 50%; background: var(--ink); color: var(--paper); transition: transform var(--dur-base) var(--ease-out); }

.about__sheet { display: grid; gap: var(--gap-group); }

.portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-inner);
  overflow: hidden;
  background: var(--ice-soft);
  max-width: 420px;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait__empty { display: none; }
.portrait.is-empty img { display: none; }
.portrait.is-empty { border: 1.5px dashed #9AA8C4; background: var(--mist); }
.portrait.is-empty .portrait__empty {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 8px;
  padding: 24px; text-align: center; color: var(--slate);
}
.portrait__empty svg { width: 56px; height: 56px; color: #7A88A6; }
.portrait__title { font-family: var(--display); font-weight: 600; color: var(--ink); font-size: var(--step-1); }
.portrait__hint { font-size: var(--step--1); max-width: 22em; }

/* About dialog: large photo beside the full story */
.modal--about .modal__sheet { width: min(100%, 900px); }
.about-more { display: grid; gap: var(--gap-group); align-items: start; }
.about-more .portrait { max-width: 340px; width: 100%; }
.about-more__text { display: grid; gap: var(--gap); align-content: start; }

.about__orb {
  position: relative; margin: 0;
  width: 168px; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  background: linear-gradient(160deg, #F2F5FF, #C8D3F4);
  box-shadow: 0 0 0 6px var(--paper), 0 22px 44px -20px rgba(46, 75, 240, 0.5);
}
.about__orb img { width: 100%; height: 100%; object-fit: cover; }
.about__orb-empty { display: none; }
.about__orb.is-empty img { display: none; }
.about__orb.is-empty .about__orb-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #7A88A6; }
.about__orb-empty svg { width: 44%; height: 44%; }
.about__body { display: grid; gap: var(--gap); align-content: center; }
.about__body .more-btn { margin-top: calc(var(--gap-action) - var(--gap)); }
.about__summary { margin: calc(var(--gap-tight) - var(--gap)) 0 0; max-width: 34em; color: var(--ink-body); }

/* Italic for every heading and display line; body text stays upright for readability */
.hero__name, .thesis__phrase, .contact__title,
.section-title, .experience__title, .about__name, .modal__title,
.pcard__title, .xp__role, .skill-group__title { font-style: italic; }
.hero__line { padding-right: 0.1em; } /* room for the slant inside the masked name lines */

/* ---------- Skills and experience ---------- */
.skills__sheet { display: grid; gap: var(--gap-group); }
.skills__groups { display: grid; gap: var(--gap-group); }
.skill-group { display: grid; gap: var(--gap); align-content: start; }
/* Experience: an open rail gutter (the neuron rides it) beside glass cards */
.experience { margin-top: var(--gap-list); --rail: 52px; --xp-gap: var(--gap-list); }
.xp { display: grid; gap: var(--xp-gap); margin-top: var(--xp-gap); }
.xp__item {
  --near: 0;
  position: relative;
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); align-items: start;
}
.xp__card {
  grid-column: 2;
  display: grid; gap: var(--gap);
  border-color: rgba(46, 75, 240, calc(var(--near) * 0.6));
  box-shadow: var(--shadow-sheet), 0 0 calc(var(--near) * 40px) rgba(61, 99, 255, calc(var(--near) * 0.4));
  background-image: radial-gradient(120% 90% at 0% 50%, rgba(61, 99, 255, calc(var(--near) * 0.1)), transparent 70%);
}
/* Entries the neuron has passed keep a thin lit edge, oldest to newest */
.xp.is-live .xp__card { box-shadow: var(--shadow-sheet), inset 0 0 0 0 transparent, 0 0 calc(var(--near) * 40px) rgba(61, 99, 255, calc(var(--near) * 0.4)); }
.xp__item.is-lit .xp__card, .xp:not(.is-live) .xp__card {
  box-shadow: var(--shadow-sheet), inset 3px 0 0 var(--cobalt), 0 0 calc(var(--near) * 40px) rgba(61, 99, 255, calc(var(--near) * 0.4));
}
.xp__meta { font-variant-numeric: tabular-nums; }
.xp__role { margin-top: calc(var(--gap-tight) - var(--gap)); }   /* meta sits 8 above the role */
.xp__note { margin: 0; max-width: var(--measure); color: var(--ink-body); }

/* One orb per entry, in the open gutter, level with the card's first line.
   The docked neuron passes through each one and lights it. */
.xp__node {
  grid-column: 1; grid-row: 1; justify-self: center;
  position: relative; z-index: 1;
  width: 18px; height: 18px; border-radius: 50%;
  /* centred on the card's first line (the meta line), so every orb sits at the same height */
  margin-top: calc(var(--pad-m) + (0.875rem * 1.5 - 18px) / 2);
  background: radial-gradient(circle at 35% 30%, #FFFFFF 0%, #EEF2FF 45%, #BCCAF2 100%);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px rgba(46, 75, 240, 0.25), 0 6px 14px -6px rgba(46, 75, 240, 0.5);
  transition: background var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.xp:not(.is-live) .xp__node,
.xp__item.is-lit .xp__node {
  background: radial-gradient(circle at 35% 30%, #8FA6FF 0%, #3D63FF 55%, #2E4BF0 100%);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px rgba(46, 75, 240, 0.4), 0 0 18px 2px rgba(61, 99, 255, 0.6);
}
.xp__item.is-lit .xp__node { transform: scale(calc(1 + var(--near) * 0.3)); }

/* Headings light up as the neuron passes behind them. --glow and --gx are
   set on the panel by neuron.js and inherited by the heading. */
.sheet { --glow: 0; --gx: 50%; }
[data-glow] {
  background-image: radial-gradient(
    ellipse 120% 160% at var(--gx) 55%,
    #3D63FF 0%,
    var(--cobalt) calc(var(--glow) * 55%),
    var(--ink) calc(var(--glow) * 85% + 0.5%)
  );
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 calc(var(--glow) * 14px) rgba(61, 99, 255, calc(var(--glow) * 0.95)));
}
.sheet:has(> [data-glow]), .sheet:has(> * > [data-glow]) {
  border-color: rgba(46, 75, 240, calc(var(--glow) * 0.55 + 0.001));
  box-shadow: var(--shadow-sheet), 0 0 calc(var(--glow) * 56px) rgba(61, 99, 255, calc(var(--glow) * 0.42));
}

/* ---------- Contact ---------- */
.contact__sheet { display: grid; gap: var(--gap); }
.contact__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step-phrase);
  line-height: 1.02;
  letter-spacing: -0.04em;
  max-width: 11em;
  text-wrap: balance;
}
.contact__text { color: var(--slate); font-size: var(--step-1); max-width: var(--measure); }

.channels { display: grid; margin-top: calc(var(--gap-action) - var(--gap)); border-top: 1px solid var(--ink); }
.channel {
  position: relative;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: var(--space-4);
  min-height: 88px; padding: var(--space-4) var(--space-2);
  border-bottom: 1px solid var(--ink);
  text-decoration: none;
  isolation: isolate;
  overflow: hidden;
  transition: color var(--dur-fast) var(--ease-out);
}
.channel__icon { width: 28px; height: 28px; }
.channel__name {
  font-family: var(--display); font-weight: 600;
  font-size: var(--step-3); letter-spacing: -0.03em; line-height: 1;
}
.channel__arrow { width: 28px; height: 28px; transition: transform var(--dur-base) var(--ease-out); }
.channel:hover .channel__arrow { transform: translate(3px, -3px); }

.footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-top: calc(var(--gap-action) - var(--gap));
  color: var(--slate); font-size: var(--step--1);
}
.footer a { display: inline-flex; align-items: center; min-height: 44px; }
.footer__brand { display: inline-flex; align-items: center; gap: var(--space-3); }
.footer__brand img { width: 88px; height: 44px; }


/* ---------- Interaction states ----------
   One "lit" state for every control. Hover, keyboard focus, an open state
   and the passing neuron all drive the same value, so they look identical:
   ink shifts to electric blue (#3D63FF) and a soft halo appears.
   Extras are intentional:
   - the + icon only on pills that open a pop-up (View project, About me);
     "See selected work" scrolls, so it has none
   - contact rows nudge their arrow because they leave the site */
@property --hover { syntax: '<number>'; inherits: true; initial-value: 0; }

:is(.button, .more-btn, .pcard__open, .skill, .modal__close, .pcard, .channel, .nav__links a) {
  --lit: var(--hover);
  transition: --hover var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
/* Only buttons the neuron lights directly react to it; a panel's heading glow
   must not leak into the controls inside that panel */
[data-glow-self] { --lit: max(var(--glow, 0), var(--hover)); }
:is(.button, .more-btn, .pcard__open, .skill, .modal__close, .channel, .nav__links a):is(:hover, :focus-visible),
.skill[aria-expanded="true"],
.pcard:hover, .pcard:has(.pcard__open:focus-visible) { --hover: 1; }

/* Pills */
:is(.button, .more-btn, .pcard__open) {
  background: transparent;
  color: rgb(calc(18 + 28 * var(--lit)) calc(26 + 49 * var(--lit)) calc(51 + 189 * var(--lit)));
  border-color: rgb(calc(18 + 43 * var(--lit)) calc(26 + 73 * var(--lit)) calc(51 + 204 * var(--lit)));
  box-shadow: 0 0 calc(var(--lit) * 22px) rgba(61, 99, 255, calc(var(--lit) * 0.7)),
              inset 0 0 calc(var(--lit) * 10px) rgba(61, 99, 255, calc(var(--lit) * 0.25));
}
:is(.more-btn, .pcard__open) svg {
  background: rgb(calc(18 + 43 * var(--lit)) calc(26 + 73 * var(--lit)) calc(51 + 204 * var(--lit)));
  box-shadow: 0 0 calc(var(--lit) * 14px) rgba(61, 99, 255, calc(var(--lit) * 0.9));
  transition: none;
}
:is(.button, .more-btn, .pcard__open, .modal__close):active { transform: scale(0.97); }

/* Skills: the same lit state at tag size */
.skill {
  color: rgb(calc(18 + 28 * var(--lit)) calc(26 + 49 * var(--lit)) calc(51 + 189 * var(--lit)));
  border-color: rgb(calc(213 - 152 * var(--lit)) calc(220 - 121 * var(--lit)) calc(232 + 23 * var(--lit)));
  box-shadow: 0 0 calc(var(--lit) * 18px) rgba(61, 99, 255, calc(var(--lit) * 0.55)),
              inset 0 0 calc(var(--lit) * 8px) rgba(61, 99, 255, calc(var(--lit) * 0.15));
}

/* Whole-card targets */
.pcard {
  border-color: rgba(61, 99, 255, calc(0.9 * var(--lit)));
  box-shadow: var(--shadow-sheet), 0 0 calc(var(--lit) * 44px) rgba(61, 99, 255, calc(var(--lit) * 0.32));
}
.pcard:has(.pcard__open:active) { transform: scale(0.99); }
.channel {
  color: rgb(calc(18 + 28 * var(--lit)) calc(26 + 49 * var(--lit)) calc(51 + 189 * var(--lit)));
  background: rgba(61, 99, 255, calc(var(--lit) * 0.06));
  box-shadow: inset 0 0 calc(var(--lit) * 28px) rgba(61, 99, 255, calc(var(--lit) * 0.16));
}
.channel:is(:hover, :focus-visible) .channel__arrow { transform: translate(3px, -3px); }

/* Round icon button (dialog close) */
.modal__close {
  color: rgb(calc(18 + 28 * var(--lit)) calc(26 + 49 * var(--lit)) calc(51 + 189 * var(--lit)));
  box-shadow: 0 0 0 calc(var(--lit) * 1.5px) #3D63FF, 0 0 calc(var(--lit) * 18px) rgba(61, 99, 255, calc(var(--lit) * 0.6));
}

/* Nav links: the same lit state, carried by the text and its underline */
.nav__links a {
  color: rgb(calc(18 + 28 * var(--lit)) calc(26 + 49 * var(--lit)) calc(51 + 189 * var(--lit)));
  text-shadow: 0 0 calc(var(--hover) * 12px) rgba(61, 99, 255, calc(var(--hover) * 0.55));
}
.nav__links a:active { opacity: 0.7; }

/* Text-level controls: blue text with the same soft glow */
:is(.text-btn, .footer a, .modal__step, .skill-card__list button) {
  transition: color var(--dur-fast) var(--ease-out), text-shadow var(--dur-base) var(--ease-out);
}
:is(.text-btn, .footer a, .modal__step, .skill-card__list button):is(:hover, :focus-visible) {
  color: var(--cobalt);
  text-shadow: 0 0 12px rgba(61, 99, 255, 0.55);
}
:is(.text-btn, .footer a, .modal__step, .skill-card__list button):active { opacity: 0.7; }

/* ---------- Initial states (only when JS runs) ---------- */
.js .hero__char { transform: translateY(105%); }
.js [data-hero-intro] { opacity: 0; }

/* ---------- Larger screens ---------- */
@media (min-width: 720px) {
  :root { --pad-l: var(--space-6); --pad-m: var(--space-5); --pad-s: var(--space-4); --gap-group: var(--space-6); }
  .hero__line--offset { padding-left: 1.05em; }
  /* Short statements centre (≤3 lines); body text elsewhere stays left-aligned */
  .contact__title, .contact__text { justify-self: center; text-align: center; }
  .contact__text { max-width: 30em; }
  .pcards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .about__sheet { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: var(--space-7); }
  .about-more { grid-template-columns: minmax(220px, 5fr) minmax(0, 7fr); }
  .skills__groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .experience { --rail: 132px; }
  }

@media (min-width: 720px) and (max-width: 1023px) and (orientation: portrait) {
  /* below the name: 1.8em is the two stacked name lines */
  .hero__art { top: calc(96px + 4vh + 1.8 * var(--step-name) + var(--space-6)); right: var(--gutter); width: 40vw; }
}

@media (min-width: 1024px) {
  :root {
    --pad-l: var(--space-7); --pad-m: var(--space-6); --pad-s: var(--space-5); --gap-list: var(--space-5);
    /* the name (~4.1em wide) stays clear of the portrait column */
    --name-room: calc((100vw - 2 * var(--gutter) - 7vw - min(30vw, 440px)) / 4.1);
    --step-name: clamp(3rem, min(15.5vw, 19vh, var(--name-room)), 14.5rem);
  }
  .thesis__sheet { justify-items: center; text-align: center; }
  .thesis__phrase { max-width: 14em; }
  .thesis__note { max-width: 36em; }
  .hero {
    grid-template-columns: 1fr 1fr; align-content: center; row-gap: 4vh;
    padding-top: calc(84px + 2vh); padding-bottom: 4vh;
  }
  .hero__name { grid-column: 1 / -1; }
  .hero__intro { grid-column: 1; }
  .skills__groups { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Short laptop screens: keep the call to action above the fold */
@media (min-width: 1024px) and (max-height: 800px) {
  :root { --step-name: clamp(3rem, min(15.5vw, 17vh, var(--name-room)), 14.5rem); }
  .hero__lede { font-size: var(--step-1); }
}

/* ---------- Phones ---------- */
@media (max-width: 719px) {
  .hero { align-content: start; gap: 0; }
  .hero__art {
    position: relative; right: auto; top: auto;
    width: min(64vw, 300px);
    margin: var(--space-7) auto;
    justify-self: center;
  }
  /* Phones: no photo; the neuron is the hero, with a small handle to spin it */
  .hero__portrait { background: none; box-shadow: none; overflow: visible; }
  .hero__portrait img, .hero__portrait.is-empty .hero__portrait-empty { display: none; }
  .hero__spin {
    position: absolute; left: 50%; top: 50%; translate: -50% -50%;
    display: grid; place-items: center;
    width: 56px; height: 56px; padding: 0; border-radius: 50%;
    border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, 0.6);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sheet);
    color: var(--ink); cursor: grab; touch-action: none;
  }
  .hero__spin:active { cursor: grabbing; }
  .hero__spin svg { width: 24px; height: 24px; }
  .hero__intro { margin-top: 0; }
  /* The hero already shows the name; the nav keeps just the logo */
  .nav__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .nav__logo { width: 64px; height: 32px; }
  /* About: the photo orb rises out of the panel; name, tags and action centred */
  .about { margin-top: calc(var(--section-gap) + 68px); }
  /* the orb overlaps the top edge, so the top padding adds its overlap to the panel tier */
  .about__sheet { position: relative; padding-top: calc(68px + var(--pad-l)); justify-items: center; text-align: center; }
  .about__orb { position: absolute; top: -68px; left: 50%; translate: -50% 0; width: 136px; box-shadow: 0 0 0 5px var(--paper), 0 18px 36px -18px rgba(46, 75, 240, 0.45); }
  .about__body { justify-items: center; width: 100%; }
  .about__tags { justify-content: center; }
  .about__body .more-btn { justify-self: stretch; justify-content: center; }
  .about-more .portrait { max-width: 220px; }
  /* Dialog becomes a bottom sheet */
  .modal { padding: 6vh 0 0; }
  .modal[open] { place-items: end stretch; }
  .modal__sheet {
    width: 100%; max-height: 94vh;
    border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
    opacity: 1; transform: translateY(100%);
    transition: transform var(--dur-base) var(--ease-out);
  }
  .modal__bar { touch-action: none; cursor: grab; }
  .modal.is-dragging .modal__sheet { transition: none; }
  .modal__bar::before {
    content: ""; position: absolute; left: 50%; top: 6px;
    width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line);
  }
  .pcard__foot { flex-wrap: wrap; }
  .project__stack > div { grid-template-columns: 1fr; gap: 8px; }
  .project__stack dt { padding-top: 0; }
  .dg-node text { font-size: 21px; }
  .channel { min-height: 76px; }
  }

/* Short phones (SE, mini): smaller neuron space so the intro starts on screen */
@media (max-width: 719px) and (max-height: 700px) {
  .hero { padding-top: calc(80px + 2vh); }
  .hero__art { width: 44%; margin: var(--space-4) auto; }
}

@media (max-width: 360px) {
  .nav__links a { --inset: 6px; font-size: 0.9rem; }
}

/* Phones held sideways: keep the neuron clear of the intro */
@media (orientation: landscape) and (max-height: 520px) {
  .hero { min-height: auto; padding-top: 88px; }
  .hero__name { font-size: min(var(--step-name), 30vh); }
  .hero__art { top: 88px; right: var(--gutter); width: min(28vw, 56vh); }
  .hero__intro { max-width: 52%; margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .js .hero__char { transform: none; }
  .js [data-hero-intro] { opacity: 1; }
}
