/* ianzhyy.com shell: the quiet night-sky frame shared by the landing page and the
   six section pages. Layout, type scale, blur and colours follow jrhu.me. */
:root {
  --bg: #010103;
  --ink: #ffffff;
  --muted: rgba(255, 255, 255, 0.6);
  --faint: rgba(255, 255, 255, 0.34);
  --ghost: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.1);
  --accent: #ff7a45;          /* Arizona sunset */
  --accent-2: #7fe3d4;        /* desert turquoise */
  --route: #ffb066;
  --card: rgba(255, 255, 255, 0.035);
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --serif: 'Newsreader', 'Iowan Old Style', 'Songti SC', Georgia, serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --rail-top: clamp(140px, 44vh, 420px);
  --left: 40px;
  --col: 232px;
  --main-w: 380px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  min-height: 100vh;
  font: 400 14px/20px var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(#05041a 0%, #0d0a2c 28%, #22114a 55%, #4a1856 80%, #7a2a52 100%) fixed;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: rgba(255, 255, 0, 0.85); color: #000; }

#contrail { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .8s ease; }
#sky.on { opacity: 1; }

.skip { position: fixed; left: 10px; top: 10px; z-index: 50; padding: 6px 10px; background: #000; color: #fff; opacity: 0; pointer-events: none; }
.skip:focus { opacity: 1; pointer-events: auto; }

/* ---------------------------------------------------------------- edge blur */
.edge-blur { position: fixed; left: 0; right: 0; height: 98px; z-index: 6; pointer-events: none; }
.edge-blur.top { top: 0; }
.edge-blur.bottom { bottom: 0; }
.edge-blur > div { position: absolute; inset: 0; }
/* iPhone Safari: `bottom: 0` is the top of the browser's bottom bar, so the blur used to stop there
   and the page scrolling behind the bar stayed sharp. Hang the bottom blur from the top of a box as
   tall as the largest viewport instead (that reaches the physical bottom of the screen, behind the
   bar), and stretch it by however much bar is showing (100lvh - 100dvh), so the fade still covers
   the visible bottom edge too. Same result as before everywhere else (lvh = dvh). */
@supports (height: 100lvh) {
  .edge-blur.bottom { top: 0; bottom: auto; height: 100lvh; }
  .edge-blur.bottom > div { inset: auto 0 0 0; height: calc(98px + 100lvh - 100dvh); }
}

/* ------------------------------------------------------------------- rails */
.rail { position: fixed; top: var(--rail-top); z-index: 8; transition: opacity .45s var(--ease); }
.rail-left { left: var(--left); }
.rail-right { right: var(--left); display: flex; gap: 40px; }
body.scrolled .rail { opacity: .32; }
body.scrolled .rail:hover, body.scrolled .rail:focus-within { opacity: 1; }

.name { display: inline-block; color: var(--ink); white-space: nowrap; letter-spacing: .01em; }
.name .y { -webkit-text-emphasis: filled dot var(--accent); text-emphasis: filled dot var(--accent); -webkit-text-emphasis-position: under; text-emphasis-position: under right; }
.name:hover .y { -webkit-text-emphasis-color: #ffb48f; text-emphasis-color: #ffb48f; }
.coord { display: block; margin-top: 14px; font: 400 11px/17px var(--mono); color: var(--faint); letter-spacing: .02em; }
.coord b { font-weight: 400; color: var(--muted); }

.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: flex-end; }
.nav a { display: block; line-height: 27px; color: var(--muted); transition: color .25s ease, opacity .25s ease; }
.nav a:hover, .nav a:focus-visible { color: var(--ink); }
.nav.has-hover a:not(:hover):not([aria-current]) { opacity: .45; }
.nav a[aria-current] { color: var(--accent); }
.rail-right { flex-direction: column; align-items: flex-end; gap: 0; }
.rail-rule { width: 4ch; height: 1px; background: rgba(255, 255, 255, .28); margin: 14px 0 12px; }
.rcontacts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: flex-end; }
.rcontacts a { display: inline-flex; align-items: baseline; gap: 8px; line-height: 27px; color: var(--muted); transition: color .25s ease; }
.rcontacts a:hover { color: var(--ink); }
.rcontacts .ic { font-family: 'Apple Symbols', 'Segoe UI Symbol', 'Noto Sans Symbols 2', var(--sans); font-size: 17px; line-height: 1; color: var(--accent); width: 1.2em; text-align: center; transform: translateY(1px); }
.rcontacts a.ok .lbl { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 1px solid rgba(255, 122, 69, .8); outline-offset: 3px; border-radius: 3px; }

/* -------------------------------------------------------------------- main */
.main {
  position: relative; z-index: 4;
  margin-left: var(--col);
  width: var(--main-w);
  max-width: calc(100vw - var(--col) - 16px);
  padding: var(--rail-top) 0 32vh;
  min-height: 100vh;
}
.main.wide { --main-w: min(640px, calc(100vw - var(--col) - 260px)); }
.main.xwide { --main-w: min(860px, calc(100vw - var(--col) - 230px)); }

.appear > * { animation: appear .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes appear { from { opacity: 0; transform: translateY(8px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
body.leaving .main { opacity: 0; transform: translateY(-4px); filter: blur(4px); transition: opacity .22s ease, transform .22s ease, filter .22s ease; }

/* serif body text */
.prose { font: 400 16px/25px var(--sans); color: rgba(255, 255, 255, .92); letter-spacing: -.003em; }
.prose p { margin: 0 0 22px; }
.prose em { font-style: normal; color: var(--ink); }
.prose a.fn { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(255, 122, 69, .55); text-decoration-thickness: 1px; text-underline-offset: 4px; transition: text-decoration-color .2s, color .2s; }
.prose a.fn:hover { color: #ffd2bd; }
.prose a.fn:hover { text-decoration-color: var(--accent); }
.lead { position: relative; }
.lead::before { content: '\2708\FE0E'; position: absolute; left: -28px; top: 0; font-size: 15px; color: var(--accent); transform: rotate(-12deg); text-shadow: 0 0 12px rgba(255, 122, 69, .5); }

.rule { height: 1px; background: linear-gradient(90deg, var(--line), rgba(255, 255, 255, .02)); border: 0; margin: 40px 0; }

/* label / value rows ("Currently  Cambridge, UK") */
.facts { display: grid; grid-template-columns: 134px 1fr; row-gap: 22px; margin: 0; }
.facts dt { color: var(--faint); font: 400 11px/25px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.facts dd { margin: 0; font: 400 16px/25px var(--sans); }
.facts dd span { display: block; }

/* contacts */
.contacts { display: flex; gap: 22px; flex-wrap: wrap; align-items: baseline; }
.contacts a, .contacts button { font: inherit; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; transition: color .2s ease; }
.contacts a:hover, .contacts button:hover { color: var(--ink); }
.contacts .addr { color: var(--faint); font-size: 12px; transition: color .3s ease; }
.contacts .addr.ok { color: var(--accent); }

/* section intro line */
.kicker { color: var(--muted); margin: 0 0 26px; font: 400 14px/21px var(--sans); }
.kicker b { color: var(--ink); font-weight: 400; }
.h-serif { font: 400 22px/28px var(--serif); margin: 0 0 6px; letter-spacing: -.005em; }

/* ------------------------------------------------------------- project list */
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 34px; }
.pcard { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 0 24px; align-items: start; }
.pcard .shot { grid-row: 1 / span 3; position: relative; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: #05070f; box-shadow: 0 24px 48px -28px rgba(0, 0, 0, .85); }
.pcard .shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease), filter .6s ease; filter: saturate(.9) brightness(.9); }
.pcard:hover .shot img { transform: scale(1.04); filter: none; }
.pcard .shot::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); pointer-events: none; }
.pcard .meta { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.pcard .t { font: 400 20px/26px var(--serif); transition: color .2s; }
.pcard:hover .t { color: var(--accent); }
.pcard .yr { color: var(--faint); font: 400 12px/20px var(--mono); white-space: nowrap; }
.pcard .d { color: var(--muted); margin: 6px 0 0; }
.pcard .go { color: var(--faint); margin-top: 8px; display: inline-block; transition: color .2s; }
.pcard:hover .go { color: var(--accent); }
@media (max-width: 560px) { .pcard { grid-template-columns: 1fr; } .pcard .shot { grid-row: auto; margin-bottom: 14px; aspect-ratio: 16 / 9; } }

/* ------------------------------------------------------------ hackathon list */
.hlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.hrow { border-bottom: 1px solid var(--line); }
.hrow > a, .hrow > div { display: grid; grid-template-columns: minmax(0, 1fr) 96px; column-gap: 18px; row-gap: 6px; padding: 20px 0; }
.hrow .n { font: 400 19px/24px var(--serif); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.hrow .dt { color: var(--muted); text-align: right; font: 400 12px/24px var(--mono); }
.hrow .aw { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink); }
.hrow .aw span { white-space: nowrap; }
.hrow .one { grid-column: 1 / -1; color: var(--muted); margin: 0; }
.hrow > a:hover .n { color: var(--accent); }
.hrow .soon { font: 500 10px/18px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #000; background: var(--accent); border-radius: 4px; padding: 0 6px; transform: translateY(-2px); }
.hrow.upcoming .n, .hrow.upcoming .one { color: var(--muted); }

/* ------------------------------------------------------------- plain lists */
.xlist { list-style: none; margin: 0; padding: 0; }
.xgroup + .xgroup { margin-top: 44px; }
.xgroup h2 { font: 400 12px/20px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 10px; }
.xitem { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 18px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.xitem .org { font: 400 16px/22px var(--serif); }
.xitem .role { color: var(--muted); grid-column: 1; }
.xitem .when { color: var(--faint); font: 400 12px/22px var(--mono); text-align: right; grid-row: 1; grid-column: 2; white-space: nowrap; }
.xitem a.org:hover { color: var(--accent); }

/* -------------------------------------------------------------- mobile menu */
.mbar { display: none; }
@media (max-width: 900px) {
  :root { --rail-top: 0px; }
  .rail-left, .rail-right { display: none; }
  .mbar {
    display: flex; position: fixed; top: 0; left: 0; right: 0; z-index: 9;
    justify-content: space-between; align-items: center;
    padding: max(14px, env(safe-area-inset-top)) 16px 12px;
  }
  .mbar button { background: none; border: 0; color: var(--ink); width: 36px; height: 36px; margin: -8px -8px -8px 0; cursor: pointer; display: grid; place-items: center; }
  .mbar svg { transition: transform .35s var(--ease); }
  .mbar[data-open] svg { transform: rotate(45deg); }
  .mpanel { position: fixed; inset: 0; z-index: 8; padding: 84px 16px 40px; background: rgba(1, 1, 6, .72); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); opacity: 0; pointer-events: none; transition: opacity .3s ease; overflow-y: auto; }
  .mpanel[data-open] { opacity: 1; pointer-events: auto; }
  .mpanel .nav { align-items: flex-start; }
  .mpanel .nav a { font: 400 26px/44px var(--serif); color: var(--ink); }
  .mpanel .nav a[aria-current] { color: var(--accent); }
.rail-right { flex-direction: column; align-items: flex-end; gap: 0; }
.rail-rule { width: 4ch; height: 1px; background: rgba(255, 255, 255, .28); margin: 14px 0 12px; }
.rcontacts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: flex-end; }
.rcontacts a { display: inline-flex; align-items: baseline; gap: 8px; line-height: 27px; color: var(--muted); transition: color .25s ease; }
.rcontacts a:hover { color: var(--ink); }
.rcontacts .ic { font-family: 'Apple Symbols', 'Segoe UI Symbol', 'Noto Sans Symbols 2', var(--sans); font-size: 17px; line-height: 1; color: var(--accent); width: 1.2em; text-align: center; transform: translateY(1px); }
.rcontacts a.ok .lbl { color: var(--accent); }
  .mpanel .rcontacts { align-items: flex-start; margin-top: 8px; }
  .mpanel .rcontacts a { font: 400 18px/40px var(--sans); }
  .mpanel .rail-rule { margin: 18px 0 8px; }
  .main, .main.wide, .main.xwide { margin: 0; width: auto; max-width: none; padding: 104px 16px 30vh; }
  .lead::before { position: static; display: inline-block; margin-right: 10px; transform: rotate(-12deg); }
  .facts { grid-template-columns: 104px 1fr; }
  .hrow > a, .hrow > div { grid-template-columns: minmax(0, 1fr) auto; }
}
@media (min-width: 901px) { .mpanel { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .appear > * { animation: none; }
  body.leaving .main { transition: none; }
}

/* creations list: whole row is the link */
.clist .xitem { display: block; padding: 0; }
.clist .xitem > a, .clist .xitem > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 18px; padding: 16px 0; }
.clist .xitem .role { max-width: 60ch; }
.clist .xitem > a:hover .org { color: var(--accent); }
