:root {
  --bg: #07080b;
  --surface: #0d0f14;
  --fg: #ece9e4;
  --muted: #8a8f99;
  --dim: #555a64;
  --line: #1c2029;
  --line-2: #2a2f3a;
  --accent: #ff7a2f;
  --cyan: #5ee0ff;
  --ok: #4cc47e;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1280px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.booting { overflow: hidden; }
a { color: inherit; }
::selection { background: var(--accent); color: #000; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--fg); color: var(--bg); padding: 8px 12px; z-index: 100; }

/* Shared type */
.label {
  margin: 0 0 18px; font: 400 12px var(--mono); letter-spacing: .22em;
  text-transform: uppercase; color: var(--muted);
}
.label b { color: var(--accent); font-weight: 500; }
h1, h2 {
  margin: 0; font-weight: 800; text-transform: uppercase;
  letter-spacing: -0.035em; line-height: .9;
}
h2 { font-size: clamp(48px, 8vw, 112px); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 16px 28px; border: 1px solid var(--line-2);
  font: 500 13px var(--mono); letter-spacing: .22em; text-transform: uppercase;
  text-decoration: none; color: var(--fg); background: rgba(7, 8, 11, .4);
  transition: border-color .2s, background .2s, color .2s;
}
.btn span { transition: transform .2s; }
.btn:hover { border-color: var(--fg); }
.btn:hover span { transform: translateX(4px); }
.btn--solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); }
.btn--ghost { color: var(--muted); cursor: default; }
.btn--ghost:hover { border-color: var(--line-2); }

/* Loader: ignition countdown */
.loader {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  align-content: center; gap: 18px; background: var(--bg);
  transition: opacity .6s ease, visibility .6s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader__count {
  font: 500 clamp(56px, 10vw, 120px) var(--mono); letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; color: var(--fg);
}
.loader__count.go { color: var(--accent); text-shadow: 0 0 40px rgba(255, 122, 47, .6); }
.loader__sub { font: 400 12px var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.loader__bar { width: 180px; height: 1px; background: var(--line-2); overflow: hidden; }
.loader__bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s linear; }

/* Header */
.top {
  position: fixed; inset: 0 0 auto; z-index: 20;
  background: linear-gradient(var(--bg) 0%, rgba(7, 8, 11, .75) 70%, transparent);
  transition: background .3s, border-color .3s; border-bottom: 1px solid transparent;
}
.top.scrolled { background: rgba(7, 8, 11, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-color: var(--line); }
.top__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.wordmark { font: 500 13px var(--mono); letter-spacing: .26em; text-transform: uppercase; text-decoration: none; }
.nav { display: flex; gap: 32px; }
.nav a {
  font: 400 12px var(--mono); letter-spacing: .22em; text-transform: uppercase;
  text-decoration: none; color: var(--muted); transition: color .2s;
}
.nav a:hover { color: var(--fg); }

/* Altimeter */
.alt {
  position: fixed; right: 22px; top: 50%; z-index: 15; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font: 400 10px var(--mono); color: var(--muted); letter-spacing: .12em;
  opacity: 0; transition: opacity .4s;
}
.alt.on { opacity: 1; }
.alt__track { position: relative; width: 1px; height: 34vh; background: var(--line-2); }
.alt__fill { position: absolute; bottom: 0; left: 0; width: 1px; height: 0; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.alt__fill::after { content: ""; position: absolute; top: -3px; left: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.alt__read { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.alt__read b { color: var(--fg); font-weight: 500; font-size: 12px; font-variant-numeric: tabular-nums; }

/* Hero */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; overflow: hidden; }
.hero__viz { position: absolute; top: 64px; right: 0; bottom: 90px; width: 52%; }
.hero__viz canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.hero__inner { position: relative; pointer-events: none; flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; padding-top: 96px; }
.hero h1 { font-size: clamp(64px, 13vw, 184px); }
.hero__role {
  max-width: 34ch; margin: 28px 0 0; min-height: 3em;
  font-size: clamp(18px, 2vw, 24px); line-height: 1.5; color: var(--muted);
}
.cursor { color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.cta, .hero__inner a { pointer-events: auto; }
.cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 40px; }
.hero__bar {
  position: relative; display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding-top: 24px; padding-bottom: 32px;
  font: 400 12px var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
}
.hero__bar::before { content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); height: 1px; background: var(--line); }
.hero__bar a { text-decoration: none; }
.hero__bar a:hover { color: var(--fg); }
.hero__clock { font-variant-numeric: tabular-nums; color: var(--fg); }

/* Chapters */
.chapter {
  position: relative; min-height: 100vh; display: flex; align-items: center;
  border-top: 1px solid var(--line); overflow: hidden;
}
.chapter__stage { position: absolute; inset: 0; }
.chapter__stage canvas { display: block; width: 100% !important; height: 100% !important; }
.chapter::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 0%, rgba(7, 8, 11, .8) 32%, transparent 60%);
}
.chapter--flip::after { background: linear-gradient(270deg, var(--bg) 0%, rgba(7, 8, 11, .8) 32%, transparent 60%); }
.chapter__text { position: relative; z-index: 1; width: 100%; padding-top: 120px; padding-bottom: 120px; }
.chapter__text > * { max-width: 600px; }
.chapter--flip .chapter__text > * { margin-left: auto; }
.chapter--flip .chapter__text h2, .chapter--flip .chapter__text .label { text-align: right; }

.role { margin: 28px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.role span { margin-left: 12px; font: 400 12px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.desc { margin: 14px 0 0; color: var(--muted); }
.specs {
  display: grid; grid-template-columns: repeat(3, 1fr); margin: 32px 0;
  border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2);
}
.specs div { padding: 12px 14px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); background: rgba(7, 8, 11, .6); }
.specs dt { font: 400 10px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.specs dd { margin: 4px 0 0; font: 500 13px var(--mono); }
.chapter--flip .btn--ghost { display: flex; width: max-content; }

/* Flight chapter (scroll-scrubbed) */
.flight { position: relative; height: 260vh; border-top: 1px solid var(--line); }
.flight__sticky { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; overflow: hidden; }
.flight__grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 56px; align-items: center; width: 100%; padding-top: 64px; }
.hint { margin-top: 28px; font: 400 12px var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }
.tlm { border: 1px solid var(--line-2); background: var(--surface); }
.tlm__head {
  display: flex; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line-2);
  font: 400 11px var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
}
.tlm__phase { color: var(--cyan); }
.tlm__plot { display: block; width: 100%; height: clamp(220px, 38vh, 380px); }
.tlm__read { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border-top: 1px solid var(--line-2); }
.tlm__read div { padding: 12px 16px; }
.tlm__read div + div { border-left: 1px solid var(--line-2); }
.tlm__read dt { font: 400 10px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.tlm__read dd { margin: 4px 0 0; font: 500 17px var(--mono); font-variant-numeric: tabular-nums; }
.tlm__note { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line-2); font: 400 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }

/* Plain sections */
.section { padding-top: 140px; }
.lead { margin: 24px 0 0; color: var(--muted); font-size: 19px; }

/* Experience */
.exp { display: grid; grid-template-columns: 1fr 1.3fr; gap: 48px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line-2); }
.exp + .exp { margin-top: 36px; }
.exp__org h3 { margin: 0 0 8px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.exp__org p { margin: 0; color: var(--muted); font-size: 15px; max-width: 40ch; }
.exp__roles { margin: 0; padding: 0; list-style: none; }
.exp__roles li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.exp__roles li:first-child { padding-top: 0; }
.exp__role { font-size: 18px; font-weight: 500; }
.exp__grp { align-self: center; font: 400 11px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.toolkit { margin-top: 56px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tags li { padding: 6px 12px; border: 1px solid var(--line-2); font: 400 12px var(--mono); color: var(--muted); }

/* Contact */
.copy {
  display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-top: 40px; padding: 0;
  border: 0; background: none; color: var(--fg); cursor: pointer; text-align: left; overflow-wrap: anywhere;
  font: 600 clamp(24px, 4.4vw, 52px) var(--sans); letter-spacing: -0.02em;
}
.copy__addr { border-bottom: 2px solid var(--accent); transition: color .2s; }
.copy:hover .copy__addr { color: var(--accent); }
.copy__hint { font: 400 12px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 32px; margin: 36px 0 0; padding: 0; list-style: none; }
.links a { font: 400 13px var(--mono); letter-spacing: .2em; text-transform: uppercase; text-decoration: none; color: var(--muted); }
.links a:hover { color: var(--accent); }

/* Footer */
.foot { margin-top: 160px; border-top: 1px solid var(--line); }
.foot__inner {
  display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; padding-top: 24px; padding-bottom: 36px;
  font: 400 11px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--fg); }
.foot__status i { display: inline-block; width: 6px; height: 6px; margin-right: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); vertical-align: 1px; }

/* No WebGL fallback */
.no3d .chapter__stage { display: none; }

/* Responsive */
@media (max-width: 1000px) {
  .alt { display: none; }
  .flight { height: 240vh; }
  .flight__grid { grid-template-columns: 1fr; gap: 24px; }
  .flight__text .desc, .flight__text .hint { display: none; }
  .tlm__plot { height: 30vh; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav { gap: 18px; }
  .nav a[href="#experience"] { display: none; }
  .wordmark { letter-spacing: .18em; }
  .hero__viz { width: 100%; opacity: .32; pointer-events: none; }
  .hero__bar .hero__clock { display: none; }
  .chapter { flex-direction: column; align-items: stretch; min-height: 0; }
  .chapter__stage { position: relative; inset: auto; height: 56vh; }
  .chapter::after, .chapter--flip::after { background: linear-gradient(180deg, transparent 30%, var(--bg) 56vh); }
  .chapter__text { margin-top: -56px; padding-top: 0; padding-bottom: 80px; }
  .chapter--flip .chapter__text > * { margin-left: 0; }
  .chapter--flip .chapter__text h2, .chapter--flip .chapter__text .label { text-align: left; }
  .specs { grid-template-columns: 1fr 1fr; }
  .role span { display: block; margin: 6px 0 0; }
  .btn { padding: 14px 20px; letter-spacing: .16em; }
  .exp { grid-template-columns: 1fr; gap: 24px; }
  .section { padding-top: 100px; }
  .tlm__read dd { font-size: 14px; }
  .tlm__read div { padding: 10px; }
  .flight__grid { padding-top: 56px; }
  .flight h2 { font-size: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
}
