:root {
    --bg: #0b0d10;
    --bg-elev: #14181d;
    --bg-elev-2: #1a1f25;
    --fg: #f3f4f6;
    --muted: #9aa3ad;
    --border: #262b32;
    --accent: #e10600;
    --accent-hover: #ff211b;
    --radius: 12px;
    --container: 1140px;
    --narrow: 720px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(circle at 50% -10%, #15191e 0%, var(--bg) 55%);
    background-repeat: no-repeat;
    background-attachment: fixed;
}

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

img { max-width: 100%; height: auto; display: block; }

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    width: 100%;
    max-width: var(--narrow);
    margin: 0 auto;
    padding: 0 24px;
}

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

.dot { color: var(--border); margin: 0 8px; }

.site-main { min-height: 60vh; padding-bottom: 72px; }

/* Checkered flag motifs */
.checker-strip {
    height: 12px;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #000 25%, transparent 25%),
        linear-gradient(-45deg, #000 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #000 75%),
        linear-gradient(-45deg, transparent 75%, #000 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
    opacity: 0.85;
}

.checker-badge {
    width: 56px;
    height: 56px;
    margin-bottom: 22px;
    border-radius: 8px;
    background-color: #000;
    background-image:
        linear-gradient(45deg, #fff 25%, transparent 25%),
        linear-gradient(-45deg, #fff 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #fff 75%),
        linear-gradient(-45deg, transparent 75%, #fff 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
    opacity: 0.9;
}

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; }

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 18px;
    padding-bottom: 18px;
    background: rgba(11, 13, 16, 0.85);
    backdrop-filter: saturate(140%) blur(10px);
    transition: padding 0.2s ease;
}

.site-header.is-scrolled .site-header-inner {
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.site-brand { display: inline-flex; align-items: center; }
.site-logo { max-height: 36px; width: auto; }

.site-wordmark {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--fg);
}

.site-nav .nav-list,
.footer-nav .nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 28px;
}

.nav-item a {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.15s ease;
}
.nav-item a:hover { color: var(--fg); }
.nav-item.nav-current a { color: var(--fg); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 9px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--fg);
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Hero */
.hero {
    padding: 84px 0 56px;
    text-align: center;
}
.hero .container { display: flex; flex-direction: column; align-items: center; }
.hero-title {
    margin: 0;
    font-size: clamp(2.4rem, 6vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.04;
}
.hero-desc {
    margin: 18px auto 0;
    max-width: 560px;
    color: var(--muted);
    font-size: clamp(1.05rem, 2.4vw, 1.25rem);
}

/* Post feed grid */
.post-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
    padding: 48px 0 0;
}

.post-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.post-card:hover {
    transform: translateY(-4px);
    border-color: #3a3026;
    box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.8);
}

.post-card-image-link { display: block; aspect-ratio: 16 / 9; background: var(--bg-elev-2); }
.post-card-image { width: 100%; height: 100%; object-fit: cover; }
.post-card-placeholder {
    display: block; width: 100%; height: 100%;
    background:
        repeating-linear-gradient(45deg, #15191e 0 12px, #1a1f25 12px 24px);
}

.post-card-body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }

.post-card-tag {
    align-self: flex-start;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 12px;
}
.post-card-tag:hover { color: var(--accent-hover); }

.post-card-title {
    margin: 0 0 10px;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
}
.post-card-title a:hover { color: var(--accent-hover); }

.post-card-excerpt { margin: 0 0 18px; color: var(--muted); font-size: 0.96rem; flex: 1; }

.post-card-meta { color: #6b7480; font-size: 0.82rem; }

/* Archive header */
.archive-header { padding: 72px 0 8px; text-align: center; }
.archive-kind {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent);
    margin-bottom: 12px;
}
.archive-title { margin: 0; font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.02em; }
.archive-desc { margin: 14px auto 0; max-width: 560px; color: var(--muted); }

/* Single post */
.post { padding-top: 56px; }
.post-header { text-align: center; padding-bottom: 36px; }
.post-tag {
    display: inline-block;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    margin-bottom: 16px;
}
.post-title { margin: 0; font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.08; }
.post-excerpt { margin: 20px auto 0; max-width: 600px; color: var(--muted); font-size: 1.15rem; }
.post-meta { margin-top: 22px; color: #6b7480; font-size: 0.9rem; }
.post-author { color: var(--fg); font-weight: 600; }

.post-feature-image {
    margin: 0 auto 48px;
    max-width: 1140px;
    padding: 0 24px;
}
.post-feature-image img { width: 100%; border-radius: var(--radius); }
.post-feature-image figcaption { margin-top: 12px; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* Content typography (Ghost .gh-content) */
.gh-content { font-size: 1.12rem; line-height: 1.75; }
.gh-content > * { margin-top: 0; margin-bottom: 1.5em; }
.gh-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.gh-content a:hover { color: var(--accent-hover); }
.gh-content h2 { margin-top: 1.8em; font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; }
.gh-content h3 { margin-top: 1.6em; font-size: 1.4rem; font-weight: 700; }
.gh-content blockquote {
    margin-left: 0;
    padding: 4px 0 4px 24px;
    border-left: 3px solid var(--accent);
    color: var(--fg);
    font-size: 1.2rem;
    font-style: italic;
}
.gh-content img, .gh-content video { border-radius: var(--radius); }
.gh-content figcaption { margin-top: 10px; text-align: center; color: var(--muted); font-size: 0.85rem; }
.gh-content hr { border: 0; height: 1px; background: var(--border); margin: 2.4em 0; }
.gh-content code {
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 0.88em;
}
.gh-content pre {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    overflow-x: auto;
}
.gh-content pre code { background: none; border: 0; padding: 0; }
.gh-content ul, .gh-content ol { padding-left: 1.4em; }
.gh-content li { margin-bottom: 0.5em; }

/* Koenig editor card widths (break out of the reading column) */
.gh-content .kg-width-wide {
    position: relative;
    width: min(1080px, 92vw);
    margin-left: 50%;
    transform: translateX(-50%);
}
.gh-content .kg-width-full {
    position: relative;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}
.gh-content .kg-width-full img { border-radius: 0; width: 100%; }
.kg-card { margin-top: 1.5em; margin-bottom: 1.5em; }

.post-footer { padding: 40px 24px 0; }
.post-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.post-tag-pill {
    font-size: 0.82rem;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.post-tag-pill:hover { color: var(--fg); border-color: var(--accent); }

.post-comments { padding-top: 48px; }

/* Footer */
.site-footer { margin-top: 80px; }
.site-footer-inner {
    padding: 48px 24px 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
    border-top: 1px solid var(--border);
}
.footer-tagline { margin: 10px 0 0; color: var(--muted); max-width: 420px; }
.footer-nav .nav-list { justify-content: center; flex-wrap: wrap; gap: 22px; }
.footer-rss { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 0.9rem; }
.footer-rss:hover { color: var(--accent-hover); }
.footer-rss svg { display: block; }
.footer-copy { margin: 0; color: #5b636d; font-size: 0.85rem; }
.footer-copy a { color: var(--muted); }
.footer-copy a:hover { color: var(--accent-hover); }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 56px 0 0;
    color: var(--muted);
}
.pagination a {
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.92rem;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent-hover); }
.pagination .page-number { font-size: 0.88rem; }

/* Error page */
.error-page { padding: 100px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.error-code { margin: 0; font-size: clamp(4rem, 14vw, 8rem); font-weight: 800; letter-spacing: -0.04em; }
.error-message { margin: 8px 0 32px; color: var(--muted); font-size: 1.2rem; }

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.btn:hover { background: var(--accent-hover); color: #fff; }

/* Contact form */
.contact-page { padding-top: 56px; }
.contact-form { margin-top: 12px; padding-bottom: 32px; }
.contact-field { margin-bottom: 20px; display: flex; flex-direction: column; }
.contact-field label { margin-bottom: 8px; font-size: 0.9rem; font-weight: 600; color: var(--fg); }
.contact-form input,
.contact-form textarea {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--fg);
    font: inherit;
    padding: 12px 14px;
    transition: border-color 0.15s ease;
}
.contact-form input:focus,
.contact-form textarea:focus { outline: none; border-color: var(--accent); }
.contact-form textarea { resize: vertical; min-height: 140px; }
.contact-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.contact-submit { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.contact-submit:disabled { opacity: 0.6; cursor: default; }
.contact-status { margin-top: 16px; font-size: 0.95rem; min-height: 1.2em; }
.contact-status.is-success { color: #38c172; }
.contact-status.is-error { color: var(--accent-hover); }

/* Responsive */
@media (max-width: 700px) {
    .nav-toggle { display: flex; }
    .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-elev);
        border-bottom: 1px solid var(--border);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease;
    }
    .site-nav.is-open { max-height: 60vh; }
    .site-nav .nav-list { flex-direction: column; gap: 0; padding: 8px 24px 16px; }
    .site-nav .nav-item a { display: block; padding: 12px 0; font-size: 1.05rem; }
    .hero { padding: 56px 0 36px; }
    .post-feed { gap: 24px; padding-top: 36px; }
}
