/* ==========================
   Blog Archive / Grid Layout
   ========================== */

/* Archive layout improvements */
.ast-blog-layout-5-grid main {
    background: linear-gradient(135deg, var(--wp--preset--color--surface) 0%, var(--wp--preset--color--elevated) 100%) !important;
}

/* Article cards in grid - Updated for blog-layout-5 */
.blog-layout-5 {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    transition: all 0.3s ease;
    display: flex;
    margin-bottom: 24px;
    position: relative;
    cursor: pointer;
}

.blog-layout-5:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

/* Make entire card clickable via title link */
.blog-layout-5 .entry-title a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* Ensure other links are still clickable */
.blog-layout-5 .cat-links,
.blog-layout-5 .entry-meta,
.blog-layout-5 .entry-footer,
.blog-layout-5 .ast-blog-post-read-more {
    position: relative;
    z-index: 2;
}

/* Title color override for blog layout 5 */
.blog-layout-5 .entry-title,
.blog-layout-5 .entry-title a {
    color: var(--wp--preset--color--surface-header) !important;
}

/* Featured image styling */
.blog-layout-5 .post-thumb {
    height: 260px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--wp--preset--color--action) 0%, var(--wp--preset--color--action-hover) 100%);
    position: relative;
    flex-shrink: 0;
    width: 40%;
    display: block;
}

.blog-layout-5 .post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
    min-width: 100%;
    min-height: 100%;
}

.blog-layout-5:hover .post-thumb img {
    transform: scale(1.05);
}

/* Overlay effect on card hover */
.blog-layout-5 .post-thumb::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(234, 200, 31, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.blog-layout-5:hover .post-thumb::after {
    opacity: 1;
}

/* Post content inside card */
.blog-layout-5 .post-content {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 60%;
}

.ast-article-single .ast-blog-post-content {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Category badge */
.blog-layout-5 .cat-links,
.ast-blog-post-content .cat-links {
    margin-bottom: 12px;
}

.blog-layout-5 .cat-links a,
.ast-blog-post-content .cat-links a {
    display: inline-block;
    background: var(--wp--preset--color--action);
    color: var(--wp--preset--color--action-text);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
}

.blog-layout-5 .cat-links a:hover,
.ast-blog-post-content .cat-links a:hover {
    background: var(--wp--preset--color--action-hover);
}

/* Post title styling */
.blog-layout-5 .entry-title,
.ast-blog-post-content .entry-title {
    font-size: 1.3rem;
    line-height: 1.4;
    margin: 12px 0;
    color: var(--wp--preset--color--surface-header) !important;
}

.blog-layout-5 .entry-title a,
.ast-blog-post-content .entry-title a {
    text-decoration: none;
    color: var(--wp--preset--color--surface-header) !important;
    transition: color 0.2s ease;
}

.blog-layout-5 .entry-title a:hover,
.ast-blog-post-content .entry-title a:hover {
    color: var(--wp--preset--color--action) !important;
}

/* Excerpt styling */
.blog-layout-5 .ast-excerpt-container,
.ast-blog-post-content .entry-content {
    color: var(--wp--preset--color--surface-text);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 12px 0;
    flex-grow: 1;
}

/* Post meta (date, author) */
.blog-layout-5 .entry-meta,
.blog-layout-5 .entry-meta *,
.ast-blog-post-content .entry-meta,
.ast-blog-post-content .entry-meta * {
    color: var(--wp--preset--color--surface-text) !important;
}

.blog-layout-5 .entry-meta,
.ast-blog-post-content .entry-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #e5e5e5;
}

.blog-layout-5 .entry-meta span,
.ast-blog-post-content .entry-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.blog-layout-5 .entry-meta a,
.blog-layout-5 .entry-meta a *,
.ast-blog-post-content .entry-meta a,
.ast-blog-post-content .entry-meta a * {
    color: var(--wp--preset--color--surface-text) !important;
    text-decoration: none;
    transition: color 0.2s ease;
}

.blog-layout-5 .entry-meta a:hover,
.ast-blog-post-content .entry-meta a:hover {
    color: var(--wp--preset--color--surface-text-muted) !important;
}

/* Read more button */
.blog-layout-5 .entry-footer,
.blog-layout-5 .ast-blog-post-read-more,
.ast-blog-post-content .ast-blog-post-read-more {
    margin-top: 12px;
    display: inline-block;
}

.blog-layout-5 .entry-footer a,
.blog-layout-5 .ast-blog-post-read-more a,
.ast-blog-post-content .ast-blog-post-read-more a,
.ast-blog-post-read-more .wp-block-button__link {
    background-color: var(--wp--preset--color--action) !important;
    color: var(--wp--preset--color--action-text) !important;
    padding: 8px 16px;
    border-radius: 5px !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-block;
    box-shadow: 0px 6px 5px rgb(0,0,0,0.5);
}

.blog-layout-5 .entry-footer a:hover,
.blog-layout-5 .ast-blog-post-read-more a:hover,
.ast-blog-post-content .ast-blog-post-read-more a:hover,
.ast-blog-post-read-more .wp-block-button__link:hover {
    background-color: var(--wp--preset--color--action-hover) !important;
    color: var(--wp--preset--color--action-text) !important;
    transform: translateX(4px);
}

/* ==========================
   Single Blog Post Page
   ========================== */

/* Single post main container */
.single-post main {
    background: var(--wp--preset--color--surface) !important;
    padding: 48px 15vw !important;
}

/* Featured image on single post */
.single-post .post-thumb {
    margin: -48px -15vw 48px -15vw;
    width: calc(100% + 30vw);
    max-height: 500px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--wp--preset--color--action) 0%, var(--wp--preset--color--action-hover) 100%);
}

.single-post .post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Single post header */
.single-post .entry-header {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 2px solid #f0f0f0;
}

.single-post .entry-title {
    font-size: 2.5rem;
    line-height: 1.2;
    margin: 24px 0;
    color: var(--wp--preset--color--elevated-header);
}

/* Single post meta */
.single-post .entry-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--wp--preset--color--surface-text-muted);
}

.single-post .entry-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.single-post .entry-meta .cat-links a {
    background: var(--wp--preset--color--action);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease;
}

.single-post .entry-meta .cat-links a:hover {
    background: var(--wp--preset--color--action-hover);
}

/* Single post content */
.single-post .entry-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--wp--preset--color--surface-text);
    max-width: 800px;
    margin: 0;
}

.single-post .entry-content p {
    margin-bottom: 24px;
    margin-left: 0;
    margin-right: 0;
}

.single-post .entry-content h2,
.single-post .entry-content h3,
.single-post .entry-content h4 {
    color: var(--wp--preset--color--elevated-header);
    margin-top: 32px;
    margin-bottom: 16px;
    font-weight: 700;
}

.single-post .entry-content h2 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--wp--preset--color--action);
    padding-bottom: 12px;
}

.single-post .entry-content h3 {
    font-size: 1.4rem;
}

/* Blockquotes styling */
.single-post .entry-content blockquote {
    border-left: 4px solid var(--wp--preset--color--action);
    padding-left: 24px;
    margin: 32px 0;
    font-style: italic;
    color: var(--wp--preset--color--surface-text-muted);
    background: #f9f9f9;
    padding: 24px;
    border-radius: 8px;
}

/* Lists styling */
.single-post .entry-content ul,
.single-post .entry-content ol {
    margin-left: 24px;
    margin-bottom: 24px;
}

.single-post .entry-content li {
    margin-bottom: 8px;
    line-height: 1.8;
}

/* Links in content */
.single-post .entry-content a {
    color: var(--wp--preset--color--action);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.single-post .entry-content a:hover {
    color: var(--wp--preset--color--action-hover);
}

/* Post footer with tags and sharing */
.single-post .entry-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.single-post .entry-footer .tags-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.single-post .entry-footer .tags-links a {
    background: #f0f0f0;
    color: var(--wp--preset--color--surface-text);
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.single-post .entry-footer .tags-links a:hover {
    background: var(--wp--preset--color--action);
    color: white;
}

/* ==========================
   Pagination
   ========================== */

.ast-pagination {
    margin-top: 48px;
    text-align: center;
}

.ast-pagination .page-numbers {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.ast-pagination .page-numbers a,
.ast-pagination .page-numbers span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.ast-pagination .page-numbers a {
    background: #f0f0f0;
    color: var(--wp--preset--color--surface-text);
    border: 1px solid #e0e0e0;
}

.ast-pagination .page-numbers a:hover {
    background: var(--wp--preset--color--action);
    color: white;
    border-color: var(--wp--preset--color--action);
    transform: translateY(-2px);
}

.ast-pagination .page-numbers.current {
    background: var(--wp--preset--color--action);
    color: white;
    border: none;
}

.ast-pagination .page-numbers.prev,
.ast-pagination .page-numbers.next {
    padding: 0 16px;
}

/* ==========================
   Comments Section
   ========================== */

.ast-comment-list {
    margin-top: 48px;
    padding: 32px;
    background: #f9f9f9;
    border-radius: 12px;
}

.ast-comment-list h2 {
    color: var(--wp--preset--color--elevated-header);
    font-size: 1.5rem;
    margin-bottom: 24px;
}

/* ==========================
   Responsive
   ========================== */

@media (max-width: 1024px) {
    .ast-article-single .post-thumb {
        height: 200px;
    }

    .single-post .entry-title {
        font-size: 1.8rem;
    }

    .single-post main {
        padding: 32px 8vw !important;
    }

    .single-post .post-thumb {
        margin: -32px -8vw 32px -8vw;
        width: calc(100% + 16vw);
    }
}

@media (max-width: 768px) {
    .ast-article-single .post-thumb {
        height: 160px;
    }

    .ast-blog-post-content {
        padding: 16px;
    }

    .single-post main {
        padding: 24px 16px !important;
    }

    .single-post .entry-title {
        font-size: 1.5rem;
    }

    .single-post .post-thumb {
        margin: -24px -16px 24px -16px;
        width: calc(100% + 32px);
        max-height: 300px;
    }

    .single-post .entry-content {
        font-size: 1rem;
    }

    .entry-footer {
        flex-direction: column;
        align-items: flex-start !important;
    }

    /* Stack blog cards vertically on mobile */
    .blog-layout-5 {
        flex-direction: column;
    }

    .blog-layout-5 .post-thumb {
        width: 100%;
        height: 200px;
    }

    .blog-layout-5 .post-content {
        width: 100%;
    }
}

/* ==========================
   Fix Blog Card Issues
   ========================== */

/* Remove Astra's default article wrapper styling to prevent double card effect */
.ast-article-post.blog-layout-5 {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Also target any grid column wrappers */
.ast-grid-common-col.blog-layout-5 {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
}

/* Target the article list item */
.ast-article-post {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* Make blog card distinct from page background */
.blog-layout-5 {
    background: #ffffff !important;
}

/* Fix image to fill entire container properly */
.blog-layout-5 .post-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    max-width: none;
    min-width: 100%;
    min-height: 100%;
}

/* Target image with all possible selectors */
.blog-layout-5 .post-thumb img,
.blog-layout-5 .ast-blog-featured-section img,
.blog-layout-5 .post-thumb-img-content img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure image link wrapper fills container */
.blog-layout-5 .post-thumb a {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    line-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure image container uses correct dimensions */
.blog-layout-5 .post-thumb {
    display: block !important;
    position: relative !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Remove any wrapper padding that might cause issues */
.blog-layout-5 .ast-blog-featured-section,
.blog-layout-5 .blog-featured-below-title,
.blog-layout-5 .post-thumb-img-content,
.blog-layout-5 .ast-blog-featured-section.post-thumb,
.blog-layout-5 .post-thumb-img-content.post-thumb {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    line-height: 0 !important;
    display: block !important;
}

/* Override any Astra width classes */
.blog-layout-5 .ast-width-md-6 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}
