:root {
    --bg: #0d1117;
    --surface: #161b22;
    --border: #21262c;
    --border-strong: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --text-dim: #484f58;
    --accent: #58a6ff;
    --danger: #f85149;
    --tag-python: #58a6ff;
    --tag-sql: #3fb950;
    --tag-linux: #f0883e;
    --tag-ia: #bc8cff;
    --tag-github: #f778ba;
    --tag-default: #8b949e;
}

:root[data-theme="light"] {
    --bg: #ffffff;
    --surface: #f6f8fa;
    --border: #d0d7de;
    --border-strong: #afb8c1;
    --text: #1f2328;
    --text-muted: #59636e;
    --text-dim: #6e7781;
    --accent: #0969da;
    --danger: #cf222e;
    --tag-python: #0969da;
    --tag-sql: #1a7f37;
    --tag-linux: #9a6700;
    --tag-ia: #8250df;
    --tag-github: #bf3989;
    --tag-default: #59636e;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg: #ffffff;
        --surface: #f6f8fa;
        --border: #d0d7de;
        --border-strong: #afb8c1;
        --text: #1f2328;
        --text-muted: #59636e;
        --text-dim: #6e7781;
        --accent: #0969da;
        --danger: #cf222e;
        --tag-python: #0969da;
        --tag-sql: #1a7f37;
        --tag-linux: #9a6700;
        --tag-ia: #8250df;
        --tag-github: #bf3989;
        --tag-default: #59636e;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

.site-header {
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 0.5px solid var(--border);
}

.site-title {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 15px;
    color: var(--text);
}

.site-header nav {
    display: flex;
    gap: 20px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
}

.site-header nav a {
    color: var(--text-muted);
}

.theme-toggle {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
}

.theme-toggle:hover {
    color: var(--text);
    text-decoration: underline;
}

.page {
    max-width: 860px;
    margin: 0 auto;
    padding: 36px 24px 56px;
}

.flash {
    font-size: 13px;
    color: #3fb950;
    margin: 0 0 20px;
}

.error {
    font-size: 13px;
    color: var(--danger);
    margin: 0 0 20px;
}

.meta {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

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

.post-item {
    padding: 18px 0;
    border-bottom: 0.5px solid var(--border);
}

.post-title {
    font-size: 19px;
    font-weight: 500;
    margin: 0 0 6px;
}

.post-title a {
    color: var(--text);
}

.post-excerpt {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.pager {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 0.5px solid var(--border);
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.empty {
    color: var(--text-muted);
    font-size: 14px;
}

.breadcrumb {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.breadcrumb .sep {
    color: var(--text-dim);
}

.article-title {
    font-size: 28px;
    font-weight: 500;
    line-height: 1.3;
    margin: 0 0 14px;
}

.article-body {
    font-size: 15px;
    line-height: 1.75;
}

.article-body p {
    max-width: 70ch;
    margin: 0 0 18px;
}

.article-body pre {
    background: #161b22;
    border: 0.5px solid #30363d;
    color: #e6edf3;
    border-radius: 8px;
    padding: 16px 18px;
    overflow-x: auto;
    font-size: 13px;
}

.article-body code {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
    background: var(--surface);
    border: 0.5px solid var(--border-strong);
    border-radius: 4px;
    padding: 1px 6px;
}

.article-body pre code {
    background: none;
    border: none;
    padding: 0;
}

.article-body h2 {
    max-width: 70ch;
    font-size: 20px;
    font-weight: 500;
    margin: 32px 0 12px;
}

.article-body h3 {
    max-width: 70ch;
    font-size: 16px;
    font-weight: 500;
    margin: 28px 0 10px;
}

.article-body ul,
.article-body ol {
    max-width: 70ch;
    margin: 0 0 18px;
    padding-left: 22px;
}

.article-body li {
    margin-bottom: 6px;
}

.article-body blockquote {
    max-width: 70ch;
    border-left: 2px solid var(--accent);
    padding: 2px 0 2px 16px;
    margin: 0 0 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.article-body strong {
    font-weight: 500;
    color: var(--text);
}

.article-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 0 0 24px;
    display: block;
}

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 24px;
}

.admin-post-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-actions {
    display: flex;
    gap: 16px;
    font-size: 13px;
    margin-top: 4px;
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--danger);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

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

.button {
    border: 0.5px solid var(--border-strong);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 640px;
}

.admin-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.admin-form .hint {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 400;
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form textarea {
    background: var(--surface);
    border: 0.5px solid var(--border-strong);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.admin-form textarea {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 13px;
    resize: vertical;
}

.checkbox-label {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
}

.admin-form-actions {
    display: flex;
    gap: 12px;
}

.admin-form button {
    align-self: flex-start;
    background: none;
    border: 0.5px solid var(--accent);
    color: var(--accent);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
}

.admin-form button:hover {
    background: rgba(88, 166, 255, 0.1);
}

.admin-form button.button-secondary {
    border-color: var(--border-strong);
    color: var(--text-muted);
}

.admin-form button.button-secondary:hover {
    background: var(--surface);
}

.preview-banner {
    display: inline-block;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    color: var(--accent);
    border: 0.5px solid var(--border-strong);
    border-radius: 6px;
    padding: 4px 10px;
    margin-bottom: 20px;
}
