:root {
  color-scheme: dark;
  --bg: #040806;
  --panel: rgba(8, 18, 12, 0.82);
  --panel-solid: #08120c;
  --text: #c6d6cc;
  --text-strong: #ecfff4;
  --muted: #7d9587;
  --line: rgba(61, 255, 143, 0.16);
  --line-strong: rgba(61, 255, 143, 0.4);
  --green: #3dff8f;
  --green-rgb: 61, 255, 143;
  --on-green: #02120a;
  --amber: #ffd24a;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
}

a { color: var(--green); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--panel-solid); color: var(--green); padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--line-strong); font-family: var(--font-mono);
}
.skip:focus { top: 12px; }

/* ---------- fixed backdrop: a dot grid and contour rings ---------- */
.world { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.grid-dots {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(var(--green-rgb), 0.13) 1px, transparent 1.3px);
  background-size: 30px 30px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 85%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 85%, transparent 100%);
}
.contour {
  position: absolute; width: 130vmax; height: 130vmax; border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 40px, rgba(var(--green-rgb), 0.06) 40px 41.5px);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 60%);
  mask-image: radial-gradient(circle, #000 0%, transparent 60%);
}
.contour-a { left: -75vmax; top: -45vmax; }
.contour-b { right: -80vmax; bottom: -60vmax; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: max(100svh, 720px);
  overflow: hidden;
  background:
    radial-gradient(60% 45% at 78% 70%, rgba(var(--green-rgb), 0.07), transparent 70%),
    linear-gradient(to bottom, #020403 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
.neural { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scan {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.flags { position: absolute; left: 0; top: 0; width: 100%; height: 130px; pointer-events: none; z-index: 2; }
.flags .string { fill: none; stroke: rgba(var(--green-rgb), 0.45); stroke-width: 1.2; }
.flag {
  transform-box: fill-box; transform-origin: 50% 0;
  animation: flutter 2.6s ease-in-out infinite;
}
.flags.gust .flag { animation-duration: 0.7s; }
@keyframes flutter {
  0%, 100% { transform: skewX(-7deg) rotate(2deg) scaleY(1); }
  50% { transform: skewX(7deg) rotate(-2deg) scaleY(0.94); }
}

.hero-inner {
  position: relative; z-index: 3;
  max-width: 1060px; margin: 0 auto;
  padding: clamp(104px, 19vh, 170px) 24px 0;
}
.hero-inner > * { animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero-inner > :nth-child(1) { animation-delay: 0.1s; }
.hero-inner > :nth-child(2) { animation-delay: 0.25s; }
.hero-inner > :nth-child(3) { animation-delay: 0.4s; }
.hero-inner > :nth-child(4) { animation-delay: 0.55s; }
.hero-inner > :nth-child(5) { animation-delay: 0.7s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.comment { margin: 0 0 4px; font-family: var(--font-mono); font-size: 15px; color: var(--muted); }
.prompt { margin: 0 0 10px; font-family: var(--font-mono); font-size: 15px; color: var(--text-strong); }
.prompt .user { color: var(--green); }
.prompt .path { color: #6fc4ff; }
.prompt .sep { color: var(--muted); }
.hero h1 {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(36px, 7.2vw, 84px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  text-shadow: 0 0 28px rgba(var(--green-rgb), 0.35);
}
.tagline {
  margin: 18px 0 0; max-width: 40ch;
  font-size: clamp(17px, 2.1vw, 21px); color: var(--text);
}
.tagline::after {
  content: ""; display: inline-block; width: 0.55em; height: 1.05em; margin-left: 3px; vertical-align: -0.15em;
  background: var(--green); animation: blink 1.05s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 18px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: rgba(var(--green-rgb), 0.05);
  color: var(--green); text-decoration: none;
  font-family: var(--font-mono); font-weight: 500; font-size: 14px;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); background: rgba(var(--green-rgb), 0.14); box-shadow: 0 0 18px rgba(var(--green-rgb), 0.28); }
.btn-primary { background: var(--green); border-color: var(--green); color: var(--on-green); font-weight: 700; }
.btn-primary:hover { background: var(--green); filter: brightness(1.1); box-shadow: 0 0 24px rgba(var(--green-rgb), 0.55); }

.statusbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; margin: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; padding: 8px 20px;
  background: rgba(4, 8, 6, 0.86); border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.statusbar a { color: var(--text); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--green-rgb), 0.5); }
  100% { box-shadow: 0 0 0 9px rgba(var(--green-rgb), 0); }
}

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px;
  background: rgba(4, 8, 6, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 14px;
  transform: translateY(-100%);
  transition: transform 0.25s ease;
}
.nav.show { transform: none; }
.nav .brand { color: var(--green); font-weight: 700; text-decoration: none; }
.blink-cursor { animation: blink 1.05s steps(2, start) infinite; }
.nav ul { display: flex; gap: 20px; margin: 0; padding: 0; list-style: none; }
.nav ul a { color: var(--muted); text-decoration: none; padding-bottom: 3px; border-bottom: 2px solid transparent; }
.nav ul a:hover { color: var(--text-strong); }
.nav ul a.current { color: var(--green); border-bottom-color: var(--green); }

/* ---------- section dividers: a little neural ridge ---------- */
.ridge { height: 100px; margin-top: 26px; pointer-events: none; }
.footer-ridge { height: clamp(100px, 13vw, 180px); }
.ridge svg, .footer-ridge svg { display: block; width: 100%; height: 100%; }
.wire .link { stroke: rgba(var(--green-rgb), 0.12); stroke-width: 1; }
.wire .back { fill: none; stroke: rgba(var(--green-rgb), 0.26); stroke-width: 1; }
.wire .front { fill: none; stroke: rgba(var(--green-rgb), 0.5); stroke-width: 1; }
.wire .n-back { fill: rgba(var(--green-rgb), 0.5); }
.wire .n-front { fill: rgba(var(--green-rgb), 0.9); }

/* ---------- sections ---------- */
.section { max-width: 1060px; margin: 0 auto; padding: 34px 24px 16px; }
.section-head { margin-bottom: 28px; }
.section-head-center { text-align: center; }
.bunting { display: block; margin: 0 0 14px; overflow: visible; }
.section-head-center .bunting { margin-left: auto; margin-right: auto; }
.bunting .string { fill: none; stroke: rgba(var(--green-rgb), 0.4); stroke-width: 1.2; }
.eyebrow { margin: 0 0 6px; font-family: var(--font-mono); font-size: 13px; color: var(--green); }
.section h2 {
  margin: 0; font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(28px, 4.2vw, 42px); line-height: 1.12; letter-spacing: -0.02em; color: var(--text-strong);
}
.section-lede { margin: 12px 0 0; max-width: 64ch; color: var(--text); font-size: 15.5px; }

/* scroll reveal */
.js .reveal { opacity: 0; translate: 0 26px; }
.reveal.in {
  opacity: 1; translate: 0 0;
  transition: opacity 0.7s ease, translate 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 90ms);
}

/* ---------- projects ---------- */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.project {
  position: relative; isolation: isolate;
  background: var(--panel); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 10px; padding: 18px 18px 22px;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.18s ease-out, box-shadow 0.25s ease, border-color 0.25s ease;
}
.project::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(var(--green-rgb), 0.09), transparent 60%);
  opacity: 0; transition: opacity 0.25s ease;
}
.project:hover { border-color: var(--line-strong); box-shadow: 0 0 34px rgba(var(--green-rgb), 0.12); }
.project:hover::after { opacity: 1; }
.project h3 { margin: 4px 0 8px; font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.01em; }
.project p { margin: 0 0 12px; color: var(--text); font-size: 15px; }
.project.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: start; padding: 20px; }
.project.featured h3 { font-size: 22px; }
.badge { margin: 0 0 6px !important; font-family: var(--font-mono); font-size: 12px !important; color: var(--green) !important; }

.media {
  position: relative; margin: 0 0 8px; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: 8px; border: 1px solid var(--line); background: #050a07;
}
.media canvas, .media img { display: block; width: 100%; height: 100%; }
.media img { object-fit: contain; background: #fff; }
#shot-quake { object-fit: cover; object-position: top; }
.viz-note { margin: 0 0 14px !important; font-size: 12.5px !important; color: var(--muted) !important; }

.viz-controls { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 8px; justify-content: flex-end; }
.viz-controls button, .tab {
  font-family: var(--font-mono); font-size: 12px; cursor: pointer; padding: 5px 11px; border-radius: 5px;
  border: 1px solid var(--line-strong); background: rgba(4, 8, 6, 0.8); color: var(--green);
}
.viz-controls button:hover, .tab:hover { background: rgba(var(--green-rgb), 0.16); }
.viz-controls button[aria-pressed="true"], .tab[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--on-green); font-weight: 700; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }

.slider {
  display: flex; align-items: center; gap: 12px; margin: 0 0 10px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--muted);
}
.slider input { flex: 1; accent-color: var(--green); cursor: pointer; animation: nudge 2.4s ease-out 1.2s 2; }
.slider output { min-width: 3.4em; color: var(--green); font-weight: 700; text-align: right; }
@keyframes nudge { 0%, 100% { filter: none; } 50% { filter: drop-shadow(0 0 7px var(--green)); } }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; }
.metrics li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: rgba(var(--green-rgb), 0.04); }
.metrics strong { display: block; font-family: var(--font-mono); font-size: 21px; color: var(--green); line-height: 1.2; }
.metrics span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); line-height: 1.35; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.tags li { padding: 2px 9px; border: 1px solid var(--line); border-radius: 4px; font-family: var(--font-mono); font-size: 12px; color: var(--text); }
.links { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 !important; font-family: var(--font-mono); font-size: 14px !important; font-weight: 500; }
.muted { color: var(--muted); font-weight: 400; }

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: 1.1fr 1fr; gap: 34px; align-items: start; }
.about-text p { margin: 0 0 16px; color: var(--text); font-size: 16.5px; }
.codecard {
  border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(2, 8, 5, 0.9); overflow: hidden;
  box-shadow: 0 0 30px rgba(var(--green-rgb), 0.08);
}
.codecard-bar {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  background: rgba(var(--green-rgb), 0.07); border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.codecard-bar i { width: 9px; height: 9px; border-radius: 50%; background: rgba(var(--green-rgb), 0.35); }
.codecard-bar span { margin-left: 8px; }
.codecard pre { margin: 0; padding: 16px 16px 18px; overflow-x: auto; }
.codecard code { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.75; color: var(--text); }
.codecard .p { color: #5f7c6c; }
.codecard .k { color: #6fc4ff; }
.codecard .s { color: var(--green); }

/* ---------- experience ---------- */
.timeline { margin: 0; padding: 0 0 0 22px; list-style: none; border-left: 1px solid var(--line-strong); }
.timeline li { position: relative; padding: 0 0 28px; }
.timeline li::before {
  content: ""; position: absolute; left: -28px; top: 8px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--green); box-shadow: 0 0 10px rgba(var(--green-rgb), 0.5);
}
.when { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.timeline h3 { margin: 2px 0 0; font-size: 17px; font-weight: 600; color: var(--text-strong); }
.timeline .where { font-weight: 400; color: var(--text); }
.timeline p { margin: 6px 0 0; color: var(--text); }

/* ---------- contact + footer ---------- */
.contact { padding-bottom: 80px; text-align: center; }
.contact .bunting { margin-left: auto; margin-right: auto; }
.contact-lede { max-width: 52ch; margin: 0 auto; color: var(--text); font-size: 17px; }
.cta-contact { justify-content: center; }

.footer-body { margin-top: -1px; padding: 0 24px 40px; background: #020403; border-top: 1px solid var(--line); text-align: center; }
.thanks { margin: 0; padding-top: 22px; font-size: 28px; color: var(--text-strong); }
.footer-note { margin: 16px 0 0; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.flag-strip {
  height: 5px; max-width: 460px; margin: 14px auto 0; border-radius: 3px;
  background: linear-gradient(90deg, #2f6fdb 0 20%, #f4f4f2 20% 40%, #e0443e 40% 60%, #2e9b57 60% 80%, #f2c230 80% 100%);
}

/* ---------- altimeter ---------- */
.altimeter {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 6px;
  background: rgba(4, 8, 6, 0.86); backdrop-filter: blur(8px); border: 1px solid var(--line-strong); color: var(--green);
  font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums;
  opacity: 0; transform: translateY(8px); transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.altimeter.show { opacity: 1; transform: none; }
.alt-arrow { font-size: 9px; }
.alt-place { color: var(--muted); }

/* ---------- small screens ---------- */
@media (max-width: 800px) {
  .projects, .about, .project.featured { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
  .nav .brand { display: none; }
  .nav ul { width: 100%; justify-content: space-between; }
  .altimeter .alt-place { display: none; }
  .project { transform: none; }
  .hero-inner { padding-top: 120px; }
}

@media (max-width: 1000px) {
  .about { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .codecard code { font-size: 11.5px; }
  .codecard pre { white-space: pre-wrap; overflow-wrap: anywhere; }   /* wrap instead of scrolling on phones */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .flag, .status-dot, .blink-cursor, .hero-inner > *, .slider input { animation: none; }
  .tagline::after { animation: none; }
  .project, .btn, .nav, .altimeter { transition: none; }
  .project { transform: none; }
  .btn:hover { transform: none; }
  .js .reveal { opacity: 1; translate: 0 0; }
}
