:root {
  --bg: #0F1115;
  --surface: #171A21;
  --raised: #20242D;
  --line: #262A33;
  --line-strong: #3A3F4B;
  --ink: #E8E6E3;
  --muted: #B8BCC6;
  --faint: #8A8F9A;
  --amber: #F5A524;
  --amber-hi: #FFC861;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--ink); overflow-x: clip;
  font: 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--amber); color: var(--bg); }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: var(--amber); transition: color 150ms ease; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px; }
@media (hover: hover) and (pointer: fine) { a:hover { color: var(--amber-hi); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1100px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

/* ---------- Header: translucent, shadow once scrolled, reading progress ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgb(15 17 21 / 0.78);
  -webkit-backdrop-filter: blur(12px) saturate(140%); backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 240ms ease;
}
.site-header.is-scrolled { box-shadow: 0 12px 30px -18px rgb(0 0 0 / 0.9); }
.progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, var(--amber), var(--amber-hi));
  transform: scaleX(0); transform-origin: left center;
}
.site-header nav { display: flex; flex-wrap: wrap; gap: 8px 32px; align-items: center; justify-content: space-between; padding-block: 14px; }
.logo { font: 600 16px var(--mono); color: var(--ink); text-decoration: none; }
.logo span { color: var(--amber); }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; font: 14px var(--mono); }
.nav-links > a, .dd-btn { position: relative; color: var(--muted); text-decoration: none; padding: 10px 0; }
.nav-links > a::after, .dd-btn::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 1px; background: var(--amber);
  transform: scaleX(0); transform-origin: left center; transition: transform 240ms var(--ease-out);
}
.nav-links > a.is-active, .dd-btn.is-active { color: var(--ink); }
.nav-links > a.is-active::after, .dd-btn.is-active::after { transform: scaleX(1); }
@media (hover: hover) and (pointer: fine) { .nav-links > a:hover, .dd-btn:hover, .logo:hover { color: var(--ink); } }

/* ---------- Projects dropdown: scales in from its trigger, exits faster than it enters ---------- */
.dd { position: relative; }
.dd-btn { font: inherit; background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chev { width: 10px; height: 10px; transition: transform 220ms var(--ease-out); }
.dd.is-open .chev { transform: rotate(180deg); }
.dd.is-open .dd-btn { color: var(--ink); }
.dd-menu {
  position: absolute; top: calc(100% + 6px); left: -14px; z-index: 20; width: 280px; padding: 6px;
  display: grid; gap: 2px;
  background: rgb(23 26 33 / 0.97); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 24px 48px -24px rgb(0 0 0 / 0.95);
  transform-origin: top left; opacity: 0; transform: scale(0.96) translateY(-4px);
  visibility: hidden; pointer-events: none;
  transition: opacity 140ms ease, transform 140ms var(--ease-out), visibility 0s linear 140ms;
}
.dd.is-open .dd-menu {
  opacity: 1; transform: none; visibility: visible; pointer-events: auto;
  transition: opacity 180ms ease, transform 240ms var(--ease-out), visibility 0s;
}
.dd-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 7px;
  color: var(--ink); text-decoration: none;
  opacity: 0; transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms var(--ease-out), background-color 150ms ease;
}
.dd.is-open .dd-item {
  opacity: 1; transform: none;
  transition: opacity 220ms ease, transform 260ms var(--ease-out), background-color 150ms ease;
  transition-delay: calc(40ms + var(--i, 0) * 45ms), calc(40ms + var(--i, 0) * 45ms), 0s;
}
.dd-item:active { transform: scale(0.98); }
.dd-ico {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 7px;
  background: var(--raised); color: var(--amber); font-size: 13px;
  transition: transform 220ms var(--ease-out), background-color 150ms ease;
}
.dd-item b { display: block; font: 600 14px var(--mono); }
.dd-item small { display: block; font: 12px var(--body); color: var(--faint); }
.dd-item[aria-current="page"] .dd-ico { background: var(--amber); color: var(--bg); }
@media (hover: hover) and (pointer: fine) {
  .dd-item:hover { background: var(--raised); color: var(--ink); }
  .dd-item:hover .dd-ico { transform: rotate(-8deg) scale(1.08); background: var(--line); }
  .dd-item[aria-current="page"]:hover .dd-ico { background: var(--amber); }
}
/* Phones: pin the menu to the header so it never runs off screen */
@media (max-width: 560px) {
  .dd { position: static; }
  .dd-menu { left: 16px; right: 16px; width: auto; top: 100%; transform-origin: top center; }
}
section[id] { scroll-margin-top: 72px; }

/* ---------- Buttons: press feedback on every pressable element ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 26px;
  border-radius: 6px; font-weight: 500; text-decoration: none;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--amber); color: var(--bg); }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--ink); }
.btn .arrow { display: inline-block; transition: transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--amber-hi); color: var(--bg); }
  .btn-ghost:hover { border-color: var(--amber); color: var(--ink); }
  .btn:hover .arrow { transform: translateY(2px); }
}
.actions { display: flex; flex-wrap: wrap; gap: 16px; }

/* ---------- Floating glyphs: JS builds them; outer span takes parallax, inner span floats ---------- */
.hero, .section, .page-body { position: relative; isolation: isolate; }
.float-layer { position: absolute; inset: 0 calc(50% - 50vw); z-index: -1; pointer-events: none; overflow: hidden; }
.contact .float-layer { inset: 0; }
.fl { position: absolute; top: var(--y); left: var(--x); will-change: transform; }
.fl > i {
  display: block; font: 600 var(--size)/1 var(--mono); font-style: normal; white-space: nowrap;
  color: var(--amber); opacity: var(--op);
  animation: float var(--dur) var(--ease-in-out) var(--delay) infinite alternate;
}
.float-layer.is-paused .fl > i { animation-play-state: paused; }
@keyframes float {
  from { transform: translate3d(0, 0, 0) rotate(var(--r0)); }
  to   { transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--r1)); }
}
@media (max-width: 760px) { .fl:nth-child(n+8) { display: none; } }
/* Side layers: glyphs sit in the gutters beside the 1100px content column, never over text */
.float-layer.sides { inset: 0 calc(50% - 50vw); }
.sides .fl-l { left: calc(var(--g) * (50% - 560px)); }
.sides .fl-r { left: auto; right: calc(var(--g) * (50% - 560px)); }
@media (max-width: 1239px) { .float-layer.sides { display: none; } } /* gutters too narrow below this */

/* ---------- Hero ---------- */
.hero { padding-block: 120px 104px; }
.eyebrow { margin: 0 0 20px; font: 15px var(--mono); color: var(--amber); }
.cursor { display: inline-block; width: 0.6em; height: 1.1em; margin-left: 3px; vertical-align: -0.2em; background: var(--amber); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero h1 { margin: 0; font: 700 clamp(2.6rem, 8vw, 4.5rem)/1.02 var(--display); letter-spacing: -0.02em; max-width: 900px; }
/* Name rises out of a mask on load */
.mask { display: inline-block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; vertical-align: bottom; }
.mask > span { display: inline-block; }
.js .mask > span { transform: translateY(105%); animation: unmask 900ms var(--ease-out) forwards; animation-delay: calc(120ms + var(--d, 0) * 110ms); }
@keyframes unmask { to { transform: translateY(0); } }
.js.title-done .mask > span { animation: none; transform: none; }
.lede { margin: 28px 0 0; font-size: 1.25rem; color: var(--muted); max-width: 640px; }
/* Word swap in the intro line */
.morph { display: inline-block; color: var(--ink); transition: opacity 220ms var(--ease-out), filter 220ms var(--ease-out), transform 220ms var(--ease-out); }
.morph__word { background: linear-gradient(transparent 62%, rgb(245 165 36 / 0.28) 62%); }
.morph.is-out { opacity: 0; filter: blur(4px); transform: translateY(-6px); }
.hero .actions { margin-top: 44px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.js .hero .eyebrow, .js .hero .lede, .js .hero .actions { animation: rise 700ms var(--ease-out) both; }
.js .hero .eyebrow { animation-delay: 60ms; }
.js .hero .lede { animation-delay: 420ms; }
.js .hero .actions { animation-delay: 520ms; }

/* ---------- Scroll reveal (only when JS runs) ---------- */
.js .reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity 650ms var(--ease-out), transform 650ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }
.js .reveal.settled { transition: none; }

/* ---------- Sections ---------- */
.section { border-top: 1px solid var(--line); }
.section > .wrap { padding-block: 96px; }
.split { display: flex; flex-wrap: wrap; gap: 32px 64px; }
.label { margin: 0; flex: 1 1 220px; font: 600 15px var(--mono); color: var(--amber); letter-spacing: 0.04em; }
.split-main { flex: 999 1 560px; min-width: 0; }
.statement { margin: 0 0 20px; font: 500 1.9rem/1.3 var(--display); }
.muted { color: var(--muted); }
.split-main p.muted { margin: 0 0 16px; }
.split-main p.muted:last-child { margin-bottom: 0; }
.cols { display: flex; flex-wrap: wrap; gap: 40px 48px; }
.cols > div { flex: 1 1 240px; }
.cols h3 { margin: 0 0 12px; font: 700 1.15rem/1.3 var(--display); }
.cols p { margin: 0; }
.cols .when { margin-top: 4px; font: 14px var(--mono); color: var(--faint); }
/* Background rows draw an underline as they arrive */
.entry { position: relative; padding-bottom: 20px; }
.entry::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--amber); opacity: 0.7;
  transform-origin: left center;
}
.js .entry::after { transform: scaleX(0); transition: transform 900ms var(--ease-out); transition-delay: calc(var(--i, 0) * 90ms + 250ms); }
.js .entry.is-in::after { transform: scaleX(1); }

/* ---------- Ticker between skills and projects ---------- */
.marquee {
  overflow: hidden; padding-block: 20px; border-top: 1px solid var(--line);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track { display: flex; align-items: center; gap: 28px; width: max-content; animation: marquee 40s linear infinite; }
.marquee__track span { font: 700 clamp(24px, 3.4vw, 38px)/1.2 var(--display); color: var(--line-strong); white-space: nowrap; letter-spacing: -0.01em; }
.marquee__track span:nth-child(4n+1) { color: var(--muted); }
.marquee__track b { color: var(--amber); font: 400 18px var(--mono); }
@media (hover: hover) and (pointer: fine) { .marquee:hover .marquee__track { animation-play-state: paused; } }
@keyframes marquee { to { transform: translate3d(-50%, 0, 0); } }

/* ---------- Projects ---------- */
.projects-head { display: flex; flex-wrap: wrap; gap: 16px 64px; align-items: baseline; margin-bottom: 48px; }
.projects-head p { margin: 0; flex: 999 1 560px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 24px; }
.grid > .reveal { display: flex; }
.card {
  position: relative; display: flex; flex-direction: column; flex: 1;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  transition: transform 220ms var(--ease-out), border-color 200ms ease, box-shadow 220ms ease;
}
.card:active { transform: scale(0.99); }
/* Spotlight follows the pointer (JS sets --mx/--my) */
.card::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgb(245 165 36 / 0.13), transparent 65%);
  opacity: 0; transition: opacity 260ms ease;
}
.cover { aspect-ratio: 16 / 9; overflow: hidden; background: var(--raised); }
.cover > * { width: 100%; height: 100%; transition: transform 500ms var(--ease-out); }
.cover img { display: block; object-fit: cover; }
.cover .art {
  display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center;
  font: 700 1.6rem var(--display); color: var(--ink);
  background:
    radial-gradient(60% 70% at 50% 110%, rgb(245 165 36 / 0.22), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--raised);
}
.card-body { padding: 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-body p { margin: 0; }
.card .meta { font: 13px var(--mono); color: var(--amber); }
.card h3 { margin: 0; font: 700 1.4rem/1.25 var(--display); }
.card .desc { color: var(--muted); font-size: 16px; }
.card .credit { font-size: 14px; color: var(--faint); }
.play {
  margin-top: auto; padding-top: 8px; min-height: 44px; display: inline-flex; align-items: center; gap: 8px;
  font: 14px var(--mono); text-decoration: none;
}
.play::after { content: ""; position: absolute; inset: 0; z-index: 2; } /* whole card is the click target */
.play .arrow { display: inline-block; transition: transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 24px 40px -28px rgb(0 0 0 / 0.9); }
  .card:hover::before { opacity: 1; }
  .card:hover .cover > * { transform: scale(1.04); }
  .card:hover .play { color: var(--amber-hi); }
  .card:hover .play .arrow { transform: translateX(4px); }
}
.card:has(.play:focus-visible) { border-color: var(--amber); }
.play:focus-visible { outline: none; }

/* ---------- Contact ---------- */
.contact > .wrap { padding-block: 112px 96px; }
.contact .label { margin-bottom: 20px; }
.contact h2 { margin: 0; font: 700 clamp(2rem, 6vw, 3rem)/1.1 var(--display); max-width: 760px; }
.contact .actions { margin-top: 40px; }
.site-footer { border-top: 1px solid var(--line); }
.site-footer p { margin: 0; padding-block: 28px; font: 13px var(--mono); color: var(--faint); }

/* ---------- Click bursts ---------- */
.burst {
  position: absolute; z-index: 60; pointer-events: none; white-space: nowrap;
  font: 600 22px var(--mono); color: var(--amber-hi); transform: translate(-50%, -50%);
  text-shadow: 0 2px 12px rgb(245 165 36 / 0.35);
}

/* ---------- Reduced motion: keep fades, drop movement ---------- */
@media (prefers-reduced-motion: reduce) {
  .fl > i, .cursor, .marquee__track { animation: none; }
  .js .mask > span { animation: none; transform: none; }
  .js .hero .eyebrow, .js .hero .lede, .js .hero .actions { animation-name: fadein; animation-duration: 300ms; }
  .js .reveal { transform: none; transition: opacity 300ms ease; }
  .js .entry::after { transition: none; transform: scaleX(1); }
  .morph.is-out { transform: none; filter: none; }
  .card, .cover > *, .play .arrow, .btn, .btn .arrow { transition-property: border-color, background-color, color, opacity; }
}
@keyframes fadein { from { opacity: 0; } }

/* ---------- Sub-pages (games, websites) ---------- */
.page-intro { padding-block: 96px 56px; }
.page-intro .lede { margin-top: 20px; }
.page-intro h1 { margin: 0; font: 700 clamp(2.6rem, 8vw, 4.5rem)/1.02 var(--display); letter-spacing: -0.02em; }
.js .page-intro .eyebrow, .js .page-intro .lede { animation: rise 700ms var(--ease-out) both; }
.js .page-intro .lede { animation-delay: 300ms; }
.page-body { padding-bottom: 112px; }
.crumb { color: var(--muted); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .crumb:hover { color: var(--ink); } }

/* ---------- Website cards: a live, scaled-down copy of the site that scrolls on hover ---------- */
.site-card { color: inherit; text-decoration: none; }
.browser { border-bottom: 1px solid var(--line); }
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: var(--raised); }
.browser-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.browser-bar span { margin-left: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px var(--mono); color: var(--faint); }
.shot { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #fff; }
.shot iframe {
  position: absolute; top: 0; left: 0; width: 1280px; height: 2400px; border: 0; pointer-events: none;
  transform-origin: 0 0; transform: scale(var(--s, 0.28)) translateY(var(--ty, 0px));
  transition: transform 700ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .site-card:hover .shot iframe { --ty: -1600px; transition: transform 5s var(--ease-in-out); }
}
@media (prefers-reduced-motion: reduce) { .shot iframe { transition: none; } .site-card:hover .shot iframe { --ty: 0px; } }


/* ---------- Home page: one glyph backdrop behind everything, sections float on it as 3D panels ---------- */
.backdrop { position: relative; isolation: isolate; }
.backdrop > .float-layer { inset: 0; }
/* JS places backdrop glyphs only in visible gaps, so every one of them shows on every screen size */
.backdrop > .float-layer .fl:nth-child(n) { display: block; }
.backdrop .section { border-top: 0; padding: 28px 24px; }
.backdrop .section > .panel,
.backdrop .contact > .panel {
  position: relative; max-width: 1100px; padding: 64px 56px; border-radius: 22px;
  background: linear-gradient(180deg, #1D2129, #16191F);
  border: 1px solid rgb(255 255 255 / 0.07);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.07),
    inset 0 -1px 0 rgb(0 0 0 / 0.5),
    0 2px 0 rgb(0 0 0 / 0.35),
    0 18px 30px -18px rgb(0 0 0 / 0.75),
    0 50px 90px -40px rgb(0 0 0 / 0.9);
}
/* Faint amber light along the top edge gives the panel a lit, raised feel */
.backdrop .panel::before {
  content: ""; position: absolute; left: 12%; right: 12%; top: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgb(245 165 36 / 0.45), transparent);
}
.backdrop .contact > .panel { padding: 80px 56px 72px; }
@media (max-width: 760px) {
  .backdrop .section { padding: 30px 16px; }
  .backdrop .section > .panel, .backdrop .contact > .panel { padding: 40px 22px; border-radius: 16px; }
}
/* Panels swing up from a tilt as they arrive */
.js .backdrop .panel {
  opacity: 0; transform: perspective(1400px) rotateX(9deg) translateY(48px) scale(0.97); transform-origin: 50% 0;
  transition: opacity 800ms var(--ease-out), transform 1000ms var(--ease-out);
}
.js .backdrop .panel.is-in { opacity: 1; transform: none; }
/* Ticker becomes its own floating strip */
.backdrop .marquee {
  width: calc(100% - 32px); max-width: 1100px; margin: 12px auto; border-radius: 18px;
  background: #16191F; border: 1px solid rgb(255 255 255 / 0.07);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 18px 30px -18px rgb(0 0 0 / 0.75);
  -webkit-mask-image: none; mask-image: none;
}
.backdrop .marquee__track {
  -webkit-mask-image: none; mask-image: none;
}
.backdrop .marquee::before, .backdrop .marquee::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 60px; z-index: 1; pointer-events: none;
}
.backdrop .marquee { position: relative; }
.backdrop .marquee::before { left: 0; background: linear-gradient(90deg, #16191F, transparent); }
.backdrop .marquee::after { right: 0; background: linear-gradient(-90deg, #16191F, transparent); }
.backdrop + .site-footer { border-top: 0; margin-top: 24px; }
@media (prefers-reduced-motion: reduce) {
  .js .backdrop .panel { transform: none; transition: opacity 300ms ease; }
}
/* Backdrop glyphs read a little stronger, since panels now cover most of the page */
.backdrop > .float-layer .fl > i { opacity: calc(var(--op) * 1.5); }
/* List pages (games, websites) use the same backdrop: the intro floats over glyphs, the list sits in a panel */
.backdrop .page-intro { padding-block: 96px 40px; }
@media (max-width: 760px) { .backdrop .page-intro { padding-block: 64px 24px; } }
.backdrop .page-body > .panel { padding-block: 56px; }
@media (max-width: 760px) { .backdrop .page-body > .panel { padding: 22px 16px; } }
@media (max-width: 760px) { .backdrop > .float-layer .fl > i { opacity: calc(var(--op) * 1.9); } }
