*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #7d8590;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
  --blue: #58a6ff;
  --asr-pending: #484f58;
  --font-mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

/* ── Header ──────────────────────────── */
header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.logo {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tagline { color: var(--muted); font-size: 0.875rem; flex: 1; }
.gh-link { color: var(--muted); font-size: 0.8rem; }
.gh-link:hover { color: var(--text); }

/* ── Hero stats ──────────────────────── */
.hero-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.stat-chip {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.875rem 1.5rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 110px;
}
.stat-chip--pending {
  border-style: dashed;
  opacity: 0.55;
  cursor: help;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}
.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Charts ──────────────────────────── */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.chart-card h3 {
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.chart-card canvas { max-height: 180px; }

/* ── Filter bar ──────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.search-input,
.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
}
.search-input { flex: 1; min-width: 220px; }
.search-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}
.result-count {
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: auto;
  font-family: var(--font-mono);
}

/* ── Table ───────────────────────────── */
.table-section { overflow-x: auto; margin-bottom: 2.5rem; }

.model-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  table-layout: fixed;
}

/* Column widths */
.col-name      { width: 200px; }
.col-desc      { width: 260px; }
.col-tags      { width: 200px; }
.col-license   { width: 110px; }
.col-source    { width: 72px; }
.col-downloads { width: 90px; }
.col-updated   { width: 90px; }
.col-trust     { width: 120px; }
.col-asr       { width: 64px; }

.model-table th {
  text-align: left;
  padding: 0.625rem 0.875rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: 0 1px 0 var(--border);
  font-weight: 600;
  white-space: nowrap;
}
.model-table td {
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.model-table tr:hover td { background: rgba(255,255,255,0.03); }

/* Name cell */
.name-cell {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}
.model-link { color: var(--blue); word-break: break-all; }
.model-link:hover { text-decoration: underline; }

/* Description */
.desc-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  max-height: calc(1.45em * 2);
}

/* Tags */
.tags-inner {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}
.tag-chip {
  background: #1c2128;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.67rem;
  padding: 0.1rem 0.4rem;
  font-family: var(--font-mono);
  color: var(--muted);
  white-space: nowrap;
}

/* License badges */
.license-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}
.badge--apache { background: #0d2a1a; color: var(--green); border: 1px solid #1a4a2e; }
.badge--mit    { background: #0c1f3e; color: var(--blue);  border: 1px solid #1a3a6e; }
.badge--other  { background: #2a1f0a; color: var(--amber); border: 1px solid #4a3a18; }
.badge--none   { background: #1c1c1c; color: var(--muted); border: 1px solid var(--border); }

/* Source badge */
.source-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.67rem;
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
}
.source--hf           { background: #1a1f3e; color: #a5b4fc; border: 1px solid #2d3a6e; }
.source--ollama       { background: #1a2a1a; color: #86efac; border: 1px solid #2d4a2d; }
.source--ollama-cloud { background: #1a2530; color: #67e8f9; border: 1px solid #164e63; }
.source--openrouter   { background: #2a1f30; color: #c4b5fd; border: 1px solid #4c1d95; }

/* Downloads */
.downloads-cell {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Updated */
.updated-cell {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Trust dots */
.trust-inner { display: flex; align-items: center; gap: 0.4rem; }
.trust-dots { font-size: 0.85rem; letter-spacing: 0.05em; line-height: 1; }
.dot--filled { color: var(--green); }
.dot--empty  { color: var(--border); }
.trust-num   { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }

/* ASR column */
.asr-col { cursor: help; }
.asr-cell { font-family: var(--font-mono); font-size: 0.8rem; }
.asr-pending { color: var(--asr-pending); }

/* Empty / loading state */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.empty-state--error { color: var(--red); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Corpus benchmark section ────────── */
.corpus-section {
  margin-top: 3rem;
}

.corpus-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.corpus-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.corpus-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
  flex: 1 1 auto;
}

.sort-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text);
}

.sort-btn:hover { background: var(--border); }

.corpus-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.corpus-table th,
.corpus-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.corpus-table th { color: var(--muted); font-weight: 500; }

.col-rank   { width: 2.5rem; }
.col-asr-val { width: 5.5rem; }
.col-n      { width: 5rem; }

.asr-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.asr-tier--high { background: #fde8e8; color: #c0392b; }
.asr-tier--mid  { background: #fef3cd; color: #7a5c00; }
.asr-tier--low  { background: #e8f5e9; color: #2e7d32; }

.classifier-cell {
  font-size: 0.72rem;
  color: var(--muted);
  max-width: 20rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Footer ──────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: center;
  text-align: center;
}
