/* ==========================================================================
   Blog stylesheet — custom properties, layout, typography, components.
   No framework, no build step.
   ========================================================================== */

:root {
    --bg: #ffffff;
    --bg-subtle: #f7f8fa;
    --bg-code: #f2f3f5;
    --text: #1c1f24;
    --text-muted: #5b6472;
    --text-faint: #8b95a3;
    --border: #e3e6ea;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-soft: #eff5ff;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #059669;
    --success-soft: #ecfdf5;
    --warning: #d97706;
    --warning-soft: #fffbeb;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .05);
    --shadow-lg: 0 8px 28px rgba(16, 24, 40, .10);

    --content-width: 720px;
    --wide-width: 1100px;
    --header-height: 64px;
}

/* Dark theme follows the OS preference. */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1216;
        --bg-subtle: #161a20;
        --bg-code: #1b2027;
        --text: #e6e9ee;
        --text-muted: #9aa4b2;
        --text-faint: #6b7684;
        --border: #262c35;
        --accent: #60a5fa;
        --accent-dark: #93c5fd;
        --accent-soft: #172337;
        --danger: #f87171;
        --danger-soft: #2a1618;
        --success: #34d399;
        --success-soft: #10241d;
        --warning: #fbbf24;
        --warning-soft: #251c0d;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .25);
        --shadow-lg: 0 8px 28px rgba(0, 0, 0, .45);
    }
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1 0 auto; }

img, video, svg { max-width: 100%; height: auto; }

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

a:hover { color: var(--accent-dark); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
    line-height: 1.25;
    margin: 0 0 .5em;
    font-weight: 700;
    letter-spacing: -.015em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1rem; }

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

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

code {
    background: var(--bg-code);
    padding: .15em .4em;
    border-radius: 4px;
}

pre {
    background: var(--bg-code);
    padding: 1rem 1.15rem;
    border-radius: var(--radius);
    overflow-x: auto;
    border: 1px solid var(--border);
    line-height: 1.55;
}

pre code {
    background: none;
    padding: 0;
    font-size: .85rem;
}

blockquote {
    margin: 1.5rem 0;
    padding: .25rem 0 .25rem 1.25rem;
    border-left: 3px solid var(--accent);
    color: var(--text-muted);
    font-style: italic;
}

blockquote p:last-child { margin-bottom: 0; }

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: .95rem;
}

th, td {
    padding: .6rem .8rem;
    border: 1px solid var(--border);
    text-align: left;
}

th {
    background: var(--bg-subtle);
    font-weight: 600;
}

ul, ol { padding-left: 1.4rem; }
li { margin-bottom: .35rem; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.container {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.wide { max-width: var(--wide-width); }

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

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: #fff;
    padding: .7rem 1rem;
    z-index: 100;
    border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
    left: 0;
    color: #fff;
}

.dot { color: var(--text-faint); }

/* --------------------------------------------------------------------------
   Header & navigation
   -------------------------------------------------------------------------- */

.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(180%) blur(8px);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
}

.header-inner {
    max-width: var(--wide-width);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: var(--header-height);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -.02em;
}

.brand:hover { text-decoration: none; color: var(--text); }

.brand-mark {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: .95rem;
}

.brand-text { font-size: 1.02rem; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.35rem;
    font-size: .93rem;
}

.site-nav a {
    color: var(--text-muted);
    font-weight: 500;
}

.site-nav a:hover { color: var(--text); text-decoration: none; }

.nav-admin {
    padding: .3rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text) !important;
}

.nav-admin:hover { border-color: var(--accent); color: var(--accent) !important; }

.logout-form { margin: 0; }

.link-button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: .93rem;
    color: var(--text-muted);
    cursor: pointer;
}

.link-button:hover { color: var(--text); }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0 9px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
    display: none;
    flex-direction: column;
    gap: .15rem;
    padding: .5rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.mobile-nav a {
    padding: .65rem .25rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.mobile-nav a:last-child { border-bottom: 0; }

@media (max-width: 720px) {
    .site-nav { display: none; }
    .nav-toggle { display: flex; }
    .mobile-nav.open { display: flex; }
}

/* --------------------------------------------------------------------------
   Flash messages
   -------------------------------------------------------------------------- */

.flash {
    margin: 1.25rem 0 0;
    padding: .85rem 1.1rem;
    border-radius: var(--radius);
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    color: var(--text);
    font-size: .95rem;
}

.flash.error {
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
    color: var(--danger);
}

.flash.success {
    background: var(--success-soft);
    border-color: color-mix(in srgb, var(--success) 30%, transparent);
    color: var(--success);
}

/* --------------------------------------------------------------------------
   Page intro & listings
   -------------------------------------------------------------------------- */

.page-intro {
    padding: 3rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.page-intro h1 { margin-bottom: .35rem; }

.site-description {
    color: var(--text-muted);
    margin-bottom: .5rem;
    font-size: 1.02rem;
}

.post-count {
    color: var(--text-faint);
    font-size: .88rem;
    margin: 0;
}

.breadcrumb {
    font-size: .88rem;
    color: var(--text-faint);
    margin-bottom: .5rem;
}

.breadcrumb a { color: var(--text-muted); }

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

.post-card {
    padding: 1.75rem 0;
    border-bottom: 1px solid var(--border);
}

.post-card:last-child { border-bottom: 0; }

.post-card-title {
    margin: 0 0 .35rem;
    font-size: 1.35rem;
    letter-spacing: -.02em;
}

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

.post-card-title a:hover { color: var(--accent); text-decoration: none; }

.post-meta {
    color: var(--text-faint);
    font-size: .875rem;
    margin: 0 0 .6rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
}

.post-card-summary {
    color: var(--text-muted);
    margin-bottom: .75rem;
}

.tag-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.tag {
    display: inline-block;
    padding: .18rem .55rem;
    font-size: .78rem;
    border-radius: 999px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.tag:hover {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    color: var(--accent);
    text-decoration: none;
}

.tag-large {
    padding: .4rem .85rem;
    font-size: .9rem;
}

.tag-count {
    color: var(--text-faint);
    font-size: .8em;
    margin-left: .15rem;
}

/* --------------------------------------------------------------------------
   Search
   -------------------------------------------------------------------------- */

.search-form {
    position: relative;
    display: flex;
    gap: .5rem;
    margin: 1.5rem 0 2rem;
}

.search-form input[type="search"] {
    flex: 1;
    padding: .65rem .9rem;
    font-size: .95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.search-form input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.search-form button {
    padding: .65rem 1.1rem;
    font-size: .9rem;
    font-family: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    cursor: pointer;
}

.search-form button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.search-suggestions {
    position: absolute;
    top: calc(100% + .35rem);
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 20;
    overflow: hidden;
}

.search-suggestions a {
    display: block;
    padding: .6rem .9rem;
    color: var(--text);
    font-size: .92rem;
    border-bottom: 1px solid var(--border);
}

.search-suggestions a:last-child { border-bottom: 0; }

.search-suggestions a:hover,
.search-suggestions a.highlighted {
    background: var(--accent-soft);
    color: var(--accent);
    text-decoration: none;
}

.results-header {
    margin: 2rem 0 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

.results-header h2 { margin: 0 0 .2rem; font-size: 1.2rem; }
.results-header p { margin: 0; color: var(--text-faint); font-size: .88rem; }

/* --------------------------------------------------------------------------
   Post page
   -------------------------------------------------------------------------- */

.post {
    padding: 2.5rem 0 1rem;
}

.post-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.post-header h1 {
    font-size: 2.2rem;
    letter-spacing: -.025em;
    margin-bottom: .5rem;
}

.draft-banner {
    display: inline-block;
    padding: .25rem .6rem;
    font-size: .78rem;
    font-weight: 600;
    border-radius: 999px;
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
    margin-bottom: .75rem;
}

.post-content {
    font-size: 1.03rem;
    line-height: 1.72;
}

.post-content h2 {
    margin-top: 2.25rem;
    padding-bottom: .3rem;
    border-bottom: 1px solid var(--border);
}

.post-content h3 { margin-top: 1.75rem; }

.post-content ul, .post-content ol { margin-bottom: 1.25rem; }

.post-content img {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 1.25rem 0;
}

.post-content a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.post-nav {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}

.post-nav:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.post-nav.empty { border-color: transparent; }

.post-nav.next { text-align: right; }

.post-nav-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
}

.post-nav-title { font-weight: 600; font-size: .95rem; }

.related-posts {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.post-card.compact {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
}

.post-card.compact h3 { margin: 0 0 .3rem; font-size: 1rem; }
.post-card.compact a { color: var(--text); }
.post-card.compact a:hover { color: var(--accent); text-decoration: none; }

/* --------------------------------------------------------------------------
   Comments
   -------------------------------------------------------------------------- */

.comments {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.comment-count {
    color: var(--text-faint);
    font-size: .8em;
    font-weight: 500;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 2.5rem;
}

.comment {
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--border);
}

.comment-header {
    display: flex;
    align-items: baseline;
    gap: .65rem;
    margin-bottom: .4rem;
}

.comment-author { font-weight: 600; font-size: .95rem; }

.comment-date { color: var(--text-faint); font-size: .82rem; }

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

.no-comments {
    color: var(--text-faint);
    font-style: italic;
}

.comment-form {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.comment-form h3 { margin-top: 0; font-size: 1.05rem; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-row { margin-bottom: 1.1rem; }

.form-row label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 600;
    font-size: .9rem;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row input[type="url"],
.form-row input[type="search"],
.form-row textarea {
    width: 100%;
    padding: .6rem .8rem;
    font-size: .95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.form-row input:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.form-row textarea { resize: vertical; min-height: 90px; }

.form-row-inline {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.form-hint {
    margin: .35rem 0 0;
    font-size: .82rem;
    color: var(--text-faint);
}

.required { color: var(--danger); }
.optional { color: var(--text-faint); font-weight: 400; }

.checkbox {
    display: inline-flex !important;
    align-items: center;
    gap: .45rem;
    font-weight: 500 !important;
    margin: 0 !important;
    cursor: pointer;
}

.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.form-note {
    margin: .75rem 0 0;
    font-size: .82rem;
    color: var(--text-faint);
}

.button {
    display: inline-block;
    padding: .65rem 1.25rem;
    font-size: .93rem;
    font-family: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    cursor: pointer;
}

.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; color: #fff; }

.button.secondary {
    color: var(--text);
    background: var(--bg);
    border-color: var(--border);
}

.button.secondary:hover { background: var(--bg-subtle); border-color: var(--text-faint); color: var(--text); }

.button.small { padding: .4rem .8rem; font-size: .85rem; }
.button.full { width: 100%; }

.inline-form { display: inline; margin: 0; }

.danger-link {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: .9rem;
    color: var(--danger);
    cursor: pointer;
}

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

/* --------------------------------------------------------------------------
   Tags & archive
   -------------------------------------------------------------------------- */

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: 2rem;
}

.archive-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 760px) {
    .archive-layout { grid-template-columns: 1fr; gap: 2rem; }
}

.archive-year {
    font-size: 1.5rem;
    margin: 1.75rem 0 .5rem;
    padding-bottom: .3rem;
    border-bottom: 1px solid var(--border);
}

.archive-year:first-child { margin-top: 0; }

.archive-months {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.archive-months li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem .6rem;
    color: var(--text);
    border-radius: var(--radius);
}

.archive-months li a:hover { background: var(--bg-subtle); text-decoration: none; }

.archive-count {
    color: var(--text-faint);
    font-size: .85rem;
    background: var(--bg-subtle);
    padding: .1rem .5rem;
    border-radius: 999px;
}

.archive-sidebar h2 { font-size: 1.05rem; }

.archive-posts {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: post;
}

.archive-posts li {
    padding: .55rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.archive-posts a { color: var(--text); font-size: .93rem; }
.archive-posts a:hover { color: var(--accent); text-decoration: none; }
.archive-posts time { color: var(--text-faint); font-size: .8rem; }

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 2.5rem 0 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.page-link {
    padding: .45rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .9rem;
}

.page-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-link.disabled { color: var(--text-faint); opacity: .5; }
.page-status { color: var(--text-faint); font-size: .87rem; }

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */

.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 2.5rem 0 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.admin-header h1 { margin: 0 0 .2rem; }
.admin-sub { color: var(--text-faint); font-size: .9rem; margin: 0; }

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.admin-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    background: var(--bg);
}

.admin-panel h2 { font-size: 1.05rem; margin-bottom: 1rem; }

.admin-post-list, .admin-comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.admin-post-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: .93rem;
}

.admin-post-info { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.admin-post-list time { color: var(--text-faint); font-size: .8rem; white-space: nowrap; }
.admin-post-list a { color: var(--text); }
.admin-post-list a:hover { color: var(--accent); }

.admin-comment-list li {
    padding: .7rem 0;
    border-bottom: 1px solid var(--border);
}

.admin-comment-body {
    font-size: .9rem;
    color: var(--text-muted);
    margin-bottom: .3rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.admin-comment-meta {
    display: flex;
    gap: .6rem;
    font-size: .8rem;
    color: var(--text-faint);
}

.panel-link {
    display: inline-block;
    font-size: .88rem;
    font-weight: 600;
}

.status {
    display: inline-block;
    padding: .12rem .5rem;
    font-size: .72rem;
    font-weight: 600;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.status.published { background: var(--success-soft); color: var(--success); }
.status.draft { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border); }
.status.scheduled { background: var(--warning-soft); color: var(--warning); }

.alert {
    padding: .85rem 1.1rem;
    border-radius: var(--radius);
    background: var(--warning-soft);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
    color: var(--text);
    font-size: .93rem;
    margin-bottom: 1.5rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}

.admin-table th {
    text-align: left;
    padding: .6rem .75rem;
    border-bottom: 2px solid var(--border);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-faint);
}

.admin-table td {
    padding: .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table-title { color: var(--text); font-weight: 600; }
.table-title:hover { color: var(--accent); }

.table-slug {
    display: block;
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: .78rem;
}

.table-actions {
    display: flex;
    gap: .75rem;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
}

.table-actions a { font-size: .87rem; }

.admin-search { max-width: 420px; }

.login-wrap {
    display: flex;
    justify-content: center;
    padding: 4rem 0;
}

.login-card {
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    background: var(--bg);
    box-shadow: var(--shadow);
}

.login-card h1 { margin-bottom: .25rem; font-size: 1.4rem; }

.login-sub {
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 1.5rem;
}

.login-form button { margin-top: .5rem; }

/* --------------------------------------------------------------------------
   Editor
   -------------------------------------------------------------------------- */

.editor-form { padding-bottom: 3rem; }

.editor-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 900px) {
    .editor-split { grid-template-columns: 1fr; }
}

.editor-split textarea {
    min-height: 440px;
    font-family: var(--font-mono);
    font-size: .88rem;
    line-height: 1.6;
}

.preview-pane {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-subtle);
    display: flex;
    flex-direction: column;
    min-height: 440px;
    overflow: hidden;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem .85rem;
    border-bottom: 1px solid var(--border);
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-faint);
}

.preview-content {
    padding: 1.1rem 1.25rem;
    overflow-y: auto;
    max-height: 520px;
    font-size: .95rem;
}

.preview-empty { color: var(--text-faint); font-style: italic; }

.editor-actions {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   Moderation
   -------------------------------------------------------------------------- */

.moderation-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.moderation-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
    background: var(--bg);
}

.moderation-body {
    margin-bottom: .6rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.moderation-meta {
    display: flex;
    gap: .75rem;
    font-size: .84rem;
    color: var(--text-faint);
    margin-bottom: .85rem;
}

.moderation-email { font-family: var(--font-mono); font-size: .92em; }

.moderation-actions { display: flex; gap: 1rem; align-items: center; }

/* --------------------------------------------------------------------------
   Empty & error states
   -------------------------------------------------------------------------- */

.empty-state {
    text-align: center;
    padding: 3.5rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    margin: 1.5rem 0;
}

.empty-state h2 { margin-bottom: .35rem; }
.empty-state p { color: var(--text-muted); margin-bottom: 1.25rem; }

.error-page { text-align: center; padding: 4rem 0; }
.error-page h1 { margin-bottom: .5rem; }
.error-page p { color: var(--text-muted); margin-bottom: 1.5rem; }
.error-code { color: var(--text-faint); font-family: var(--font-mono); font-size: .9rem; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
    margin-top: 4rem;
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
    flex-shrink: 0;
}

.footer-inner {
    max-width: var(--wide-width);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    color: var(--text-faint);
    font-size: .87rem;
}

.footer-inner p { margin: 0; }

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Copy button on code blocks
   -------------------------------------------------------------------------- */

.copy-button {
    position: absolute;
    top: .5rem;
    right: .5rem;
    padding: .25rem .55rem;
    font-family: var(--font-sans);
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s ease;
}

.post-content pre:hover .copy-button,
.copy-button:focus-visible {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
    .site-header, .site-footer, .comments, .post-footer, .search-form { display: none; }
    body { font-size: 12pt; }
    .post-content { font-size: 11pt; }
    a { color: inherit; text-decoration: underline; }
}
