:root {
  --bg: #0a0a0a;
  --panel: #101010;
  --panel-2: #141414;
  --line: #1f1f1f;
  --line-2: #2c2c2c;
  --text: #ededed;
  --muted: #8a8a8a;
  --dim: #555;

  --f-sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, monospace;
  --f-pixel: 'Silkscreen', var(--f-mono);

  --pad: clamp(20px, 4.5vw, 64px);
  --max: 1280px;
  --bar-h: 56px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 24px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.6 var(--f-sans); letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--text); color: var(--bg); }
/* Classic dotted focus rectangle */
:focus-visible { outline: 1px dotted var(--text); outline-offset: 3px; }

/* Matte finish: a static, very fine grain */
.grain {
  position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--bar-h);
  display: flex; align-items: center; gap: 24px; padding: 0 var(--pad);
  background: rgba(10, 10, 10, 0.82); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.mark {
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--line-2); font: 600 12px var(--f-mono); letter-spacing: 0.02em;
}
.mark:hover { background: var(--text); color: var(--bg); }
.links { display: flex; gap: 4px; margin: 0 auto; }
.links a {
  display: flex; align-items: baseline; gap: 6px; padding: 6px 12px; font-size: 13.5px; color: var(--muted);
  border: 1px solid transparent; transition: color 0.2s, border-color 0.2s;
}
.links a i { font: 400 10.5px var(--f-mono); font-style: normal; color: var(--dim); }
.links a:hover { color: var(--text); }
.links a.active { color: var(--text); border-color: var(--line-2); background: var(--panel); }
.tray { display: flex; align-items: center; gap: 10px; }
.auto {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; cursor: pointer;
  background: none; border: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted);
  transition: color 0.2s, border-color 0.2s;
}
.auto:hover { color: var(--text); border-color: #3a3a3a; }
.auto-icon { width: 0; height: 0; border-left: 7px solid currentColor; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
.auto[aria-pressed='true'] { color: var(--bg); background: var(--text); border-color: var(--text); }
.auto[aria-pressed='true'] .auto-icon { width: 8px; height: 8px; border: 0; background: currentColor; }
.clock {
  height: 30px; display: grid; place-items: center; padding: 0 10px;
  border: 1px solid var(--line); background: var(--panel); font: 12px var(--f-mono); color: var(--muted);
  box-shadow: inset 1px 1px 0 #000;
}
/* Segmented progress, like an old install bar */
.segments { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; display: flex; gap: 2px; }
.segments i { flex: 1; background: transparent; transition: background 0.15s; }
.segments i.on { background: var(--text); }

/* ---------- Window chrome ---------- */
.win {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  transition: border-color 0.3s, box-shadow 0.3s, translate 0.3s;
}
.win::before {
  /* Pointer spotlight */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.05), transparent 60%);
}
.win:hover { border-color: var(--line-2); box-shadow: 6px 6px 0 #161616; translate: -2px -2px; }
.win:hover::before { opacity: 1; }
.win-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 32px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--line);
  font: 12px var(--f-mono); color: var(--muted); background: var(--panel-2);
  transition: color 0.3s;
}
.win:hover .win-bar { color: var(--text); }
.ctrl { display: flex; gap: 3px; }
.ctrl i {
  display: grid; place-items: center; width: 16px; height: 14px; font: 9px/1 var(--f-mono); font-style: normal;
  border: 1px solid var(--line-2); color: var(--dim);
}
.win-body { padding: 22px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; font: 500 14px var(--f-sans); color: var(--text);
  transition: translate 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
}
.btn:hover { translate: -2px -2px; box-shadow: 4px 4px 0 var(--line-2); }
.btn:active { translate: 0 0; box-shadow: none; }
.btn.solid { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.solid:hover { box-shadow: 4px 4px 0 #3a3a3a; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh; max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(32px, 5vw, 80px); align-items: end;
  padding: calc(var(--bar-h) + 80px) var(--pad) 80px;
}
.hero { position: relative; }
.hero-3d { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
.hero-3d.ready { opacity: 1; }
.hero-main, .hero-win { position: relative; z-index: 1; }
.status { display: flex; align-items: center; gap: 10px; margin: 0 0 28px; font: 12.5px var(--f-mono); color: var(--muted); }
.pulse { width: 7px; height: 7px; background: var(--text); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.2; } }
.name {
  margin: 0; font-weight: 600; font-size: clamp(56px, 10.5vw, 168px); line-height: 0.88; letter-spacing: -0.055em;
}
.name span { display: block; }
.name span + span { color: #3d3d3d; }
.lede { margin: 30px 0 32px; max-width: 46ch; font-size: clamp(16px, 1.4vw, 19px); color: var(--muted); line-height: 1.55; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }

.kv { margin: 0; padding: 6px 0; }
.kv > div { display: grid; grid-template-columns: 100px 1fr; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.kv dt { font: 11.5px var(--f-mono); color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; padding-top: 2px; }
.kv dd { margin: 0; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.stats div { padding: 18px; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats b { display: block; font-weight: 600; font-size: 30px; letter-spacing: -0.04em; line-height: 1.1; }
.stats span { font: 11px var(--f-mono); color: var(--dim); }

/* ---------- Sections ---------- */
.section { max-width: var(--max); margin: 0 auto; padding: clamp(96px, 14vh, 160px) var(--pad) 0; }
.head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 36px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.head h2 { margin: 0; order: -1; font-weight: 600; font-size: clamp(36px, 5vw, 64px); letter-spacing: -0.045em; line-height: 1; }
.label { margin: 0; font: 12px var(--f-mono); color: var(--dim); white-space: nowrap; }

.grid { display: grid; gap: 16px; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.card h3 { margin: 4px 0 14px; font-weight: 600; font-size: 20px; letter-spacing: -0.025em; line-height: 1.25; }
.meta { margin: 0; font: 12px var(--f-mono); color: var(--dim); }
.card ul { margin: 0 0 18px; padding: 0; list-style: none; }
.card li { position: relative; padding-left: 16px; margin: 8px 0; color: #b5b5b5; font-size: 14px; }
.card li::before { content: ''; position: absolute; left: 0; top: 0.72em; width: 6px; height: 1px; background: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tags span { padding: 3px 8px; border: 1px solid var(--line-2); font: 11.5px var(--f-mono); color: var(--muted); }

/* Projects */
.screen { height: 170px; border-bottom: 1px solid var(--line); background: #0c0c0c; position: relative; overflow: hidden; }
.pool { display: grid; grid-template-columns: repeat(20, 1fr); gap: 5px; padding: 22px; align-content: center; }
.pool i { aspect-ratio: 1; background: #181818; transition: background-color 0.4s; }
.pool i.warm { background: #3a3a3a; }
.pool i.run { background: var(--text); }
.flow { display: flex; align-items: center; gap: 8px; padding: 0 22px; font: 11.5px var(--f-mono); }
.flow span { padding: 7px 10px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; background: var(--panel); }
.flow span.hub { color: var(--bg); background: var(--text); border-color: var(--text); }
.flow i { flex: 1; min-width: 8px; height: 1px; background: var(--line-2); position: relative; overflow: hidden; }
.flow i::after { content: ''; position: absolute; inset: -1px 0; background: linear-gradient(90deg, transparent calc(100% - 10px), var(--text) 0); animation: packet 1.6s linear infinite; }
.flow i:nth-of-type(2)::after { animation-delay: 0.5s; }
.flow i:nth-of-type(3)::after { animation-delay: 1s; }
@keyframes packet { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.p-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.project h3 { font-size: 26px; margin: 0 0 10px; }
.metric { margin: 0; font: 11.5px var(--f-mono); color: var(--dim); text-align: right; }
.metric b { display: block; font: 600 26px var(--f-sans); letter-spacing: -0.04em; color: var(--text); }
.desc { margin: 0 0 16px; color: #b5b5b5; font-size: 14.5px; }
.more { display: inline-block; margin-top: 20px; font: 12.5px var(--f-mono); color: var(--muted); border-bottom: 1px solid var(--line-2); padding-bottom: 2px; transition: color 0.2s, border-color 0.2s; }
.more:hover { color: var(--text); border-color: var(--text); }

/* Education table */
.row { display: grid; grid-template-columns: 1.3fr 1.4fr 0.7fr 0.6fr; gap: 20px; padding: 18px 22px; border-bottom: 1px solid var(--line); font-size: 14.5px; color: #b5b5b5; transition: background 0.2s; }
.row:last-child { border-bottom: 0; }
.row b { font-weight: 500; color: var(--text); }
.row span:last-child { font-family: var(--f-mono); font-size: 12.5px; text-align: right; }
.row:not(.th):not(.note):hover { background: var(--panel-2); }
.row.th { padding-block: 10px; font: 11px var(--f-mono); color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.row.th span:last-child { font-size: 11px; }
.row.note { grid-template-columns: 1fr; color: var(--muted); font-size: 13.5px; }
.row.note span { font: inherit; text-align: left; }

/* Skills */
.marquee { margin: 0 calc(var(--pad) * -1) 40px; overflow: hidden; border-block: 1px solid var(--line); }
.m-row { display: flex; }
.m-row + .m-row { border-top: 1px solid var(--line); }
.m-track {
  flex: none; white-space: pre; padding: 14px 0;
  font: 500 clamp(20px, 2.6vw, 34px) var(--f-sans); letter-spacing: -0.03em; color: var(--muted);
  animation: marquee 50s linear infinite;
}
.m-row.rev .m-track { animation-direction: reverse; animation-duration: 60s; color: var(--dim); }
@keyframes marquee { to { transform: translateX(-100%); } }
.skills { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.skills > div { padding: 20px 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.skills dt { font: 11.5px var(--f-mono); color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.skills dd { margin: 0; color: #c9c9c9; font-size: 14.5px; }

/* Contact */
.contact { padding-bottom: 40px; }
.big { margin: 18px 0 36px; font-weight: 600; font-size: clamp(56px, 10vw, 150px); line-height: 0.9; letter-spacing: -0.055em; }
.copy-hint { padding-left: 10px; border-left: 1px solid rgba(0, 0, 0, 0.25); font: 11.5px var(--f-mono); opacity: 0.6; }
.footer { margin-top: clamp(100px, 16vh, 180px); padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer p { margin: 0; font: 12px var(--f-mono); color: var(--dim); }
/* 88×31 button badges from the early web, in monochrome */
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: flex; align-items: center; width: 88px; height: 31px; border: 1px solid var(--line-2);
  font: 8px/1 var(--f-pixel); color: var(--muted); text-transform: uppercase; overflow: hidden;
}
.badge b { align-self: stretch; display: grid; place-items: center; padding: 0 6px; margin-right: 6px; background: var(--text); color: var(--bg); font-weight: 400; font-size: 9px; }
.counter b { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }

/* Initial reveal state, with a fallback in case the script never runs */
.js .reveal, .js .hero-main > *, .js .hero-win { opacity: 0; animation: show 0s 2.5s forwards; }
@keyframes show { to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .grid.three, .grid.two { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr 1fr; }
  .row { grid-template-columns: 1fr 1fr; }
  .row span:last-child { text-align: left; }
  .row.th { display: none; }
}
@media (max-width: 760px) {
  :root { --bar-h: 52px; }
  /* backdrop-filter would trap the fixed bottom nav inside the bar */
  .bar { gap: 10px; -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(10, 10, 10, 0.96); }
  .links { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(10, 10, 10, 0.92); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .links a { flex-direction: column; align-items: center; gap: 0; padding: 4px 6px; font-size: 11.5px; }
  .tray { margin-left: auto; }
  .auto-label { display: none; }
  body { padding-bottom: 60px; }
  .hero { padding-top: calc(var(--bar-h) + 48px); }
  .name { font-size: clamp(56px, 19vw, 110px); }
  .kv > div { grid-template-columns: 1fr; gap: 2px; }
  .head { flex-direction: column; align-items: start; gap: 8px; }
  .head h2 { order: 0; }
  .skills { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; gap: 2px; }
  .flow { gap: 4px; padding: 0 12px; font-size: 10px; }
  .flow span { padding: 6px 6px; }
  .pool { grid-template-columns: repeat(14, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .m-track, .pulse, .flow i::after { animation: none !important; }
  .win, .btn { transition: none; }
}
