:root {
  /* surfaces */
  --bg: #0a0d12;
  --surface: #12161d;
  --surface-raised: #171c25;
  --line: #232a35;
  --line-soft: #1a2029;

  /* text */
  --ink: #eef1f5;
  --muted: #8b96a5;
  --muted-2: #5c6675;

  /* accents */
  --signal: #5eead4;
  --signal-ink: #06201b;
  --amber: #f2b872;
  --violet: #8b7cf0;
  --blue: #4d8dff;
  --green: #7be495;
  --red: #f2705c;

  --spectrum: linear-gradient(90deg,
    var(--violet) 0%, var(--blue) 22%, var(--signal) 44%,
    var(--green) 62%, var(--amber) 80%, var(--red) 100%);

  --radius: 10px;
  --radius-sm: 6px;
  --container: 1120px;

  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease: cubic-bezier(.16,.8,.24,1);
  --dur: .25s;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; line-height: 1.15; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* visible focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--signal); color: var(--signal-ink);
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0; z-index: 200;
  font-family: var(--font-mono); font-size: 13px;
}
.skip-link:focus { left: 0; }

/* ---------- layout helpers ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 28px; }
section { padding: 96px 0; }
@media (max-width: 720px) { section { padding: 64px 0; } .container { padding: 0 20px; } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}

.mark {
  height: 3px; width: 64px; border-radius: 4px; background: var(--spectrum);
  background-size: 200% 100%;
  animation: shimmer 8s linear infinite;
}
@keyframes shimmer { to { background-position: 200% 0; } }

.divider-spectrum {
  height: 3px; width: 100%; border-radius: 4px; background: var(--spectrum);
  background-size: 200% 100%; animation: shimmer 10s linear infinite;
  opacity: .9;
}

.lede { color: var(--muted); font-size: 18px; max-width: 60ch; }

.section-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 48px; }
.section-head h2 { font-size: clamp(28px, 3.4vw, 38px); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn-primary { background: var(--signal); color: var(--signal-ink); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--signal); color: var(--signal); transform: translateY(-2px); }
.btn svg { width: 16px; height: 16px; }

/* ---------- nav ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,13,18,.88);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: saturate(140%) blur(6px);
}
.site-nav .container { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 12px var(--signal); }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  position: relative; padding: 8px 14px; font-size: 14.5px; color: var(--muted);
  transition: color var(--dur) var(--ease);
}
.nav-links a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px;
  background: var(--signal); border-radius: 2px;
  transform: scaleX(0); transform-origin: left; transition: transform var(--dur) var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"]::after { transform: scaleX(1); }

.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius-sm); width: 40px; height: 40px; align-items: center; justify-content: center; }
.nav-toggle svg { width: 18px; height: 18px; }

@media (max-width: 780px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line-soft);
    flex-direction: column; align-items: stretch; padding: 8px 20px 18px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 4px; }
  .nav-links a::after { display: none; }
}

/* ---------- hero ---------- */
.hero { position: relative; padding: 120px 0 88px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--line-soft) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 70% 20%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse 60% 60% at 70% 20%, #000 0%, transparent 70%);
  opacity: .5;
}
.hero-inner {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 56px;
}
.hero-copy { display: flex; flex-direction: column; gap: 22px; max-width: 620px; flex: 1 1 480px; }
.hero h1 { font-size: clamp(38px, 6vw, 62px); }
.hero .lede { font-size: 19px; }
.hero-actions { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.hero-caption { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted-2); margin-top: -6px; }

/* ---------- hero photo: circular frame with a rotating spectrum ring ---------- */
.hero-photo { flex: 0 0 auto; display: flex; justify-content: center; }
.photo-frame {
  position: relative;
  width: clamp(160px, 20vw, 260px);
  height: clamp(160px, 20vw, 260px);
  border-radius: 50%;
  flex-shrink: 0;
}
.photo-frame::before {
  content: "";
  position: absolute; inset: -6px; z-index: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    var(--violet), var(--blue), var(--signal), var(--green), var(--amber), var(--red), var(--violet));
  animation: spin-ring 8s linear infinite;
}
@keyframes spin-ring { to { transform: rotate(360deg); } }
.photo-img, .photo-fallback {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.photo-fallback {
  display: none; /* shown automatically via onerror if no photo is found yet */
  align-items: center; justify-content: center;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  color: var(--muted-2);
}
.photo-fallback svg { width: 36%; height: 36%; }

@media (max-width: 860px) {
  .hero-inner { flex-direction: column-reverse; text-align: center; gap: 36px; }
  .hero-copy { max-width: 100%; align-items: center; }
  .hero-actions { justify-content: center; }
}

/* ---------- datasheet strip ---------- */
.datasheet {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.datasheet .cell { padding: 20px 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.datasheet .cell:nth-child(4n) { border-right: none; }
.datasheet .label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 8px; }
.datasheet .value { font-size: 15px; color: var(--ink); }
@media (max-width: 780px) {
  .datasheet { grid-template-columns: repeat(2, 1fr); }
  .datasheet .cell:nth-child(4n) { border-right: 1px solid var(--line); }
  .datasheet .cell:nth-child(2n) { border-right: none; }
}

/* ---------- about / skills ---------- */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 64px; align-items: start; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; gap: 40px; } }
.about-copy p + p { margin-top: 16px; }
.about-copy { color: var(--muted); font-size: 16.5px; }
.about-copy strong { color: var(--ink); font-weight: 600; }

.skills-title { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 14px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--ink);
  border: 1px solid var(--line); background: var(--surface);
  padding: 7px 12px; border-radius: 999px;
}

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: 40px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -32px; top: 4px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--signal);
}
.timeline-item .when { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted-2); margin-bottom: 6px; }
.timeline-item h3 { font-size: 19px; margin-bottom: 6px; }
.timeline-item p { color: var(--muted); font-size: 15.5px; max-width: 62ch; }

/* ---------- cards / project grid ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 980px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 26px; display: flex; flex-direction: column; gap: 14px;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card:hover { transform: translateY(-4px); border-color: var(--signal); }
.card-icon { width: 38px; height: 38px; border-radius: 9px; background: var(--surface-raised); display: flex; align-items: center; justify-content: center; color: var(--signal); }
.card-icon svg { width: 19px; height: 19px; }
.card h3 { font-size: 18px; }
.card p { color: var(--muted); font-size: 14.5px; flex-grow: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); padding: 4px 9px; border-radius: 6px; }
.card-links { display: flex; gap: 16px; margin-top: 4px; }
.card-links a { font-size: 13.5px; color: var(--signal); display: inline-flex; align-items: center; gap: 6px; }
.card-links a:hover { text-decoration: underline; }
.card-links svg { width: 14px; height: 14px; }

/* ---------- github page ---------- */
.gh-profile {
  display: flex; gap: 24px; align-items: center; border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--radius); padding: 28px;
  flex-wrap: wrap;
}
.gh-avatar {
  width: 84px; height: 84px; border-radius: 50%; background: var(--surface-raised);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--signal); flex-shrink: 0;
}
.gh-avatar svg { width: 38px; height: 38px; }
.gh-meta h2 { font-size: 22px; margin-bottom: 4px; }
.gh-meta p { color: var(--muted); font-size: 15px; }
.gh-stats { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.gh-stats img { border-radius: var(--radius-sm); }
.gh-cta { margin-left: auto; }
@media (max-width: 640px) { .gh-cta { margin-left: 0; } }

/* ---------- resume page ---------- */
.resume-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.resume-block + .resume-block { margin-top: 44px; }
.resume-block h2 { font-size: 21px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.resume-block h2 .mark { width: 26px; }
.resume-entry + .resume-entry { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.resume-entry-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.resume-entry-head h3 { font-size: 16.5px; }
.resume-entry-head .when { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted-2); white-space: nowrap; }
.resume-entry .org { color: var(--signal); font-size: 14px; margin-top: 2px; }
.resume-entry ul { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.resume-entry li { color: var(--muted); font-size: 14.5px; padding-left: 18px; position: relative; }
.resume-entry li::before { content: "—"; position: absolute; left: 0; color: var(--muted-2); }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; gap: 44px; } }

.contact-link-row {
  display: flex; align-items: center; gap: 14px; padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
.contact-link-row:first-child { padding-top: 0; }
.contact-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--signal); flex-shrink: 0; }
.contact-icon svg { width: 16px; height: 16px; }
.contact-link-row .label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.contact-link-row .value { font-size: 15.5px; margin-top: 2px; }
.contact-link-row a.value:hover { color: var(--signal); }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field label { font-family: var(--font-mono); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; color: var(--ink); resize: vertical;
  transition: border-color var(--dur) var(--ease);
}
.field input:focus, .field textarea:focus { border-color: var(--signal); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.form-note { font-size: 13px; color: var(--muted-2); margin-top: 10px; }
.form-status { font-size: 14px; margin-top: 14px; min-height: 20px; }
.form-status.ok { color: var(--signal); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line-soft); padding: 40px 0; margin-top: 40px; }
.site-footer .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer-copy { color: var(--muted-2); font-size: 13.5px; font-family: var(--font-mono); }
.footer-social { display: flex; gap: 10px; }
.footer-social a {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.footer-social a:hover { color: var(--signal); border-color: var(--signal); }
.footer-social svg { width: 16px; height: 16px; }

/* ---------- page kicker (used at top of every page's main heading) ---------- */
.page-head { padding: 56px 0 8px; }
.page-head .mark { margin-bottom: 18px; }
.page-head h1 { font-size: clamp(32px, 4.4vw, 46px); margin-bottom: 14px; }

/* ---------- reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: translateY(0); }
