/* ==========================================
   CONSUME TO CREATE — BLOG DESIGN SYSTEM
   Dark • Minimal • Readable • Reusable
   ========================================== */

/* 1. Design tokens */

:root {
    color-scheme: dark;

    --bg: #191919;
    --surface: #202020;
    --surface-hover: #272825;

    --text: #e5e5e0;
    --body-text: #c4c4bd;
    --muted: #92928a;

    --border: #343432;
    --accent: #a8b49a;

    --font-ui: -apple-system, BlinkMacSystemFont,
        "Segoe UI", Helvetica, Arial, sans-serif;

    --font-reading: Georgia, "Times New Roman", serif;

    --page-width: 900px;
    --reading-width: 700px;
}


/* 2. Reset */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);

    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.75;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

::selection {
    color: var(--bg);
    background: var(--accent);
}


/* 3. Reusable layout containers */

.container {
    width: min(100% - 40px, var(--page-width));
    margin-inline: auto;
}

.reading-column {
    width: min(100% - 40px, var(--reading-width));
    margin-inline: auto;
}


/* 4. Header and navigation */

.site-header {
    border-bottom: 1px solid var(--border);
}

.header-inner {
    width: min(100% - 40px, var(--page-width));
    min-height: 68px;
    margin-inline: auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.site-logo {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 650;
    letter-spacing: -0.3px;
    text-decoration: none;
}

.site-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 22px;
}

.site-nav a {
    color: var(--muted);
    font-size: 0.88rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--text);
}


/* 5. Page introduction and blog index */

.page-intro {
    padding-top: 64px;
    margin-bottom: 42px;
}

.page-intro h1 {
    margin: 0 0 12px;

    font-family: var(--font-reading);
    font-size: clamp(2.3rem, 5vw, 3.2rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -1px;
}

.page-intro p {
    max-width: 580px;
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
}


/* 6. Article layout */

article {
    width: 100%;
}

.article-header {
    padding-top: 68px;
    margin-bottom: 38px;
}

.category {
    margin: 0 0 18px;

    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.article-title,
.article-header h1 {
    margin: 0;

    color: var(--text);
    font-family: var(--font-reading);
    font-size: clamp(2.35rem, 5vw, 3.4rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -1px;
    overflow-wrap: break-word;
}


/* 7. Article metadata */

.metadata {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;

    margin-top: 20px;

    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.metadata time {
    color: inherit;
}

/* Compatibility with older HTML using <sub> */

article sub,
body > sub {
    display: block;
    margin-top: 18px;

    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.6;
}


/* 8. Article body — the reading experience */

.article-content {
    color: var(--body-text);
    font-family: var(--font-reading);
    font-size: 1.12rem;
    line-height: 1.9;
    overflow-wrap: break-word;
}

.article-content p {
    margin: 0 0 26px;
}

.article-content strong,
.article-content b {
    color: var(--text);
    font-weight: 700;
}

.article-content h2 {
    margin: 48px 0 17px;

    color: var(--text);
    font-family: var(--font-ui);
    font-size: 1.65rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.5px;
}

.article-content h3 {
    margin: 34px 0 12px;

    color: var(--text);
    font-family: var(--font-ui);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
}

.article-content h4 {
    margin: 28px 0 10px;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
}

.article-content ul,
.article-content ol {
    margin: 0 0 28px;
    padding-left: 28px;
}

.article-content li {
    padding-left: 4px;
    margin-bottom: 8px;
}

.article-content li::marker {
    color: var(--muted);
}


/* 9. Links */

a {
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
}

.article-content a {
    color: var(--accent);
    text-decoration: underline;
}

.article-content a:hover {
    color: var(--text);
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}


/* 10. Blockquotes */

.article-content blockquote {
    margin: 34px 0;
    padding: 4px 0 4px 22px;

    border-left: 2px solid var(--accent);

    color: #b6b6ad;
    font-size: 1.08em;
    font-style: italic;
}

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


/* 11. Dividers */

hr,
.article-divider {
    height: 1px;
    border: 0;
    background: var(--border);
    margin: 28px 0;
}


/* 12. Images and captions */

.article-content figure {
    margin: 36px 0;
}

.article-content figure img,
.article-image {
    width: 100%;
    border-radius: 4px;
}

.article-content figcaption {
    margin-top: 10px;
    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    line-height: 1.6;
}


/* 13. Code snippets */

.article-content code,
code {
    font-family: "SFMono-Regular", Consolas,
        "Liberation Mono", monospace;
    font-size: 0.84em;
}

.article-content p code,
.article-content li code {
    padding: 2px 5px;
    border: 1px solid var(--border);
    border-radius: 3px;

    background: var(--surface);
    color: #c8d5bb;
}

.article-content pre,
pre {
    overflow-x: auto;
    margin: 28px 0;
    padding: 18px 20px;

    border: 1px solid var(--border);
    border-radius: 5px;

    background: #151515;
    color: var(--body-text);

    font-size: 0.88rem;
    line-height: 1.75;
    tab-size: 4;
}

.article-content pre code,
pre code {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: inherit;
}


/* 14. Tables */

.article-content table {
    width: 100%;
    margin: 28px 0;
    border-collapse: collapse;

    font-family: var(--font-ui);
    font-size: 0.92rem;
}

.article-content th,
.article-content td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.article-content th {
    color: var(--text);
    font-weight: 600;
}

.article-content td {
    color: var(--body-text);
}


/* 15. Blog index cards */

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

.post-card {
    padding: 25px 0;
    border-top: 1px solid var(--border);
}

.post-card:last-child {
    border-bottom: 1px solid var(--border);
}

.post-card .category {
    margin-bottom: 8px;
}

.post-card h2 {
    margin: 0 0 9px;

    font-family: var(--font-reading);
    font-size: 1.65rem;
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: -0.3px;
}

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

.post-card h2 a:hover {
    color: var(--accent);
}

.post-card p {
    max-width: 620px;
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.8;
}

.post-card .metadata {
    margin-top: 12px;
}


/* 16. Tags */

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0;
}

.tag {
    padding: 3px 9px;

    border: 1px solid var(--border);
    border-radius: 3px;

    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 0.78rem;
}


/* 17. End of article */

.article-end {
    margin-top: 48px;
    padding-top: 22px;
    border-top: 1px solid var(--border);

    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 0.88rem;
}

.back-link {
    display: inline-block;
    margin-top: 18px;
    color: var(--accent);
    font-size: 0.9rem;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}


/* 18. Footer */

.site-footer {
    margin-top: 70px;
    border-top: 1px solid var(--border);
}

.footer-inner {
    width: min(100% - 40px, var(--page-width));
    min-height: 78px;
    margin-inline: auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-inner p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.footer-links a {
    color: var(--muted);
    font-size: 0.82rem;
    text-decoration: none;
}

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


/* 19. Mobile */

@media (max-width: 600px) {
    body {
        font-size: 15px;
    }

    .container,
    .reading-column {
        width: calc(100% - 36px);
    }

    .header-inner {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 12px;
        padding: 17px 0;
    }

    .site-nav {
        justify-content: flex-start;
        gap: 17px;
    }

    .page-intro {
        padding-top: 44px;
        margin-bottom: 32px;
    }

    .article-header {
        padding-top: 46px;
        margin-bottom: 30px;
    }

    .article-title,
    .article-header h1 {
        font-size: 2.35rem;
        letter-spacing: -0.7px;
    }

    .article-content {
        font-size: 1.06rem;
        line-height: 1.85;
    }

    .article-content p {
        margin-bottom: 23px;
    }

    .article-content h2 {
        margin-top: 38px;
        font-size: 1.45rem;
    }

    .article-content h3 {
        margin-top: 29px;
        font-size: 1.18rem;
    }

    .article-content pre,
    pre {
        padding: 14px;
        font-size: 0.8rem;
    }

    .footer-inner {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        padding: 20px 0;
    }
}


/* 20. Reduced motion */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
