/* ==========================
   Blog Layout
   ========================== */

.blog-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.blog-main {
    min-width: 0;
}

.blog-post-wrap {
    margin-bottom: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid #e5e7eb;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: .5rem;
    margin-top: 3rem;
}

.blog-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.category-list,
.top-posts {
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: .5rem;
    background: #fafafa;
}

.category-list h3,
.top-posts h3 {
    margin: 0 0 1rem;
}

.all-cats {
    display: inline-block;
    margin-top: 1rem;
    text-decoration: none;
}


/* ==========================
   Blog Post
   ========================== */

.post-title {
    margin: 0 0 .5rem;
    font-size: 2rem;
    margin-top: 3rem;
    border-top:1px solid #ccc;
    padding-top: 3rem;
}

.post-title:first-of-type {
    margin-top: 0;
    border-top:0;
    padding-top:0;
}

.post-title a {
    color: inherit;
    text-decoration: none;
}

.post-title a:hover {
    text-decoration: underline;
}

.meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    color: #6b7280;
}

.post-cat {
}

.post-date {
}

.post-content-wrap {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2rem;
    align-items: start;
}

.post-content {
    order: 1;
}

.post-featured-image {
    order: 2;
}

.post-featured-image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: .5rem;
}

/* Hide empty image container */
.post-featured-image:empty {
    display: none;
}

/* Collapse to a single column when there's no image */
.post-content-wrap:has(.post-featured-image:empty) {
    grid-template-columns: 1fr;
}

.button {
    display: inline-block;
    margin-top: 1.5rem;
    padding: .75rem 1.5rem;
    background: #111827;
    color: #fff;
    text-decoration: none;
    border-radius: .375rem;
    transition: background .2s ease;
}

.button:hover {
    background: #374151;
}


/* ==========================
   Sidebar Recent Posts
   ========================== */

.top-post {
    padding: .75rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.top-post:last-child {
    border-bottom: none;
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

.blogPag {
    display: flex;
    flex-direction: row-reverse;
    gap: 1rem;
}

.blogPag a {
    display: inline-block;
    padding: .75rem 1.5rem;
    background: #111827;
    color: #fff;
    text-decoration: none;
    border-radius: .375rem;
    transition: background .2s ease;
}

.blogPag a:hover {
    background: #374151;
}

.newpost-button::after {
    content: " →";
}

.oldpost-button::before {
    content: "← ";
}

@media (max-width: 600px) {
    .blogPag {
        flex-direction: column;
        width: 100%;
    }

    .blogPag a {
        text-align: center;
    }
}


/* ==========================
   Responsive
   ========================== */

@media (max-width: 900px) {

    .blog-wrapper {
        grid-template-columns: 1fr;
    }

    .post-content-wrap {
        grid-template-columns: 1fr;
    }

    .post-content,
    .post-featured-image {
        order: initial;
    }

}