/**
 * ─────────────────────────────────────────────
 *  SPB Git — Personal Git Platform
 * ─────────────────────────────────────────────
 *  Author  : Simon-Pierre Boucher
 *  Contact : contact@spboucher.ai
 *  File    : src/web/assets/css/app.css
 *  Purpose : Application styles v2 — layout, depth, motion, every page
 *  License : MIT © Simon-Pierre Boucher
 * ─────────────────────────────────────────────
 */

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 12% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 420px at 88% -6%, var(--bg-glow-2), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-feature-settings: 'cv02', 'cv03', 'ss01';
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
code, pre, kbd { font-family: var(--font-mono); }
button { font-family: inherit; }
::selection { background: var(--accent-soft); }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }
main.container { flex: 1; padding-top: 28px; padding-bottom: 56px; }

.sr-only, .skip-link {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto;
  background: var(--surface); border: 1px solid var(--accent); padding: 8px 12px;
  border-radius: var(--radius); z-index: 100;
}
.muted { color: var(--muted); }

/* ── Top nav ─────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.topnav-inner { display: flex; align-items: center; gap: 16px; height: 58px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-bright); font-weight: 700; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; color: var(--text-bright); }
.brand-mark { flex: none; filter: drop-shadow(0 2px 8px var(--accent-glow)); transition: transform 0.2s ease; }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.06); }
.global-search { flex: 1; max-width: 440px; position: relative; }
.global-search input, .repo-filters input, .search-page-form input {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 13px; font-size: 14px; outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.global-search input:focus, .repo-filters input:focus, .search-page-form input:focus {
  border-color: var(--accent); box-shadow: var(--ring);
}
.topnav-links { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topnav-ext { color: var(--muted); font-size: 14px; font-weight: 500; }
.topnav-ext:hover { color: var(--text); text-decoration: none; }
.icon-btn {
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 10px; cursor: pointer; line-height: 0;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
html[data-theme='dark'] .icon-moon { display: none; }
html[data-theme='light'] .icon-sun { display: none; }

/* ── Buttons & chips ─────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 14px; font-size: 14px; font-weight: 500; cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover {
  border-color: var(--border-strong); background: var(--surface-2);
  text-decoration: none; color: var(--text); transform: translateY(-1px);
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
  background: var(--gradient-brand); border-color: transparent; color: #fff;
  box-shadow: 0 4px 16px -4px var(--accent-glow);
}
.btn-primary:hover { background: var(--gradient-brand); color: #fff; filter: brightness(1.08); }
.btn-sm { padding: 4px 11px; font-size: 13px; }
.copy-btn.copied { border-color: var(--accent-2); color: var(--accent-2); }

.chip {
  display: inline-flex; align-items: center;
  border-radius: 999px; padding: 2px 11px; font-size: 12px; font-weight: 500;
  background: var(--chip-bg); color: var(--accent); border: 1px solid transparent;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.chip-topic:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.chip-public { color: var(--muted); background: transparent; border-color: var(--border-strong); }
.chip-license { color: var(--accent-2); background: var(--accent-2-soft); }
.chip-default { color: var(--accent-2); background: var(--accent-2-soft); }
.chip-pin { color: var(--warning); background: transparent; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.count {
  background: var(--surface-2); border-radius: 999px; padding: 0 8px;
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}

/* ── Hero ────────────────────────────────── */
.hero {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 22px; padding: 40px 0 30px;
  border-bottom: 1px solid var(--border); margin-bottom: 30px;
}
.hero::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: var(--gradient-brand); opacity: 0.5;
  mask: linear-gradient(90deg, black, transparent 70%);
  -webkit-mask: linear-gradient(90deg, black, transparent 70%);
}
.hero-id { display: flex; align-items: center; gap: 20px; }
.hero-avatar {
  width: 72px; height: 72px; border-radius: 20px;
  background: var(--gradient-brand);
  color: #fff; font-weight: 700; font-size: 22px; letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: center; flex: none;
  box-shadow: 0 10px 30px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.hero-name {
  margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  background: var(--gradient-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-tagline { margin: 4px 0 0; color: var(--muted); }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; }
.badge-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px; font-size: 14px; color: var(--muted);
  box-shadow: var(--shadow-1); font-variant-numeric: tabular-nums;
}
.badge-stat strong { color: var(--text-bright); margin-right: 5px; font-size: 16px; }

.section-title {
  font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  margin: 0 0 14px; display: flex; align-items: center; gap: 8px;
}

/* ── Repo cards / home ───────────────────── */
.pinned-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px; margin-bottom: 34px;
}
.home-columns { display: grid; grid-template-columns: 1fr 300px; gap: 36px; align-items: start; }
.repo-list { display: flex; flex-direction: column; gap: 12px; }
.repo-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 17px 19px;
  box-shadow: var(--shadow-1);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}
.repo-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--gradient-brand); opacity: 0;
  transition: opacity 0.18s ease;
}
.repo-card:hover {
  border-color: var(--border-strong); transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.repo-card:hover::before { opacity: 1; }
.repo-card-name { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.repo-card-name a { color: var(--text-bright); font-weight: 600; }
.repo-card-name a:hover { color: var(--accent); text-decoration: none; }
.repo-card-desc { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.repo-card .chip-row { margin-bottom: 10px; }
.repo-card-meta { display: flex; gap: 16px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.lang-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none;
  box-shadow: 0 0 6px 0 currentColor; opacity: 0.95;
}
.lang-dot-label { display: inline-flex; align-items: center; gap: 6px; }

.repo-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.repo-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.repo-filters input { max-width: 200px; }
.repo-filters select, .ref-select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 11px; font-size: 14px; cursor: pointer;
  transition: border-color 0.15s ease;
}
.repo-filters select:hover, .ref-select:hover { border-color: var(--border-strong); }
.empty-state { text-align: center; padding: 44px 0; color: var(--muted); }

/* ── Activity feed ───────────────────────── */
.activity-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; font-size: 14px; }
.activity-feed li {
  display: flex; gap: 12px; align-items: baseline; position: relative;
  padding: 7px 0 7px 4px;
}
.activity-feed li:not(:last-child)::before {
  content: ''; position: absolute; left: 7px; top: 22px; bottom: -8px;
  width: 2px; background: var(--border); border-radius: 1px;
}
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2); flex: none; position: relative; top: -1px;
  box-shadow: 0 0 8px 0 var(--accent-2);
}
.ref-inline { font-size: 12px; color: var(--muted); }

/* ── Heatmap ─────────────────────────────── */
.heatmap-section { margin-top: 44px; }
.heatmap-scroll { overflow-x: auto; padding-bottom: 6px; }
.heatmap-label { fill: var(--muted); font-size: 9px; font-family: var(--font-ui); }
.heatmap-cell { transition: transform 0.1s ease; transform-origin: center; transform-box: fill-box; }
.heatmap-cell:hover { transform: scale(1.35); stroke: var(--accent); stroke-width: 1; }
.heatmap-cell[data-level='0'] { fill: var(--heat-0); }
.heatmap-cell[data-level='1'] { fill: var(--heat-1); }
.heatmap-cell[data-level='2'] { fill: var(--heat-2); }
.heatmap-cell[data-level='3'] { fill: var(--heat-3); }
.heatmap-cell[data-level='4'] { fill: var(--heat-4); }
.heatmap-legend { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; margin-top: 8px; }
.heatmap-cell-demo { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.heatmap-cell-demo[data-level='0'] { background: var(--heat-0); }
.heatmap-cell-demo[data-level='1'] { background: var(--heat-1); }
.heatmap-cell-demo[data-level='2'] { background: var(--heat-2); }
.heatmap-cell-demo[data-level='3'] { background: var(--heat-3); }
.heatmap-cell-demo[data-level='4'] { background: var(--heat-4); }

/* ── Repo header ─────────────────────────── */
.repo-header { padding-bottom: 0; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.repo-title {
  font-size: 21px; margin: 6px 0 6px; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap; font-weight: 500; letter-spacing: -0.01em;
}
.repo-owner { color: var(--muted); }
.repo-owner:hover { color: var(--accent); text-decoration: none; }
.repo-sep { color: var(--faint); }
.repo-name { font-weight: 700; color: var(--text-bright); }
.repo-name:hover { color: var(--accent); text-decoration: none; }
.repo-desc { margin: 0 0 10px; color: var(--muted); max-width: 780px; font-size: 15px; }
.repo-meta-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 10px; }
.repo-homepage { font-size: 14px; font-weight: 500; }
.lang-bar {
  display: flex; height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--surface-2); margin: 8px 0; gap: 1px;
}
.lang-bar-seg { display: block; height: 100%; min-width: 2px; transition: filter 0.15s ease; }
.lang-bar-seg:hover { filter: brightness(1.25); }
.lang-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; margin-bottom: 12px; }
.repo-tabs { display: flex; gap: 2px; align-items: center; margin-top: 10px; overflow-x: auto; }
.repo-tab {
  color: var(--muted); padding: 9px 15px; position: relative;
  display: inline-flex; gap: 7px; align-items: center;
  white-space: nowrap; font-size: 14px; font-weight: 500;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color 0.15s ease, background 0.15s ease;
}
.repo-tab::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px;
  background: var(--gradient-brand); border-radius: 2px 2px 0 0;
  opacity: 0; transform: scaleX(0.5);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.repo-tab:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.repo-tab.active { color: var(--text-bright); font-weight: 600; }
.repo-tab.active::after { opacity: 1; transform: scaleX(1); }
.repo-tab-meta { margin-left: auto; font-size: 13px; white-space: nowrap; }

/* ── Repo toolbar / clone box ────────────── */
.repo-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.clone-box {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 5px;
  box-shadow: var(--shadow-1);
}
.clone-url {
  background: transparent; border: none; color: var(--muted);
  padding: 6px 10px; font-family: var(--font-mono);
  font-size: 13px; width: 300px; max-width: 60vw; outline: none;
}
.clone-snippet {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; font-size: 13px; overflow-x: auto; display: inline-block; text-align: left;
}
.path-breadcrumb { font-family: var(--font-mono); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.crumb-sep { color: var(--faint); }

/* ── File table ──────────────────────────── */
.file-table {
  width: 100%; border-collapse: collapse; border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; background: var(--surface);
  font-size: 14px; margin-bottom: 26px; box-shadow: var(--shadow-1);
}
.file-table td { padding: 9px 14px; border-top: 1px solid var(--border); }
.file-table tr:first-child td { border-top: 0; }
.file-row { transition: background 0.12s ease; }
.file-row:hover { background: var(--surface-2); }
.file-name { white-space: nowrap; width: 32%; }
.file-name a { color: var(--text); }
.file-name a:hover { color: var(--accent); text-decoration: none; }
.file-icon { vertical-align: -3px; margin-right: 8px; color: var(--muted); }
.icon-dir { color: var(--accent); }
.file-commit { overflow: hidden; text-overflow: ellipsis; max-width: 400px; white-space: nowrap; }
.file-commit a:hover { color: var(--accent); }
.file-date { text-align: right; white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums; }

/* ── README / markdown section ───────────── */
.readme-section {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); margin-bottom: 32px; box-shadow: var(--shadow-1);
}
.readme-header {
  display: flex; align-items: center; gap: 8px; padding: 11px 20px;
  border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13px;
  position: sticky; top: 58px; background: var(--surface); z-index: 10;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.readme-section .markdown-body { padding: 26px 34px 34px; }
.empty-repo { text-align: center; padding: 52px 20px; }
.notice {
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 8px 14px; font-size: 13px; margin: 12px;
}

/* ── Blob view ───────────────────────────── */
.blob-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); overflow: hidden; box-shadow: var(--shadow-1);
}
.blob-header {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 58px; background: var(--surface); z-index: 10;
}
.blob-meta { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.blob-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.blob-image { text-align: center; padding: 32px; background: var(--surface-2); }
.blob-image img { max-width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-2); }
.blob-binary { text-align: center; padding: 52px 20px; color: var(--muted); }
.blob-markdown { padding: 26px 34px 34px; }

/* PDF viewer */
.pdf-viewer { background: var(--surface-2); }
.pdf-frame {
  display: block; width: 100%; height: calc(100vh - 220px); min-height: 560px;
  border: 0; background: var(--surface-2);
}
.pdf-fallback { text-align: center; padding: 52px 20px; color: var(--muted); }

.code-view { overflow-x: auto; background: var(--code-bg); }
.code-view pre.shiki {
  margin: 0; padding: 14px 0; background: transparent !important;
  font-size: 13px; line-height: 1.65; min-width: max-content;
}
.code-view .line { display: block; padding: 0 16px 0 0; min-height: 1.65em; transition: background 0.12s ease; }
.code-view .line:hover { background: var(--surface-2); }
.code-view .line:target { background: var(--accent-soft); animation: line-flash 1.2s ease 1; }
.code-view .line.range-hl { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
@keyframes line-flash {
  0% { background: var(--accent-glow); }
  100% { background: var(--accent-soft); }
}
.code-view .ln {
  display: inline-block; width: 56px; padding-right: 18px; text-align: right;
  color: var(--faint); user-select: none; font-size: 12px; text-decoration: none;
  position: sticky; left: 0; background: var(--code-bg);
  font-variant-numeric: tabular-nums;
}
.code-view .ln:hover { color: var(--accent); }
.plain-readme { padding: 20px; overflow-x: auto; font-size: 13px; }

/* ── Commits ─────────────────────────────── */
.commit-list {
  list-style: none; margin: 0 0 20px; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden;
}
.commit-row {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px;
  border-top: 1px solid var(--border); transition: background 0.12s ease;
}
.commit-row:hover { background: var(--surface-2); }
.commit-row:first-child { border-top: 0; }
.commit-avatar {
  flex: none; border-radius: 8px; overflow: hidden; background: var(--surface-2);
  line-height: 0; padding: 3px; border: 1px solid var(--border);
}
.commit-main { flex: 1; min-width: 0; }
.commit-subject { font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.commit-subject a { color: var(--text); }
.commit-subject a:hover { color: var(--accent); text-decoration: none; }
.commit-body-toggle summary {
  cursor: pointer; color: var(--muted); background: var(--surface-2);
  border-radius: 4px; padding: 0 8px; display: inline-block; list-style: none;
}
.commit-body-toggle summary::-webkit-details-marker { display: none; }
.commit-body { font-size: 13px; color: var(--muted); white-space: pre-wrap; margin: 8px 0 0; }
.commit-meta { font-size: 13px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px; }
.sha-chip {
  font-family: var(--font-mono); font-size: 12px; background: var(--surface-2);
  color: var(--accent); border: 1px solid var(--border); border-radius: 7px;
  padding: 3px 9px; cursor: pointer; flex: none;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.sha-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.pagination { display: flex; gap: 10px; justify-content: center; margin: 22px 0; }

/* ── Commit detail / diffs ───────────────── */
.commit-detail-header {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 18px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-1);
}
.commit-detail-subject { margin: 0 0 8px; font-size: 19px; letter-spacing: -0.01em; }
.commit-detail-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 14px; }
.commit-stats { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.diff-add { color: var(--add-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.diff-del { color: var(--del-text); font-weight: 600; font-variant-numeric: tabular-nums; }

.diff-file {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); margin-bottom: 16px; overflow: hidden;
  box-shadow: var(--shadow-1);
}
.diff-file-header {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px;
  cursor: pointer; background: var(--surface-2); font-size: 13px; list-style: none;
  position: sticky; top: 58px; z-index: 5;
  transition: background 0.12s ease;
}
.diff-file-header:hover { background: var(--surface-3); }
.diff-file-header::-webkit-details-marker { display: none; }
.diff-file-header::before { content: '▾'; color: var(--muted); transition: transform 0.15s ease; }
.diff-file:not([open]) .diff-file-header::before { content: '▸'; }
.diff-path { font-size: 13px; word-break: break-all; }
.diff-counts { margin-left: auto; white-space: nowrap; }
.diff-status {
  border-radius: 5px; padding: 1px 8px; font-size: 11px;
  text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em;
}
.diff-status-added { background: var(--add-bg); color: var(--add-text); }
.diff-status-deleted { background: var(--del-bg); color: var(--del-text); }
.diff-status-modified { background: var(--accent-soft); color: var(--accent); }
.diff-status-renamed { background: var(--chip-bg); color: var(--accent-2); }

.diff-table-wrap { overflow-x: auto; background: var(--code-bg); }
.diff-table { border-collapse: collapse; width: 100%; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }
.diff-gutter {
  width: 44px; min-width: 44px; text-align: right; padding: 0 8px;
  color: var(--faint); user-select: none; border-right: 1px solid var(--border);
  font-size: 11.5px; vertical-align: top; font-variant-numeric: tabular-nums;
}
.diff-code { padding: 0 10px; white-space: pre; }
.diff-sign { display: inline-block; width: 14px; user-select: none; color: var(--muted); }
.diff-line-add { background: var(--add-bg); }
.diff-line-add .diff-gutter { background: var(--add-bg-strong); border-right-color: transparent; }
.diff-line-add .diff-sign { color: var(--add-text); }
.diff-line-del { background: var(--del-bg); }
.diff-line-del .diff-gutter { background: var(--del-bg-strong); border-right-color: transparent; }
.diff-line-del .diff-sign { color: var(--del-text); }
.diff-hunk-header td { background: var(--hunk-bg); color: var(--muted); padding: 4px 10px; font-size: 12px; }
.diff-binary { padding: 16px; }

/* ── Blame ───────────────────────────────── */
.blame-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.blame-commit {
  border-top: 1px solid var(--border); border-right: 1px solid var(--border);
  padding: 4px 10px; width: 320px; min-width: 240px; vertical-align: top;
  background: var(--surface-2);
}
.blame-commit-inner { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.blame-date { font-size: 12px; width: 100%; padding-left: 30px; }
.blame-ln { width: 44px; text-align: right; color: var(--faint); padding: 0 8px; user-select: none; font-family: var(--font-mono); font-size: 12px; }
.blame-code pre { margin: 0; font-size: 12.5px; line-height: 1.6; white-space: pre; }
.blame-line[data-age='0'] .blame-commit { box-shadow: inset 3px 0 0 var(--accent); }
.blame-line[data-age='1'] .blame-commit { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 85%, transparent); }
.blame-line[data-age='2'] .blame-commit { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
.blame-line[data-age='3'] .blame-commit { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 58%, transparent); }
.blame-line[data-age='4'] .blame-commit { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 47%, transparent); }
.blame-line[data-age='5'] .blame-commit { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 38%, transparent); }
.blame-line[data-age='6'] .blame-commit { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 30%, transparent); }
.blame-line[data-age='7'] .blame-commit { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 22%, transparent); }
.blame-line[data-age='8'] .blame-commit { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 15%, transparent); }
.blame-line[data-age='9'] .blame-commit { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 8%, transparent); }

/* ── Branch/tag tables ───────────────────── */
.ref-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
  font-size: 14px; box-shadow: var(--shadow-1);
}
.ref-table th { text-align: left; padding: 11px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-bottom: 1px solid var(--border); }
.ref-table td { padding: 11px 14px; border-top: 1px solid var(--border); }
.ref-table tbody tr { transition: background 0.12s ease; }
.ref-table tbody tr:hover { background: var(--surface-2); }
.ref-name { font-family: var(--font-mono); font-size: 13px; }
.ahead-behind { display: inline-flex; gap: 10px; font-family: var(--font-mono); font-size: 13px; }
.archive-links { display: flex; gap: 6px; }

/* ── Releases ────────────────────────────── */
.release-list { display: flex; flex-direction: column; gap: 18px; }
.release-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 22px;
  box-shadow: var(--shadow-1);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.release-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-card); }
.release-header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.release-tag { margin: 0; font-size: 17px; font-family: var(--font-mono); }
.release-subject { color: var(--muted); }
.release-assets { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.release-assets li {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 14px; font-size: 14px;
  transition: border-color 0.15s ease;
}
.release-assets li:hover { border-color: var(--accent); }
.release-assets li svg { color: var(--accent-2); flex: none; }

/* ── Search page ─────────────────────────── */
.search-page-form { display: flex; gap: 8px; margin-bottom: 28px; max-width: 560px; }
.search-results { list-style: none; margin: 0 0 32px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.search-results li {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 15px 19px; box-shadow: var(--shadow-1);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.search-results li:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.search-hit-name { font-weight: 600; font-size: 15px; }
.search-snippet { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

/* ── Error pages ─────────────────────────── */
.error-page { text-align: center; padding: 80px 20px; }
.error-code {
  font-size: 104px; font-weight: 700; font-family: var(--font-mono); line-height: 1;
  background: var(--gradient-brand);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.error-message { font-size: 18px; color: var(--muted); margin: 16px 0 8px; }
.error-art { display: inline-block; text-align: left; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; font-size: 13px; margin: 16px 0 24px; }

/* ── Mermaid blocks ──────────────────────── */
.mermaid-block { margin: 16px 0; }
.mermaid-src { display: none; }
.mermaid-block[data-rendered='0'] .mermaid-src { display: block; }
.mermaid-target svg { max-width: 100%; }

/* ── Footer ──────────────────────────────── */
.footer {
  border-top: 1px solid var(--border); color: var(--muted);
  padding: 22px 0; font-size: 13px; text-align: center;
}

/* ── Page entrance ───────────────────────── */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
main.container > * { animation: rise-in 0.35s ease both; }
main.container > *:nth-child(2) { animation-delay: 0.04s; }
main.container > *:nth-child(3) { animation-delay: 0.08s; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 960px) {
  .home-columns { grid-template-columns: 1fr; }
  .file-commit { display: none; }
  .blame-commit { width: 200px; min-width: 150px; }
}
@media (max-width: 640px) {
  .global-search { display: none; }
  .hero { flex-direction: column; align-items: flex-start; }
  .pinned-grid { grid-template-columns: 1fr; }
  .clone-url { width: 100%; max-width: none; }
  .repo-toolbar { flex-direction: column; align-items: stretch; }
  .file-date { display: none; }
  .readme-section .markdown-body, .blob-markdown { padding: 16px; }
  .pdf-frame { height: 70vh; min-height: 420px; }
}
