:root {
  --paper: #e8ecf0;
  --paper-2: #dde3ea;
  --card: #f4f6f9;
  --ink: #16213a;
  --ink-2: #4f5a74;
  --rule: #c3ccd7;
  --plum: #440154;
  --plum-2: #350142;
  --night: #121a30;
  --night-2: #0c1224;
  --teal: #1d7f7b;
  --lime: #fde725;
  --hot: #ff5c39;
  --sans: "Inter Tight", "Inter", system-ui, sans-serif;
  --serif: "Inter", system-ui, sans-serif;
  --gutter: clamp(16px, 6vw, 96px);
  --wrap: 1240px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--serif);
  -webkit-font-smoothing: antialiased;
  background-image:
    linear-gradient(var(--paper-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-2) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-color: var(--teal); text-decoration-thickness: 1.5px; text-underline-offset: 4px; transition: color .2s, text-decoration-color .2s; }
a:hover { color: var(--teal); }
:focus-visible { outline: 2.5px solid var(--teal); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--sans); font-weight: 600; letter-spacing: -0.025em; margin: 0; }
p { margin: 0; }
.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 50; }

/* words that rise out of a mask */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.wi { display: inline-block; will-change: transform; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

/* ---------- buttons ---------- */
.pill {
  font: 500 0.98rem/1 var(--sans); color: var(--paper); background: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 999px; padding: 13px 20px; cursor: pointer;
  transition: background .25s, border-color .25s, color .25s, transform .25s;
}
.pill:hover { background: var(--teal); border-color: var(--teal); }
.pill:active { transform: scale(0.96); }
a.pill { display: inline-block; text-decoration: none; }
a.pill:hover { color: var(--paper); }
.pill-outline { background: transparent; color: var(--ink); }
.pill-outline:hover, a.pill-outline:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pill:disabled { opacity: .5; cursor: default; }

/* ---------- top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px var(--gutter);
  font-family: var(--sans);
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}
.wordmark { font-weight: 600; font-size: 1.1rem; text-decoration: none; }
.bar { transition: background-color .4s, color .4s; }
.bar-dark { background: color-mix(in srgb, var(--night-2) 80%, transparent); color: #fff; }
.bar-dark .bar-progress { background: var(--lime); }
.bar-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink); transform: scaleX(0); transform-origin: left; }

/* ---------- story ---------- */
/* both 3D stages sit in a dark frame inset from the paper */
:root { --void: #030308; --frame: 10px; --frame-r: 22px; }
.story { height: 520vh; position: relative; }
.story-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; color: #fff; background: var(--void); clip-path: inset(var(--frame) round var(--frame-r)); }
#net3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.story-sticky::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(3,3,8,.72), rgba(3,3,8,.35) 38%, transparent 58%); pointer-events: none; z-index: 1; }

.chapter, .scroll-cue { z-index: 2; }
.chapter { position: absolute; left: var(--gutter); top: 50%; translate: 0 -50%; width: min(520px, 100% - 2 * var(--gutter)); pointer-events: none; visibility: hidden; opacity: 0; }
.chapter h2 { font-size: clamp(2.3rem, 4.3vw, 3.9rem); line-height: 1.02; letter-spacing: -0.035em; margin: 0 0 22px; }
.ch-body { font-size: 1.2rem; color: #a9b1c7; max-width: 42ch; }

.ch-hero { visibility: visible; opacity: 1; top: auto; bottom: clamp(48px, 11vh, 120px); translate: none; width: auto; }
.hero-name { font-size: clamp(4.6rem, 15.5vw, 16rem); line-height: 0.84; letter-spacing: -0.045em; font-weight: 600; margin: 0 0 clamp(20px, 3vh, 36px) -0.04em; }
.hn-line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hn-word { display: inline-block; padding-right: 0.08em; } /* room for the last letter, which negative tracking would clip */
.hero-line { font-size: clamp(1.15rem, 1.7vw, 1.45rem); max-width: 30ch; line-height: 1.4; color: #a9b1c7; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: clamp(24px, 4vh, 40px); pointer-events: auto; }
.story .pill { background: #fff; border-color: #fff; color: var(--ink); }
.story .pill:hover { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.story .pill-outline { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.story .pill-outline:hover { background: rgba(255,255,255,.1); border-color: #fff; color: #fff; }

.chips { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; max-width: 460px; }
.chips li { font: 500 0.92rem/1 var(--sans); padding: 9px 14px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(6px); }

.scroll-cue { position: absolute; left: 50%; translate: -50% 0; bottom: 30px; display: flex; flex-direction: column; align-items: center; gap: 10px; font: 500 0.82rem var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: #8b93a8; pointer-events: none; }
.scroll-cue i { width: 1px; height: 44px; background: linear-gradient(#fff 0 40%, transparent 0) 0 0 / 100% 200%; animation: cue 1.8s cubic-bezier(.6,0,.3,1) infinite; }
@keyframes cue { from { background-position: 0 100%; } to { background-position: 0 -100%; } }

/* the bar turns clear and white while it floats over a dark stage */
.bar-clear { background: transparent; backdrop-filter: none; color: #fff; }
.bar-clear .bar-progress { opacity: 0; }
.bar-clear .wordmark { color: #fff; }
.bar-clear { top: var(--frame); left: var(--frame); right: var(--frame); }
.bar { transition: background-color .4s, color .4s, top .4s, left .4s, right .4s; }

/* ---------- projects (on the night grid) ---------- */
.work { background: var(--night); color: #dfe4ef; position: relative; }
.work::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 24px 24px; pointer-events: none; }
.work > * { position: relative; }
.work-head h2 { color: #fff; }
.work .px-stage { box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 60px 100px -50px rgba(0,0,0,.7); }
.work .px-item { background: rgba(255,255,255,.035); border-color: rgba(255,255,255,.1); }
.work .px-item.on { background: var(--night-2); border-color: rgba(255,255,255,.18); box-shadow: 0 18px 40px -24px rgba(0,0,0,.8); }
.work .px-item:not(.on):hover { background: rgba(255,255,255,.07); box-shadow: none; }
.work .px-title { color: #fff; }
.work .px-sum, .work .px-desc { color: #a9b1c7; }
.work .px-chev { background: rgba(255,255,255,.08); stroke: #fff; }
.work .px-item:not(.on):hover .px-chev { background: #fff; stroke: var(--ink); }
.work .px-head:focus-visible, .work :focus-visible { outline-color: var(--lime); }
.work .tags li { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); color: #c9d0df; }
.work .btn { background: #fff; border-color: #fff; color: var(--ink); }
.work .btn:hover { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.work .btn-outline { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.work .btn-outline:hover { background: rgba(255,255,255,.1); border-color: #fff; color: #fff; }
.work .px-mobile-media { box-shadow: 0 0 0 1px rgba(255,255,255,.1); }
/* ---------- projects ---------- */
.work { padding: clamp(140px, 22vh, 240px) 0 clamp(120px, 20vh, 220px); }
.work-head { display: flex; justify-content: space-between; align-items: end; gap: 24px 48px; flex-wrap: wrap; margin-bottom: clamp(48px, 8vh, 88px); }
.work-head h2 { font-size: clamp(3.2rem, 8vw, 7.5rem); line-height: 0.95; letter-spacing: -0.04em; }
.px { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(28px, 4vw, 64px); align-items: start; }
.px-stage {
  position: sticky; top: 100px; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; background: #fff;
  box-shadow: 0 0 0 1px rgba(22,33,58,.1), 0 40px 80px -40px rgba(22,33,58,.5);
}
.px-media { position: absolute; inset: 0; display: grid; place-items: center; background: var(--night-2); opacity: 0; transform: scale(1.03); transition: opacity .5s, transform .7s cubic-bezier(.2,.8,.2,1); }
.px-media.on { opacity: 1; transform: none; z-index: 1; }
.px-media img { width: 100%; height: 100%; object-fit: cover; }
.fit-contain img { object-fit: contain; padding: 5%; }
.px-list { display: grid; gap: 8px; }
.px-item { position: relative; border-radius: 12px; background: color-mix(in srgb, var(--card) 70%, transparent); border: 1px solid var(--rule); transition: background .3s, border-color .3s, box-shadow .3s; }
.px-item.on { background: #fff; border-color: transparent; box-shadow: 0 0 0 1px rgba(22,33,58,.08), 0 18px 40px -24px rgba(22,33,58,.45); }
.px-item h3 { font: inherit; letter-spacing: normal; }
.px-head { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; row-gap: 2px; padding: 16px 20px; }
.px-title, .px-sum { grid-column: 1; }
.px-chev { grid-column: 2; grid-row: 1 / span 2; align-self: center; width: 32px; height: 32px; padding: 7px; border-radius: 50%; background: var(--paper); fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s cubic-bezier(.2,.8,.2,1), background .25s, stroke .25s; }
.px-item:not(.on):hover .px-chev { background: var(--ink); stroke: #fff; }
.px-item.on .px-chev { transform: rotate(180deg); }
.px-item.on .px-head:hover .px-chev { background: #fff; stroke: var(--ink); }
/* collapsed rows stay one line each, so every closed item is the same height */
.px-item:not(.on) :is(.px-title, .px-sum) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.px-head:focus-visible { outline: 2.5px solid var(--teal); outline-offset: 2px; border-radius: 12px; }
.px-title { font: 600 1.12rem/1.3 var(--sans); letter-spacing: -0.015em; color: var(--ink); }
.px-sum { font-size: 0.95rem; color: var(--ink-2); }
.px-item:not(.on):hover { background: #fff; }
.px-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s cubic-bezier(.2,.8,.2,1); }
.px-body > div { overflow: hidden; padding: 0 20px; }
.px-item.on .px-body { grid-template-rows: 1fr; }
.px-item.on .px-body > div { padding-bottom: 20px; }
.px-desc { font-size: 0.98rem; color: var(--ink-2); margin: 6px 0 16px; }
.px-mobile-media:empty { display: none; }
.px-mobile-media { position: relative; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; margin: 6px 0 14px; box-shadow: 0 0 0 1px rgba(22,33,58,.1); }
.tags { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags:last-child { margin-bottom: 2px; }
.tags li { font: 500 0.8rem/1 var(--sans); padding: 7px 10px; border-radius: 6px; background: var(--card); border: 1px solid var(--rule); color: var(--ink-2); }
.px-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1.5px solid var(--ink); background: var(--ink); color: #fff; font: 500 0.93rem/1 var(--sans); text-decoration: none; transition: background .2s, border-color .2s, color .2s, transform .2s, box-shadow .2s; }
.btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.btn svg.ico-fill { fill: currentColor; stroke: none; }
.btn:hover { color: #fff; background: var(--teal); border-color: var(--teal); transform: translateY(-1px); box-shadow: 0 8px 18px -10px rgba(22,33,58,.6); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn-outline { background: transparent; color: var(--ink); }
.btn-outline:hover { background: var(--ink); border-color: var(--ink); }
.btn-outline:hover svg { transform: translate(2px, -2px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- coursework ---------- */
.courses { padding: clamp(140px, 22vh, 240px) 0 clamp(120px, 20vh, 220px); }
.courses-head { display: flex; justify-content: space-between; align-items: end; gap: 24px 48px; flex-wrap: wrap; margin-bottom: clamp(56px, 10vh, 110px); }
.courses-head h2 { font-size: clamp(3.2rem, 8vw, 7.5rem); line-height: 0.95; letter-spacing: -0.04em; font-weight: 600; }
.courses-head p { color: var(--ink-2); font-size: 1.2rem; }
.course-groups { display: grid; gap: clamp(56px, 9vh, 96px); }
.cg { display: grid; grid-template-columns: minmax(200px, 1fr) 2.4fr; gap: 16px clamp(24px, 4vw, 64px); align-items: start; }
.cg-issuer { position: sticky; top: 96px; display: flex; align-items: center; gap: 12px; font-size: clamp(1.25rem, 1.8vw, 1.6rem); letter-spacing: -0.02em; }
.cg-issuer .dot { width: 14px; height: 14px; background: var(--c); }
.cg-list { list-style: none; margin: 0; padding: 0; }
.course { --rule: 1; position: relative; overflow: hidden; padding: 20px 0 20px 4px; font: 500 clamp(1.15rem, 1.9vw, 1.65rem)/1.25 var(--sans); letter-spacing: -0.02em; cursor: default; }
.course::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1.5px; background: var(--ink); transform: scaleX(var(--rule)); transform-origin: left; opacity: .85; }
.cg-list .course:last-child { box-shadow: inset 0 -1.5px 0 var(--rule-c, transparent); }
.course::after { content: ""; position: absolute; inset: 1.5px 0 0; background: var(--c); transform: scaleY(0); transform-origin: bottom; transition: transform .45s cubic-bezier(.2,.8,.2,1); z-index: -1; }
.course { isolation: isolate; transition: color .3s, padding-left .45s cubic-bezier(.2,.8,.2,1); }
.course span { display: inline-block; }
@media (hover: hover) {
  .course:hover { color: #fff; padding-left: 22px; }
  .course:hover::after { transform: scaleY(1); }
}

/* ---------- ride ---------- */
.ride { height: 760vh; position: relative; }
.ride-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.ride canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: var(--void); clip-path: inset(26vh 30vw round 28px); }
/* the closing view sinks into the contact section's colour, so the two read as one space */
.ride-fade { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(rgba(18,26,48,.55), rgba(18,26,48,.25) 42%, rgba(18,26,48,.1) 62%, var(--night) 98%); }
.ride-anchor { position: absolute; left: 0; bottom: 0; height: 100vh; height: 100svh; }
.ride-end {
  position: absolute; left: 50%; top: clamp(96px, 14vh, 160px); translate: -50% 0; width: min(100% - 2 * var(--gutter), 980px);
  z-index: 1; text-align: center; color: #fff; pointer-events: none; visibility: hidden; transition: visibility 0s 1.2s;
}
.ride-end.on { pointer-events: auto; visibility: visible; transition: none; }
.ride-end > * { opacity: 0; transform: translateY(26px); filter: blur(8px); transition: opacity .9s, transform 1.1s cubic-bezier(.2,.8,.2,1), filter .9s; }
.ride-end.on > * { opacity: 1; transform: none; filter: none; }
.ride-end.on > :nth-child(2) { transition-delay: .15s; }
.ride-end.on > :nth-child(3) { transition-delay: .3s; }
.ride-end.on > :nth-child(4) { transition-delay: .45s; }
.re-lede { color: #b9c2d6; max-width: 52ch; margin: 22px auto 32px; font-size: clamp(1.02rem, 1.4vw, 1.2rem); }
.ride-end .mail-row { justify-content: center; }
.ride-end .elsewhere { justify-content: center; margin-top: 30px; }
.ride-end .mail { color: #fff; text-decoration-color: var(--lime); }
.ride-end .mail:hover { color: var(--lime); }
.ride-end .pill { background: #fff; border-color: #fff; color: var(--ink); }
.ride-end .pill:hover { background: var(--lime); border-color: var(--lime); }
.ride-end .elsewhere a:hover { color: var(--lime); }
.ride-end :focus-visible { outline-color: var(--lime); }
.ride-still { height: 100vh; height: 100svh; }
.ride-still .ride-end { visibility: visible; pointer-events: auto; }
.ride-still .ride-end > * { opacity: 1; transform: none; filter: none; }
.ride-still canvas { clip-path: none; }
.ride-still .ride-fade { opacity: 1; }
@media (max-width: 760px) { .ride { height: 620vh; } }

/* ---------- contact details (on the outro's end frame) ---------- */
.mail-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.mail { font: 600 clamp(1.4rem, 3vw, 2.4rem) var(--sans); letter-spacing: -0.03em; overflow-wrap: anywhere; }
.copy-status { font: 500 1rem var(--sans); color: var(--lime); }
/* the flip-disc panel says COPIED, so the status line is for screen readers unless copying failed */
.ride-end .mail-row { position: relative; }
.ride-end .copy-status { position: absolute; top: 100%; left: 0; right: 0; margin-top: 10px; }
.ride-end .copy-status:not(.err) { width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; left: 50%; }
.elsewhere { list-style: none; padding: 0; margin: 48px 0 0; display: flex; gap: 32px; flex-wrap: wrap; font: 500 1.05rem var(--sans); }
.elsewhere span { color: #a9b1c7; font-weight: 400; }
.foot { background: var(--night); color: #b9c2d6; font: 400 0.95rem/1.6 var(--serif); padding: clamp(160px, 26vh, 300px) 0 32px; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.foot-name { font: 600 1.25rem var(--sans); color: #fff; margin-bottom: 6px; }
.foot nav { display: grid; gap: 8px; align-content: start; }
.foot-h { font: 600 0.95rem var(--sans); color: #fff; margin-bottom: 4px; }
.foot a { text-decoration: none; color: #b9c2d6; }
.foot a:hover { color: var(--lime); }
.foot-base { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 64px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.12); font-size: 0.85rem; color: #8a94ab; }
@media (max-width: 700px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-id { grid-column: 1 / -1; } }

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  .bar { padding: 14px var(--gutter); }
  .chapter { top: auto; bottom: 96px; translate: none; }
  :root { --frame: 6px; --frame-r: 16px; }
  .story-sticky::before { display: none; }
  .story-sticky::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(3,3,8,.88) 38%); pointer-events: none; }
  .chapter { z-index: 1; }
  .chapter h2 { font-size: clamp(1.9rem, 7.4vw, 2.6rem); margin: 10px 0 12px; }
  .ch-body { font-size: 1.05rem; }
  .chips { margin-top: 16px; }
  .chips li { font-size: 0.82rem; padding: 7px 11px; }
  .ch-hero { bottom: 110px; }
  .scroll-cue { display: none; }

  .px { grid-template-columns: 1fr; }
  .px-stage { display: none; }

  .cg { grid-template-columns: 1fr; }
  .cg-issuer { position: static; }
}
@media (max-width: 520px) {
  .bar { gap: 12px; }
  .wordmark { font-size: 1rem; white-space: nowrap; }
  /* the summary gets two lines on phones, still a fixed height so closed rows match */
  .px-item:not(.on) .px-sum { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; min-height: calc(2 * 1.65em); }
  .px-head { padding: 14px 16px; }
  .px-body > div { padding: 0 16px; }
  .foot { padding-top: 96px; }
  .work, .courses { padding-top: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue i { animation: none; }
  .course, .course::after, .pill { transition: none; }
}
