/*
 * Blog-specific styles — built on top of reset.css
 */

/* Layout */

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    text-align: left;
}

/* Site header */

.site-header {
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) 0;
    margin-bottom: var(--space-xl);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Site logo — two halves forming one rounded rectangle */
.site-logo {
    display: flex;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    line-height: 0;
}

.site-logo img {
    display: block;
}

.site-nav {
    display: flex;
    gap: var(--space-lg);
}

.site-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    transition: color 0.15s;
}

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

/* Main content */

main {
    padding-bottom: var(--space-xl);
}

main > h1:first-child {
    margin-top: 0;
}

/* Post list */

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

.post-list li {
    padding: var(--space-lg) 0;
    border-bottom: 1px solid var(--border);
}

.post-list li:first-child {
    padding-top: 0;
}

.post-list li:last-child {
    border-bottom: none;
}

.post-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0 0 var(--space-xs);
    line-height: 1.3;
}

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

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

.post-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
    margin-top: var(--space-xs);
}

.post-meta time {
    white-space: nowrap;
}

.post-excerpt {
    margin-top: var(--space-sm);
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Tags */

.tag {
    display: inline-block;
    font-size: 0.78rem;
    padding: 0.25em 0.6em;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

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

/* Tags index */

.tag-index {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: var(--space-sm);
}

.tag-index li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

.tag-index li:hover {
    border-color: var(--accent);
}

.tag-index a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
}

.tag-index a:hover {
    color: var(--accent);
}

.tag-index .count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.15em 0.5em;
    border-radius: 999px;
    min-width: 1.5em;
    text-align: center;
}

.series-index .count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Series index */

.series-index {
    list-style: none;
    padding: 0;
}

.series-index li {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border);
}

.series-index li:last-child {
    border-bottom: none;
}

.series-index a {
    font-size: 1.15rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
}

.series-index a:hover {
    color: var(--accent);
}

.series-desc {
    margin-top: var(--space-xs);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Single post / page */

.post-header {
    margin-bottom: var(--space-lg);
}

.post-header h1 {
    margin-top: 0;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.post-body {
    font-size: 1rem;
    line-height: 1.75;
}

.post-body > *:first-child {
    margin-top: 0;
}

/* Table of contents */

.toc {
    border: none;
    padding: 0;
    margin-bottom: var(--space-md);
}

.toc summary {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
}

.toc summary::before {
    content: "# ";
}

.toc summary::-webkit-details-marker {
    display: none;
}

.toc ol {
    margin: var(--space-xs) 0 0;
    padding-left: 1.25em;
    font-size: 0.82rem;
    line-height: 1.5;
}

.toc li {
    margin-top: 0.15em;
}

.toc .toc-sub {
    margin-left: 1em;
}

.toc a {
    color: var(--text-muted);
    text-decoration: none;
}

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

/* Post navigation (prev/next) */

.post-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

.post-nav a {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    max-width: 50%;
}

.post-nav a small {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-xs);
}

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

.post-nav a:hover span {
    color: var(--accent);
}

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

/* Series nav */

.series-nav {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.series-nav h3 {
    margin-top: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.series-nav ol {
    margin-bottom: 0;
    font-size: 0.925rem;
}

/* Related posts */

.related-posts {
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
}

.related-posts h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 0;
}

.related-posts ul {
    list-style: none;
    padding: 0;
}

.related-posts li {
    padding: var(--space-xs) 0;
}

.related-posts a {
    text-decoration: none;
    color: var(--text);
}

.related-posts a:hover {
    color: var(--accent);
}

.series-nav li.current {
    font-weight: 600;
}

/* Footer */

.site-footer {
    border-top: 1px solid var(--border);
    padding: var(--space-lg) 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Mobile nav — pure CSS checkbox toggle */

.nav-toggle {
    display: none;
}

.nav-toggle-label {
    display: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    width: 44px;
    height: 44px;
    padding: 10px;
    user-select: none;
    /* Hamburger icon — 3 rounded lines, 24x24 viewBox */
    background: no-repeat center/24px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231a1a2e' stroke-width='2' stroke-linecap='round'%3E%3Cline x1='4' y1='6' x2='20' y2='6'/%3E%3Cline x1='4' y1='12' x2='20' y2='12'/%3E%3Cline x1='4' y1='18' x2='20' y2='18'/%3E%3C/svg%3E");
}

/* X icon when open */
.nav-toggle:checked ~ .nav-toggle-label {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231a1a2e' stroke-width='2' stroke-linecap='round'%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
    .nav-toggle-label {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23e0e0e8' stroke-width='2' stroke-linecap='round'%3E%3Cline x1='4' y1='6' x2='20' y2='6'/%3E%3Cline x1='4' y1='12' x2='20' y2='12'/%3E%3Cline x1='4' y1='18' x2='20' y2='18'/%3E%3C/svg%3E");
    }
    .nav-toggle:checked ~ .nav-toggle-label {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23e0e0e8' stroke-width='2' stroke-linecap='round'%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3C/svg%3E");
    }
}

/* Responsive */

@media (max-width: 640px) {
    .container {
        padding: 0 var(--space-md);
    }

    .site-header {
        padding: var(--space-xs) 0;
        margin-bottom: var(--space-lg);
    }

    .site-header .container {
        flex-wrap: wrap;
        align-items: center;
    }

    .nav-toggle-label {
        display: block;
        margin-left: auto;
    }

    .site-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding: var(--space-xs) 0;
        border-top: 1px solid var(--border);
        margin-top: var(--space-xs);
    }

    .nav-toggle:checked ~ .site-nav {
        display: flex;
    }

    .site-nav a {
        display: block;
        padding: var(--space-sm) 0;
        font-size: 1rem;
    }

    .post-header h1 {
        font-size: 1.8rem;
    }

    .post-list li {
        padding: var(--space-md) 0;
    }

    .post-title {
        font-size: 1.15rem;
    }
}
