/* === Brand Tokens === */
:root {
  --brand: #0061a7;
  --brand-light: #e8f2fb;
  --brand-dark: #004a80;
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --surface: #ffffff;
  --border: #d8dee4;
  --border-light: #e8ecf0;
  --text: #1f2937;
  --text-muted: #586069;
  --text-light: #8b949e;
  --link: #0061a7;
  --link-hover: #004a80;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg-alt);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

/* === Top Navigation === */
.topnav {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}

.nav-brand:hover { color: var(--brand); }

.nav-links {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
}

.nav-links a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--brand); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  margin-left: auto;
}

/* === Hero === */
.hero {
  background: linear-gradient(135deg, #0061a7 0%, #004a80 100%);
  color: #fff;
  padding: 3rem 1.5rem 2.5rem;
}

.hero-inner {
  max-width: 1280px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 1.05rem;
  opacity: 0.9;
  max-width: 640px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 1.5rem;
}

.stat { display: flex; flex-direction: column; }

.stat-num {
  font-size: 1.75rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

/* === Toolbar === */
.toolbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 56px;
  z-index: 100;
}

.toolbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-box {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box:focus { border-color: var(--brand); }

.search-box::placeholder { color: var(--text-light); }

.result-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* === Content Layout === */
.content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  width: 100%;
  flex: 1;
}

/* === Sidebar === */
.sidebar-heading {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.sidebar-section {
  margin-top: 1.5rem;
}

#tag-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tag-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.35rem 0.6rem;
  background: none;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.84rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s;
}

.tag-btn:hover { background: var(--brand-light); }

.tag-btn.active {
  background: var(--brand);
  color: #fff;
}

.tag-btn.active .tag-count {
  color: rgba(255,255,255,0.8);
}

.tag-count {
  font-size: 0.75rem;
  color: var(--text-light);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.sidebar-link:hover { color: var(--brand); }

/* === Repo Grid === */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.75rem;
}

.repo-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.repo-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.repo-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.repo-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--brand);
  line-height: 1.3;
}

.repo-name:hover { color: var(--brand-dark); text-decoration: underline; }

.repo-gh {
  color: var(--text-light);
  flex-shrink: 0;
  margin-top: 2px;
}

.repo-gh:hover { color: var(--text); }

.repo-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

.repo-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.repo-tag {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.18rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
}

.repo-tag:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.repo-tag.active {
  background: var(--brand-light);
  border-color: var(--brand);
  color: var(--brand);
}

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* === Footer === */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-sep { margin: 0 0.5rem; }

/* === About Page === */
.page {
  max-width: 780px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  flex: 1;
}

.page h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.page h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.page p {
  margin-bottom: 1rem;
  color: var(--text-muted);
  line-height: 1.75;
}

.page img {
  width: 100%;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}

.page ul {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  color: var(--text-muted);
  line-height: 1.75;
}

.page a { font-weight: 500; }

.page blockquote {
  border-left: 3px solid var(--brand);
  padding: 0.75rem 1rem;
  margin: 1.5rem 0;
  background: var(--brand-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
  font-style: italic;
}

/* === Responsive === */
@media (max-width: 860px) {
  .content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .sidebar-heading { width: 100%; }

  #tag-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .tag-btn {
    width: auto;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 0.78rem;
  }

  .tag-btn.active {
    border-color: var(--brand);
  }

  .sidebar-section {
    margin-top: 0.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
  }

  .sidebar-section .sidebar-heading { display: none; }

  .repo-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.75rem 1.5rem;
    gap: 0.75rem;
  }

  .nav-links.open { display: flex; }

  .nav-toggle { display: block; }

  .hero { padding: 2rem 1rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.95rem; }
  .content { padding: 1rem; }
  .page { padding: 1.5rem 1rem; }
}
