/* Blog layout styles - shared between blog listing and individual posts */
.blog-layout {
    display: flex;
    gap: 3rem;
    margin-top: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

/* mobile toggle hidden by default */
.mobile-posts-toggle,
.posts-toggle {
    display: none;
}

/* Sidebar with post list */
.blog-list {
    flex: 0 0 280px;
    padding: 1rem;
    background: #f8f9fa;
    height: fit-content;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.blog-list h2 {
    margin: 0.5rem;
    color: #333;
    font-size: 1.25rem;
    position: sticky;
}

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

.blog-list li {
    margin-bottom: 1rem;
}

.blog-list li:last-child {
    margin-bottom: 0;
}

.blog-list a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.4;
    display: block;
    padding: 0.5rem;
    border-bottom: 1px solid #e9ecef;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.blog-list a:hover {
    color: #0066cc;
    background: #eef2f6;
}

.blog-list a.active {
    background: #4c6277;
    color: white;
}

.blog-list a.active .post-date {
    color: white;
}

.blog-list .post-date {
    color: #6c757d;
    font-size: 0.85rem;
}

/* remove border on the last anchor to avoid double spacing at the end */
.blog-list li:last-child a {
    border-bottom: none;
}

/* Main content area */
.blog-content {
    flex: 1;
    min-width: 0;
    max-width: 70ch;
}

/* Responsive design */
@media (max-width: 768px) {
    .blog-layout {
        flex-direction: column;
        gap: 2rem;
        padding: 0;
    }
    
    /* Show mobile All Posts trigger opposite Home link */
    .mobile-posts-toggle {
        display: inline;
        position: absolute;
        top: 0;
        left: 1rem;
        margin: 1rem;
        color: #0066cc;
        text-decoration: underline;
        cursor: pointer;
        z-index: 3;
    }

    /* Open/close indicator on the mobile toggle (chevron before text) */
    .mobile-posts-toggle::before {
        content: "\25B8"; /* ▸ right (closed) */
        display: inline-block;
        margin-right: 0.25rem;
        font-weight: 700;
    }
    .posts-toggle:checked + .mobile-posts-toggle::before {
        content: "\25BE"; /* ▾ down (open) */
    }

    .mobile-posts-toggle:hover,
    .mobile-posts-toggle:active,
    .mobile-posts-toggle:focus,
    .mobile-posts-toggle:focus-visible {
        text-decoration: underline;
    }

    /* Hide sidebar by default on mobile */
    .blog-list {
        flex: none;
        position: static;
        order: 2;
        max-height: none;
        overflow-y: visible;
        display: none;
    }

    /* Make list items look like links on mobile */
    .blog-list a {
        text-decoration: underline;
    }
    /* Ensure the current page remains clearly highlighted */
    .blog-list a.active {
        background: #4c6277;
        color: #fff;
    }
    .blog-list a.active .post-date {
        color: #fff;
    }
    
    .blog-content {
        order: 1;
        max-width: 100%; /* allow full width on mobile */
    }

    /* Reveal sidebar when toggle is checked */
    .posts-toggle:checked ~ .blog-list {
        display: block;
        order: 1;
    }

    /* Move content below when menu is open */
    .posts-toggle:checked ~ .blog-content {
        order: 2;
    }
} 
