/* === Blog Archive Styles === */

/* Archive Header */
.archive-header {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 24px;
}

.blog-archive {
    padding-top: 16px;
}

.blog-filter-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

.blog-filter-desktop {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #fffaf0 0%, #f5f5f5 100%);
    border: 1px solid rgba(197, 143, 22, 0.18);
    border-radius: 999px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}

.blog-filter-chip,
.blog-filter-mobile-item,
.blog-filter-mobile-toggle {
    appearance: none;
    border: 0;
    cursor: pointer;
    transition: all 0.25s ease;
    font-weight: 700;
}

.blog-filter-chip {
    padding: 10px 18px;
    border-radius: 999px;
    background: transparent;
    color: #444;
    font-size: 14px;
    outline: none;
    box-shadow: none;
}

.blog-filter-chip:hover {
    background: rgba(197, 143, 22, 0.12);
    color: #8a6511;
}

.blog-filter-chip:focus,
.blog-filter-chip:focus-visible,
.blog-filter-mobile-toggle:focus,
.blog-filter-mobile-toggle:focus-visible,
.blog-filter-mobile-toggle:active,
.blog-filter-mobile-item:focus,
.blog-filter-mobile-item:focus-visible {
    outline: none;
    box-shadow: none;
}

.blog-filter-chip.is-active {
    background: linear-gradient(135deg, #1f1f1f 0%, #cca471 100%);
    color: #fff;
    box-shadow: 0 10px 18px rgba(138, 101, 17, 0.2);
}

.blog-filter-mobile {
    display: none;
    position: relative;
    width: 100%;
    max-width: 360px;
}

.blog-filter-mobile-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #f1f1f1;
    color: #222;
    box-shadow: none;
    outline: none;
}

.blog-filter-mobile-toggle i {
    color: #cca471;
    transition: transform 0.25s ease;
}

.blog-filter-mobile-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.blog-filter-mobile-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    padding: 10px;
    background: #fff;
    border: 1px solid rgba(197, 143, 22, 0.18);
    border-radius: 18px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
    z-index: 20;
}

.blog-filter-mobile-item {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border-radius: 12px;
    background: transparent;
    color: #333;
    font-size: 14px;
    outline: none;
    box-shadow: none;
}

.blog-filter-mobile-item.is-active,
.blog-filter-mobile-item:hover {
    background: rgba(197, 143, 22, 0.12);
    color: #8a6511;
}

.blog-filter-results {
    position: relative;
    transition: opacity 0.2s ease;
}

.blog-filter-results.is-loading {
    opacity: 0.45;
    pointer-events: none;
}

.archive-title {
    font-size: 36px;
    font-weight: 800;
    color: #222;
    margin: 0 0 15px 0;
    position: relative;
    padding-bottom: 15px;
    display: inline-block;
}

.archive-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 3px;
    background: #cca471;
}

.archive-description-left {
    max-width: 760px;
    margin: 18px auto 40px;
    padding: 15px;
    background-color: #f0f0f0;
    border-left: 4px solid #cca471;
    border-radius: 5px;
    text-align: left;
    font-style: italic;
    font-size: 17px;
    line-height: 1.7;
    color: #333;
}

.archive-header-courses {
    margin-top: 28px;
}

.archive-description-courses {
    max-width: 100%;
}

/* Blog Grid - 2 columns (Desktop) */
/* Blog Grid - 2 columns (Desktop) */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    /* Increased gap for wider spacing */
    row-gap: 60px;
    /* Extra vertical spacing */
    margin-bottom: 80px;
}

/* Blog Card */
.blog-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Blog Card Image */
.blog-card-image {
    position: relative;
    overflow: hidden;
    background-color: #f5f5f5;
}

.blog-card-image a {
    display: block;
    position: relative;
    padding-top: 66.67%;
    /* 3:2 aspect ratio */
}

.blog-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

/* Blog Card Content */
.blog-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.blog-card-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-card-title a {
    color: #212529;
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-card-title a:hover {
    color: #cca471;
}

/* Blog Card Meta */
.blog-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #6c757d;
}

.meta-date i,
.meta-reading i {
    margin-right: 5px;
}

/* Blog Card Excerpt */
.blog-card-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: #495057;
    margin-bottom: 20px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: calc(1.6em * 2);
}

.blog-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: nowrap;
    margin-top: auto;
    min-width: 0;
}

.blog-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 28px;
    padding: 4px 12px;
    border-radius: 10px;
    background: #cca471;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 10px 18px rgba(122, 86, 8, 0.18), 0 4px 10px rgba(17, 17, 17, 0.08);
    transition: opacity 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-card-button:hover {
    color: #fff;
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(122, 86, 8, 0.24), 0 6px 14px rgba(17, 17, 17, 0.12);
}

.blog-card-tags {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.blog-card-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 140px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #9a9a9a;
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.2;
    text-decoration: none;
    transition: color 0.25s ease;
    min-width: 0;
}

.blog-card-tag-icon {
    color: inherit;
    font-size: 0.8rem;
    flex: 0 0 auto;
}

.blog-card-tag-text {
    display: block;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-card-tag:hover {
    color: #8a8a8a;
}

/* Blog Pagination */
.blog-pagination {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 60px;
}

.blog-pagination .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.blog-pagination .page-numbers {
    display: inline-block;
    padding: 8px 15px;
    background-color: #cca471;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.blog-pagination .page-numbers:hover {
    background-color: #b88410;
    color: #fff;
}

.blog-pagination .page-numbers.current {
    background: linear-gradient(135deg, #1f1f1f 0%, #cca471 100%);
    color: #fff;
    font-weight: bold;
}

.blog-pagination .page-numbers.dots {
    background-color: transparent;
    cursor: default;
}

.blog-load-more-wrap {
    display: flex;
    justify-content: center;
    margin: 10px 0 60px;
}

.blog-load-more-button {
    appearance: none;
    border: 2px solid #cca471;
    padding: 14px 22px;
    border-radius: 14px;
    background: #fff;
    color: #8a6511;
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: min(100%, 420px);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.blog-load-more-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(197, 143, 22, 0.14);
}

.blog-load-more-button i {
    font-size: 16px;
}

.blog-load-more-button:focus,
.blog-load-more-button:focus-visible {
    outline: none;
    box-shadow: none;
}

/* No Posts Message */
.no-posts {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 18px;
}

/* Tablet Responsive (2 columns) */
@media screen and (max-width: 1024px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
        row-gap: 40px;
    }

    .archive-title {
        font-size: 32px;
    }
}

/* Mobile Responsive (1 column) */
@media screen and (max-width: 768px) {
    .blog-archive {
        padding-top: 10px;
    }

    .blog-filter-desktop {
        display: none;
    }

    .blog-filter-mobile {
        display: block;
    }

    .blog-filter-bar {
        margin-bottom: 18px;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        /* Increased mobile gap */
        margin-bottom: 50px;
    }

    .archive-header {
        margin-bottom: 30px;
    }

    .archive-title {
        font-size: 28px;
    }

    .archive-description-left {
        margin-top: 16px;
        margin-bottom: 50px;
        padding: 15px;
        font-size: 17px;
    }

    .archive-header-courses {
        margin-top: 20px;
    }

    .blog-card-content {
        padding: 15px;
    }

    .blog-card-title {
        font-size: 17px;
    }

    .blog-card-excerpt {
        font-size: 14px;
        max-height: calc(1.6em * 2);
    }

    .blog-card-actions {
        align-items: center;
        gap: 10px;
    }

    .blog-card-button {
        font-size: 0.76rem;
        padding: 4px 11px;
    }


    .blog-pagination {
        margin-top: 30px;
    }

    .blog-pagination .page-numbers {
        padding: 6px 12px;
        font-size: 14px;
    }

    .blog-load-more-wrap {
        margin: 0 0 40px;
    }

    .blog-load-more-button {
        width: 100%;
        max-width: 100%;
        padding: 13px 18px;
        font-size: 15px;
        border-radius: 12px;
    }
}

/* === Related Posts Styles === */
.related-posts {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #eee;
}

.related-posts-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
    position: relative;
    padding-left: 15px;
    border-left: 4px solid #cca471;
}

.related-posts-list {
    display: grid;
    grid-template-columns: 1fr;
    /* Mobile default */
    gap: 30px;
}

.related-post-card {
    display: flex;
    flex-direction: column;
}

.related-post-thumb {
    position: relative;
    overflow: hidden;
    margin-bottom: 15px;
    background-color: #f5f5f5;
}

.related-post-thumb a {
    display: block;
    padding-top: 66.67%;
    /* 3:2 Aspect Ratio */
    position: relative;
}

.related-post-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-post-card:hover .related-post-thumb img {
    transform: scale(1.05);
}

.related-post-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 10px;
}

/* Title Truncation (Max 3 lines) */
.related-post-title a {
    color: #333;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.related-post-title a:hover {
    color: #cca471;
}

.related-post-content .blog-card-tags {
    justify-content: flex-start;
    margin-top: 10px;
    gap: 10px;
    overflow: hidden;
}

.related-post-content .blog-card-tag {
    max-width: 100%;
}

.related-post-excerpt {
    display: none;
    /* Hide excerpt in grid view to keep it clean, as per visual request "image top, title bottom" */
}


/* === Desktop Width Restriction & Related Posts Grid === */
@media screen and (min-width: 992px) {

    /* Single Post, Blog Archive, Category Archive */
    main.single-post .container,
    .blog-archive .container {
        max-width: 800px;
    }

    /* Related Posts 2-Column Grid on Desktop */
    .related-posts-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet Support */
@media screen and (min-width: 769px) and (max-width: 991px) {
    .related-posts-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .related-post-title {
        font-size: 15px;
        /* Slightly smaller for tablet */
    }
}

/* === Mobile Related Posts (List Layout) === */
@media screen and (max-width: 768px) {
    .related-posts-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .related-post-card {
        flex-direction: row;
        align-items: flex-start;
        padding-bottom: 18px;
        margin-bottom: 18px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    .related-post-thumb {
        width: 36%;
        margin-bottom: 0;
        border-radius: 8px;
        overflow: hidden;
    }

    .related-post-content {
        width: 64%;
        padding-left: 14px;
        padding-top: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .related-post-title {
        font-size: 15px;
        line-height: 1.4;
        margin-bottom: 5px;
    }

    .related-post-title a {
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
}

@media screen and (max-width: 768px) {
    body.single-post .related-posts .related-posts-list {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 18px !important;
    }

    body.single-post .related-posts .related-post-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        width: 100% !important;
        margin-bottom: 18px !important;
        padding-bottom: 18px !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
    }

    body.single-post .related-posts .related-post-thumb {
        width: 40% !important;
        max-width: 40% !important;
        margin-bottom: 0 !important;
    }

    body.single-post .related-posts .related-post-content {
        width: 60% !important;
        max-width: 60% !important;
        padding-left: 14px !important;
        padding-top: 0 !important;
    }

    body.single-post .related-posts .related-post-thumb .sdnh-post-badge {
        top: 6px !important;
        left: 6px !important;
        padding: 4px 8px !important;
        border-radius: 12px !important;
        font-size: 10px !important;
        line-height: 1.1 !important;
        box-shadow: 0 6px 12px rgba(122, 86, 8, 0.14) !important;
    }

    body.single-post .related-posts .related-post-thumb .sdnh-post-badge i {
        margin-right: 3px !important;
        font-size: 9px !important;
    }

}
