/* SearchHub theme for Abbaye -- monospace, earthy, dark mode */
:root {
    --bg: #f5f0e8;
    --text: #292524;
    --accent: #d97706;
    --border: #a8a29e;
    --border-strong: #44403c;
    --input-bg: #faf6f0;
    --btn-bg: #44403c;
    --btn-text: #faf6f0;
    --link: #92400e;
    --link-hover-bg: #d97706;
    --link-hover-text: #faf6f0;
    --meta: #78716c;
    --url: #78716c;
    --desc: #57534e;
    --dotted: #d6d3d1;
    --footer: #a8a29e;
    --pre-bg: #eae2d4;
    --bg-alt: #ede5d8;
    --bg-content: #fdfaf5;
    --hash-bg: #eae2d4;
    --font: "Courier New", Courier, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1c1917;
        --text: #faf6f0;
        --accent: #fbbf24;
        --border: #57534e;
        --border-strong: #fbbf24;
        --input-bg: #292524;
        --btn-bg: #fbbf24;
        --btn-text: #1c1917;
        --link: #fbbf24;
        --link-hover-bg: #fbbf24;
        --link-hover-text: #1c1917;
        --meta: #a8a29e;
        --url: #a8a29e;
        --desc: #d6d3d1;
        --dotted: #57534e;
        --footer: #78716c;
        --pre-bg: #292524;
        --bg-alt: #292524;
        --bg-content: #1c1917;
        --hash-bg: #292524;
    }
}

:root.dark {
    --bg: #1c1917;
    --text: #faf6f0;
    --accent: #fbbf24;
    --border: #57534e;
    --border-strong: #fbbf24;
    --input-bg: #292524;
    --btn-bg: #fbbf24;
    --btn-text: #1c1917;
    --link: #fbbf24;
    --link-hover-bg: #fbbf24;
    --link-hover-text: #1c1917;
    --meta: #a8a29e;
    --url: #a8a29e;
    --desc: #d6d3d1;
    --dotted: #57534e;
    --footer: #78716c;
    --pre-bg: #292524;
    --bg-alt: #292524;
    --bg-content: #1c1917;
    --hash-bg: #292524;
}

:root.light {
    --bg: #f5f0e8;
    --text: #292524;
    --accent: #d97706;
    --border: #a8a29e;
    --border-strong: #44403c;
    --input-bg: #faf6f0;
    --btn-bg: #44403c;
    --btn-text: #faf6f0;
    --link: #92400e;
    --link-hover-bg: #d97706;
    --link-hover-text: #faf6f0;
    --meta: #78716c;
    --url: #78716c;
    --desc: #57534e;
    --dotted: #d6d3d1;
    --footer: #a8a29e;
    --pre-bg: #eae2d4;
    --bg-alt: #ede5d8;
    --bg-content: #fdfaf5;
    --hash-bg: #eae2d4;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background 0.2s, color 0.2s;
}

/* ── Header ─────────────────────────────────────────────────────── */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 2rem;
    border-bottom: 3px solid var(--border-strong);
    padding: 0.5rem 1.5rem;
    background: none;
    color: var(--text);
    flex-wrap: wrap;
    gap: 0.5rem;
}
header .site-title {
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.15s;
}
header .site-title:hover,
header .title:hover {
    text-decoration-color: var(--accent);
}
header .title {
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--text);
}
header a {
    color: var(--link);
    text-decoration: underline;
    font-size: 0.8rem;
    transition: background 0.1s, color 0.1s;
}
header a:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover-text);
}
header nav {
    display: flex;
    gap: 0.75rem;
    margin-left: auto;
}
header nav a {
    color: var(--link);
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
header nav a.active {
    color: var(--accent);
    font-weight: bold;
}
header h1 {
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text);
}

/* ── Layout ─────────────────────────────────────────────────────── */
main {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* ── Tables ─────────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
thead th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--meta);
    border-bottom: 2px solid var(--border-strong);
}
tbody tr {
    border-bottom: 1px dotted var(--dotted);
}
tbody tr:last-child {
    border-bottom: none;
}
tbody tr:hover {
    background: var(--bg-alt);
}
tbody td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}

/* ── Monospace hash badges ───────────────────────────────────────── */
.hash {
    font-family: var(--font);
    font-size: 0.75rem;
    background: var(--hash-bg);
    border: 1px solid var(--border);
    padding: 0.15em 0.5em;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}
a.hash:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Status badges ───────────────────────────────────────────────── */
.badge {
    font-size: 0.6rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.15em 0.5em;
    border: 1px solid;
    white-space: nowrap;
}
.badge-added {
    background: transparent;
    color: #2a6a2a;
    border-color: #2a6a2a;
}
.badge-deleted {
    background: transparent;
    color: #6a2a2a;
    border-color: #6a2a2a;
}
.badge-modified {
    background: transparent;
    color: #6a4a2a;
    border-color: #6a4a2a;
}
.badge-renamed {
    background: transparent;
    color: #2a3a6a;
    border-color: #2a3a6a;
}
.badge-copied {
    background: transparent;
    color: #4a2a6a;
    border-color: #4a2a6a;
}
.badge-changed {
    border-color: var(--border);
    color: var(--meta);
}

/* ── Clone instruction box ───────────────────────────────────────── */
.clone-box {
    border: 1px solid var(--border);
    padding: 0.6rem 0.8rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.clone-label {
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--meta);
    flex-shrink: 0;
}
.clone-url {
    font-family: var(--font);
    font-size: 0.8rem;
    color: var(--text);
    flex: 1;
    overflow-x: auto;
}

/* ── Section headings ────────────────────────────────────────────── */
.section-heading {
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--meta);
    margin-bottom: 0.75rem;
    margin-top: 2rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--dotted);
}
.section-heading:first-child {
    margin-top: 0;
}

/* ── Commit detail ───────────────────────────────────────────────── */
.commit-meta {
    border: 1px solid var(--border);
    padding: 0.8rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.8rem;
}
.commit-meta dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 1rem;
}
.commit-meta dt {
    color: var(--meta);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
}
.hash-full {
    font-family: var(--font);
    font-size: 0.75rem;
    word-break: break-all;
}
.commit-message {
    background: var(--pre-bg);
    border: 1px solid var(--border);
    padding: 0.8rem 1rem;
    font-family: var(--font);
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 1.5rem;
}

/* ── Changed-files list ──────────────────────────────────────────── */
.files-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.files-list li {
    border: 1px solid var(--border);
}
.files-list details > summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.files-list details > summary::-webkit-details-marker {
    display: none;
}
.files-list details[open] > summary {
    border-bottom: 1px solid var(--border);
}
.files-list details > summary:hover {
    background: var(--bg-alt);
}
.file-path {
    font-family: var(--font);
    font-size: 0.8rem;
    flex: 1;
}

/* ── Diff table ───────────────────────────────────────────────────── */
.diff-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font);
    font-size: 0.75rem;
    line-height: 1.45;
}
.diff-cell {
    padding: 0 0.75em;
    white-space: pre;
    overflow-x: visible;
}
.diff-table thead th,
.diff-table tbody tr {
    border-bottom: none;
}
.diff-table tbody tr:hover {
    background: inherit;
}
.diff-table tbody tr:last-child {
    border-bottom: none;
}
tr.diff-header td {
    color: var(--meta);
}
tr.diff-hunk td {
    background: #eef2ff;
    color: #2a3a7a;
}
tr.diff-added td {
    background: #e8f8e8;
    color: #1a4a1a;
}
tr.diff-removed td {
    background: #fce8e8;
    color: #5a1818;
}
tr.diff-context td {
    color: var(--text);
}

:root.dark tr.diff-hunk td {
    background: #1a1a3a;
    color: #8888cc;
}
:root.dark tr.diff-added td {
    background: #0a2a0a;
    color: #66cc66;
}
:root.dark tr.diff-removed td {
    background: #2a0a0a;
    color: #cc6666;
}
@media (prefers-color-scheme: dark) {
    tr.diff-hunk td { background: #1a1a3a; color: #8888cc; }
    tr.diff-added td { background: #0a2a0a; color: #66cc66; }
    tr.diff-removed td { background: #2a0a0a; color: #cc6666; }
}

/* ── Ref badges (commit log) ────────────────────────────────────────────── */
.commit-hash-cell {
    white-space: nowrap;
}
.ref-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 0.1em 0.4em;
    border: 1px solid;
    white-space: nowrap;
    vertical-align: middle;
    margin-left: 0.35em;
    text-decoration: none;
    line-height: 1.4;
}
.browse-link {
    background: var(--bg-alt);
    color: var(--link);
    border-color: var(--border);
}
.browse-link:hover {
    background: var(--link);
    color: var(--bg-content);
    border-color: var(--link);
}
.ref-badge-tag {
    background: transparent;
    color: #2d6a2d;
    border-color: #2d6a2d;
}
.ref-badge-branch {
    background: transparent;
    color: #2a3a6a;
    border-color: #2a3a6a;
}

:root.dark .ref-badge-tag {
    color: #66cc66;
    border-color: #66cc66;
}
:root.dark .ref-badge-branch {
    color: #6688cc;
    border-color: #6688cc;
}
@media (prefers-color-scheme: dark) {
    .ref-badge-tag { color: #66cc66; border-color: #66cc66; }
    .ref-badge-branch { color: #6688cc; border-color: #6688cc; }
}

/* ── Branch switcher (log page nav) ─────────────────────────────────────── */
.branch-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
}
.branch-switcher a {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--link);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.branch-switcher a:hover {
    border-color: var(--accent);
    background: var(--link-hover-bg);
    color: var(--link-hover-text);
}
.branch-switcher a.active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--btn-text);
}

/* ── Ref colours ─────────────────────────────────────────────────────────── */
.ref-kind-tag {
    color: var(--accent);
}
.ref-kind-branch {
    color: #336699;
}

:root.dark .ref-kind-branch {
    color: #6699cc;
}
@media (prefers-color-scheme: dark) {
    .ref-kind-branch { color: #6699cc; }
}

/* ── Links ───────────────────────────────────────────────────────── */
a {
    color: var(--link);
    text-decoration: underline;
    transition: color 0.15s, background 0.15s;
}
a:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover-text);
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
    main {
        padding: 0 1rem;
        margin: 1rem auto;
    }
    .commit-meta dl {
        grid-template-columns: 1fr;
    }
    .clone-box {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Root index (versions list) page ─────────────────────────────── */

/* Atom/RSS feed link shown in the header */
.feed-link {
    display: flex;
    align-items: center;
    gap: 0.4em;
    color: var(--link);
    text-decoration: underline;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.feed-link:hover {
    color: var(--accent);
}
.feed-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    background: #f96b15;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='3' cy='13' r='2' fill='white'/%3E%3Cpath d='M3 6.5A6.5 6.5 0 0 1 9.5 13' stroke='white' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 2A11 11 0 0 1 14 13' stroke='white' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 80%;
}

/* Versions list main area */
.versions-main {
    max-width: 760px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}
.versions-list {
    list-style: none;
}
.versions-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
    transition: border-color 0.15s;
}
.versions-list li:hover {
    border-color: var(--accent);
}
a.version-link {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--link);
    text-decoration: underline;
}
a.version-link:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover-text);
}
.badge-latest {
    font-size: 0.6rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.15em 0.5em;
}
.badge-latest a {
    color: inherit;
    text-decoration: none;
}
.badge-latest a:hover {
    background: var(--accent);
    color: var(--btn-text);
}
.version-date {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--meta);
    font-variant-numeric: tabular-nums;
}
.repo-browse-link {
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

/* ── Version release page ────────────────────────────────────────── */

.release-layout {
    display: flex;
    min-height: calc(100vh - 44px);
}

aside {
    width: 230px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    font-size: 0.8rem;
}
aside h3 {
    font-size: 0.65rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--meta);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}
aside h3:first-child {
    margin-top: 0;
}
aside ul {
    list-style: none;
}
aside li {
    padding: 0.2rem 0;
}
aside a {
    color: var(--link);
    text-decoration: underline;
}
aside a:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover-text);
}

.release-content {
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 860px;
    overflow-x: hidden;
    margin: 0;
}

/* Markdown typography inside the release content pane */
.release-content h1,
.release-content h2,
.release-content h3,
.release-content h4,
.release-content h5,
.release-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.3;
    color: var(--text);
}
.release-content h1 {
    font-size: 1.5rem;
    border-bottom: 2px solid var(--border-strong);
    padding-bottom: 0.4rem;
}
.release-content h2 {
    font-size: 1.2rem;
    border-bottom: 1px solid var(--dotted);
    padding-bottom: 0.3rem;
}
.release-content h3 {
    font-size: 1.05rem;
}
.release-content p {
    margin-bottom: 1em;
}
.release-content a {
    color: var(--link);
}
.release-content a:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover-text);
}
.release-content img {
    max-width: 100%;
    height: auto;
}
.release-content pre {
    background: var(--pre-bg);
    border: 1px solid var(--border);
    padding: 0.8em 1em;
    overflow-x: auto;
    margin-bottom: 1em;
    font-size: 0.85em;
}
.release-content code {
    font-family: var(--font);
    background: var(--pre-bg);
    padding: 0.15em 0.4em;
    font-size: 0.85em;
}
.release-content pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}
.release-content ul,
.release-content ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}
.release-content li {
    margin-bottom: 0.2em;
}
.release-content table {
    border-collapse: collapse;
    margin-bottom: 1em;
    width: 100%;
}
.release-content th,
.release-content td {
    border: 1px solid var(--border);
    padding: 0.35em 0.75em;
    text-align: left;
}
.release-content th {
    font-weight: bold;
}
.release-content blockquote {
    border-left: 3px solid var(--border);
    padding: 0.4em 1em;
    margin: 0 0 1em;
    color: var(--meta);
}

/* Dist file metadata in the sidebar */
.dist-meta {
    font-size: 0.7rem;
    color: var(--meta);
    margin-top: 0.15rem;
    word-break: break-all;
}
.dist-meta code {
    font-family: var(--font);
    font-size: 0.65rem;
}

/* Changelog section divider and heading */
.changelog-divider {
    border: none;
    border-top: 2px solid var(--border-strong);
    margin: 2.5rem 0;
}
.changelog-heading {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 1rem;
}

@media (max-width: 640px) {
    .release-layout {
        flex-direction: column;
    }
    aside {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .release-content {
        padding: 1.5rem 1rem;
    }
}

/* ── Tree browser (directory listings and file views) ────────────── */

/* ── Breadcrumb ───────────────────────────────────────────────────── */
.breadcrumb {
    font-size: 0.8rem;
    color: var(--meta);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2em;
}
.breadcrumb a {
    color: var(--link);
    text-decoration: underline;
}
.breadcrumb a:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover-text);
}
.breadcrumb-sep {
    color: var(--border);
    margin: 0 0.1em;
    user-select: none;
}

/* ── Revision note ────────────────────────────────────────────────── */
.tree-rev {
    font-size: 0.75rem;
    color: var(--meta);
    margin-top: 0.5rem;
}

/* ── Directory listing table ──────────────────────────────────────── */
.tree-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.tree-table thead th,
.tree-table tbody tr {
    border-bottom: 1px solid var(--dotted);
}
.tree-table tbody tr:last-child {
    border-bottom: none;
}
.tree-table tbody tr:hover {
    background: var(--bg-alt);
}

.tree-mode {
    width: 1.5rem;
    padding: 0.4rem 0.5rem 0.4rem 0.75rem;
    color: var(--meta);
    font-size: 0.75rem;
}
.tree-mode-tree::before {
    content: ">";
}
.tree-mode-blob::before {
    content: "-";
}

.tree-table td:last-child {
    padding: 0.4rem 0.75rem;
}
a.tree-entry-tree {
    color: var(--link);
    font-weight: bold;
    text-decoration: underline;
}
a.tree-entry-tree:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover-text);
}
a.tree-entry-blob {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.15s;
}
a.tree-entry-blob:hover {
    color: var(--link);
    text-decoration-color: var(--link);
}

/* ── Blob (file content) ─────────────────────────────────────────── */
.blob-notice {
    font-size: 0.85rem;
    color: var(--meta);
    padding: 1.5rem 0;
}
.blob-content {
    overflow-x: auto;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    line-height: 1.5;
}
.blob-content pre {
    background: var(--pre-bg) !important;
    margin: 0 !important;
    padding: 0.75em 1em !important;
    font-family: var(--font);
    overflow-x: auto;
}
