/* ── skills-sh dashboard ── */
/* Warm light theme — sand/paper palette */

:root {
  --bg-root: #f6f4f0;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f0ece4;
  --bg-input: #f6f4f0;

  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #a8a29e;

  --accent: #b45309;
  --accent-dim: #92400e;
  --blue: #1d4ed8;
  --green: #15803d;
  --yellow: #a16207;
  --red: #dc2626;
  --purple: #7c3aed;

  --border: #e2ded6;
  --border-subtle: #ece8e1;

  --radius: 6px;
  --font-mono: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06);
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ── */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Nav ── */

.topnav {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.topnav-brand {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.topnav-brand span {
  color: var(--text-muted);
  font-weight: 400;
}

.topnav-links {
  display: flex;
  gap: 4px;
}

.topnav-links a {
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.topnav-links a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topnav-links a.active {
  background: var(--accent);
  color: #fff;
}

.topnav-meta {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Page Header ── */

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  margin-bottom: 4px;
}

.page-header h1 {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.page-subtitle a {
  color: var(--blue);
  text-decoration: none;
}

.page-subtitle a:hover {
  text-decoration: underline;
}

.snapshot-date {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  box-shadow: var(--shadow);
}

/* ── Hero Stats ── */

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 28px 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card .stat-value {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ── Toolbar / Filters ── */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar input[type="text"],
.toolbar input[type="search"],
.toolbar select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 8px 12px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color .15s;
}

.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(180,83,9,.1);
}

.toolbar input[type="search"] {
  min-width: 240px;
}

.toolbar select {
  cursor: pointer;
}

.toolbar label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.toolbar .result-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Tables ── */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--bg-root);
  border-bottom: 2px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
}

thead th.sortable {
  cursor: pointer;
}

thead th.sortable:hover {
  color: var(--accent);
}

thead th.sort-asc::after { content: ' \u25B2'; color: var(--accent); }
thead th.sort-desc::after { content: ' \u25BC'; color: var(--accent); }

tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background .1s;
}

tbody tr:hover {
  background: var(--bg-hover);
}

td {
  padding: 10px 14px;
  vertical-align: middle;
}

td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

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

td a:hover {
  text-decoration: underline;
}

/* ── Badges ── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-active {
  background: #dcfce7;
  color: var(--green);
}

.badge-recent {
  background: #fef3c7;
  color: var(--yellow);
}

.badge-stale {
  background: #fee2e2;
  color: var(--red);
}

.risk-warn {
  background: #fef3c7;
  color: var(--yellow);
}

.risk-danger {
  background: #fee2e2;
  color: var(--red);
}

/* ── Cluster badges & notices ── */

.badge-cluster {
  background: #ede9fe;
  color: var(--purple);
}

.cluster-row {
  opacity: 0.55;
}

.cluster-notice {
  background: #ede9fe;
  color: var(--purple);
  border: 1px solid #c4b5fd;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.cluster-notice strong {
  font-weight: 700;
}

/* ── Health Score ── */

.health-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
}

.health-high { color: var(--green); }
.health-mid { color: var(--yellow); }
.health-low { color: var(--red); }

/* ── Section headings ── */

.section-title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.section-title span {
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Charts ── */

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.chart-card h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.chart-card canvas {
  width: 100% !important;
}

/* ── Compare ── */

.compare-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.compare-picker input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 8px 12px;
  min-width: 260px;
  outline: none;
}

.compare-picker input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(180,83,9,.1);
}

.compare-picker .suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.compare-picker .suggestions div {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-subtle);
}

.compare-picker .suggestions div:hover {
  background: var(--bg-hover);
}

.compare-picker .suggestions .sg-name {
  color: var(--text-primary);
  font-weight: 500;
}

.compare-picker .suggestions .sg-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.search-wrapper {
  position: relative;
}

.selected-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selected-skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #dbeafe;
  color: var(--blue);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
}

.selected-skill-tag button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.selected-skill-tag button:hover {
  color: var(--red);
}

.compare-grid {
  display: grid;
  gap: 24px;
}

/* ── Radar Chart ── */

.radar-wrap {
  max-width: 500px;
  margin: 0 auto 32px;
}

/* ── Risk Flags ── */

.risk-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ── Correlation table ── */

.corr-table td:first-child {
  font-weight: 600;
  color: var(--text-secondary);
}

.corr-positive { color: var(--green); }
.corr-negative { color: var(--red); }
.corr-neutral { color: var(--text-muted); }

/* ── Empty / Loading states ── */

.loading {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.loading::after {
  content: '';
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 16px auto 0;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

/* ── About page ── */

.about-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 0 48px;
}

.about-content h1 {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.about-content .lead {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
}

.about-content h2 {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.about-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--accent-dim);
}

.about-content p {
  margin-bottom: 12px;
  line-height: 1.65;
  color: var(--text-primary);
}

.about-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  margin: 12px 0 16px;
  background: var(--bg-hover);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.about-content ul {
  margin: 8px 0 16px 20px;
  color: var(--text-primary);
}

.about-content li {
  margin-bottom: 4px;
  line-height: 1.6;
}

.about-content a {
  color: var(--blue);
  text-decoration: none;
}

.about-content a:hover {
  text-decoration: underline;
}

.about-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.about-content .page-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.about-content .page-card strong {
  color: var(--accent-dim);
}

/* ── Trends page ── */

.early-data-notice {
  background: #fef3c7;
  color: var(--yellow);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 24px;
}

.period-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}

.period-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: var(--font-sans);
}

.period-btn:hover {
  color: var(--text-primary);
}

.period-btn.active {
  background: var(--accent);
  color: #fff;
}

.sparkline {
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 1px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ── Footer ── */

.site-footer {
  text-align: center;
  padding: 32px 0;
  margin-top: 48px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-secondary);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .topnav {
    flex-wrap: wrap;
    gap: 12px;
  }

  .topnav-meta {
    margin-left: 0;
    width: 100%;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar input[type="search"] {
    min-width: 0;
  }

  .toolbar .result-count {
    margin-left: 0;
  }

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

  table { font-size: 0.8rem; }
  td, thead th { padding: 8px 10px; }
}
