/* CodaLM SAE — Clean academic theme, data-rich, mobile-first */

* { box-sizing: border-box; }

body {
  font-family: -apple-system, system-ui, 'Segoe UI', sans-serif;
  line-height: 1.5;
  color: #111;
  background: #fff;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* Typography */
h1 {
  font-family: 'Times New Roman', Times, serif;
  font-size: 2em;
  font-weight: normal;
  margin-bottom: 0.15em;
  line-height: 1.15;
}
h2 {
  font-size: 1.05em;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.3em;
}
h3 {
  font-size: 0.92em;
  font-weight: 600;
  margin-top: 1.2em;
  margin-bottom: 0.3em;
}
p { margin-bottom: 0.7em; font-size: 0.92em; }
.subtitle {
  font-family: 'Times New Roman', Times, serif;
  font-size: 1.05em;
  color: #555;
  font-style: italic;
  margin-bottom: 1.2em;
}

/* Links */
a { color: #111; text-decoration: none; border-bottom: 1px solid #ccc; }
a:hover { border-bottom-color: #111; }
.back-link {
  display: inline-block;
  margin-bottom: 0.8em;
  font-size: 0.85em;
  color: #888;
  border-bottom-color: #ddd;
}
.back-link:hover { color: #111; border-bottom-color: #111; }

/* Dividers */
hr { border: none; border-top: 1px solid #eee; margin: 1.8em 0; }

/* Stats inline */
.stats { font-size: 0.85em; color: #666; margin-bottom: 0.8em; }
.stats strong { color: #111; }

/* ========== SECTION CARDS ========== */
.section-card {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1.1em 1.3em;
  margin-bottom: 0.8em;
}
.section-card h2 { margin-top: 0; margin-bottom: 0.2em; }
.section-card .section-desc {
  color: #777;
  font-size: 0.84em;
  margin-bottom: 0.6em;
}

/* ========== GRIDS ========== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5em;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5em;
}

/* ========== CARDS ========== */
.card {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 0.8em 0.9em;
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
  display: block;
  color: inherit;
}
.card:hover {
  border-color: #bbb;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
a.card, a.card:hover { border-bottom: none; }

/* Grid card (vertical layout) */
.grid-card-name {
  font-size: 0.95em;
  font-weight: 700;
  margin-bottom: 0.25em;
  line-height: 1.3;
}
.grid-card-desc {
  font-size: 0.78em;
  color: #666;
  line-height: 1.35;
  margin-bottom: 0.4em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.grid-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  font-size: 0.76em;
  color: #888;
  align-items: center;
}
.grid-card-meta strong { color: #333; }

/* Type border */
.type-universal { border-left: 3px solid #4caf50; }
.type-clan-specific { border-left: 3px solid #e57373; }
.type-intermediate { border-left: 3px solid #ddd; }

/* ========== BADGES ========== */
.badge {
  display: inline-block;
  font-size: 0.72em;
  font-weight: 500;
  padding: 0.12em 0.4em;
  border-radius: 3px;
  vertical-align: middle;
}
.badge-universal { background: #e8f5e9; color: #2e7d32; }
.badge-clan { background: #ffebee; color: #c62828; }
.badge-intermediate { background: #f0f0f0; color: #999; }
.badge-novel { background: #f3e5f5; color: #7b1fa2; }

/* ========== BARS ========== */
.rate-bar {
  width: 100%;
  height: 3px;
  background: #eee;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.35em;
}
.rate-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: #aaa;
}
.activation-bar {
  height: 3px;
  background: #eee;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.2em;
}
.activation-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: #5b8def;
}

/* ========== STAT GRID ========== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5em;
  margin-bottom: 1.2em;
}
.stat-item {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 0.5em 0.4em;
  text-align: center;
}
.stat-value {
  font-size: 1.25em;
  font-weight: 700;
  display: block;
  line-height: 1.2;
}
.stat-label {
  font-size: 0.68em;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.1em;
}

/* ========== CONTROLS ========== */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  align-items: center;
  margin-bottom: 0.6em;
  font-size: 0.82em;
}
.controls label { color: #666; }
.controls select {
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #111;
}

/* Charts */
.chart-wrap { max-width: 100%; margin: 0.5em 0 0.5em; }

/* ========== CODA TOKENS ========== */
.coda-seq { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.coda-token {
  display: inline-block;
  font-size: 0.68em;
  font-weight: 500;
  padding: 0.12em 0.35em;
  border-radius: 3px;
  line-height: 1.3;
}

/* ========== EXAMPLE ROWS ========== */
.example-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6em;
  padding: 0.5em 0;
  border-bottom: 1px solid #f0f0f0;
}
.example-card:last-child { border-bottom: none; }
.example-clan {
  font-weight: 700;
  min-width: 30px;
  font-size: 0.82em;
  flex-shrink: 0;
  padding-top: 0.1em;
}
.example-act {
  font-variant-numeric: tabular-nums;
  color: #666;
  min-width: 38px;
  text-align: right;
  font-size: 0.82em;
  flex-shrink: 0;
}
.example-seq { flex: 1; min-width: 0; }

/* ========== CLIP ROWS ========== */
.clip-row {
  display: grid;
  grid-template-columns: 2em 1fr auto;
  gap: 0.5em;
  align-items: center;
  padding: 0.55em 0;
  border-bottom: 1px solid #f0f0f0;
}
.clip-row:last-child { border-bottom: none; }
.clip-rank { font-size: 0.78em; color: #bbb; font-weight: 600; text-align: right; }
.clip-info { min-width: 0; }
.clip-name { font-weight: 600; font-size: 0.88em; }
.clip-meta {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.76em;
  color: #888;
}
.clip-audio { flex-shrink: 0; }
.clip-audio audio { width: 200px; }

/* ========== PROPERTY LIST ========== */
.prop-item {
  display: flex;
  justify-content: space-between;
  padding: 0.35em 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.88em;
}
.prop-item:last-child { border-bottom: none; }
.prop-label { color: #666; }
.prop-value { font-weight: 600; color: #5b8def; }

/* ========== CLAN CHIPS ========== */
.clan-list { display: flex; flex-wrap: wrap; gap: 0.3em; margin-bottom: 0.8em; }
.clan-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  padding: 0.2em 0.55em;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.82em;
  transition: border-color 0.15s;
}
a.clan-chip { border-bottom: none; }
a.clan-chip:hover { border-color: #999; }
.clan-chip strong { font-size: 0.88em; }
.clan-chip .clan-count { color: #aaa; font-size: 0.78em; }

/* ========== HOMEPAGE ========== */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5em;
  margin: 1.2em 0 1.8em;
}
.hero-stat {
  text-align: center;
  padding: 0.7em 0.3em;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 6px;
}
.hero-stat-value {
  font-size: 1.4em;
  font-weight: 700;
  display: block;
  line-height: 1.15;
}
.hero-stat-label {
  font-size: 0.68em;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 1.5em;
  margin-bottom: 0.3em;
}
.section-header h2 { margin: 0; }
.section-header a { font-size: 0.82em; color: #888; }
.section-header a:hover { color: #111; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5em;
  margin-top: 0.5em;
}
.result-card {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 0.7em 0.9em;
}
.result-card strong {
  display: block;
  margin-bottom: 0.15em;
  font-size: 0.88em;
}
.result-card p {
  font-size: 0.78em;
  color: #666;
  margin: 0;
  line-height: 1.35;
}

/* ========== MISC ========== */
.load-more-btn {
  font-size: 0.82em;
  padding: 0.45em 1.8em;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  color: #444;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.load-more-btn:hover { border-color: #999; background: #f5f5f5; }

.showing-count { font-size: 0.78em; color: #aaa; margin-bottom: 0.4em; }
.section-desc { font-size: 0.85em; color: #777; margin-bottom: 0.6em; }
.muted { color: #999; font-size: 0.85em; }

footer {
  margin-top: 2.5em;
  padding-top: 1em;
  border-top: 1px solid #eee;
  font-size: 0.82em;
  color: #bbb;
  text-align: center;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .results-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .clip-audio audio { width: 180px; }
}
@media (max-width: 480px) {
  .container { padding: 20px 14px 40px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .controls { flex-direction: column; align-items: stretch; }
  .clip-row { grid-template-columns: 1fr; gap: 0.2em; }
  .clip-rank { display: none; }
  .clip-audio { width: 100%; }
  .clip-audio audio { width: 100%; }
  .example-card { flex-direction: column; gap: 0.3em; }
  .section-card { padding: 0.8em 1em; }
  h1 { font-size: 1.6em; }
}
