/* ============================================================
   JabJab Git Viewer — style matching jabjab.xmpp.tel
   Applied to stagit-generated HTML via publish-gitweb.sh
   ============================================================ */

/* Fonts served locally — fonts.css + fonts/ are generated by publish-gitweb.sh */
@import url('fonts.css');

:root {
  --primary:       #7C3AED;
  --primary-light: #9333EA;
  --primary-dark:  #6B46C1;
  --accent:        #A78BFA;
  --accent-soft:   #C4B5FD;
  --dark-bg:       #0F172A;
  --surface:       #1E293B;
  --surface-2:     #263348;
  --border:        #334155;
  --text:          #F1F5F9;
  --text-muted:    #94A3B8;
  --text-dim:      #64748B;
  --success:       #10B981;
  --radius-sm:     6px;
  --radius-md:     12px;
  --shadow-md:     0 4px 24px rgba(0,0,0,.5);
  --font:          'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--dark-bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-soft); text-decoration: underline; text-underline-offset: 3px; }

hr { border: none; border-top: 1px solid var(--border); margin: 0; }

h1 { font-size: 1.35rem; font-weight: 700; color: var(--text); }
h2 { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 1rem; }

::selection { background: rgba(124,58,237,.35); color: var(--text); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--dark-bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Site nav injected by post-processor ── */
.jj-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  background: rgba(15,23,42,.9);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid rgba(51,65,85,.7);
  display: flex;
  align-items: center;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  gap: 1.5rem;
}

.jj-nav__logo {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.jj-nav__logo:hover { text-decoration: none; color: var(--text); }

.jj-nav__icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  box-shadow: 0 2px 8px rgba(124,58,237,.5);
  flex-shrink: 0;
}

.jj-nav__sep {
  color: var(--border);
  font-size: 1.2rem;
  font-weight: 300;
  flex-shrink: 0;
}

.jj-nav__links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

.jj-nav__links a {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color .2s;
  text-decoration: none;
}
.jj-nav__links a:hover { color: var(--text); text-decoration: none; }

.jj-nav__home {
  margin-left: auto;
  flex-shrink: 0;
}

.jj-nav__home a {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-dim);
}
.jj-nav__home a:hover { color: var(--accent); text-decoration: none; }

/* ── Page wrapper ── */
.jj-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 4rem;
}

/* ── Repo header (stagit's top table) ── */
/* Hide the stagit default logo/table nav — we replace it with jj-nav + jj-repo-header */
body > table:first-of-type { display: none; }
body > hr:first-of-type    { display: none; }

.jj-repo-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.jj-repo-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .3rem;
}

.jj-repo-header h1::before {
  content: '📦';
  font-size: 1.2rem;
}

.jj-repo-header__desc {
  color: var(--text-muted);
  font-size: .95rem;
  margin-bottom: 1rem;
}

.jj-repo-nav {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.jj-repo-nav a {
  display: inline-block;
  padding: .35rem .9rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  transition: all .2s;
  text-decoration: none;
}

.jj-repo-nav a:hover,
.jj-repo-nav a.active {
  color: var(--accent);
  border-color: rgba(124,58,237,.4);
  background: rgba(124,58,237,.08);
  text-decoration: none;
}

/* ── Index page (list of repos) ── */
table#index {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

table#index thead tr {
  border-bottom: 1px solid var(--border);
}

table#index th {
  text-align: left;
  padding: .6rem 1rem .6rem 0;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
}

table#index td {
  padding: .75rem 1rem .75rem 0;
  border-bottom: 1px solid rgba(51,65,85,.4);
  vertical-align: middle;
  color: var(--text-muted);
}

table#index td:first-child a {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
}

table#index tr:hover td { background: rgba(124,58,237,.05); }

/* ── Commit log table ── */
#log {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

#log thead tr { border-bottom: 1px solid var(--border); }

#log th {
  text-align: left;
  padding: .6rem 1rem .6rem 0;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
}

#log td {
  padding: .65rem 1rem .65rem 0;
  border-bottom: 1px solid rgba(51,65,85,.35);
  vertical-align: top;
  color: var(--text-muted);
  white-space: nowrap;
}

#log td:nth-child(3) {
  white-space: normal;
  width: 100%;
  color: var(--text);
}

#log td:nth-child(3) a { color: var(--text); font-weight: 500; }
#log td:nth-child(3) a:hover { color: var(--accent); }

#log tr:hover td { background: rgba(124,58,237,.05); }

/* Age column */
#log td:nth-child(1) { color: var(--text-dim); font-size: .8rem; }

/* Author column */
#log td:nth-child(2) { color: var(--text-muted); font-size: .82rem; }

/* Files/+ / - columns */
#log td:nth-child(4),
#log td:nth-child(5),
#log td:nth-child(6) { font-family: var(--font-mono); font-size: .78rem; text-align: right; }

#log td:nth-child(5) { color: #10B981; } /* additions */
#log td:nth-child(6) { color: #F87171; } /* deletions */

/* ── Files table ── */
#files {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

#files thead tr { border-bottom: 1px solid var(--border); }

#files th {
  text-align: left;
  padding: .6rem 1rem .6rem 0;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
}

#files td {
  padding: .6rem 1rem .6rem 0;
  border-bottom: 1px solid rgba(51,65,85,.3);
  color: var(--text-muted);
  font-size: .875rem;
}

#files td:first-child a { color: var(--text); font-weight: 500; }
#files tr:hover td { background: rgba(124,58,237,.05); }

/* ── Refs (branches/tags) ── */
#refs {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

#refs thead tr { border-bottom: 1px solid var(--border); }

#refs th {
  text-align: left;
  padding: .6rem 1rem .6rem 0;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
}

#refs td {
  padding: .65rem 1rem .65rem 0;
  border-bottom: 1px solid rgba(51,65,85,.3);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .82rem;
}

#refs td:first-child { font-family: var(--font); color: var(--text); font-weight: 600; }

/* ── Commit detail ── */
.commit-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: .875rem;
}

.commit-info table { border-collapse: collapse; width: 100%; }

.commit-info td {
  padding: .25rem .75rem .25rem 0;
  vertical-align: top;
  color: var(--text-muted);
}

.commit-info td:first-child {
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  width: 90px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-top: .35rem;
}

.commit-info td:last-child { color: var(--text); }

pre#commitdiff,
pre.diff {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.6;
  overflow-x: auto;
  tab-size: 4;
}

/* Diff colors */
.diff-add, span.i { color: #86efac; }
.diff-del, span.d { color: #fca5a5; }
.diff-hunk        { color: var(--accent); opacity: .8; }

/* ── Source file viewer ── */
#blob {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

table#blob {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.65;
}

table#blob td { padding: 0 1rem; vertical-align: top; }

/* Line numbers */
table#blob td:first-child {
  color: var(--text-dim);
  text-align: right;
  padding-right: 1.25rem;
  user-select: none;
  border-right: 1px solid var(--border);
  min-width: 52px;
  background: rgba(0,0,0,.2);
}

table#blob td:first-child a {
  color: var(--text-dim);
  text-decoration: none;
}

table#blob td:last-child {
  color: var(--text);
  white-space: pre;
  width: 100%;
}

table#blob tr:hover td:first-child { color: var(--accent); }
table#blob tr:hover { background: rgba(124,58,237,.06); }
table#blob tr:target { background: rgba(124,58,237,.12); }

/* ── Footer injected by post-processor ── */
.jj-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.jj-footer__copy {
  font-size: .8rem;
  color: var(--text-dim);
}

.jj-footer__links {
  display: flex;
  gap: 1.5rem;
}

.jj-footer__links a {
  font-size: .8rem;
  color: var(--text-dim);
}
.jj-footer__links a:hover { color: var(--accent); text-decoration: none; }

/* ── Misc ── */
#content { /* stagit wraps content in this */ }

p { color: var(--text-muted); margin-bottom: .75rem; }

/* "Powered by stagit" line stagit adds */
body > p:last-of-type {
  text-align: center;
  color: var(--text-dim);
  font-size: .75rem;
  padding: 1rem;
  opacity: .4;
}
