:root { --ink:#111; --muted:#6b6b6b; --line:#ededed; --ease:cubic-bezier(.22,1,.36,1); }
* { box-sizing:border-box; }
body { margin:0; min-height:100svh; display:flex; flex-direction:column; background:#fff; color:var(--ink); font:400 1rem/1.5 "IBM Plex Serif",Georgia,serif; -webkit-font-smoothing:antialiased; }
a { color:inherit; text-underline-offset:4px; }
a:focus-visible { outline:2px solid currentColor; outline-offset:4px; }
svg { fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.icon { flex:none; width:1.2em; height:1.2em; }

.site { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:20px 28px; }
.site a { display:flex; align-items:center; gap:8px; min-height:44px; text-decoration:none; }
.name { view-transition-name:name; }
.back { color:var(--muted); transition:color .2s; }
.back:hover { color:var(--ink); }

main { width:100%; max-width:608px; margin:0 auto; padding:clamp(48px,12vh,128px) 28px 80px; }
main.home { margin:auto; padding-top:40px; }
h1 { margin:0 0 12px; font-size:1.75rem; font-weight:400; line-height:1.3; letter-spacing:0; }
h1.intro { margin:0; font-size:clamp(1.35rem,5vw,1.75rem); line-height:1.45; text-wrap:balance; }
.intro .icon { width:1em; height:1em; vertical-align:-.12em; margin-right:.22em; }
.keep { white-space:nowrap; }
.lead { margin:0; color:var(--muted); font-size:1.125rem; }
.date, small { color:var(--muted); font-size:.875rem; }

.list { margin:44px 0 0; padding:0; list-style:none; }
.list li + li { border-top:1px solid var(--line); }
.list li > a, .pending { display:flex; align-items:center; gap:14px; min-height:54px; text-decoration:none; }
.list li > a > span, .pending > span { flex:1; }
.pending { color:var(--muted); }
.arrow { width:18px; height:18px; opacity:.3; transition:opacity .25s,transform .35s var(--ease); }
.list a:hover .arrow { opacity:1; transform:translateX(4px); }
.project { display:flex; gap:14px; padding:20px 0; }
.project div { flex:1; }
.project h2 { margin:0; font-size:1rem; font-weight:400; }
.project p { margin:4px 0 0; color:var(--muted); }
.visit { display:inline-flex; align-items:center; gap:8px; margin-top:32px; min-height:44px; }
article { margin-top:40px; line-height:1.7; }

/* Sub-pages settle in. */
.rise { animation:rise .8s var(--ease) both; }
.later { animation-delay:.25s; }
@keyframes rise { from { opacity:0; transform:translateY(8px); } }

/* Homepage intro, driven by home.js. */
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.typing .typed { visibility:hidden; }
.typing.ready .typed { visibility:visible; }
.typing .ch, .typing .typed svg { visibility:hidden; }
.typing .ch.shown, .typing .typed svg.shown { visibility:visible; }
.typed svg.shown path { stroke-dasharray:1; animation:draw 1.15s ease-in-out both; }
.typing .name { opacity:0; }
.name { transition:opacity .6s; }
.typing .pages li { opacity:0; transform:translateY(8px); pointer-events:none; }
.pages li { transition:opacity .5s var(--ease),transform .5s var(--ease); }
.typing .pages li.shown { opacity:1; transform:none; pointer-events:auto; }
@keyframes draw { 0% { stroke-dashoffset:1; opacity:0; } 12% { opacity:1; } 100% { stroke-dashoffset:0; opacity:1; } }

/* Hover icons. Keyboard focus and a tap play them too. */
.anim { width:26px; height:26px; overflow:visible; }
.anim * { transform-box:view-box; }
.pending { cursor:default; }

/* Portfolio: the film runs down through the strip. Thinner lines, as it has more of them. */
.reel { stroke-width:1.2; }
:is(a:hover,a:focus-visible,a:active) .reel .frames { animation:reel .6s linear infinite; }
@keyframes reel { to { transform:translateY(6px); } }

/* Blog: the pen moves left and writes a line, staying clear of the word. */
.ink { opacity:0; stroke-dasharray:1; }
:is(a:hover,a:focus-visible,a:active) .write .ink { animation:ink 2s linear infinite; }
:is(a:hover,a:focus-visible,a:active) .write .nib { animation:nib 2s linear infinite; }
@keyframes ink { 0%,12% { opacity:0; stroke-dashoffset:1; } 13% { opacity:1; stroke-dashoffset:1; } 72%,86% { opacity:1; stroke-dashoffset:0; } 100% { opacity:0; stroke-dashoffset:0; } }
@keyframes nib { 0%,100% { transform:none; } 13% { transform:translate(-5px,2px); } 27% { transform:translate(-2.500px,.5px); } 42% { transform:translate(0,2px); } 57% { transform:translate(3px,.5px); } 72%,86% { transform:translate(5px,1.500px); } }

/* Loopwork: a line runs round the infinity. */
.track { transition:opacity .2s; }
.runner { opacity:0; stroke-width:2.2; stroke-dasharray:.3 .7; }
:is(a:hover,a:focus-visible,a:active) .track { opacity:.2; }
:is(a:hover,a:focus-visible,a:active) .runner { opacity:1; animation:run 1.2s linear infinite; }
@keyframes run { to { stroke-dashoffset:-1; } }

/* Ember Media: the flicker is in icons.js, as it redraws the shape of the flame. */

/* LinkedIn: a second person turns up and the two connect.
   The base rules are the way out (line goes first, then the head grows back), the hover rules are the way in. */
.connect .me { transition:transform .35s ease-in-out .18s; }
.connect .them { opacity:0; transform:translateX(5px); transition:opacity .16s .06s,transform .3s var(--ease) .06s; }
.connect .bond { opacity:0; stroke-dasharray:1; stroke-dashoffset:1; transition:opacity .1s,stroke-dashoffset 0s .12s; }
:is(a,.pending):is(:hover,:focus-visible,:active) .connect .me { transform:translate(-2px,0) scale(.65); transition:transform .4s var(--ease); }
:is(a,.pending):is(:hover,:focus-visible,:active) .connect .them { opacity:1; transform:none; transition:opacity .3s .2s,transform .4s var(--ease) .2s; }
:is(a,.pending):is(:hover,:focus-visible,:active) .connect .bond { opacity:1; stroke-dashoffset:0; transition:opacity .1s .5s,stroke-dashoffset .45s .5s; }

/* Portfolio page. Same idea as Ember Media's: words on the left, the video on the right, plays in place. */
main.portfolio { max-width:1136px; padding-top:clamp(32px,7vh,72px); }
.works { margin:64px 0 0; padding:0; list-style:none; display:flex; flex-direction:column; gap:88px; }
.work { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.45fr); align-items:center; gap:64px; }
.work.waiting { opacity:0; }
.work.in { animation:rise .8s var(--ease) both; }
.work.in .badge path { stroke-dasharray:1; animation:draw 1.15s ease-in-out .15s both; }
.badge { display:block; width:48px; height:48px; margin-bottom:24px; stroke-width:1.3; }
.info h2 { margin:0; font-size:1.5rem; font-weight:400; line-height:1.3; text-wrap:balance; }
.info p { margin:12px 0; max-width:440px; color:var(--muted); line-height:1.65; }
.screen { display:block; position:relative; width:100%; aspect-ratio:16/9; overflow:hidden; border:0; border-radius:20px; background:#000; }
a.screen { transition:transform .3s var(--ease); }
a.screen:hover { transform:translateY(-4px); }
.screen img { display:block; width:100%; height:100%; object-fit:cover; opacity:.78; transition:opacity .3s; }
a.screen:hover img { opacity:.96; }
.play { position:absolute; left:50%; top:50%; width:72px; height:72px; margin:-36px 0 0 -36px; filter:drop-shadow(0 0 15px rgb(0 0 0 / .45)); transition:transform .25s var(--ease); }
.play path { fill:#fff; stroke:none; }
a.screen:hover .play { transform:scale(1.1); }
.screen.sound { background:#f5f5f4; }
.sound audio[controls] { position:absolute; left:5%; top:50%; width:90%; transform:translateY(-50%); }
.player { height:100%; padding:28px; display:flex; flex-direction:column; justify-content:space-between; gap:12px; }
.player[hidden] { display:none; }
.wave { position:relative; flex:1; min-height:0; }
.wave svg { position:absolute; inset:0; width:100%; height:100%; stroke:#c9c9c6; stroke-width:1.7; }
.wave .played { stroke:var(--ink); clip-path:inset(0 calc(100% - var(--done,0%)) 0 0); }
.seek { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; }
.wave:has(:focus-visible) { outline:2px solid var(--ink); outline-offset:4px; }
.controls { display:flex; align-items:center; gap:14px; }
.toggle { display:grid; place-items:center; width:48px; height:48px; padding:0; border:0; border-radius:50%; background:#fff; color:var(--ink); cursor:pointer; }
.toggle svg { width:22px; height:22px; }
.to-play { fill:currentColor; }
.toggle:focus-visible { outline:2px solid var(--ink); outline-offset:4px; }
.to-pause, .playing .to-play { display:none; }
.playing .to-pause { display:inline; }
.also { margin-top:80px; border-top:1px solid var(--line); }
@media (max-width:900px) {
  .works { margin-top:48px; gap:64px; }
  .work { grid-template-columns:minmax(0,1fr); gap:24px; }
  .info p { max-width:none; }
  .badge { width:40px; height:40px; margin-bottom:16px; }
  .info h2 { font-size:1.3rem; }
}
@media (max-width:560px) {
  .screen { border-radius:14px; }
  .play { width:60px; height:60px; margin:-30px 0 0 -30px; }
  .player { padding:14px 16px; }
}

@media (prefers-reduced-motion:reduce) {
  * { animation:none!important; transition:none!important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation:none!important; }
}
