/* ---------- Theme tokens: deep space ---------- */
:root {
  --bg: #05060f;
  --surface: rgba(17, 20, 42, .62);
  --surface-solid: #11142a;
  --surface-2: rgba(30, 34, 68, .7);
  --border: rgba(139, 147, 216, .18);
  --border-strong: rgba(167, 139, 250, .45);
  --text: #eef0ff;
  --muted: #9aa1c7;
  --violet: #a78bfa;
  --pink: #f472b6;
  --cyan: #5eead4;
  --blue: #60a5fa;
  --grad: linear-gradient(100deg, var(--cyan), var(--violet) 50%, var(--pink));
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .8);
  --glow: 0 0 40px -8px rgba(167, 139, 250, .55);
  --radius: 18px;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.12; margin: 0; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
strong { color: var(--text); font-weight: 600; }

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.muted { color: var(--muted); }
.gradient {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.container {
  position: relative;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--cyan);
  color: #000;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 100;
}
.skip-link:focus { left: 8px; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }

/* ---------- Space background ---------- */
#stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.nebula {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(40vw 40vw at 85% 10%, rgba(124, 58, 237, .28), transparent 70%),
    radial-gradient(35vw 35vw at 10% 30%, rgba(236, 72, 153, .14), transparent 70%),
    radial-gradient(45vw 45vw at 30% 95%, rgba(14, 165, 233, .14), transparent 70%),
    radial-gradient(30vw 30vw at 95% 75%, rgba(94, 234, 212, .08), transparent 70%),
    var(--bg);
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 6, 15, .55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 66px; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  margin-right: auto;
  letter-spacing: -0.01em;
}
.logo .muted { font-weight: 400; }
.logo-orb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #c4b5fd 30%, #7c3aed 70%, #312e81);
  box-shadow: 0 0 16px rgba(167, 139, 250, .8);
  position: relative;
}
.logo-orb::after {
  content: "";
  position: absolute;
  inset: 7px -6px;
  border: 1.5px solid rgba(94, 234, 212, .8);
  border-radius: 50%;
  transform: rotate(-20deg);
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: .88rem;
}
.nav-links a { color: var(--muted); transition: color .2s; }
.nav-links a::before { content: "./"; color: var(--violet); opacity: 0; transition: opacity .2s; }
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::before { opacity: 1; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: calc(100vh - 66px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px 0 60px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: center;
}
.hero-grid > * { min-width: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .8rem;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 26px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(94, 234, 212, .7); }
  70% { box-shadow: 0 0 0 10px rgba(94, 234, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); }
}

.hero h1 {
  font-size: clamp(2.3rem, 5.2vw, 3.9rem);
  font-weight: 700;
  margin-bottom: 22px;
}
.hero-sub { font-size: 1.15rem; color: var(--muted); max-width: 44ch; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 34px 0 28px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: .97rem;
  transition: transform .15s, box-shadow .25s, border-color .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--grad);
  color: #0b0820;
  box-shadow: 0 10px 30px -10px rgba(167, 139, 250, .9);
}
.btn-primary:hover { box-shadow: 0 14px 40px -8px rgba(244, 114, 182, .8); }
.btn-ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { border-color: var(--border-strong); box-shadow: var(--glow); }

.socials { display: flex; gap: 10px; list-style: none; padding: 0; margin: 0; }
.socials a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color .2s, border-color .2s, transform .15s, box-shadow .2s;
}
.socials a:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--glow); }
.socials svg { width: 19px; height: 19px; fill: currentColor; }

/* Space scene */
.scene {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 480px;
  margin-left: auto;
}

.moon {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, #ffffff 0%, #e7e5f5 18%, #b9b6d3 48%, #6d6a92 78%, #3a3760 100%);
  box-shadow:
    inset -24px -18px 50px rgba(20, 16, 60, .75),
    0 0 60px rgba(196, 181, 253, .35),
    0 0 140px rgba(124, 58, 237, .35);
  overflow: hidden;
}
.crater {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 60% 60%, rgba(255, 255, 255, .25), rgba(60, 55, 100, .45) 60%);
  box-shadow: inset 3px 3px 6px rgba(40, 35, 80, .5);
}
.c1 { width: 22%; height: 22%; top: 22%; left: 52%; }
.c2 { width: 13%; height: 13%; top: 56%; left: 24%; }
.c3 { width: 9%;  height: 9%;  top: 68%; left: 60%; }
.c4 { width: 16%; height: 16%; top: 30%; left: 18%; }

.orbit {
  position: absolute;
  border: 1px dashed rgba(167, 139, 250, .28);
  border-radius: 50%;
  animation: spin linear infinite;
}
.orbit-1 { inset: 12%; animation-duration: 28s; }
.orbit-2 { inset: 3%;  animation-duration: 42s; animation-direction: reverse; border-color: rgba(94, 234, 212, .22); }
.orbit-3 { inset: -6%; animation-duration: 60s; border-style: dotted; border-color: rgba(244, 114, 182, .2); }
.satellite {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: .8rem;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  color: var(--cyan);
  box-shadow: var(--glow);
  animation: spin linear infinite reverse;
  animation-duration: inherit;
}
.orbit-2 .satellite { top: auto; bottom: 14%; left: -4px; color: var(--cyan); }
.orbit-3 .satellite { top: 40%; left: auto; right: -14px; color: var(--pink); }
@keyframes spin { to { transform: rotate(360deg); } }

.astronaut {
  position: absolute;
  width: 34%;
  top: -2%;
  right: -2%;
  overflow: visible;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .5)) drop-shadow(0 0 18px rgba(167, 139, 250, .35));
  animation: float 7s ease-in-out infinite;
  z-index: 3;
}
.astronaut .tether { stroke: rgba(196, 181, 253, .55); }
@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(-8deg); }
  50% { transform: translate(-10px, 16px) rotate(6deg); }
}

.scroll-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .08em;
}
.chev { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }

/* ---------- Sections ---------- */
.section { position: relative; padding: 110px 0; }

.kicker { color: var(--violet); font-size: .82rem; margin-bottom: 10px; letter-spacing: .02em; }
.section-title {
  font-size: clamp(1.9rem, 3.6vw, 2.7rem);
  font-weight: 700;
  margin-bottom: 38px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color .25s, transform .25s, box-shadow .25s;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 56px;
  align-items: center;
}
.about-grid > * { min-width: 0; }
.about-grid p { color: var(--muted); }

.about-head {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}
.about-head .section-title { margin-bottom: 0; }
.avatar-ring {
  position: relative;
  flex: none;
  width: 112px;
  height: 112px;
  padding: 3px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: var(--glow);
}
.avatar-ring::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px dashed rgba(167, 139, 250, .4);
  border-radius: 50%;
  animation: spin 30s linear infinite;
}
.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--bg);
}

.terminal { padding: 0; overflow: hidden; box-shadow: var(--shadow); }
.window-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.window-bar span { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.window-bar span:nth-child(2) { background: #febc2e; }
.window-bar span:nth-child(3) { background: #28c840; }
.window-bar p { margin: 0 0 0 12px; font-size: .78rem; color: var(--muted); }

.code {
  margin: 0;
  padding: 22px 22px 26px;
  font-size: .84rem;
  line-height: 1.75;
  overflow-x: auto;
  color: var(--text);
}
.code .prompt { color: var(--violet); }
.code .s { color: var(--cyan); }
.code .ok { color: #4ade80; }
.cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  margin-left: 4px;
  vertical-align: text-bottom;
  background: var(--cyan);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.skill-card:hover { border-color: var(--border-strong); box-shadow: var(--glow); transform: translateY(-4px); }
.skill-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  color: #0b0820;
  background: var(--grad);
  box-shadow: 0 8px 24px -8px rgba(167, 139, 250, .8);
}
.skills-grid h3 { font-size: 1.15rem; margin-bottom: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; list-style: none; margin: 0; padding: 0; }
.chips li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .86rem;
  font-weight: 500;
}
.chips img { width: 16px; height: 16px; object-fit: contain; }

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
.project { position: relative; overflow: hidden; }
.project::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at 100% 0%, rgba(167, 139, 250, .16), transparent 60%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.project:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--glow), var(--shadow); }
.project:hover::before { opacity: 1; }

.project-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.project-head img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  padding: 9px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.mission-id { font-size: .72rem; color: var(--muted); letter-spacing: .1em; margin-right: auto; }
.repo-link {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.1rem;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: color .2s, border-color .2s;
}
.project:hover .repo-link { color: var(--cyan); border-color: var(--cyan); }
/* Whole card is clickable via the repo link */
.repo-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }

.project h3 { font-size: 1.3rem; margin-bottom: 10px; }
.project p { color: var(--muted); font-size: .97rem; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 4px 0 0; }
.tags li {
  font-size: .72rem;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--violet);
  background: rgba(167, 139, 250, .12);
  border: 1px solid rgba(167, 139, 250, .2);
}

.more { margin-top: 34px; text-align: center; }
.link-arrow { font-weight: 600; color: var(--cyan); }
.link-arrow:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Contact */
.contact {
  position: relative;
  overflow: hidden;
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
  padding: 64px 40px;
  background:
    radial-gradient(circle at 50% 0%, rgba(124, 58, 237, .25), transparent 60%),
    var(--surface);
}
.contact .section-title { margin-bottom: 18px; }
.contact p:not(.kicker) { color: var(--muted); max-width: 54ch; margin: 0 auto 30px; }
.contact > *:not(.contact-moon) { position: relative; }
.contact-moon {
  position: absolute;
  width: 220px;
  height: 220px;
  right: -70px;
  top: -80px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f5f3ff, #a5a1c9 50%, #3a3760);
  box-shadow: inset -18px -14px 40px rgba(20, 16, 60, .8), 0 0 80px rgba(196, 181, 253, .3);
  opacity: .5;
}

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 28px 0; font-size: .8rem; background: rgba(5, 6, 15, .6); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.footer p { margin: 0; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s ease, transform .8s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { min-height: 0; padding: 64px 0 90px; }
  .hero-grid, .about-grid { grid-template-columns: 1fr; gap: 48px; }
  .scene { max-width: 360px; margin: 0 auto; }
  .skills-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .nav-links { display: none; }
  .projects-grid { grid-template-columns: 1fr; }
  .section { padding: 80px 0; }
  .card { padding: 22px; }
  .contact { padding: 48px 22px; }
  .code { font-size: .76rem; }
  .scene { max-width: 290px; }
  .avatar-ring { width: 88px; height: 88px; }
}
