:root {
  --bg: #07090d;
  --surface: rgba(20, 26, 35, .62);
  --surface-solid: #11161e;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #e8edf3;
  --muted: #8d99a6;
  --accent: #34d399;
  --accent-2: #22d3ee;
  --accent-ink: #04130d;
  --accent-soft: rgba(52, 211, 153, .12);
  --glow-1: rgba(52, 211, 153, .18);
  --glow-2: rgba(34, 211, 238, .12);
  --grid-line: rgba(255, 255, 255, .035);
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .6);
  --l0: #161b22;
  --l1: #0e4429;
  --l2: #006d32;
  --l3: #26a641;
  --l4: #39d353;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f9fb;
    --surface: rgba(255, 255, 255, .78);
    --surface-solid: #ffffff;
    --border: rgba(15, 23, 42, .08);
    --border-strong: rgba(15, 23, 42, .16);
    --text: #0f172a;
    --muted: #5b6676;
    --accent: #059669;
    --accent-2: #0891b2;
    --accent-ink: #ffffff;
    --accent-soft: rgba(5, 150, 105, .1);
    --glow-1: rgba(16, 185, 129, .16);
    --glow-2: rgba(6, 182, 212, .12);
    --grid-line: rgba(15, 23, 42, .045);
    --shadow: 0 20px 40px -24px rgba(15, 23, 42, .25);
    --l0: #ebedf0;
    --l1: #9be9a8;
    --l2: #40c463;
    --l3: #30a14e;
    --l4: #216e39;
    color-scheme: light;
  }
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; text-decoration: none; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* Ambient background: soft glows over a faint grid */
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 400px at 15% -5%, var(--glow-1), transparent 70%),
    radial-gradient(700px 500px at 90% 10%, var(--glow-2), transparent 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 48px 48px;
  mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 90%);
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-weight: 800; letter-spacing: -.03em; font-size: 18px; }
.logo span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav nav { display: flex; align-items: center; gap: 26px; font-size: 14px; color: var(--muted); }
.nav nav a { transition: color .15s; }
.nav nav a:hover { color: var(--text); }
.nav .nav-cta {
  color: var(--text); padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong);
}
.nav .nav-cta:hover { border-color: var(--accent); }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 48px;
  padding-top: 104px; padding-bottom: 88px;
}
.status {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  padding: 6px 14px 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  margin-bottom: 22px;
}
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--accent); animation: pulse 2s ease-out infinite;
}
@keyframes pulse { to { transform: scale(3); opacity: 0; } }

h1 {
  font-size: clamp(46px, 8.5vw, 84px); line-height: 1; letter-spacing: -.045em; font-weight: 800;
  background: linear-gradient(180deg, var(--text) 30%, color-mix(in srgb, var(--text) 55%, transparent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: 6px;
}
.lead { font-size: 19px; color: var(--muted); max-width: 560px; margin-top: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.hero-photo .ring {
  position: relative; width: 240px; height: 240px; border-radius: 50%; padding: 3px;
  background: conic-gradient(from 140deg, var(--accent), var(--accent-2), transparent 60%, var(--accent));
  box-shadow: 0 0 80px -10px var(--glow-1);
}
.hero-photo img {
  display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 6px solid var(--bg);
}

.stats {
  display: flex; flex-wrap: wrap; gap: 14px 40px; margin-top: 48px;
  padding-top: 26px; border-top: 1px solid var(--border);
}
.stats dt { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stats dd { margin: 0; font-size: 13px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 15px; font-weight: 500;
  backdrop-filter: blur(8px);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: var(--accent-ink); font-weight: 600;
  box-shadow: 0 10px 30px -10px var(--accent);
}
.btn.primary:hover { box-shadow: 0 14px 36px -10px var(--accent); }
.btn.big { font-size: 18px; padding: 15px 26px; border-radius: 14px; }

/* Sections */
.section { padding-top: 72px; padding-bottom: 40px; }
.section-title {
  display: flex; align-items: center; gap: 14px;
  font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-bottom: 32px;
}
.section-title .mono {
  font-size: 13px; font-weight: 500; color: var(--accent);
  padding: 3px 9px; border-radius: 8px; background: var(--accent-soft);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }
.section-title.center { justify-content: center; }
.section-title.center::after { display: none; }
.section-lead { color: var(--muted); max-width: 640px; margin: -14px 0 26px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  backdrop-filter: blur(10px);
}

/* About */
.about { display: grid; grid-template-columns: 1.5fr 1fr; gap: 44px; }
.about p { color: var(--muted); margin-bottom: 14px; }
a.inline { color: var(--accent); }
a.inline:hover { text-decoration: underline; }

.sub { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 30px 0 14px; }
.timeline { list-style: none; padding: 0; border-left: 1px solid var(--border-strong); }
.timeline li { padding: 0 0 18px 20px; position: relative; }
.timeline li:last-child { padding-bottom: 2px; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 8px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--muted);
}
.timeline li.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline strong { display: block; font-weight: 600; }
.timeline span { font-size: 14px; color: var(--muted); }

.stack { padding: 24px; align-self: start; display: grid; gap: 20px; box-shadow: var(--shadow); }
.stack-group h3 {
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin-bottom: 10px;
}
.stack-group + .stack-group { padding-top: 20px; border-top: 1px solid var(--border); }
.skills { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.skills li {
  font-size: 13px; font-weight: 500; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-solid);
  transition: border-color .15s, color .15s;
}
.skills li:hover { border-color: var(--accent); color: var(--accent); }

/* Works */
.filters {
  display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 22px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.filters button {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--muted);
  background: none; border: 0; padding: 7px 14px; border-radius: 9px; cursor: pointer;
  transition: color .15s, background .15s;
}
.filters button:hover { color: var(--text); }
.filters button.active { background: var(--surface-solid); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.project {
  position: relative; overflow: hidden;
  padding: 22px; display: flex; flex-direction: column; gap: 10px;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.project::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0; transition: opacity .25s;
}
.project:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.project:hover::before { opacity: 1; }
.project h3 { font-size: 18px; letter-spacing: -.015em; }
.project p { color: var(--muted); font-size: 14px; flex: 1; }
.project .kind { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.project.trade .kind { color: var(--accent-2); }
.project .tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.project .tags li { font-size: 12px; color: var(--muted); padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; }
.project.hidden { display: none; }

/* Activity */
.activity { padding: 22px; box-shadow: var(--shadow); }
.activity-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; font-size: 14px; }
.activity-head a { color: var(--muted); }
.activity-head a:hover { color: var(--accent); }
#contrib-total strong { color: var(--accent); font-size: 18px; }
.snapshot { display: block; width: 100%; height: auto; border-radius: 10px; background: #fff; }
/* The screenshot is GitHub's light theme; flip it to match the dark page. */
@media (prefers-color-scheme: dark) {
  .snapshot { filter: invert(.92) hue-rotate(180deg) saturate(1.3); }
}
.note { font-size: 13px; color: var(--muted); margin-top: 12px; }
.heatmap-scroll { overflow-x: auto; padding-bottom: 6px; }
.heatmap {
  display: grid; grid-auto-flow: column;
  grid-template-rows: repeat(7, 11px); grid-auto-columns: 11px; gap: 3px;
  width: max-content;
}
.heatmap i, .legend i { display: block; width: 11px; height: 11px; border-radius: 2px; }
.l0 { background: var(--l0); } .l1 { background: var(--l1); } .l2 { background: var(--l2); }
.l3 { background: var(--l3); } .l4 { background: var(--l4); }
.legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 10px; }

/* Contact */
.contact {
  position: relative; overflow: hidden; text-align: center;
  padding: 56px 24px; margin-bottom: 40px;
}
.contact::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(500px 220px at 50% 0%, var(--glow-1), transparent 70%);
}
.contact p { color: var(--muted); margin: -12px 0 28px; font-size: 17px; }
.socials { display: flex; justify-content: center; gap: 28px; margin-top: 26px; color: var(--muted); font-size: 15px; }
.socials a:hover { color: var(--accent); }

.footer { border-top: 1px solid var(--border); padding: 28px 20px; font-size: 13px; color: var(--muted); text-align: center; max-width: none; }

/* Scroll reveal (enabled by script.js) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }

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

@media (max-width: 760px) {
  .nav nav { gap: 14px; font-size: 13px; }
  .nav nav a:nth-child(1) { display: none; }
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 56px; padding-bottom: 56px; }
  .hero-photo { order: -1; }
  .hero-photo .ring { width: 128px; height: 128px; }
  .hero-photo img { border-width: 4px; }
  .stats { gap: 14px 28px; }
  .about { grid-template-columns: 1fr; gap: 28px; }
  .section-title { font-size: 25px; }
  .filters { display: flex; overflow-x: auto; }
  .filters button { white-space: nowrap; }
}
