:root {
  --bg: #0b1020;
  --bg-2: #101730;
  --accent: #7dd3fc;
  --accent-2: #a5b4fc;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.09);
  --glass: rgba(16, 23, 48, 0.55);
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: radial-gradient(1200px 800px at 20% -10%, #1b2a5e 0%, transparent 55%),
              radial-gradient(900px 700px at 100% 10%, #0f1d3f 0%, transparent 50%),
              linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
code { font-family: var(--font-mono); font-size: 0.92em; }

::selection { background: rgba(125, 211, 252, 0.3); }

[hidden] { display: none !important; }

/* ---------- navbar ---------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: rgba(11, 16, 32, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.3px;
}
.brand b { color: var(--accent); font-weight: 700; }
.brand-icon {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(125,211,252,0.18), rgba(165,180,252,0.18));
  border: 1px solid rgba(125, 211, 252, 0.3);
  font-size: 1.15rem;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.nav-link.active { color: var(--accent); background: rgba(125,211,252,0.12); }
.nav-link .nf { font-size: 1.05rem; }

.nav-cta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  color: #0b1020;
  background: var(--accent);
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(125,211,252,0.35); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 7rem 1.25rem 3rem;
  text-align: center;
}

.hero-glow {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: 520px; height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(125,211,252,0.16), transparent 60%);
  filter: blur(10px);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 2; max-width: 720px; }

.hero-avatar-wrap {
  position: relative;
  width: 140px; height: 140px;
  margin: 0 auto 1.4rem;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), transparent 70%);
  box-shadow: 0 0 40px rgba(125,211,252,0.35);
}
.hero-avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--bg-2);
}
.avatar-status {
  position: absolute;
  bottom: 4px; right: 4px;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--bg-2);
  border: 2px solid var(--accent);
  font-size: 1rem;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 0.9rem;
}
.hero-kicker .nf { font-size: 0.9rem; }

.hero-name {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.8rem;
}
.cursor {
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-bio {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 560px;
  margin: 0 auto 1rem;
  min-height: 1.6em;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 2.2rem;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 0.4rem; }
.hero-meta .nf { color: var(--accent); }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.stat-card {
  min-width: 150px;
  padding: 1rem 1.4rem;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: transform 0.25s, border-color 0.25s;
}
.stat-card:hover { transform: translateY(-4px); border-color: rgba(125,211,252,0.4); }
.stat-card .nf { color: var(--accent); font-size: 1.25rem; margin-bottom: 0.15rem; }
.stat-num { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--muted); font-family: var(--font-mono); }

/* ---------- sections ---------- */
.section {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3.5rem 1.25rem 4.5rem;
  scroll-margin-top: 62px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.section-head h2 {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.section-head h2 .nf { color: var(--accent); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.icon-btn:hover { color: var(--accent); border-color: rgba(125,211,252,0.4); transform: rotate(90deg); }

/* ---------- terminal / readme ---------- */
.terminal-card {
  border-radius: 16px;
  overflow: hidden;
  background: var(--glass);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--card-border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #f87171; }
.dot.yellow { background: #fbbf24; }
.dot.green { background: #34d399; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  margin-left: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.terminal-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  background: rgba(125,211,252,0.12);
  border: 1px solid rgba(125,211,252,0.25);
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

.terminal-body {
  padding: 1.4rem 1.6rem;
}

/* rendered markdown */
.markdown-body { color: var(--text); font-size: 0.98rem; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 { margin: 1.4em 0 0.6em; line-height: 1.25; color: #fff; }
.markdown-body h1 { font-size: 1.7em; border-bottom: 1px solid var(--card-border); padding-bottom: 0.35em; }
.markdown-body h2 { font-size: 1.35em; border-bottom: 1px solid var(--card-border); padding-bottom: 0.3em; }
.markdown-body h3 { font-size: 1.15em; }
.markdown-body p { margin: 0.7em 0; }
.markdown-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.markdown-body strong { color: #fff; }
.markdown-body img { max-width: 100%; border-radius: 10px; }
.markdown-body ul, .markdown-body ol { margin: 0.7em 0; padding-left: 1.5em; }
.markdown-body li { margin: 0.3em 0; }
.markdown-body blockquote {
  margin: 1em 0;
  padding: 0.6em 1em;
  border-left: 3px solid var(--accent);
  background: rgba(125,211,252,0.07);
  border-radius: 0 10px 10px 0;
  color: var(--muted);
}
.markdown-body pre {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1em 0;
}
.markdown-body pre code { font-family: var(--font-mono); font-size: 0.88rem; color: #cbd5e1; background: none; padding: 0; }
.markdown-body code {
  font-family: var(--font-mono);
  background: rgba(125,211,252,0.1);
  color: var(--accent);
  padding: 0.15em 0.4em;
  border-radius: 6px;
  font-size: 0.88em;
}
.markdown-body table { border-collapse: collapse; margin: 1em 0; width: 100%; }
.markdown-body th, .markdown-body td { border: 1px solid var(--card-border); padding: 0.5em 0.8em; }
.markdown-body th { background: rgba(255,255,255,0.05); color: #fff; }
.markdown-body hr { border: 0; border-top: 1px solid var(--card-border); margin: 1.6em 0; }
.markdown-body br + br { display: none; }

/* ---------- repos ---------- */
.repo-count {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 0.3rem 0.8rem;
  border-radius: 99px;
}

.repo-toolbar {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--muted);
}
.search-box:focus-within { border-color: rgba(125,211,252,0.5); }
.search-box input {
  flex: 1;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.sort-select {
  padding: 0.6rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
}
.sort-select option { background: var(--bg-2); }

.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.1rem;
}

.repo-card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.2rem 1.3rem;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.repo-card:hover {
  transform: translateY(-4px);
  border-color: rgba(125,211,252,0.4);
  box-shadow: 0 14px 40px rgba(0,0,0,0.4);
}

.repo-card-top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.repo-card-top .repo-icon { color: var(--accent); font-size: 1.05rem; }
.repo-name {
  font-weight: 600;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.02rem;
}
.repo-name:hover { text-decoration: underline; text-underline-offset: 3px; }

.repo-desc {
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.repo-desc:empty::before { content: "no description provided"; font-style: italic; opacity: 0.6; }

.repo-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.topic {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-2);
  background: rgba(165,180,252,0.1);
  border: 1px solid rgba(165,180,252,0.25);
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
}

.repo-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: auto;
  padding-top: 0.6rem;
  border-top: 1px solid var(--card-border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.repo-meta .nf { color: var(--accent); }
.repo-meta > span { display: inline-flex; align-items: center; gap: 0.35rem; }
.repo-lang { margin-left: auto; }
.repo-lang i { margin-right: 0.3rem; }

.lang-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.3rem;
}

/* ---------- states ---------- */
.loading, .error, .empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2.4rem 1rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border-radius: 16px;
  background: var(--card);
  border: 1px dashed var(--card-border);
}
.error { color: #fca5a5; border-color: rgba(248,113,113,0.4); }

#repoLoading, #repoError, #repoEmpty { margin: 1.25rem 0 1.1rem; }

.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- footer ---------- */
footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2.5rem 1.25rem 3rem;
  border-top: 1px solid var(--card-border);
  color: var(--muted);
  font-size: 0.9rem;
}
footer .nf { color: var(--accent); }
footer a { color: var(--accent); }
.footer-sub { font-family: var(--font-mono); font-size: 0.78rem; margin-top: 0.3rem; opacity: 0.7; }

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #26355e; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #33487c; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: 62px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem 1.25rem 1.1rem;
    background: rgba(11, 16, 32, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--card-border);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; visibility: visible; }

  .nav-link, .nav-cta { padding: 0.7rem 0.9rem; }
  .nav-cta { justify-content: center; margin-left: 0; }

  .hero-stats { width: 100%; }
  .stat-card { flex: 1; min-width: 120px; }
  .terminal-body { padding: 1.1rem 1.2rem; }
  .hero-meta { font-size: 0.78rem; gap: 0.4rem 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}