/* ============================================================================
   GitHubDB · css/detail.css — DETAILSEITEN
   ----------------------------------------------------------------------------
   Zuständig für die getabten Detailseiten (js/detail.js: Repo, User/Org,
   Topic; Lizenz-Detail in js/misc.js).
   EIGENE COMPONENT-CLASSES:
     .detail-header, .detail-title, .title-sep, .detail-desc, .badges,
     .home-link, .topics, .topic, .stat-row, .stat-tile, .stat-value,
     .stat-label, .stat-sub, .detail-tabs, .detail-tab, .crumb-btn,
     .crumb-sep, .tree-branch, .tree-list, .tree-dir, .tree-ico,
     .tree-size, #pathCrumb, .plain-list, .mono-sha, .release-list,
     .release-row, .release-dl, .contrib-list, .commit-list,
     .label-cloud, .gh-label, .readme, .retry-btn, .detail-github
   Grundgerüste (.panel, .section-grid, .badge, .repo-table, .checklist,
   .btn) liegen in base.css — nicht duplizieren. Alle Werte aus den
   Tokens in css/tokens.css; Zahlen mono + tabular-nums.
   ========================================================================== */

/* ---------- Detail-Kopf (Karte mit Hairline) ---------- */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
}
.detail-header .repo-cell { align-items: flex-start; }
.detail-header .repo-avatar {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.detail-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  line-height: var(--leading-2xl);
  word-break: break-word;
}
.detail-title a { color: var(--text-1); }
.detail-title a:hover { color: var(--accent); text-decoration: none; }
.title-sep { color: var(--text-3); margin: 0 3px; font-weight: var(--weight-normal); }
.detail-desc { color: var(--text-2); margin: 6px 0 var(--space-3); max-width: 70ch; }

/* Meta-Zeile: Badges + externe Links */
.badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--text-sm);
}
.badges .badge { background: var(--surface-2); }
.badges .badge a { color: var(--accent); }
.badges .mono { font-size: var(--text-xs); font-weight: var(--weight-medium); }
.home-link {
  color: var(--text-2);
  font-size: var(--text-sm);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px dotted var(--border-strong);
  transition: color var(--transition-fast) var(--ease-out),
              border-color var(--transition-fast) var(--ease-out);
}
.home-link:hover { color: var(--accent-hover); border-bottom-color: var(--accent); text-decoration: none; }
.detail-github { flex-shrink: 0; align-self: flex-start; }

/* ---------- Topic-Pills ---------- */
.topics { margin-top: var(--space-2); display: flex; flex-wrap: wrap; gap: 6px; }
.topic {
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  transition: background-color var(--transition-fast) var(--ease-out),
              color var(--transition-fast) var(--ease-out),
              border-color var(--transition-fast) var(--ease-out);
}
.topic:hover {
  text-decoration: none;
  color: var(--accent-hover);
  background: var(--accent-muted);
  border-color: var(--accent-border);
}
.topic:active { color: var(--accent); }

/* ---------- Kennzahlen-Kacheln (Zahlen immer mono) ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 0;
  transition: border-color var(--transition-fast) var(--ease-out),
              background-color var(--transition-fast) var(--ease-out);
}
.stat-tile:hover { border-color: var(--border-strong); background: var(--surface-2); }
.stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-xl);
  color: var(--text-1);
}
.stat-label {
  margin-top: 2px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-sub { margin-top: 2px; font-size: var(--text-xs); }

/* ---------- Tab-Leiste (ARIA-Tabs) ---------- */
.detail-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  scrollbar-width: thin;
}
.detail-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-sm);
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color var(--transition-fast) var(--ease-out),
              background-color var(--transition-fast) var(--ease-out),
              border-color var(--transition-fast) var(--ease-out);
}
.detail-tab:hover { color: var(--text-1); background: var(--surface-2); }
.detail-tab:active { color: var(--text-1); }
.detail-tab.active {
  color: var(--text-1);
  border-bottom-color: var(--accent);
  background: var(--accent-muted);
}
.detail-tab:focus-visible { outline-offset: -2px; }

/* ---------- Datei-Browser ---------- */
#pathCrumb {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}
.crumb-btn {
  background: none;
  border: none;
  padding: 0 2px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast) var(--ease-out),
              background-color var(--transition-fast) var(--ease-out);
}
.crumb-btn:hover { color: var(--accent-hover); background: var(--surface-2); text-decoration: none; }
.crumb-btn:active { color: var(--accent); }
.crumb-sep { margin: 0 2px; color: var(--border-strong); }
.tree-branch { font-size: var(--text-xs); font-weight: var(--weight-normal); }

.tree-list {
  list-style: none;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: auto;
  max-height: 520px;
}
.tree-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  line-height: var(--leading-sm);
  min-width: 0;
}
.tree-list li:last-child { border-bottom: none; }
.tree-dir { cursor: pointer; }
.tree-dir:hover { color: var(--accent); background: var(--surface-2); }
.tree-dir:active { color: var(--accent-hover); }
.tree-dir:focus-visible { outline-offset: -2px; background: var(--surface-2); }
.tree-ico { font-size: var(--text-sm); flex-shrink: 0; }
.tree-list li a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-size {
  margin-left: auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  flex-shrink: 0;
}

/* ---------- Einfache Listen in Panels ---------- */
.plain-list { list-style: none; }
.plain-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.plain-list li:last-child { border-bottom: none; }
.plain-list code { font-size: var(--text-xs); }
.mono-sha {
  margin-left: auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
}

/* ---------- Releases / Contributors / Commits ---------- */
.release-list, .contrib-list, .commit-list { list-style: none; }
.release-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.release-row:last-child { border-bottom: none; }
.release-dl {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 160px;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  flex-shrink: 0;
}
.release-dl .mini-bar { max-width: 80px; }
.contrib-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 0;
  border-radius: var(--radius-sm);
}
.contrib-list li:hover { background: var(--surface-2); }
.contrib-list .repo-cell { min-width: 0; gap: var(--space-2); }
.commit-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.commit-list li:last-child { border-bottom: none; }

/* ---------- Label-Cloud (Repo-Labels, SBOM, gitignore) ---------- */
.label-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.gh-label {
  border: 1px solid;
  border-radius: var(--radius-pill);
  padding: 1px 10px;
  font-size: var(--text-xs);
  font-family: inherit;
  background: transparent;
  cursor: default;
}
button.gh-label { cursor: pointer; }
button.gh-label:hover, button.gh-label:active { opacity: 1; }

/* ---------- README (serverseitig von GitHub gerendert) ---------- */
.readme { font-size: var(--text-base); line-height: var(--leading-base); overflow-x: auto; color: var(--text-1); }
.readme > :first-child { margin-top: 0; }
.readme h1, .readme h2, .readme h3, .readme h4 {
  margin: 20px 0 var(--space-2);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  font-weight: var(--weight-semibold);
}
.readme p, .readme ul, .readme ol, .readme pre, .readme table, .readme blockquote { margin-bottom: var(--space-3); }
.readme ul, .readme ol { padding-left: 24px; }
.readme li { margin: 2px 0; }
.readme a { color: var(--accent); }
.readme img { max-width: 100%; border-radius: var(--radius-sm); }
.readme table { border-collapse: collapse; }
.readme td, .readme th { border: 1px solid var(--border); padding: 6px 10px; }
.readme th { background: var(--surface-2); font-size: var(--text-sm); }
.readme blockquote {
  border-left: 3px solid var(--accent-border);
  padding-left: var(--space-3);
  color: var(--text-2);
}
.readme pre { margin-top: var(--space-2); }
.readme hr { border: none; border-top: 1px solid var(--border); margin: var(--space-4) 0; }

/* ---------- Retry nach 202 (GitHub berechnet Statistik) ---------- */
.retry-btn { margin-top: var(--space-3); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .detail-header { flex-direction: column; padding: var(--space-4); }
  .detail-title { font-size: var(--text-xl); }
  .detail-github { align-self: stretch; justify-content: center; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: var(--text-lg); }
}
