:root {
  --bg: #0b0f14;
  --bg-elev: #111720;
  --bg-elev-2: #161e29;
  --border: #223041;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 14px;
  --mono: "Fira Code", ui-monospace, SFMono-Regular, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f9fc;
  --bg-elev: #ffffff;
  --bg-elev-2: #eef2f7;
  --border: #d9e1ec;
  --text: #0f1722;
  --muted: #5a6b80;
  --accent: #0284c7;
  --accent-2: #7c3aed;
  --danger: #dc2626;
  --ok: #16a34a;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: .25;
  mask-image: radial-gradient(ellipse at top, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at top, #000 20%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.accent { color: var(--accent); }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 32px; } }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { font-family: var(--mono); font-weight: 600; color: var(--text); }
.logo:hover { text-decoration: none; }
.prompt { color: var(--accent); }
nav { margin-left: auto; }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  font-family: var(--mono); font-size: 14px; color: var(--muted);
  padding: 6px 10px; border-radius: 8px;
}
.nav-links a:hover { color: var(--text); background: var(--bg-elev-2); text-decoration: none; }
@media (max-width: 560px) { .nav-links { display: none; } }

.theme-toggle {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }
.icon-sun { display: none; }
:root[data-theme="light"] .icon-sun { display: block; }
:root[data-theme="light"] .icon-moon { display: none; }

/* HERO */
.hero {
  display: grid; gap: 40px; align-items: center;
  padding-top: 72px; padding-bottom: 72px;
}
@media (min-width: 880px) {
  .hero { grid-template-columns: 1.4fr 1fr; padding-top: 112px; padding-bottom: 112px; }
}
.eyebrow { color: var(--accent); font-size: 14px; margin: 0 0 12px; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); line-height: 1.1; margin: 0 0 16px; letter-spacing: -.02em; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 52ch; margin: 0 0 28px; }

.terminal {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; max-width: 560px;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.5);
}
.terminal-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px; background: var(--bg-elev-2); border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.red { background: #ff5f57; } .dot.yellow { background: #febc2e; } .dot.green { background: #28c840; }
.terminal-title { margin-left: 10px; font-size: 12px; color: var(--muted); }
.terminal-body { padding: 16px 18px; font-size: 15px; min-height: 56px; }
.t-prompt { color: var(--ok); }
.cursor { color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; transition: transform .15s, background .2s, border-color .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #04121c; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--bg-elev); }
.btn-ghost:hover { border-color: var(--accent); }

.hero-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 24px;
}
.avatar {
  width: 160px; height: 160px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 18%, transparent);
  background: var(--bg-elev-2);
}
.facts { width: 100%; margin: 0; font-size: 14px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }
.pulse {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  margin-right: 4px; vertical-align: middle; animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* SECTIONS */
.section { padding-top: 64px; padding-bottom: 64px; }
.section-title { font-size: clamp(1.6rem, 3vw, 2rem); margin: 0 0 32px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 12px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); max-width: 280px; transform: translateY(-6px); }
.num { color: var(--accent); font-size: .7em; font-weight: 500; }

.split { display: grid; gap: 20px; }
@media (min-width: 760px) { .split { grid-template-columns: 1fr 1fr; } }
.split-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; position: relative; overflow: hidden;
}
.split-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; }
.split-card.day::before { background: var(--danger); }
.split-card.night::before { background: var(--accent-2); }
.split-card .label { font-size: 13px; margin: 0 0 8px; }
.split-card.day .label { color: var(--danger); }
.split-card.night .label { color: var(--accent-2); }
.split-card h3 { margin: 0 0 10px; font-size: 1.2rem; }
.split-card p:last-child { margin: 0; color: var(--muted); }
.about-note { color: var(--muted); margin-top: 24px; }

.stack-grid { display: grid; gap: 20px; }
@media (min-width: 760px) { .stack-grid { grid-template-columns: repeat(3, 1fr); } }
.stack-group { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.stack-group h3 { margin: 0 0 16px; font-size: 15px; color: var(--accent); font-weight: 500; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-family: var(--mono); font-size: 13px; padding: 5px 11px; border-radius: 999px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  transition: border-color .2s, color .2s;
}
.chips li:hover { border-color: var(--accent); color: var(--accent); }

/* PROJECTS */
.projects-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 24px; }
.projects-head .section-title { margin-bottom: 24px; }
.filters { display: flex; gap: 4px; padding: 4px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 24px; }
.filter {
  font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 7px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.filter:hover { color: var(--text); }
.filter.active { background: var(--bg-elev-2); color: var(--accent); }

.projects-grid { display: grid; gap: 20px; }
@media (min-width: 640px) { .projects-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .projects-grid { grid-template-columns: repeat(3, 1fr); } }
.project {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; color: var(--text);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.project:hover {
  text-decoration: none; transform: translateY(-3px); border-color: var(--accent);
  box-shadow: 0 16px 40px -20px color-mix(in srgb, var(--accent) 50%, transparent);
}
.project-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.project h3 { margin: 0; font-size: 1.05rem; font-family: var(--mono); font-weight: 600; word-break: break-word; }
.project p { margin: 0; color: var(--muted); font-size: 14.5px; flex: 1; }
.project-meta { display: flex; flex-wrap: wrap; gap: 14px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.lang-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.tag-fork { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }
.projects-foot { font-size: 13px; color: var(--muted); margin-top: 24px; }
.skeleton { min-height: 160px; background: linear-gradient(90deg, var(--bg-elev) 0%, var(--bg-elev-2) 50%, var(--bg-elev) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); border: 1px solid var(--border); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* CONTACT */
.contact-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center;
}
.contact-card p { color: var(--muted); max-width: 52ch; margin: 0 auto 24px; font-size: 1.05rem; }
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 20px; }
.social { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.social:hover { color: var(--accent); }

.footer { padding-top: 32px; padding-bottom: 48px; border-top: 1px solid var(--border); text-align: center; font-size: 13px; }
.footer p { margin: 6px 0; }

/* REVEAL */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .cursor, .pulse, .skeleton { animation: none; }
}
