/* Ioskeley Mono (OFL, self-hosted, v2.2.0), the site font. Licence: assets/fonts/IoskeleyMono-LICENSE.txt */
@font-face {
  font-family: "Ioskeley Mono";
  src: url("assets/fonts/IoskeleyMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Ioskeley Mono";
  src: url("assets/fonts/IoskeleyMono-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* Commit Mono (OFL, self-hosted), fallback: only downloaded if a glyph is missing from Ioskeley */
@font-face {
  font-family: "Commit Mono";
  src: url("assets/fonts/CommitMono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Commit Mono";
  src: url("assets/fonts/CommitMono-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --ink: #0A0A0A;
  --text: #2A2A2A;
  --muted: #8A8A8A;
  --line: #EDEDED;
  --bg: #FFFFFF;
  --blue: #3B5BD9;
  --navy: #1E2540;
  --yellow: #F5C400;
  --lime: #D8F600;
  --red: #E8452C;
  --font: "Ioskeley Mono", "Commit Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(16px, 4.5vw, 72px);
  --notch: polygon(0 5px, 5px 5px, 5px 0, calc(100% - 5px) 0, calc(100% - 5px) 5px, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 5px calc(100% - 5px), 0 calc(100% - 5px));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, #F6F6F6 1px, transparent 1px),
    linear-gradient(to bottom, #F6F6F6 1px, transparent 1px);
  background-size: 24px 24px;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 400; color: var(--ink); }
canvas { display: block; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter); }

/* INTRO — CSS timeline (can't be stalled by the 3D setup), then the word flies into the hero logo */
.loader { display: none; }
.is-intro .loader { display: block; position: fixed; inset: 0; z-index: 100; cursor: pointer; overflow: hidden; }
.is-intro body { overflow: hidden; }
.loader-layer { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.loader-layer.dark { background: #0A0A0A; color: #FFFFFF; }
.loader-layer.light { background: #FFFFFF; color: #0A0A0A; translate: 0 100%; }
.loader-layer.light .loader-inner { translate: 0 -100%; }
.loader-inner { position: absolute; inset: 0; display: grid; place-items: center; }
.loader-word {
  font-family: var(--font); font-size: clamp(48px, 11vw, 168px); letter-spacing: -0.05em; line-height: 1;
  white-space: pre;
}
.loader-word .ch { display: inline-block; opacity: 0; translate: 0 .12em; }
.loader.go .ch { animation: ch-in .4s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(.1s + var(--i) * 75ms); }
/* the asterisk keeps turning while the 3D wall loads; JS stops it on a full turn (rest position) */
.loader.go .ast { animation: ch-in .4s cubic-bezier(.2,.8,.2,1) both, ast-spin 1.1s cubic-bezier(.6,0,.2,1) .75s infinite;
  animation-delay: calc(.1s + var(--i) * 75ms), .75s; }
.loader.settled .ast { animation: ch-in .4s cubic-bezier(.2,.8,.2,1) both; animation-delay: 0s; }
.loader.wipe .light, .loader.wipe .light .loader-inner { animation: wipe .8s cubic-bezier(.77,0,.18,1) both; }
@keyframes ch-in { to { opacity: 1; translate: 0 0; } }
@keyframes ast-spin { from { rotate: 0deg; } to { rotate: 360deg; } }   /* full turn: ends exactly where the logo rests */
@keyframes wipe { to { translate: 0 0; } }

/* hero pieces wait for the word to land */
.is-intro .logo, .is-intro .hero-title, .is-intro .hero-side, .is-intro .top-cta, .is-intro .scroll-hint { opacity: 0; }
.intro-done .top-cta { animation: rise .8s cubic-bezier(.2,.8,.2,1) .15s both; }
.intro-done .hero-title { animation: rise .8s cubic-bezier(.2,.8,.2,1) both; }
.intro-done .hero-side { animation: rise .8s cubic-bezier(.2,.8,.2,1) .15s both; }

/* HERO */
.logo {
  grid-column: 1 / -1; justify-self: start; text-decoration: none; color: var(--ink);
  font-size: 22px; line-height: 1; letter-spacing: -0.05em;
}
.logo .ast { display: inline-block; transition: rotate .9s cubic-bezier(.6,0,.2,1); }   /* script.js adds a full turn per hover */
.hero {
  position: relative; display: grid; grid-template-columns: 1.6fr 1fr; gap: clamp(20px, 2.4vw, 32px) 40px;
  padding-top: clamp(24px, 3vw, 40px); padding-bottom: 24px;
}
.hero-title {
  font-size: clamp(40px, 6.4vw, 92px); line-height: .98; letter-spacing: -0.04em;
  text-transform: uppercase;
}
.hero-side {
  border-left: 1px solid var(--line); padding-left: 40px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
}
.spread {
  display: flex; flex-direction: column;
  margin: 8px 0 0; text-transform: uppercase; font-size: 17px; line-height: 1.35; color: var(--ink);
  max-width: 380px;
}
.hero-meta { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; max-width: 380px; }
/* head that follows the cursor: 9 pre-rendered poses stacked, one visible at a time */
.avatar { position: relative; flex: none; width: 112px; aspect-ratio: 1; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .12s linear; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.avatar img.on { opacity: 1; }
.hero-meta p { margin: 0; font-size: 12px; line-height: 1.5; text-align: right; color: var(--text); max-width: 40ch; text-wrap: balance; }

/* small LinkedIn link, top right, level with the logo */
.top-cta {
  position: absolute; top: clamp(24px, 3vw, 40px); right: var(--gutter);
  font-size: 13px; line-height: 22px; color: var(--ink); text-decoration: underline; text-underline-offset: 4px;
  transition: color .15s;
}
.top-cta:hover { color: var(--blue); }

/* scroll hint: pinned to the bottom of the screen on a white fade, gone after the first scroll */
.scroll-hint {
  position: fixed; inset: auto 0 0; z-index: 5; pointer-events: none;
  display: flex; justify-content: center; padding: 40px 0 max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(rgb(255 255 255 / 0), #fff 65%); transition: opacity .4s, visibility .4s;
}
.scroll-hint a {
  pointer-events: auto; padding: 7px 12px; background: #fff; color: var(--ink); clip-path: var(--notch);
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--ink);
}
.scroll-hint span { display: inline-block; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { translate: 0 -2px; } 50% { translate: 0 3px; } }
.scrolled .scroll-hint { opacity: 0; visibility: hidden; }

/* LEGO WALL */
.wall-wrap { position: relative; }
.wall { width: 100%; height: clamp(260px, 32vw, 460px); -webkit-tap-highlight-color: transparent; }
.no-webgl { display: none; }

/* INTRO */
.intro { padding-top: clamp(48px, 7vw, 110px); padding-bottom: 48px; }
.intro p {
  margin: 0; max-width: 1100px; color: var(--ink);
  font-size: clamp(22px, 2.7vw, 38px); line-height: 1.22; letter-spacing: -0.02em;
}

/* WORK RAIL */
.work { padding-bottom: clamp(80px, 10vw, 160px); }
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(260px, 26vw, 360px); gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  scroll-padding-inline: var(--gutter); overscroll-behavior-x: contain;
  padding: 0 var(--gutter) 8px;
  padding-left: max(var(--gutter), calc((100vw - 1320px) / 2 + var(--gutter)));
}
.rail::-webkit-scrollbar { display: none; }
.tile { scroll-snap-align: start; text-align: center; }
.cover { width: 100%; aspect-ratio: 4 / 3; background: #F3F3F3; transition: filter .2s; }
.tile:hover .cover { filter: saturate(1.25) contrast(1.05); }
.tile h3 { font-size: 18px; margin: 16px 0 6px; letter-spacing: -0.01em; }
.tile p { margin: 0 auto; font-size: 12.5px; line-height: 1.5; max-width: 30ch; }
.rail-hint { margin: 28px auto 0; font-size: 13px; }
.rail-hint a { text-underline-offset: 4px; }

.tags { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tile .tags { justify-content: center; }
.tags li {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 8px; background: var(--ink); color: #fff; clip-path: var(--notch);
}
.tags li:nth-child(3n+1) { background: var(--blue); }
.tags li:nth-child(3n+2) { background: var(--red); }
.tags li:nth-child(3n+3) { background: var(--ink); }

/* SPLIT SECTIONS */
.split {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px;
  padding-top: clamp(56px, 7vw, 120px); padding-bottom: clamp(56px, 7vw, 120px);
}
.split-head h2, .process h2 {
  font-size: clamp(30px, 3.3vw, 46px); line-height: 1.07; letter-spacing: -0.03em;
}
.label {
  margin: 14px 0 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.split-body { padding-top: 8px; max-width: 660px; }
.prose p { margin: 0 0 20px; font-size: 16.5px; }
.prose p.small { font-size: 13px; color: var(--muted); }

.jobs { list-style: none; padding: 0; margin: 0; }
.jobs > li { display: grid; grid-template-columns: 76px 1fr; gap: 20px; padding: 0 0 32px; }
.jobs > li + li { border-top: 1px solid var(--line); padding-top: 28px; }
.year { font-size: 12px; letter-spacing: 0; color: var(--muted); padding-top: 6px; }
.jobs h3 { font-size: 20px; letter-spacing: -0.01em; margin-bottom: 8px; }
.jobs h3 span { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.jobs p { margin: 0; }

/* EXPERIENCE: List | Play toggle */
.view-toggle { display: inline-flex; margin-top: 24px; border: 1px solid var(--ink); }
.view-toggle button {
  font: inherit; font-size: 13px; padding: 9px 16px; border: 0; background: var(--bg); color: var(--ink); cursor: pointer;
  transition: background .15s, color .15s;
}
.view-toggle button + button { border-left: 1px solid var(--ink); }
.view-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.view-toggle button:not([aria-pressed="true"]):hover { background: var(--yellow); }

/* CAREER MODE (embedded game) */
.game { -webkit-tap-highlight-color: transparent; }
.game .stage { position: relative; }
.game canvas {
  display: block; width: 100%; aspect-ratio: 16 / 9; image-rendering: pixelated; image-rendering: crisp-edges;
  background: #fff; outline: 1px solid var(--line); touch-action: none;
  max-height: 58svh;   /* landscape phones: keep game + buttons on one screen */
}
.game .overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 12px; background: rgba(255,255,255,.88); }
.game .overlay h3 { margin: 0 0 8px; font-size: clamp(22px, 3.4vw, 40px); line-height: 1; letter-spacing: -0.04em; text-transform: uppercase; }
.game .overlay p { margin: 0 auto 16px; max-width: 40ch; font-size: 13.5px; }
.game .keys { font-size: 12px; color: var(--muted); margin: 12px 0 0 !important; }
.game .btn { border: 0; cursor: pointer; font: inherit; font-size: 14px; padding: 12px 24px; }
.game .end-links { display: flex; gap: 10px 18px; justify-content: center; margin-top: 14px; font-size: 13px; }
.game .end-links a { text-underline-offset: 4px; }
.game .hud-strip { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); }
.game .hud-strip b { color: var(--ink); font-weight: 400; }
.game .pad { display: none; margin-top: 12px; gap: 10px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.game .pad button { flex: 1; height: 60px; border: 1px solid var(--ink); background: #fff; color: var(--ink); font: inherit; font-size: 22px; touch-action: none; clip-path: var(--notch); }
.game .pad button.on { background: var(--ink); color: #fff; }
.game .pad .jump { flex: 1.4; background: var(--yellow); }
.game .gcard { margin-top: 16px; display: grid; grid-template-columns: 110px 1fr; gap: 6px 24px; border-top: 1px solid var(--line); padding-top: 16px; min-height: 160px; }
.game .gcard .when { font-size: 12px; color: var(--muted); }
.game .gcard .when b { display: block; color: var(--ink); font-size: 26px; font-weight: 400; letter-spacing: -0.04em; line-height: 1.1; }
.game .gcard h3 { font-size: 20px; letter-spacing: -0.02em; }
.game .gcard .role { margin: 2px 0 10px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.game .gcard .txt { margin: 0; }
.game .gcard.flash { animation: cardIn .45s cubic-bezier(.2,.8,.2,1); }
@keyframes cardIn { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
.touch-only { display: none; }
@media (pointer: coarse) { .game .pad { display: flex; } .game .desk-only { display: none; } .game .touch-only { display: block; } }

.game .bubble {
  position: absolute; z-index: 2; width: max-content; max-width: min(340px, 62%);
  background: #fff; color: var(--ink); border: 1px solid var(--ink); padding: 8px 11px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink); font-size: 13px; line-height: 1.45; pointer-events: auto;
}
.game .bubble p { margin: 0; min-height: 1.45em; }
@media (max-width: 560px) { .game .bubble { font-size: 12.5px; padding: 6px 8px; max-width: 78%; } }

/* PROCESS */
.process { padding-top: clamp(56px, 7vw, 120px); padding-bottom: clamp(56px, 7vw, 120px); }
.strip { width: 100%; height: clamp(220px, 26vw, 380px); margin: 40px 0 32px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.steps h3 { display: flex; align-items: center; gap: 10px; font-size: 15px; margin-bottom: 10px; }
.num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; font-size: 9px;
  background: var(--navy); color: #fff; clip-path: var(--notch);
}
.steps p { margin: 0; font-size: 13px; line-height: 1.55; }

/* STACK */
.stack { margin: 0; display: grid; grid-template-columns: 120px 1fr; }
.stack dt, .stack dd { padding: 14px 0; border-top: 1px solid var(--line); margin: 0; }
.stack dt { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 18px; }
.stack dd { color: var(--ink); }
.stack dd span { white-space: nowrap; }
.stack dd span:not(:last-child)::after { content: " ·"; color: var(--muted); }

/* CONTACT */
.contact { text-align: center; padding-top: clamp(80px, 10vw, 160px); padding-bottom: 72px; }
.btn {
  display: inline-block; text-decoration: none; background: var(--ink); color: #fff;
  padding: 14px 30px; font-size: 15px; clip-path: var(--notch); transition: background .15s;
}
.btn:hover { background: var(--blue); }
.contact p { max-width: 520px; margin: 28px auto 0; color: var(--muted); }
.contact .links { color: var(--ink); font-size: 14px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; }
.contact .links .sep { color: var(--muted); }
#cv-wrap { display: contents; }
#cv-wrap[hidden] { display: none !important; }
.contact .links a { text-underline-offset: 4px; }

footer { margin-top: 24px; }
.bricks { width: 100%; height: 120px; }

/* reveal */
.reveal:not(.in) { opacity: 0; }
.reveal.in { animation: rise .7s ease both; }
@keyframes rise { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }

/* RESPONSIVE */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  /* one column: size the title from the width so "AN ENGINEER" (longest line) fills ~85% */
  .hero-title { font-size: min(92px, calc((100vw - 2 * var(--gutter)) * 0.135)); }
  .hero-meta { justify-content: flex-start; align-items: flex-start; gap: 14px; max-width: 520px; }
  .hero-meta p { text-align: left; font-size: 13.5px; max-width: none; }
  .hero-meta { align-items: center; }
  .avatar { width: 92px; }
  .hero-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 20px; }
  .split { grid-template-columns: 1fr; gap: 24px; }
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .game canvas { aspect-ratio: 4 / 3; }
  .game .gcard { grid-template-columns: 1fr; min-height: 220px; }
  .steps { grid-template-columns: 1fr; }
  .jobs > li { grid-template-columns: 1fr; gap: 4px; }
  .stack { grid-template-columns: 1fr; }
  .stack dd { border-top: 0; padding-top: 0; }

  /* phones: bigger hero, readable small text, thumb-friendly links */
  .hero-side { gap: 20px; }
  .intro { padding-top: 40px; padding-bottom: 32px; }
  .rail { grid-auto-columns: 80vw; gap: 14px; }
  .tile p { font-size: 14px; }
  .tags li { font-size: 11.5px; padding: 4px 9px; }
  .steps p, .prose p.small { font-size: 14.5px; }
  .split, .process { padding-top: 64px; padding-bottom: 32px; }
  .contact { padding-top: 72px; }
  .contact .links { flex-direction: column; gap: 14px; font-size: 15px; }
  .contact .links .sep { display: none; }
  .contact .links a { padding: 4px 0; }
  .btn { padding: 16px 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal:not(.in) { opacity: 1; }
}
