:root {
  --bg: #f5f2ea;
  --ink: #17160f;
  --muted: #5d5a4f;
  --card: #fffdf7;
  --line: #ddd8c9;
  --accent: #b83a07;
  --accent-2: #a16207;
  --on-accent: #fff;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --gutter: clamp(16px, 4vw, 56px);
  --wrap: 1280px;
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1012;
    --ink: #ece9e0;
    --muted: #a09c8f;
    --card: #17181b;
    --line: #2a2b2f;
    --accent: #ff8a5b;
    --accent-2: #ffc857;
    --on-accent: #0f1012;
  }
}
@media (min-width: 1800px) { :root { --wrap: 1480px; } body { font-size: 18px; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font: 17px/1.6 var(--sans);
}
.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--on-accent); }

/* scroll progress + nav */
.progress {
  position: fixed; inset: 0 0 auto; height: 3px; z-index: 30;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: 0 50%; transform: scaleX(var(--p, 0));
}
.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 20px; height: var(--nav-h); }
.brand { display: flex; align-items: center; gap: 10px; font: 600 15px var(--mono); text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 50%; transition: transform .4s var(--ease); }
.brand:hover img { transform: rotate(-12deg) scale(1.08); }
.nav ul { display: flex; gap: 2px; list-style: none; margin: 0 0 0 auto; padding: 0; }
.nav ul a {
  display: block; padding: 6px 12px; border-radius: 999px; text-decoration: none;
  font-size: 14px; color: var(--muted); transition: color .2s, background .2s;
}
.nav ul a:hover, .nav ul a.active { color: var(--ink); background: var(--card); }
.nav .btn { padding: 7px 16px; font-size: 14px; }
@media (max-width: 860px) {
  :root { --nav-h: 100px; }
  .nav .wrap { flex-wrap: wrap; height: auto; padding: 10px 0 8px; row-gap: 6px; }
  .nav .btn { margin-left: auto; }
  .nav ul { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; } /* swipeable link row */
  .nav ul::-webkit-scrollbar { display: none; }
  .nav ul a { white-space: nowrap; padding: 8px 12px; }
}

/* buttons */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-block; padding: 11px 22px; border-radius: 999px;
  border: 1px solid var(--ink); text-decoration: none; font-weight: 600; font-size: 15px;
  transition: transform .25s var(--ease), box-shadow .25s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -12px var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost { border-color: var(--line); }

/* hero */
.hero {
  position: relative; isolation: isolate;
  display: grid; gap: clamp(40px, 6vw, 80px); align-items: center;
  padding: clamp(48px, 9vh, 112px) 0 clamp(64px, 10vh, 120px);
}
@media (min-width: 960px) {
  .hero { grid-template-columns: 1.1fr 1fr; min-height: clamp(560px, 100svh - var(--nav-h), 980px); }
}
.blob {
  position: absolute; z-index: -1; width: clamp(260px, 38vw, 560px); aspect-ratio: 1;
  border-radius: 50%; filter: blur(80px); opacity: .28;
  animation: float 16s ease-in-out infinite alternate;
}
.blob.a { background: var(--accent); top: -8%; right: -6%; }
.blob.b { background: var(--accent-2); bottom: -4%; left: -14%; animation-delay: -8s; }
@keyframes float { to { transform: translate(-10%, 14%) scale(1.18); } }

.hero-text > * { animation: rise .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 110ms); }
@keyframes rise { from { opacity: 0; transform: translateY(28px); } }
.eyebrow { font: 500 14px var(--mono); color: var(--muted); margin: 0 0 20px; }
.cursor {
  display: inline-block; width: 9px; height: 1em; margin-left: 4px;
  background: var(--accent); vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
h1 {
  font-size: clamp(2.7rem, 6.4vw, 6rem);
  line-height: 1.02; letter-spacing: -0.045em; margin: 0 0 28px;
}
h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent)) 0 / 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 6s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }
.wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.6s ease-in-out infinite; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
.lead { font-size: clamp(1.1rem, 1.6vw, 1.35rem); max-width: 34em; color: var(--muted); margin: 0 0 36px; }
.lead strong { color: var(--ink); font-weight: 600; }

/* hero terminal (always dark, it's a terminal) */
.term-wrap { position: relative; animation: rise 1s var(--ease) .35s both; }
.avatar {
  position: absolute; top: -34px; right: 18px; z-index: 1;
  width: clamp(76px, 9vw, 112px); height: auto; border-radius: 50%;
  border: 4px solid var(--bg); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
  animation: bob 6s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-10px) rotate(4deg); } }
.term {
  background: #111214; color: #e8e6df; border: 1px solid #2a2b2f; border-radius: 16px;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .6); overflow: hidden;
  font: clamp(13px, 1.1vw, 15px)/1.75 var(--mono);
  transition: transform .5s var(--ease);
}
.term-wrap:hover .term { transform: rotate(-.6deg) translateY(-4px); }
.term-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: #18191c; border-bottom: 1px solid #2a2b2f; }
.term-bar i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: 12px; color: #8b8a85; font-size: 12px; }
.term-body { padding: 22px 24px 26px; }
.term p { margin: 0; white-space: pre-wrap; }
.term .cmd::before { content: "$ "; color: #ff8a5b; }
.term .out { color: #a7a59c; margin-bottom: 8px; }
.term .hi { color: #ffc857; }
.term .typing::after, .term .caret::after {
  content: ""; display: inline-block; width: 8px; height: 1.1em; margin-left: 2px;
  background: #e8e6df; vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite;
}

.scroll-cue {
  position: absolute; bottom: 24px; left: 50%; translate: -50% 0;
  font: 12px var(--mono); color: var(--muted); text-decoration: none;
  animation: nudge 2s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: translateY(6px); } }
@media (max-width: 959px) { .scroll-cue { display: none; } }

/* sections */
main { counter-reset: sec; }
section { padding: clamp(48px, 8vw, 104px) 0; border-top: 1px solid var(--line); }
h2 { font: 600 14px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 28px; }
h2::before { counter-increment: sec; content: counter(sec, decimal-leading-zero); color: var(--accent); margin-right: 8px; } /* auto-numbers sections */
@media (min-width: 1024px) {
  section { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 48px; align-items: start; }
  section h2 { position: sticky; top: calc(var(--nav-h) + 32px); margin: 0; }
  section > :nth-child(n + 3) { grid-column: 2; }
}

dl {
  display: grid; grid-template-columns: max-content 1fr; gap: 14px 32px; margin: 0;
  padding: clamp(20px, 3vw, 32px); background: var(--card); border: 1px solid var(--line); border-radius: 16px;
}
dt { font: 500 14px/1.9 var(--mono); color: var(--muted); }
dd { margin: 0; font-size: 1.05rem; }
dd a { text-decoration-color: var(--accent); text-underline-offset: 3px; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 0; }
.chips li {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 15px;
  transition: transform .25s var(--ease), border-color .2s;
}
.chips li:hover { transform: translateY(-3px) rotate(-2deg); border-color: var(--accent); }
.chips img { width: 22px; height: 22px; }

/* cursor-following glow on cards (JS sets --x/--y) */
.glow { position: relative; overflow: hidden; }
.glow::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(380px circle at var(--x, 50%) var(--y, 50%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 65%);
}
.glow:hover::before { opacity: 1; }

.projects { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.project {
  display: flex; flex-direction: column; gap: 10px; padding: 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; text-decoration: none;
  transition: border-color .2s, transform .3s var(--ease), box-shadow .3s;
}
.project:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 20px 40px -24px var(--accent); }
.project h3 { margin: 0; font-size: 1.15rem; }
.project p { margin: 0; color: var(--muted); font-size: 15px; }
.project ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.project li { font: 12px var(--mono); padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.project .repo { margin-top: auto; padding-top: 4px; font: 500 13px var(--mono); color: var(--accent); overflow-wrap: anywhere; }
.project .repo::after { content: " ↗"; display: inline-block; transition: transform .25s var(--ease); }
.project:hover .repo::after { transform: translate(3px, -3px); }

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card.wide { grid-column: 1 / -1; }
.card.light { background: #fff; } /* pacman svg is drawn for light backgrounds */
.card img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.card p { margin: 0 0 8px; font: 500 13px var(--mono); color: var(--muted); }

#quote img { max-width: 100%; height: auto; }

.videos { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.video {
  margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  transition: transform .3s var(--ease), border-color .2s;
}
.video:hover { transform: translateY(-4px); border-color: var(--accent); }
.play { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; background: #000; cursor: pointer; }
.play img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity .3s, transform .5s var(--ease); }
.play::after {
  content: "▶"; position: absolute; top: 50%; left: 50%; translate: -50% -50%;
  display: grid; place-items: center; width: 68px; height: 48px; border-radius: 14px;
  background: rgba(255, 0, 0, .88); color: #fff; font-size: 20px; transition: transform .25s var(--ease);
}
.play:hover img { opacity: .85; transform: scale(1.04); }
.play:hover::after, .play:focus-visible::after { transform: scale(1.12); }
.video iframe { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
.video figcaption { position: relative; padding: 14px 16px 18px; }
.video h3 { margin: 0 0 8px; font-size: 1rem; }
.video h3 a { text-decoration: none; }
.video h3 a:hover { color: var(--accent); }
.video blockquote { margin: 0; padding-left: 12px; border-left: 2px solid var(--accent); color: var(--muted); font-size: 15px; }

/* childhood sites: Windows XP style windows */
.sites { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.xp {
  border: 3px solid #0831d9; border-top: 0; border-radius: 8px 8px 4px 4px; overflow: hidden;
  background: #ece9d8; color: #111; font-family: Tahoma, "Segoe UI", sans-serif;
  box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .5); transition: transform .3s var(--ease);
}
.xp:hover { transform: translateY(-4px) rotate(-.4deg); }
.xp-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 6px 5px 10px;
  background: linear-gradient(#0997ff, #0053ee 12%, #0050ee 85%, #06f);
  color: #fff; font-weight: 700; font-size: 13px; text-shadow: 1px 1px #0f1089;
}
.xp-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp-bar i {
  flex: none; display: grid; place-items: center; width: 21px; height: 21px; border: 1px solid #fff; border-radius: 3px;
  background: linear-gradient(135deg, #e88a6f, #c0391c); font-style: normal; font-size: 11px;
}
.xp-screen { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #fff; border-bottom: 1px solid #aca899; }
.xp-load {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 0; cursor: pointer; font: inherit; color: #fff;
  background: /* Bliss, roughly */
    radial-gradient(ellipse 130% 55% at 35% 112%, #6bbf3a 58%, transparent 59%),
    radial-gradient(ellipse 90% 40% at 95% 105%, #4f9e2a 55%, transparent 56%),
    linear-gradient(#1f6fd6, #74b6f2 60%, #bfe0ff);
}
.xp-load span {
  padding: 6px 16px; border: 1px solid #003c74; border-radius: 3px; color: #111; font-size: 14px;
  background: linear-gradient(#fff, #ece9d8 85%, #d6d0c0); box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
  transition: transform .2s var(--ease);
}
.xp-load:hover span, .xp-load:focus-visible span { transform: scale(1.06); }
.xp-load small { font-size: 12px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.site-frame { position: absolute; top: 0; left: 0; width: 1280px; height: 800px; border: 0; transform: scale(var(--s, .3)); transform-origin: 0 0; }
.xp-foot { padding: 12px 14px 14px; }
.xp-foot blockquote { margin: 0 0 10px; font-size: 14px; font-style: italic; }
.xp-foot p { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: 13px; }
.xp-foot span { color: #555; }
.xp-foot a { color: #0645ad; margin-left: auto; }

.links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; list-style: none; padding: 0; margin: 0; }
.links a {
  display: block; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); text-decoration: none; font-size: 15px;
  transition: border-color .2s, color .2s, transform .25s var(--ease);
}
.links a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-3px); }
#social-list a { display: flex; align-items: center; gap: 8px; padding-left: 12px; }
#social-list img { width: 20px; height: 20px; transition: transform .3s var(--ease); }
#social-list a:hover img { transform: scale(1.2) rotate(-8deg); }
#support-list a { padding: 0; border: 0; background: none; } /* the badge image is the button */
#support-list img { display: block; height: 44px; width: auto; border-radius: 8px; }
@media (prefers-color-scheme: dark) { .links img.mono { filter: invert(1); } }

footer { border-top: 1px solid var(--line); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 32px 0 48px; color: var(--muted); font: 13px var(--mono); }
footer a { text-decoration: none; }
footer a:hover { color: var(--accent); }

/* scroll reveal: JS adds [data-reveal] and .in. Uses `translate` so hover `transform`s still work */
.js [data-reveal] { opacity: 0; }
.js [data-reveal].in { animation: reveal .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes reveal { from { opacity: 0; translate: 0 32px; } to { opacity: 1; translate: 0 0; } }

@media (max-width: 560px) {
  dl { grid-template-columns: 1fr; gap: 0; }
  dd { margin-bottom: 14px; }
  .avatar { top: -26px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}
