@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap");

:root {
    --nav-height: 44px;
    --toolbar-height: 44px;
    --target-size: 44px;
}

body {
    font-family: Inter, sans-serif;
    max-width: 80rem;
    margin: auto;
    padding: 0;
    background-color: #181818;
    color: white;
}

/* --- Harmonized anchor defaults (cgit-inspired) ---
 * Links appear as ordinary text; on hover they turn blue + underlined,
 * and the parent element gets a subtle highlight. */

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: skyblue;
    text-decoration: underline;
}

/* Parent-highlight on hover — the wrapping element gets a subtle glow */
li:has(> a:hover),
span:has(> a:hover):not(.toolbar-pagination),
dd:has(> a:hover) {
    background-color: #252525;
    border-radius: 0.25rem;
}

#page-header {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 0.5em 1em;
}

#page-header .site-logo {
    width: 2.5em;
    height: 2.5em;
}

#page-header h1 {
    margin: 0;
    padding: 0;
}

#page-header p {
    margin: 0;
    color: #b0b0b0;
}

#page-header .subtitle {
    margin: 0;
    color: #b0b0b0;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    padding: 0.5em 1em;
    background: white;
    color: black;
    z-index: 100;
    font-weight: bold;
}

.skip-link:focus {
    top: 0;
}

.skip-link:hover {
    color: black;
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid skyblue;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

nav#top {
    background-color: black;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    min-height: var(--nav-height);
    box-sizing: border-box;
}

.nav-toggle {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.nav-hamburger {
    display: none;
}

.nav-home {
    display: flex;
    align-items: center;
    padding: 0.5em 1em;
    min-height: var(--target-size);
    border-radius: 0.25rem;
    font-family: monospace;
    box-sizing: border-box;
}

.toolbar ~ .nav-home,
.nav-home:has(~ .toolbar) {
    display: none;
}

.nav-home:hover {
    background-color: white;
    color: black;
    text-decoration: none;
}

.nav-logo {
    display: flex;
    align-items: center;
    padding: 0.5em;
    min-height: var(--target-size);
    border-radius: 0.25rem;
    box-sizing: border-box;
}

.nav-logo:hover {
    background-color: #333;
    text-decoration: none;
}

.nav-logo .site-logo {
    width: 2em;
    height: 2em;
}

nav#top ul {
    display: flex;
    flex-wrap: nowrap;
    list-style-type: none;
    padding: 0.25em;
    margin: 0;
    margin-left: auto;
    gap: 0.25em;
}

nav#top ul li {
    border-radius: 0.5rem;
}

nav#top ul li a {
    display: flex;
    align-items: center;
    padding: 0.5em 1em;
    min-height: var(--target-size);
    border-radius: 0.5rem;
    box-sizing: border-box;
}

nav#top ul li a:hover {
    background-color: white;
    color: black;
    text-decoration: none;
}

nav#top ul li[aria-current="page"] {
    border-radius: 0.5rem;
    background-color: rgb(194, 79, 30);
}

nav#top ul li[aria-current="page"] a:hover {
    border-radius: 0.5rem;
    background-color: rgb(132, 40, 0);
    color: white;
    text-decoration: none;
}

#main {
    padding: 0 1em;
}

#main ul {
    padding-left: 0;
    list-style: none;
}

#main ul li {
    border: 1px solid #303030;
}

#main .tree-nested li {
    border: none;
    border-top: 1px solid #252525;
}

#main .tree-nested li:first-child {
    border-top: none;
}

/* File/branch/tag list items (still use li > a wrapping pattern) */

#main ul li > a {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 0.75em;
    min-height: var(--target-size);
    box-sizing: border-box;
}

#main ul li > a:hover {
    text-decoration: underline;
}

#main ul li:has(> a:hover) {
    background-color: #252525;
}

/* Root page layout */
.root-layout {
    display: flex;
    flex-direction: column;
}

.root-readme:empty {
    display: none;
}

@media (min-width: 960px) {
    .root-layout {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 2em;
    }
}

/* Root page section toggles */
.section-toggle {
    cursor: pointer;
    list-style: none;
    user-select: none;
    position: sticky;
    top: var(--nav-height);
    background-color: #1a1a1a;
    z-index: 5;
    padding: 0.5em 0;
    display: flex;
    align-items: center;
}

.section-toggle::-webkit-details-marker {
    display: none;
}

.section-toggle h1 {
    display: inline;
    font-size: 1.25em;
    letter-spacing: 0.02em;
    font-weight: 700;
}

details[open] > .section-toggle > .tree-chevron {
    transform: rotate(90deg);
}

details:not([open]) > .section-toggle::before {
    transform: rotate(-90deg);
}

/* Root page repository items */
#repositories li,
.repo-section li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0 1em;
}

#main #repositories li > a,
#main .repo-section li > a {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding: 0.75em;
    min-height: var(--target-size);
    box-sizing: border-box;
    gap: 0.5em;
}

.repo-name {
    flex-shrink: 0;
    white-space: nowrap;
}

.repo-description {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    color: #b0b0b0;
    font-size: 0.85em;
}

/* Commit list items — flat layout, commit-title anchor fills the li height */

#main ul li:has(.commit-title) {
    display: flex;
    align-items: center;
    line-height: 1.5rem;
    min-height: var(--target-size);
    box-sizing: border-box;
    gap: 0.5em;
    padding: 0 0.75em;
}

#main ul li:has(.commit-title):hover {
    background-color: #252525;
}

.commit-ago {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    font-size: 0.85em;
    color: #b0b0b0;
    white-space: nowrap;
    padding-right: 0.75em;
}

.commit-author {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    font-family: monospace;
    font-size: 0.85em;
    color: #b0b0b0;
    white-space: nowrap;
    padding-right: 0.75em;
}

.commit-identity {
    display: flex;
    align-items: center;
    text-underline-offset: 0.15em;
    border-radius: 0.2rem;
}

.commit-identity:hover {
    text-decoration: underline;
}

.commit-meta .commit-identity,
.commit-meta time {
    font-family: monospace;
}

.commit-pill {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0.4em 0.9em;
    margin: 0.3em 0;
    border-radius: 9999px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    vertical-align: middle;
}

.commit-pill a {
    padding: 0.1em 0;
}

.commit-pill a:hover {
    color: inherit;
    text-decoration: underline;
    background-color: transparent;
}

.commit-title {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    align-self: stretch;
}

.commit-title a {
    display: block;
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: var(--target-size);
}

/* Summary page layout */
.summary-layout {
    display: flex;
    flex-direction: column;
}

.summary-readme:empty {
    display: none;
}

@media (min-width: 960px) {
    .summary-layout {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 2em;
    }
}

/* "Show previous commits" link on summary page */

.summary-more {
    text-align: center;
    margin: 1em 0;
}

/* Pill color variants — WCAG AA contrast against their backgrounds */

.commit-pill-feat {
    background-color: #1a4d2e;
    color: #86efac;
}

.commit-pill-fix {
    background-color: #4d1a1a;
    color: #fca5a5;
}

.commit-pill-docs {
    background-color: #1a3a4d;
    color: #93dbfd;
}

.commit-pill-style {
    background-color: #3d1a4d;
    color: #e0c4ff;
}

.commit-pill-refactor {
    background-color: #4d3a1a;
    color: #fcd34d;
}

.commit-pill-perf {
    background-color: #4d2d1a;
    color: #fdba74;
}

.commit-pill-test {
    background-color: #1a2e4d;
    color: #a5d0fe;
}

.commit-pill-build {
    background-color: #2d2d2d;
    color: #c0c0c0;
}

.commit-pill-ci {
    background-color: #2d2d2d;
    color: #c0c0c0;
}

.commit-pill-chore {
    background-color: #2d2d2d;
    color: #c0c0c0;
}

.commit-pill-revert {
    background-color: #4d1a3a;
    color: #fbb6d0;
}

/* Toolbar — persistent bar between navbar and content in commits/files views */

.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75em;
    height: var(--nav-height);
    box-sizing: border-box;
    flex: 1;
    min-width: 0;
    background-color: black;
    padding: 0 0.75em;
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
}

.toolbar::-webkit-scrollbar {
    display: none;
}

.toolbar-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    flex-shrink: 0;
}

.toolbar-filter-value {
    display: inline-flex;
    align-items: center;
    padding: 0.4em 0.9em;
    border-radius: 9999px;
    font-family: monospace;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
    background-color: #2d2d2d;
    box-sizing: border-box;
}

.toolbar-dismiss {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2em;
    height: 1.2em;
    padding: 0;
    color: #b0b0b0;
    background-color: #3a3a3a;
    text-decoration: none;
    font-size: 0.8em;
    line-height: 1;
    border-radius: 50%;
    box-sizing: border-box;
}

.toolbar-dismiss::before {
    content: "";
    position: absolute;
    inset: -10px;
    min-width: var(--target-size);
    min-height: var(--target-size);
}

.toolbar-dismiss:hover {
    background-color: #555;
    color: white;
    text-decoration: none;
}


/* Pagination controls */

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: 0.5em;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
}

.toolbar-filters::-webkit-scrollbar {
    display: none;
}

.toolbar-filters .commit-pill {
    margin: 0;
    box-sizing: border-box;
}
}

.toolbar-pagination {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-shrink: 0;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2em;
    min-height: 2em;
    padding: 0.25em 0.5em;
    border-radius: 0.25rem;
    font-size: 1em;
    font-weight: 600;
    color: white;
    background-color: #2a2a2a;
    box-sizing: border-box;
}

.pagination-btn:hover {
    background-color: white;
    color: black;
    text-decoration: none;
}

.pagination-disabled {
    color: #777;
    background-color: #1e1e1e;
    cursor: default;
}

.pagination-disabled:hover {
    color: #777;
    background-color: #1e1e1e;
}

.pagination-page {
    font-size: 0.9em;
    color: #ccc;
    min-width: var(--target-size);
    text-align: center;
}

h1 {
    padding: 0;
}

.timestamp {
    font-family: monospace;
    color: #b0b0b0;
    font-size: 0.85em;
}

#blob,
.blob {
    display: grid;
    column-gap: 1.5em;
    row-gap: 0.2em;
    grid-template-columns: 3em auto;
    font-family: monospace;
    overflow-x: auto;
}

#blob a.line-anchor,
.blob a.line-anchor {
    color: #b0b0b0;
    text-align: right;
}

#blob a.line-anchor:target,
.blob a.line-anchor:target {
    color: white;
    background-color: grey;
}

#blob a.line-anchor:hover,
.blob a.line-anchor:hover {
    color: skyblue;
    background-color: inherit;
    text-decoration: none;
}

#blob span.line,
.blob span.line {
    white-space: preserve-spaces;
}

.commit-meta {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.35em 1em;
}

.commit-meta dt {
    color: #b0b0b0;
}

.commit-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.commit-body {
    font-family: monospace;
    white-space: pre;
    overflow-x: auto;
    background: #1e1e1e;
    padding: 0.75em 1em;
    border-radius: 0.25rem;
    border: 1px solid #303030;
}

/* Path pill — breadcrumb trail as a single rounded pill */

.path-pill {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0.4em 0.9em;
    border-radius: 9999px;
    font-size: 0.85em;
    font-family: monospace;
    background-color: #1a3a4d;
    color: #93dbfd;
}

.path-pill a:hover {
    text-decoration: underline;
}

.path-pill-link {
    padding: 0.1em 0.2em;
    border-radius: 0.25rem;
}

.path-pill-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    text-decoration: underline;
}

.path-pill-sep {
    color: #6ab0d4;
    margin: 0 0.1em;
}

/* Tree directory expand/collapse */

.tree-dir {
    padding: 0;
}

.tree-dir > details {
    width: 100%;
}

.tree-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    list-style: none;
    padding: 0.75em;
    min-height: var(--target-size);
    box-sizing: border-box;
    gap: 0;
}

details[open] > .tree-toggle {
    position: sticky;
    top: var(--nav-height);
    z-index: 8;
    background-color: #181818;
}
.tree-toggle::-webkit-details-marker {
    display: none;
}

.tree-toggle::marker {
    content: "";
}

.tree-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6em;
    height: 1.6em;
    font-size: 1.1em;
    color: #b0b0b0;
    background-color: #2a2a2a;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 0.5em;
    transition: transform 0.15s ease;
}

details[open] > .tree-toggle > .tree-chevron {
    transform: rotate(90deg);
}

.tree-chevron:hover {
    background-color: #444;
    color: white;
}

.tree-link {
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
}

.tree-link:hover {
    text-decoration: underline;
}

.tree-nested {
    padding-left: 2.1em;
    list-style: none;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.tree-nested li {
    padding-left: 0.75em;
}

.tree-hidden {
    font-style: italic;
    opacity: 0.75;
}

.tree-overflow {
    padding: 0.5em 0.75em;
}

.tree-overflow a {
    color: #b0b0b0;
    font-style: italic;
}

.tree-overflow a:hover {
    text-decoration: underline;
}

/* Inline README display at bottom of directory listings */

.readme-inline {
    margin-top: 1.5em;
    border: 1px solid #3a3a3a;
    border-radius: 0.25rem;
    overflow-x: auto;
}

.readme-inline h3 {
    margin: 0;
    padding: 0.6em 1em;
    background-color: #242424;
    font-size: 0.9em;
    color: #b0b0b0;
    border-bottom: 1px solid #3a3a3a;
}

.readme-inline .blob {
    padding: 0.5em 0;
}

.diff-file {
    margin: 1.5em 0;
    border: 1px solid #3a3a3a;
    border-radius: 0.25rem;
    overflow: hidden;
}

.diff-hunk {
    border-top: 1px solid #3a3a3a;
}

.diff-file-header,
.diff-meta,
.hunk-header {
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-family: monospace;
}

.diff-file-header {
    background: #242424;
    cursor: pointer;
    list-style: none;
}

.diff-file-header::-webkit-details-marker {
    display: none;
}

.diff-file-header::marker {
    content: "";
}

.diff-meta {
    color: #b0b0b0;
    border-top: 1px solid #3a3a3a;
}

.hunk-header {
    color: #b7c9ff;
    background: #252535;
    cursor: pointer;
    list-style: none;
}

.hunk-header::-webkit-details-marker {
    display: none;
}

.hunk-header::marker {
    content: "";
}

.diff-lines-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

.diff-lines {
    display: grid;
    width: max-content;
    min-width: 100%;
    grid-template-columns: max-content max-content max-content minmax(max-content, 1fr);
    font-family: monospace;
    grid-auto-rows: minmax(1.35em, auto);
}

.diff-line {
    display: contents;
}

.diff-line .line-number {
    padding-right: 0.6em;
    color: #b0b0b0;
    text-align: right;
    user-select: none;
    border-right: 1px solid #3a3a3a;
}

.diff-marker {
    text-align: center;
    user-select: none;
}

.diff-text {
    padding-right: 0.75em;
    white-space: pre;
}

.diff-line.addition > * {
    background: #17351f;
}

.diff-line.deletion > * {
    background: #3b1d1d;
}

.binary-diff {
    margin: 0;
    padding: 0.75em;
}

footer {
    margin: 1em;
    padding: 0 1em;
    text-align: center;
}

@media (max-width: 768px) {
    .timestamp {
        display: none;
    }
}

@media (max-width: 600px) {
    #page-header {
        padding: 0.5em 0.5em;
    }

    #main {
        padding: 0 0.5em;
        padding-bottom: 60px;
    }

    .commit-author {
        display: none;
    }

    footer {
        padding: 0 0.5em;
        padding-bottom: 60px;
    }

    .nav-hamburger {
        display: none;
    }

    nav#top {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: initial;
        margin: 0;
        border-radius: 0;
    }

    nav#top .nav-home {
        margin-right: auto;
    }

    nav#top ul {
        display: none;
    }

    #blob,
    .blob {
        column-gap: 0.75em;
        row-gap: 0;
        grid-template-columns: max-content auto;
        font-size: 0.85em;
    }

    .diff-lines {
        font-size: 0.85em;
    }

    .toolbar-pagination {
        margin-left: auto;
    }
}

/* Bottom navigation bar (mobile only) */
#bottom-nav {
    display: none;
}

@media (max-width: 600px) {
    #bottom-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 20;
        background-color: black;
        border-top: 1px solid #303030;
    }

    #bottom-nav ul {
        display: flex;
        list-style: none;
        margin: 0;
        padding: 0.25em;
        gap: 0.25em;
    }

    #bottom-nav ul li {
        flex: 1;
        border: none;
        border-radius: 0.5rem;
    }

    #bottom-nav ul li a {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: var(--target-size);
        padding: 0.5em 0;
        font-size: 1em;
        text-align: center;
        border-radius: 0.5rem;
    }

    #bottom-nav ul li a:hover {
        background-color: #252525;
        text-decoration: none;
    }

    #bottom-nav ul li[aria-current="page"] {
        background-color: rgb(194, 79, 30);
        border-radius: 0.5rem;
    }

    #bottom-nav ul li[aria-current="page"] a:hover {
        background-color: rgb(132, 40, 0);
        color: white;
        text-decoration: none;
    }
}


/* Error pages */
#error-header {
    text-align: center;
    padding: 2em 1em 1em;
}

#error-header .error-code {
    display: block;
    font-size: 4em;
    font-weight: bold;
    opacity: 0.3;
    line-height: 1;
}

#error-header h1 {
    margin: 0.25em 0 0;
    font-size: 1.5em;
}

.error-hint {
    font-size: 1.1em;
    margin-bottom: 1em;
}

.error-detail {
    font-family: monospace;
    font-size: 0.9em;
    opacity: 0.8;
    word-break: break-word;
}

.error-nav {
    margin-top: 2em;
}
