/* ---------- Hero: a live long exposure ---------- */
/* the sky can be held still with a finger, so no long-press menu */
.hero { position: relative; height: 100svh; min-height: 320px; overflow: hidden; isolation: isolate; background: var(--bg); touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.js .hero { cursor: grab; }
.no-sky .hero { cursor: auto; }
.hero.is-turning { cursor: grabbing; }
.hero-sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-fallback { display: none; position: absolute; inset: 0; }
.hero-fallback picture, .hero-fallback img { width: 100%; height: 100%; object-fit: cover; }
.hero-fallback::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4, 6, 11, .35), rgba(4, 6, 11, .2) 40%, var(--bg)); }
.no-js .hero-fallback, .no-sky .hero-fallback { display: block; }
.hero::after { content: ''; position: absolute; inset: auto 0 0; height: 22%; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }

.hero-inner { position: absolute; z-index: 2; left: var(--gutter); right: var(--gutter); bottom: clamp(72px, 13vh, 150px); }
.hero-name {
  font-family: var(--display); font-style: italic; font-weight: 560;
  font-size: clamp(76px, 15.2vw, 262px); line-height: .9; letter-spacing: 0;
  margin-left: -.035em; white-space: nowrap; color: var(--ink);
}
.hero-name span { display: inline-block; }
.js .hero-name { color: transparent; }
.no-sky .hero-name { color: var(--ink); text-shadow: 0 2px 40px rgba(0, 0, 0, .6); }
/* without WebGL the light theme shows the name on the plain page rather than on the dark photograph */
[data-theme="light"] .no-sky .hero-fallback, [data-theme="light"].no-sky .hero-fallback { display: none; }
[data-theme="light"].no-sky .hero-name { text-shadow: none; }
.hero-intro { max-width: 31ch; margin-top: clamp(18px, 2.6vh, 30px); font: 400 clamp(17px, 1.32vw, 21px)/1.5 var(--sans); color: var(--ink-2); }

.js .hero [data-hero-in] { opacity: 0; transform: translateY(14px); transition: opacity 1.2s var(--ease-out), transform 1.4s var(--ease-out); }
.js .hero.is-ready .hero-intro { opacity: 1; transform: none; transition-delay: .9s; }
.js .page-home.is-returning .hero [data-hero-in] { transition-delay: 0s; }

/* Windows high contrast: the glass can't follow the system colours, so the name is plain text */
@media (forced-colors: active) {
  .hero-sky { display: none; }
  .js .hero-name { color: CanvasText; }
  .statement .sw { opacity: 1; }
}

@media (max-width: 760px) {
  .hero-inner { bottom: clamp(96px, 18vh, 180px); }
  .hero-name { font-size: min(27.5vw, 15vh); white-space: normal; line-height: .88; }
  .hero-name span { display: block; }
  .hero-name span + span { margin-left: .34em; }
  .hero-intro { font-size: 17px; max-width: 28ch; }
}
@media (max-height: 620px) and (min-width: 761px) {
  .hero-name { font-size: min(15.2vw, 30vh); }
  .hero-inner { bottom: 64px; }
}
/* a phone held sideways: the name goes back on one line and everything sits low and small */
@media (orientation: landscape) and (max-height: 500px) {
  .hero-inner { bottom: max(26px, env(safe-area-inset-bottom)); }
  .hero-name { font-size: min(12.5vw, 27vh); white-space: nowrap; line-height: .9; }
  .hero-name span { display: inline-block; }
  .hero-name span + span { margin-left: 0; }
  .hero-intro { max-width: 52ch; margin-top: 10px; font-size: 15px; }
}

/* ---------- Hello ---------- */
.hello { padding: clamp(110px, 15vw, 230px) var(--gutter) clamp(70px, 9vw, 150px); }
.hello-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(36px, 6.5vw, 120px); column-gap: max(clamp(36px, 6.5vw, 120px), calc(var(--note-w) + 3 * var(--note-gap))); align-items: start; max-width: 1640px; margin: 0 auto; }
.hello-portrait { position: sticky; top: 110px; }
.hello-portrait .portrait-note { left: calc(100% + var(--note-gap)); }
.hello-portrait picture { aspect-ratio: 4 / 5; overflow: hidden; border-radius: 24px; background: var(--surface); }
.hello-portrait img { height: 100%; object-fit: cover; object-position: 50% 30%; }
.hello-copy { padding-top: clamp(0px, 4vw, 70px); }
.statement { font: 360 clamp(28px, 3.1vw, 52px)/1.18 var(--serif); letter-spacing: -.014em; color: var(--ink); }
/* the words light up as you read down to them */
.statement .sw { opacity: var(--unlit); transition: opacity .6s var(--ease-out); }
.statement .sw.is-lit { opacity: 1; }
/* The signature under the statement. It waits, then writes itself once the last word above
   has lit up. Without JavaScript, or with reduced motion, it is simply there. */
.signature { width: clamp(230px, 52%, 360px); margin: clamp(26px, 3vw, 40px) 0 0 -4px; color: var(--ink); }
.signature svg { display: block; width: 100%; height: auto; overflow: visible; }
.sig-ink { fill: currentColor; }
.sig-pen { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 2; }
.sig-settle { fill: #fff; }
.sig-hold { fill: #000; }
.js .signature .sig-pen { stroke-dashoffset: 1.02; opacity: 0; }
.js .signature .sig-settle { opacity: 0; }
.js .signature.is-signed .sig-pen { animation: sig-write var(--d) var(--e, linear) var(--t) both; }
.js .signature.is-signed .sig-settle { animation: sig-settle .45s ease var(--t) both; }
@keyframes sig-write {
  0% { stroke-dashoffset: 1.02; opacity: 0; }
  0.01% { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes sig-settle { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .js .signature .sig-pen, .js .signature.is-signed .sig-pen { stroke-dashoffset: 0; opacity: 1; animation: none; }
  .js .signature .sig-settle, .js .signature.is-signed .sig-settle { opacity: 1; animation: none; }
}
.hello-foot { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 16px 40px; margin-top: clamp(40px, 5vw, 64px); padding-top: 24px; border-top: 1px solid var(--line); }
.hello-note { font-size: 16px; color: var(--ink-2); }
.hello-foot .text-link { font-size: 15px; }
@media (max-width: 900px) {
  .hello-grid { grid-template-columns: 1fr; }
  .hello-portrait { position: relative; top: 0; max-width: 420px; }
}

/* ---------- Things I've built: plates that stack as you scroll ---------- */
.work { padding-top: clamp(50px, 7vw, 110px); }
.stack { padding: 0 var(--gutter) 8vh; }
.stack-item { position: sticky; top: calc(92px + var(--i) * 16px); padding-bottom: 5vh; }
.stack-item:last-child { padding-bottom: 0; }
.plate {
  position: relative; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 4vw, 72px);
  height: min(calc(100svh - 156px), 800px); min-height: 520px; padding: clamp(28px, 3.4vw, 60px);
  overflow: hidden; border-radius: 28px; transform-origin: 50% 0;
  background: var(--plate);
  box-shadow: inset 0 0 0 1px var(--plate-edge), var(--plate-shadow);
  transform: scale(var(--plate-scale, 1));
}
.plate > *, .plate-visual > * { min-width: 0; }
/* While the cards stack, each one shrinks and darkens every frame; on its own layer the GPU
   just recomposites it instead of redrawing the whole card and its screenshots. */
@media (min-width: 1101px) and (min-height: 701px) { .js .plate { will-change: transform, filter; } }
.plate-copy { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; min-height: 0; }
.plate-title { font: 360 clamp(48px, 6.4vw, 108px)/.94 var(--serif); letter-spacing: -.024em; }
.plate-title a { display: inline-block; }
.plate-title a::after { content: ''; position: absolute; inset: 0; z-index: 3; border-radius: 28px; }
.plate-title a:focus-visible { outline: none; }
.plate:has(.plate-title a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }
.plate-tagline { margin-top: 18px; font: 380 clamp(21px, 1.7vw, 27px)/1.3 var(--serif); color: var(--ink); }
.plate-summary { max-width: 44ch; margin-top: 14px; font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.plate-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.plate-facts dt { font-size: 13px; color: var(--ink-3); }
.plate-facts dd { margin-top: 3px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.plate-more { margin-top: 26px; align-self: flex-start; font-size: 15px; font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .24em; text-decoration-color: var(--line-2); transition: text-decoration-color .25s; }
.plate:has(.plate-title a:hover) .plate-more { text-decoration-color: currentColor; }
.plate-visual { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; max-width: 100%; min-height: 0; }
.plate--terminal .plate-visual .terminal, .plate--code .plate-visual .code-plate { max-width: 680px; }
.plate--research .plate-visual .fig { max-width: 600px; }

@media (max-width: 1100px) {
  .plate { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 0; }
  .plate-visual { margin-top: 10px; }
}
@media (max-width: 1100px), (max-height: 700px) {
  .stack-item { position: relative; top: 0; padding-bottom: 22px; }
  .plate { transform: none; filter: none; height: auto; }
}
@media (max-width: 600px) {
  .plate { padding: 26px 20px 26px; border-radius: 22px; }
  .plate-title a::after { border-radius: 22px; }
  .plate-facts { grid-template-columns: 1fr; }
  .screens { padding-right: 13%; }
  .phone { width: 27%; border-radius: 14px; }
}

/* ---------- Competitions and research ---------- */
.awards { padding-top: clamp(90px, 12vw, 190px); }

/* ---------- Looking Up: the real photograph ---------- */
.lookup { position: relative; height: 230svh; margin-top: clamp(80px, 11vw, 170px); }
.lookup-sticky { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.lookup-frame { position: absolute; inset: 0; overflow: hidden; clip-path: inset(var(--clip-y, 14%) var(--clip-x, 24%) round var(--clip-r, 28px)); }
.lookup-frame picture, .lookup-frame img { width: 100%; height: 100%; object-fit: cover; }
.lookup-frame img { transform: scale(var(--zoom, 1.18)); transform-origin: 70% 50%; }
.lookup-shade { position: absolute; inset: 0; pointer-events: none; opacity: var(--shade, 0); background: linear-gradient(0deg, rgba(3, 4, 8, .92), rgba(3, 4, 8, .3) 50%, transparent 75%), linear-gradient(90deg, rgba(3, 4, 8, .55), transparent 60%); }
.lookup-copy { position: absolute; left: var(--gutter); bottom: clamp(56px, 10vh, 110px); max-width: 600px; opacity: var(--copy, 0); transform: translateY(calc((1 - var(--copy, 0)) * 34px)); }
.lookup-title { font: 340 clamp(70px, 10.5vw, 180px)/.88 var(--serif); letter-spacing: -.03em; }
.lookup-text { max-width: 44ch; margin-top: 26px; font-size: 18px; line-height: 1.6; color: var(--ink); }
.lookup-copy .details { margin-top: 14px; color: var(--ink-2); }
.lookup-copy .text-link { display: inline-block; margin-top: 24px; font-size: 15px; }
/* The same curves as the script fallback in home.js. cubic-bezier(1/3, 1, 2/3, 1) is exactly
   the script's ease-out, 1 - (1 - t)^3. The "contain" range runs from the section's top
   reaching the top of the screen to its bottom reaching the bottom: the script's p from 0 to 1. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .js .lookup { view-timeline-name: --lookup; view-timeline-axis: block; }
    .js .lookup-frame, .js .lookup-frame img, .js .lookup-shade, .js .lookup-copy {
      animation-duration: auto; animation-fill-mode: both; animation-timeline: --lookup;
    }
    .js .lookup-frame { animation-name: lookup-open; animation-timing-function: cubic-bezier(.3333333, 1, .6666667, 1); animation-range: contain 0% contain 50%; }
    .js .lookup-frame img { animation-name: lookup-zoom; animation-timing-function: cubic-bezier(.3333333, 1, .6666667, 1); animation-range: contain 0% contain 50%; }
    .js .lookup-shade { animation-name: lookup-shade; animation-timing-function: linear; animation-range: contain 30% contain 60%; }
    .js .lookup-copy { animation-name: lookup-copy; animation-timing-function: cubic-bezier(.3333333, 1, .6666667, 1); animation-range: contain 42% contain 68%; }
  }
}
@keyframes lookup-open { from { clip-path: inset(14% 24% round 28px); } to { clip-path: inset(0% 0% round 0px); } }
@keyframes lookup-zoom { from { transform: scale(1.18); } to { transform: scale(1); } }
@keyframes lookup-shade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lookup-copy { from { opacity: 0; transform: translateY(34px); } to { opacity: 1; transform: translateY(0); } }
/* keep the photo, the shade and the text on their own layers while they move */
.js .lookup-frame img { will-change: transform; }
.js .lookup-shade { will-change: opacity; }
.js .lookup-copy { will-change: opacity, transform; }
.no-js .lookup { height: auto; }
.no-js .lookup-sticky { position: relative; }
.no-js .lookup-frame { clip-path: none; }
@media (prefers-reduced-motion: reduce) {
  .lookup { height: auto; }
  .lookup-sticky { position: relative; height: 100svh; }
  .lookup-frame { clip-path: none; }
  .lookup-frame img { transform: none; }
  .lookup-shade, .lookup-copy { opacity: 1; transform: none; }
}

/* The same sky drawn in code, over the photograph, on the far side of a line you can drag
   (home.js). It only comes in once the photograph is fully open. */
.lookup-code { position: absolute; inset: 0; width: 100%; height: 100%; clip-path: inset(0 0 0 calc(var(--split, 1) * 100%)); opacity: 0; transition: opacity .6s var(--ease-out); }
.lookup.is-comparing .lookup-code { opacity: 1; }
.compare { position: absolute; inset: 0; pointer-events: none; visibility: hidden; opacity: 0; transition: opacity .6s var(--ease-out), visibility 0s .6s; -webkit-user-select: none; user-select: none; }
.lookup.is-comparing .compare { visibility: visible; opacity: 1; transition: opacity .6s var(--ease-out); }
.compare-hit { position: absolute; top: 0; bottom: 0; left: calc(var(--split, 1) * 100%); width: 44px; margin-left: -22px; pointer-events: auto; cursor: ew-resize; touch-action: pan-y; }
.compare-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: rgba(236, 239, 245, .55); box-shadow: 0 0 12px rgba(188, 211, 255, .35); }
.compare-knob { --glass-tint: rgba(10, 13, 20, .5); position: absolute; top: 24%; left: 50%; display: grid; place-items: center; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; color: var(--ink); transition: transform .4s var(--ease-out); }
.compare-knob .icon { font-size: 18px; }
.compare-hit:hover .compare-knob, .compare.is-dragging .compare-knob { transform: scale(1.08); }
.compare:has(.compare-range:focus-visible) .compare-knob { outline: 2px solid var(--accent); outline-offset: 3px; }
.compare-label { position: absolute; top: 24%; margin-top: -.75em; font-size: 13px; line-height: 1.5; color: var(--ink-2); white-space: nowrap; text-shadow: 0 1px 10px rgba(0, 0, 0, .8); pointer-events: none; }
.compare-label--photo { right: 50%; margin-right: 34px; }
.compare-label--code { left: 50%; margin-left: 34px; }
.compare-range { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
@media (forced-colors: active) { .lookup-code, .compare { display: none; } }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 2vw, 32px); padding: clamp(18px, 2.4vw, 36px) var(--gutter) 0; }
.pair-image { display: block; overflow: hidden; border-radius: 22px; background: var(--surface); }
.pair-image picture { aspect-ratio: 16 / 10; }
.pair-image img { height: 100%; object-fit: cover; }
.pair-caption { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: 14px; }
.pair-caption cite { font-size: 21px; line-height: 1.2; }
.pair-caption span { font-size: 14px; color: var(--ink-3); }
@media (max-width: 700px) { .pair { grid-template-columns: 1fr; } }
