:root {
  --bg: #0a0a0b;
  --panel: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f2ee;
  --muted: #9a9aa2;
  --accent: #f29a5c;
  --display: 'Inter Tight', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--body);
  -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
.accent { color: var(--accent); }

/* Glass pills, as on the reference's buttons */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  font: 500 13px/1 var(--body); color: #fff; background: rgba(20, 24, 30, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.22); backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%); cursor: pointer;
  transition: background .25s ease, transform .25s ease; }
.pill:hover { background: rgba(20, 24, 30, 0.5); transform: translateY(-1px); }
.cta-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.35); margin-left: -6px; }

/* Hero */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 480px; overflow: hidden; }
.sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover;
  transform: scale(1.04); transform-origin: 50% 30%; will-change: transform; background: #111 url(hero.jpg?v=0.5.4) center / cover; }
.hero-shade { position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(6, 8, 12, 0.55) 0%, rgba(6, 8, 12, 0.15) 45%, rgba(0, 0, 0, 0) 70%),
    linear-gradient(180deg, rgba(0, 0, 0, 0) 60%, var(--bg) 100%); }

/* Film grain over the footage; the tile jumps around each frame so it reads as moving grain */
.grain { position: absolute; inset: -50%; pointer-events: none; opacity: .22; mix-blend-mode: overlay;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.6 -.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .5s steps(6) infinite; }
@keyframes grain {
  0% { transform: translate(0, 0); } 17% { transform: translate(-7%, 4%); } 33% { transform: translate(5%, -6%); }
  50% { transform: translate(-3%, 8%); } 67% { transform: translate(8%, 2%); } 83% { transform: translate(-6%, -5%); }
}
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } }

.top { position: absolute; top: 28px; left: 40px; right: 40px; display: flex;
  justify-content: space-between; align-items: center; z-index: 2; }
.mark { display: flex; align-items: center; gap: 10px; font: 500 17px var(--display); color: #fff; }
.mark-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18); }

.hero-copy { position: absolute; left: 40px; bottom: 120px; max-width: 760px; z-index: 2; }
.kicker { display: flex; align-items: center; gap: 10px; margin: 0 0 18px;
  font: 500 13px/1 var(--body); letter-spacing: .02em; color: rgba(255, 255, 255, 0.86); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
h1 { margin: 0; font: 300 clamp(56px, min(11vw, 19vh), 168px)/0.88 var(--display); letter-spacing: -0.045em;
  color: #fff; text-shadow: 0 2px 40px rgba(0, 0, 0, 0.18); }
.lede { margin: 26px 0 0; max-width: 440px; font: 400 18px/1.45 var(--body); color: rgba(255, 255, 255, 0.92); }
.contact-line { display: none; }

.hero-actions { position: absolute; left: 40px; bottom: 44px; display: flex; gap: 10px; z-index: 2; }
.hero-controls { position: absolute; right: 40px; bottom: 44px; display: flex; gap: 10px; z-index: 2; }

/* Content */
main { max-width: 1120px; margin: 0 auto; padding: 40px 40px 0; }

/* Highlights as one editorial sentence: muted prose, figures in full white */
.proof { padding: 80px 0 72px; border-bottom: 1px solid var(--line); }
.proof p { margin: 0; max-width: 980px; font: 300 clamp(28px, 3.3vw, 46px)/1.22 var(--display);
  letter-spacing: -0.02em; color: #7d7d85; }
.proof em { font-style: normal; font-weight: 400; color: var(--text); font-variant-numeric: tabular-nums; }
.proof a:not(.pill) { color: var(--text); }

.block { display: grid; grid-template-columns: 260px 1fr; gap: 0 40px; padding: 72px 0;
  border-bottom: 1px solid var(--line); }
.block > :not(h2) { grid-column: 2; }
.block > h2 { margin: 0; grid-row: 1 / span 9; font: 300 44px/1 var(--display); letter-spacing: -0.03em; }
.prose p { margin: 0 0 16px; max-width: 680px; font-size: 18px; color: #d6d4cf; }

.now-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card { padding: 28px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
  transition: transform .3s ease, border-color .3s ease; }
.card:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, 0.18); }
.card h3 { margin: 6px 0 8px; font: 500 22px var(--display); letter-spacing: -0.01em; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .card-meta { font-size: 13px; color: var(--accent); }

.role + .role { margin-top: 48px; }
.role header { display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: 2px; }
.role h3, .projects h3 { margin: 0; font: 500 24px var(--display); letter-spacing: -0.015em; }
.title { margin: 0; color: #d6d4cf; }
.where, .when { color: var(--muted); font-size: 14px; text-align: right; }
main a:not(.pill) { text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.25);
  text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color .2s ease, text-decoration-color .2s ease; }
main a:not(.pill):hover { color: var(--accent); text-decoration-color: var(--accent); }
main h3 a:not(.pill) { text-decoration: none; }
main h3 a:not(.pill)::after { content: ' ↗'; font-size: .62em; color: var(--muted); vertical-align: .25em; }
main h3 a:not(.pill):hover::after { color: var(--accent); }

.role ul { margin: 16px 0 0; padding: 0; list-style: none; }
.role li { position: relative; padding-left: 20px; margin: 0 0 10px; color: #c9c7c2; }
.role li::before { content: ''; position: absolute; left: 0; top: 0.72em; width: 8px; height: 1px;
  background: var(--accent); }
.role li b, .projects b { color: var(--text); font-weight: 500; }

.projects { display: grid; gap: 36px; }
.projects header { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.projects h3 { font-size: 21px; }
.projects p { margin: 8px 0 0; color: #c9c7c2; }

.skills { display: grid; grid-template-columns: 140px 1fr; gap: 12px 24px; margin: 0; }
.skills dt { color: var(--muted); font-size: 14px; padding-top: 2px; }
.skills dd { margin: 0; color: #d6d4cf; }

.outro { padding: 120px 0 100px; }
.outro-title { margin: 0; font: 300 clamp(64px, 10vw, 144px)/0.9 var(--display); letter-spacing: -0.045em; }
.outro-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }
.outro .pill { background: rgba(255, 255, 255, 0.05); border-color: var(--line); }
.outro-title button { all: unset; cursor: pointer; transition: opacity .25s ease; }
.outro-title button:hover { opacity: .8; }
.outro-title button:focus-visible { outline: 2px solid var(--accent); outline-offset: 8px; }

/* "Ask your favourite AI about me": each link opens an assistant with a prompt to read this page */
.ask-ai { margin-top: 56px; }
.ask-ai p { margin: 0 0 16px; font-size: 17px; color: var(--muted); }
.ask-ai-links { display: grid; grid-template-columns: repeat(4, max-content); gap: 14px 36px; }
main .ask-ai-links a { display: inline-flex; align-items: center; gap: 10px; font: 500 19px var(--body); color: var(--text);
  text-decoration: none; }
main .ask-ai-links a:hover { color: var(--text); }
.ask-ai-links svg { width: 22px; height: 22px; flex: none; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.ask-ai-links span { padding-bottom: 2px; border-bottom: 1.5px solid color-mix(in srgb, var(--accent) 45%, transparent);
  transition: border-color .25s ease, color .25s ease; }
main .ask-ai-links a:hover span { border-color: var(--accent); }
main .ask-ai-links a:hover svg { transform: rotate(-12deg) scale(1.12); }

/* Section headings stay pinned while their section scrolls past (motion.js adds .stuck) */
.block > h2 { position: sticky; top: 32px; align-self: start; z-index: 3; transform-origin: 0 50%; }
html.motion .block > h2.reveal, .block > h2 { transition: opacity .8s ease var(--d, 0ms), transform .9s cubic-bezier(.2, .8, .2, 1) var(--d, 0ms),
  scale .45s cubic-bezier(.2, .8, .2, 1), font-size .35s ease, color .45s ease; }
.block > h2.stuck { scale: .82; }

/* Contact modal */
.contact { width: min(620px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 0; border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px; color: var(--text); background: rgba(16, 18, 22, 0.72);
  backdrop-filter: blur(28px) saturate(150%); -webkit-backdrop-filter: blur(28px) saturate(150%);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.55); }
.contact::backdrop { background: rgba(6, 8, 12, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.contact[open] { animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.contact-form, .contact-done { position: relative; padding: 40px; }
.contact h2 { margin: 0 0 28px; font: 300 64px/0.95 var(--display); letter-spacing: -0.04em; }
.contact-close { position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--muted);
  font: 300 22px/1 var(--body); cursor: pointer; }
.contact-close:hover { color: var(--text); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.fields label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.fields label.wide { grid-column: 1 / -1; }
.fields i { font-style: normal; opacity: .6; }
.fields input, .fields textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04); color: var(--text); font: 400 15px/1.45 var(--body); resize: vertical;
  transition: border-color .2s ease, background .2s ease; }
.fields input:focus, .fields textarea:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  background: rgba(255, 255, 255, 0.07); }
.fields textarea::placeholder { color: #5f5f66; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 24px; }
.contact-status { margin: 0; font-size: 14px; color: var(--muted); }
.contact .pill-cta { background: var(--accent); border-color: var(--accent); color: #1a0f07; font-weight: 600; }
.contact .pill-cta .cta-dot { background: #fff; box-shadow: none; width: 8px; height: 8px; margin-left: 0; }
.contact .pill-cta:disabled { opacity: .6; cursor: default; }
.contact-done p:not(.kicker) { margin: 0 0 28px; color: #c9c7c2; font-size: 17px; }
button.pill { font-family: var(--body); }

/* Short laptop screens: tighten the hero and the modal so nothing spills off-screen */
@media screen and (max-height: 760px) {
  .hero-copy { bottom: 96px; }
  .lede { margin-top: 18px; font-size: 16px; }
  .kicker { margin-bottom: 12px; }
  .hero-actions, .hero-controls { bottom: 32px; }
  .contact-form, .contact-done { padding: 28px 32px; }
  .contact h2 { margin-bottom: 18px; font-size: 48px; }
  .fields { gap: 12px 16px; }
  .fields input, .fields textarea { padding: 10px 12px; }
  .fields textarea { height: 96px; }
  .contact-foot { margin-top: 16px; }
}
@media screen and (max-height: 600px) {
  .lede { display: none; }
  .hero-copy { bottom: 84px; }
}

@media screen and (max-width: 820px) {
  .top, .hero-copy, .hero-actions { left: 20px; right: 20px; }
  .hero-controls { display: none; }
  .hero-copy { bottom: 110px; }
  .fields { grid-template-columns: 1fr; }
  h1 { font-size: clamp(64px, 20vw, 104px); }
  .hero-shade { background: linear-gradient(180deg, rgba(6, 8, 12, 0.15) 0%, rgba(6, 8, 12, 0.3) 30%, rgba(6, 8, 12, 0.7) 50%, rgba(6, 8, 12, 0.85) 75%, var(--bg) 100%); }
  .prose p { font-size: 16px; }
  .projects header { flex-direction: column; gap: 2px; }
  .proof .s { display: block; }
  .proof .s + .s { margin-top: .6em; }
  .block > h2 { top: 0; margin: 0 -20px; padding: 14px 20px 18px;
    background: linear-gradient(180deg, var(--bg) 65%, color-mix(in srgb, var(--bg) 0%, transparent)); }
  .block > h2.stuck { scale: 1; font-size: 28px; }
  .projects header .when { text-align: left; }
  .skills { grid-template-columns: 1fr; gap: 2px; }
  .skills dd { margin-bottom: 14px; }
  .ask-ai-links { grid-template-columns: repeat(2, max-content); gap: 16px 40px; }
  .contact-form, .contact-done { padding: 28px 22px; }
  .contact h2 { font-size: 48px; }
  main { padding: 24px 20px 0; }
  .proof { padding: 56px 0; }
  .block { grid-template-columns: 1fr; gap: 24px; padding: 56px 0; }
  .block > *, .block > h2, .block > :not(h2) { grid-column: 1; grid-row: auto; }
  .now-grid { grid-template-columns: 1fr; }
  .role header { grid-template-columns: 1fr; }
  .where, .when { text-align: left; }
}

/* Print: a short sky band with the name, then a light, dense two-page resume */
@page { size: A4; margin: 10mm 0 8mm; }
@page :first { margin-top: 0; }
@media print {
  :root { --text: #141416; --muted: #6b6b72; --line: #e3e1dc; --accent: #d9783a; }
  body { background: #fff; color: var(--text); font-size: 8.7pt; line-height: 1.4;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sky, .hero-shade, .grain, .top, .hero-actions, .hero-controls, .lede, .now, .outro { display: none; }
  .hero { height: auto; min-height: 0; padding: 11mm 14mm 7mm; color: #fff;
    background:
      linear-gradient(180deg, rgba(10,10,11,0) 55%, rgba(10,10,11,0.25) 100%),
      radial-gradient(60% 120% at 40% 10%, rgba(255,255,255,0.22), rgba(255,255,255,0) 70%),
      linear-gradient(180deg, #0e0e10 0%, #2c2c30 55%, #6a6a70 100%); }
  .hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 18mm;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 60' preserveAspectRatio='none'%3E%3Cpath d='M0 38 C90 20 160 34 240 24 S420 6 520 22 S700 36 800 18 V60 H0Z' fill='%233a3a3f'/%3E%3Cpath d='M0 50 C120 36 220 48 330 40 S560 30 640 42 S760 50 800 40 V60 H0Z' fill='%2318181b'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat; }
  .hero-copy { position: relative; left: 0; bottom: 0; max-width: none; z-index: 1; }
  .kicker { margin-bottom: 3mm; font-size: 8.5pt; color: rgba(255,255,255,0.92); }
  h1 { font-size: 44pt; line-height: 0.9; }
  h1 br { display: none; }
  .contact-line { display: flex; flex-wrap: wrap; gap: 0 4mm; margin: 3.5mm 0 7mm; font-size: 9pt; }
  .contact-line > * + *::before { content: '·'; margin-right: 4mm; opacity: .7; }

  main { max-width: none; padding: 5mm 14mm 0; }
  .proof { padding: 0 0 3mm; border-bottom: 1px solid var(--line); }
  .proof p { font-size: 12.5pt; line-height: 1.3; color: #5a5a60; }
  .proof em, .proof a:not(.pill) { color: var(--text); }

  .block { grid-template-columns: 1fr; gap: 1.5mm; padding: 3.5mm 0 1.5mm; border: 0; }
  .block > *, .block > h2, .block > :not(h2) { grid-column: 1; grid-row: auto; }
  .block > h2 { font: 500 12pt/1.1 var(--display); letter-spacing: -0.01em; border-bottom: 1px solid var(--line);
    padding-bottom: 1.2mm; }
  .prose p { margin: 0 0 1.5mm; max-width: none; font-size: 8.7pt; color: var(--text); }
  .role, .projects article { break-inside: avoid; }
  .role + .role { margin-top: 3.2mm; }
  .role h3, .projects h3 { font-size: 10.5pt; }
  .projects h3 { font-size: 9.8pt; }
  .title { color: var(--text); font-style: italic; }
  .where, .when { font-size: 8.3pt; }
  .role ul { margin-top: 1mm; }
  .role li { margin: 0 0 0.8mm; padding-left: 3.2mm; color: var(--text); }
  .role li::before { width: 1.6mm; }
  .projects { gap: 2.4mm; }
  .projects p { margin-top: 0.5mm; color: var(--text); }
  .skills { grid-template-columns: 26mm 1fr; gap: 0.8mm 3mm; }
  .skills dt { font-size: 8.4pt; padding: 0; }
  .skills dd { color: var(--text); }
  main a:not(.pill) { color: inherit; text-decoration-color: rgba(0, 0, 0, 0.25); }
  main h3 a:not(.pill)::after { content: none; }
}

/* Micro-animations (motion.js). Only active with html.motion, so reduced-motion and print stay static. */
h1 br { display: none; }
.line { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.line > span { display: inline-block; }
@keyframes rise-in { from { transform: translateY(105%); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { from { transform: scale(0); } 60% { transform: scale(1.35); } }
html.motion .line > span { animation: rise-in 1s cubic-bezier(.2, .8, .2, 1) both; }
html.motion .line + br + .line > span { animation-delay: .1s; }
html.motion h1 .accent { display: inline-block; animation: pop .6s .7s cubic-bezier(.3, 1.6, .5, 1) both; }
html.motion .kicker, html.motion .lede, html.motion .hero-actions, html.motion .hero-controls, html.motion .top {
  animation: fade-up .9s cubic-bezier(.2, .8, .2, 1) both; }
html.motion .hero .kicker { animation-delay: .05s; }
html.motion .lede { animation-delay: .35s; }
html.motion .hero-actions { animation-delay: .5s; }
html.motion .hero-controls, html.motion .top { animation-delay: .65s; }

/* Status dot breathes */
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
html.motion .kicker .dot { animation: pulse 2.2s ease-out infinite; }

/* Scroll reveals */
html.motion .reveal { opacity: 0; transform: translateY(22px);
  transition: opacity .8s ease var(--d, 0ms), transform .9s cubic-bezier(.2, .8, .2, 1) var(--d, 0ms); }
html.motion .reveal.in { opacity: 1; transform: none; }
html.motion .card.reveal.in:hover { transform: translateY(-4px); transition-delay: 0ms; }
html.motion .block > h2.reveal .accent { display: inline-block; transform: scale(0);
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1) .45s; }
html.motion .block > h2.reveal.in .accent { transform: scale(1); }

/* Cursor glow on cards */
.card { position: relative; overflow: hidden; }
.card::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s ease;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%); }
.card:hover::before { opacity: 1; }

/* Hover details */
.role li::before { transition: width .3s cubic-bezier(.2, .8, .2, 1); }
.role li:hover::before { width: 14px; }
.arrow, main h3 a:not(.pill)::after { display: inline-block; transition: transform .25s ease; }
.pill:hover .arrow, main h3 a:not(.pill):hover::after { transform: translate(2px, -2px); }
.pill-cta .cta-dot { transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.pill-cta:hover .cta-dot { transform: scale(1.18); }

@media print {
  html.motion .reveal { opacity: 1; transform: none; }
  .block > h2 { position: static; scale: 1; }
  .line, .line > span { display: inline; overflow: visible; }
}

/* Clicking the full stop after the name cycles the accent colour across the site (accent.js) */
.accent, .dot, .cta-dot, .card .card-meta, .role li::before { transition: color .5s ease, background-color .5s ease; }
h1 .accent[role=button] { cursor: pointer; border-radius: 4px; }
h1 .accent[role=button]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
@keyframes squash { 25% { transform: scale(1.35, .7); } 55% { transform: scale(.85, 1.2) translateY(-.08em); } }
html.motion h1 .accent.swap, h1 .accent.swap { animation: squash .5s cubic-bezier(.3, 1.4, .5, 1); transform-origin: 50% 85%; }
@media print { :root { --accent: #d9783a !important; } }
