/* WebGit design system — technical / schematic, light + dark. */

:root {
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --bg: #ecedef;
    --surface: #ffffff;
    --surface-2: #f6f7f8;
    --ink: #15171a;
    --muted: #555c67;
    --line: #d4d7db;
    --line-strong: #15171a;
    --accent: #ff5a1f;
    --highlight: #c9f24d;
    --ok: #16803c;
    --warn: #b4690e;
    --err: #c02a2a;
    --shadow: none;
    --radius: 2px;
}

:root:not([data-theme]) {
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #0b0c0e;
        --surface: #131417;
        --surface-2: #1a1c20;
        --ink: #ecedee;
        --muted: #b7bec8;
        --line: #2a2d33;
        --line-strong: #ecedee;
        --ok: #3fbf6a;
        --warn: #e0a24a;
        --err: #ff6b6b;
        color-scheme: dark;
    }
}

[data-theme="dark"] {
    --bg: #0b0c0e;
    --surface: #131417;
    --surface-2: #1a1c20;
    --ink: #ecedee;
    --muted: #b7bec8;
    --line: #2a2d33;
    --line-strong: #ecedee;
    --ok: #3fbf6a;
    --warn: #e0a24a;
    --err: #ff6b6b;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

a:hover {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

h1, h2, h3 {
    font-weight: 800;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    line-height: 1.1;
    margin: 1.4em 0 0.5em;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 0.95rem; }

p { margin: 0.6em 0; }

code, pre, .mono {
    font-family: var(--font-mono);
    font-size: 0.86em;
}

code {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.05em 0.35em;
}

pre {
    overflow: auto;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    margin: 0.8em 0;
}

/* App bar */
.appbar {
    background: var(--surface);
    border-bottom: 2px solid var(--line-strong);
    position: sticky;
    top: 0;
    z-index: 10;
}

.appbar-inner {
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.7rem 1.25rem;
}

.brand {
    display: flex;
    flex-direction: column;
    line-height: 1;
    border: 0;
    font-weight: 900;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.brand:hover { color: var(--ink); border: 0; }

.brand-sub {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.28em;
    color: var(--muted);
    font-weight: 500;
    margin-top: 0.25rem;
}

.appnav {
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-right: auto;
}

.appnav a {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border: 0;
    color: var(--muted);
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
}

.appnav a:hover,
.appnav a.active {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.appbar-end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.whoami {
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.whoami::before { content: "▸ "; color: var(--accent); }

.theme-toggle {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    line-height: 1;
    font-size: 0.9rem;
    border-radius: var(--radius);
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

.feedback-link {
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 0;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.feedback-link:hover { border-color: var(--accent); color: var(--accent); }

.appbar-search { margin: 0; }

.appbar-search input {
    width: 11rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.78rem;
}

.comment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
    margin-top: 0.4rem;
}

.comment-actions form { margin: 0; }
.comment-actions textarea { width: 100%; min-width: 18rem; }

/* Layout */
.page {
    max-width: 80rem;
    margin: 2rem auto 4rem;
    padding: 0 1.25rem;
}

.footer {
    border-top: 1px solid var(--line);
    margin-top: 3rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.footer-inner {
    max-width: 80rem;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Tag chip (SECTION) */
.tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius);
}

/* Section block (black slab) */
.section-block {
    background: var(--line-strong);
    color: var(--bg);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    border-radius: var(--radius);
}

.section-block .section-title {
    margin: 0.35rem 0 0;
    font-size: 1.5rem;
    color: var(--bg);
}

.section-block .tag {
    color: var(--bg);
    border-color: color-mix(in srgb, var(--bg) 45%, transparent);
}

/* Tabs / segmented nav */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 1px solid var(--line);
    margin: 1rem 0;
}

.tabs a {
    border: 0;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid transparent;
}

.tabs a.active,
.tabs a:hover {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line-strong);
}

tbody tr:hover { background: var(--surface-2); }

.table-actions { white-space: nowrap; }

.table-actions form {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0.35rem 0 0;
    vertical-align: middle;
}

.table-actions select { width: auto; min-width: 6rem; }

.labels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.4rem 0;
}

.label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.02em;
}

.label::before {
    content: "";
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--label, var(--line));
    border: 1px solid var(--line);
}

.label-check {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-right: 0.75rem;
    text-transform: none;
}

.label-check input { width: auto; }

/* Buttons */
button, .btn {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    display: inline-block;
    line-height: 1;
}

button:hover, .btn:hover {
    background: var(--line-strong);
    color: var(--bg);
    border-bottom-color: var(--line-strong);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: #e14a12; border-color: #e14a12; color: #fff; }

.btn-danger { border-color: var(--err); color: var(--err); }
.btn-danger:hover { background: var(--err); color: #fff; border-color: var(--err); }

.btn.subtle {
    border-color: var(--line);
    color: var(--muted);
}

.btn.subtle:hover { color: var(--ink); background: var(--surface-2); border-color: var(--line); }

/* Forms */
form { margin: 1rem 0; }

.field, input[type="text"], input[type="number"], input[type="password"], textarea, select {
    width: 100%;
    font: inherit;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

label { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

/* Badges */
.badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
}

.badge-open { color: var(--accent); border-color: var(--accent); }
.badge-closed { color: var(--muted); }
.badge-merged, .badge-ok, .badge-success { color: var(--ok); border-color: var(--ok); }
.badge-fail, .badge-failure { color: var(--err); border-color: var(--err); }
.badge-running, .badge-draft { color: var(--warn); border-color: var(--warn); }
.badge-queued { color: var(--muted); }

/* Comments / cards */
.comment {
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 0.7rem 0.9rem;
    margin: 0.65rem 0;
    background: var(--surface);
}

.comment .meta {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    color: var(--muted);
    text-transform: uppercase;
}

.muted { color: var(--muted); }
.text { white-space: pre-wrap; }

.diff, .log {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre;
}

ul.requests { list-style: none; padding: 0; }
ul.requests li {
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    margin: 0.75rem 0;
    background: var(--surface);
}

/* Landing modules */
.modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    margin: 1.5rem 0;
}

.module {
    background: var(--surface);
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border: 0;
    min-height: 6rem;
}

.module:hover { background: var(--surface-2); border: 0; }

.module .idx {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.2em;
    color: var(--accent);
}

.module .name {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ink);
}

.module .desc {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted);
}

.accent-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.accent-swatch {
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--sw);
    cursor: pointer;
}

.accent-swatch:hover { border-color: var(--ink); }

.accent-custom {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: none;
    cursor: pointer;
}

.accent-reset {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    background: none;
    border: 0;
    padding: 0.2rem 0.3rem;
    cursor: pointer;
}

.accent-reset:hover { color: var(--accent); }

.shell { max-width: 66rem; margin: 3rem auto; padding: 0 1.25rem; }

@media (max-width: 560px) {
    .appbar-inner { flex-wrap: wrap; gap: 0.6rem; }
    .appnav { order: 3; width: 100%; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Repo page (GitHub-like) */
.repo-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.05rem;
    margin: 0.5rem 0 0.75rem;
    flex-wrap: wrap;
}
.repo-title strong { font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }

.repo-toolbar {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1rem;
}
.branch-select { width: auto; min-width: 12rem; }
.clone code { border: 0; background: transparent; font-size: 0.72rem; color: var(--muted); }

.repo-layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.75rem; align-items: start; }
.repo-main { min-width: 0; }
.repo-side { font-size: 0.85rem; }
.repo-side h3 { margin-top: 0; }
.repo-side .facts { margin: 0.75rem 0; }
.repo-side .facts dt { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 0.6rem; }
.repo-side .facts dd { margin: 0.15rem 0 0; }
.set-default { display: flex; gap: 0.4rem; margin-top: 0.75rem; }
.set-default select { flex: 1; }

.commit-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--line);
    border-bottom: 0;
    background: var(--surface-2);
    font-size: 0.82rem;
    border-radius: var(--radius) var(--radius) 0 0;
}
.commit-bar strong { font-weight: 700; }

table.files, table.commits { margin-top: 0; }
table.files .name a { border-bottom: 0; }
table.files .name a:hover { border-bottom: 1px solid var(--accent); }
.num { text-align: right; }

.breadcrumb {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    margin: 0.5rem 0 1rem;
    color: var(--muted);
}
.breadcrumb a { border-bottom: 0; }

.readme { margin-top: 1.75rem; border: 1px solid var(--line); border-radius: var(--radius); }
.readme-head {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.readme .markdown { padding: 0.5rem 1.1rem 1.1rem; }
.file-head { display: flex; align-items: center; gap: 0.75rem; margin: 0.5rem 0 0.75rem; }
.file-head .file { font-family: var(--font-mono); }
pre.code, pre.inline { margin: 0; }
pre.inline { border: 0; padding: 0.2rem 0.4rem; background: transparent; white-space: pre; }
table.blame td { padding: 0.2rem 0.5rem; }

/* Markdown */
.markdown { line-height: 1.6; word-wrap: break-word; }
.markdown > :first-child { margin-top: 0.6rem; }
.markdown h1, .markdown h2 { border-bottom: 1px solid var(--line); padding-bottom: 0.3rem; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { text-transform: none; letter-spacing: 0; }
.markdown a { border-bottom: 1px solid var(--line); }
.markdown code { white-space: pre-wrap; }
.markdown pre { background: var(--surface-2); }
.markdown ul, .markdown ol { padding-left: 1.4rem; }
.markdown li { margin: 0.2rem 0; }
.markdown blockquote {
    margin: 0.8rem 0;
    padding: 0.2rem 0.9rem;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}
.markdown img { max-width: 100%; }
.markdown hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.markdown table { font-size: 0.85rem; }
.markdown input[type="checkbox"] { width: auto; }

@media (max-width: 800px) {
    .repo-layout { grid-template-columns: 1fr; }
}

/* Full-width repo body (tree/blob/commits — no sidebar) */
.repo-body { display: block; width: 100%; }

/* GitHub-like file table */
.files td.name a { font-weight: 600; }
.files td.msg { max-width: 32rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files tr.parent td { background: var(--surface-2); }

/* Mermaid diagrams */
pre.mermaid { display: flex; justify-content: center; }
pre.mermaid svg { max-width: 100%; height: auto; }

/* Avatars */
.avatar {
    width: 26px;
    height: 26px;
    max-width: 26px;
    max-height: 26px;
    border-radius: 50%;
    border: 1px solid var(--line);
    object-fit: cover;
    vertical-align: middle;
}
.avatar-lg {
    width: 72px;
    height: 72px;
    max-width: 72px;
    max-height: 72px;
    border-radius: 50%;
    border: 1px solid var(--line);
    object-fit: cover;
}
.profile-head { display: flex; align-items: flex-start; gap: 1.25rem; flex-wrap: wrap; }
.profile-head table { flex: 1; min-width: 16rem; }

/* Notices */
.notice { padding: 0.6rem 0.9rem; border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius); }
.notice.ok { border-left-color: var(--ok); }
.notice.warn { border-left-color: var(--warn); }
.notice.err { border-left-color: var(--err); }

/* Mirroring */
form.inline { display: inline-block; margin-right: 0.5rem; }
.release { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 1rem 0; }
.release-head { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.5rem; }

/* Mirror directions */
.directions { border: 1px solid var(--line); border-radius: var(--radius); margin: 1rem 0; }
.direction { display: flex; align-items: center; gap: 1rem; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); }
.direction:last-child { border-bottom: 0; }
.direction-info { flex: 1; }
.direction-info strong { display: block; }
.direction-state { flex: 0 0 auto; }
.direction form { margin: 0; }

.direction-status { font-family: var(--font-mono); font-size: 0.72rem; margin-top: 0.35rem; }
