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

footer {
  padding: 1rem;
  margin-top: 2rem;
  color: var(--secondary);
  font-size: .875rem;
  text-align: center;
}

html { overflow-x: clip; }

body {
  font-family: var(--font-body);
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
  background: var(--background);
  color: var(--primary);
}

header {
  padding: .75rem 1rem;
  margin-bottom: .75rem;
}

header ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: 1.2rem;
  min-width: 0;
}

header li {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

header li:first-child { flex-shrink: 0; }
header li:last-child { flex-shrink: 1; }

header li + li::before {
  content: '/';
  margin-right: .25rem;
  color: var(--secondary);
}

header a {
  color: var(--primary);
  text-decoration: none;
}

header a:hover {
  color: var(--emphasized);
  text-decoration: underline;
  text-underline-offset: 4px;
}

main > h1, main > p {
  padding-left: 1rem;
  padding-right: 1rem;
}

main > h1 { margin-bottom: .75rem; }
main > p { margin-top: 0; }

.repo-nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  min-height: 50px;
  text-decoration: none;
  color: var(--primary);
  font-family: var(--font-mono);
  border-top: 1px solid var(--secondary);
  transition: background-color .3s ease-out;
}

.repo-nav-item + .repo-nav-item { border-top: 1px solid var(--highlight); }
.repo-nav-item:last-child { border-bottom: 1px solid var(--secondary); }
.repo-nav-item:active { background-color: var(--highlight); transition: none; }
.repo-nav-item:hover > span:first-of-type { text-decoration: underline; text-underline-offset: 3px; }

.repo-nav-item-meta {
  margin-left: auto;
  color: var(--secondary);
}

.repo-nav-item-arrow {
  color: var(--secondary);
}
main > article { padding: 0 1rem; }

.repo-list {
  display: flex;
  flex-direction: column;
}

.repo-card {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
}

.repo-card:hover { background: var(--highlight); }

.repo-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--emphasized);
}

.repo-desc {
  font-size: 1rem;
  color: var(--primary);
}

.repo-meta {
  display: flex;
  justify-content: space-between;
  color: var(--secondary);
}

.tag-info {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .2rem 1.5rem;
  font-family: var(--font-mono);
  margin: 0 1rem 1rem;
}

.tag-info dt { color: var(--secondary); }
.tag-info dd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }
.tag-info a { color: var(--primary); }

.tag-downloads {
  font-family: var(--font-mono);
  padding: 0 1rem;
}

.tag-message {
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 1rem;
  margin: 0 1rem 1rem;
  background: var(--highlight);
  border-radius: 6px;
  white-space: pre-wrap;
  color: var(--primary);
}

.branch-list, .tag-list { display: flex; flex-direction: column; }

.branch-row, .tag-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: .75rem 1rem;
  text-decoration: none;
  color: inherit;
  font-family: var(--font-mono);
}

.branch-row:hover, .tag-row:hover { background: var(--highlight); }

.branch-name,
.tag-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}


.branch-default {
  color: var(--secondary);
  margin-right: 1rem;
}

.branch-date, .tag-date {
  display: flex;
  align-items: baseline;
  flex-shrink: 0;
  color: var(--secondary);
  padding-left: 1rem;
}

.commit-log {
  display: flex;
  flex-direction: column;
}

.commit-row {
  display: grid;
  grid-template-columns: 5rem 1fr;
  grid-template-rows: auto auto;
  gap: .15rem 1rem;
  padding: .75rem 1rem;
  text-decoration: none;
  color: inherit;
  font-family: var(--font-mono);
}

.commit-row:hover { background: var(--highlight); }

.commit-sha {
  font-family: var(--font-mono);
  color: var(--secondary);
  grid-row: 1;
}

.commit-message {
  color: var(--primary);
  grid-row: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commit-meta {
  display: flex;
  justify-content: space-between;
  color: var(--secondary);
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

.commit-meta span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.commit-meta span:last-child {
  flex-shrink: 0;
  padding-left: 1rem;
}

.pagination {
  display: flex;
  justify-content: space-between;
  padding: .75rem 1rem;
}

.pagination a { color: var(--secondary); text-decoration: none; }
.pagination a:hover { color: var(--primary); }

details {
  border-top: 1px solid var(--highlight);
}

details:first-of-type {
  border-top: 1px solid var(--secondary);
}

details:last-of-type {
  border-bottom: 1px solid var(--highlight);
}

summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  min-height: 50px;
  font-family: var(--font-mono);
  background: var(--highlight);
}

.summary-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}


details[open] summary {
  color: var(--emphasized);
}

summary::after {
  content: '[+]';
  color: var(--secondary);
}

summary:not(:has(span))::after {
  margin-left: auto;
}

details[open] summary::after {
  content: '[−]';
}


summary span {
  color: var(--secondary);
  margin-left: auto;
}

details > *:not(summary) {
  padding: 0 1rem .75rem;
  margin-bottom: 0;
}

details > ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

details ul li + li {
  border-top: 1px solid var(--highlight);
}

details ul li {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 50px;
  padding: 0 1rem;
  color: var(--secondary);
  font-family: var(--font-mono);
  font-size: 1rem;
}

details ul li:has(a), details ul li:has(button) {
  padding: 0;
}

details ul li a,
details ul li button {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  min-height: 50px;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 1rem;
}

details ul li a,
details ul li button { transition: background-color .3s ease-out; }

details ul li a:active,
details ul li button:active { background-color: var(--highlight); transition: none; }

details ul li a:hover span:first-child,
details ul li button:hover span:first-child { text-decoration: underline; text-underline-offset: 3px; }

/* First span grows to fill available space in both link and button rows */
details ul li a span:first-child,
details ul li button span:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary);
}

/* Clone rows: animate URL text on copy, label fixed width on right */
details ul li button span:first-child { transition: opacity .1s; }
details ul li button span:nth-child(2) {
  flex-shrink: 0;
  min-width: 4rem;
  text-align: right;
  color: var(--secondary);
}

/* Branch/tag rows: remaining spans fixed on the right */
details ul li a span:not(:first-child) {
  flex-shrink: 0;
  color: var(--secondary);
}

/* Accent colors — specificity matches details ul li a span:first-child */
details ul li a span.branch-name,
.branch-name { color: var(--blue); }

details ul li a span.tag-name,
.tag-name { color: var(--violet); }
