body {
    background-color: var(--light-color) !important;
}

/* ── Archive Layout ── */
.codex-page-title {
    padding: 40px 0;
    text-align: center;
}

.codex-page-title h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--dark-color);
    margin: 0;
}

.codex-container {
    max-width: 1320px;
    margin: 0 auto;
    /* padding: 0 48px 72px; */
}

.codex-archive-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
}

.codex-categories ul {
    display: flex;
    gap: 28px;
    margin: 0px;
}

.codex-categories ul li {
    list-style: none;
}

.codex-categories ul li a {
    font-size: 15px;
    font-weight: 500;
    color: rgb(156, 163, 175);
    border-bottom: 2px solid transparent;
    transition: all ease 0.3s;
    padding-bottom: 2px;
}

.codex-categories ul li:hover a,
.codex-categories ul li.codex-cat-active a {
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

/* ── Search Form ── */
.codex-search-form .codex-search-wrap {
    position: relative;
}

.codex-search-form .codex-search-wrap .codex-search-icon {
    position: absolute;
    top: 13px;
    left: 20px;
}

.codex-search-wrap input {
    padding: 11px 18px 11px 40px;
    border: 1.5px solid rgb(229, 231, 235) !important;
    border-radius: 100px;
    font-size: 14px;
    font-family: inherit;
    color: rgb(55, 65, 81);
    background: rgb(255, 255, 255) !important;
    width: 270px;
}

.codex-search-form .codex-search-wrap:focus-within {
    border-color: #7C3AED;
}

.codex-search-form .codex-search-wrap svg {
    color: #999;
    flex-shrink: 0;
}

.codex-search-form .codex-search-wrap input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 14px;
    color: #333;
    background: transparent;
}

.codex-search-form .codex-search-wrap input::placeholder {
    color: #aaa;
}

/* ── Posts Grid ── */
.codex-archive-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

/* ── Card ── */
.codex-archive-card {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid #eee;
    background: #fff;
    transition: box-shadow 0.2s, transform 0.2s;
}

.codex-archive-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-4px);
}

.codex-card-img {
    display: block;
    overflow: hidden;
}

.codex-card-img img {
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 0.3s;
}

.codex-card-body {
    padding: 18px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.codex-card-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.codex-card-category {
    display: inline-block;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.codex-card-category::after {
    content: ',';
}

.codex-card-category:last-child::after {
    content: '';
}

.codex-card-category:hover {
    color: var(--dark-color);
}

.codex-card-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

.codex-card-title a {
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    color: var(--dark-color);
    transition: color 0.2s;
}

.codex-card-title a:hover {
    color: #7C3AED;
}

.codex-card-footer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.codex-card-reading-time {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #888;
}

/* ── Pagination ── */
.codex-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin: 40px 0 80px;
}

.codex-pagination-btn a ,
.codex-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid #ddd;
    text-decoration: none;
    font-size: 14px;
    color: #444;
    transition: all 0.2s;
}

.codex-pagination .page-numbers li span,
.codex-pagination .page-numbers li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 50%;
    border: 1px solid transparent;
    text-decoration: none;
    font-size: 14px;
    color: #444;
    transition: all 0.2s;
}

.codex-pagination-btn a:hover,
.codex-pagination-btn a.codex-active {
    background: #7C3AED;
    color: #fff;
    border-color: #7C3AED;
}

.codex-pagination .page-numbers li a:hover,
.codex-pagination .page-numbers li span:hover,
.codex-pagination .page-numbers.codex-active {
    background: #7C3AED;
    color: #fff;
    border-color: #7C3AED;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 50%;
}

.codex-pagination .page-numbers li .prev:hover,
.codex-pagination .page-numbers li .next:hover {
    background: transparent;
    color: #fff;
    border-color: transparent;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 50%;
}

.codex-pagination ul {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.codex-no-posts {
    text-align: center;
    color: #888;
    font-size: 16px;
    padding: 48px 0;
}

/* ── Search Page Title ── */
.codex-page-title span {
    color: var(--primary-color);
}

.codex-search-count {
    font-size: 14px;
    color: #888;
    margin-top: 6px;
}

.codex-search-count strong {
    color: var(--dark-color);
}

/* ── No Results ── */
.codex-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    gap: 16px;
    color: #888;
}

.codex-no-results svg {
    color: #ddd;
}

.codex-no-results h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

.codex-no-results p {
    font-size: 15px;
    color: #888;
    margin: 0;
}

.codex-no-results strong {
    color: var(--dark-color);
}

.codex-back-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 10px 24px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.codex-back-btn:hover {
    opacity: 0.85;
    color: #fff;
}

/* ── Responsive ── */
@media ( max-width: 1280px ) {
    .codex-container {
        padding: 0 32px;
    }
}

@media ( max-width: 1024px ) {
    .codex-container {
        padding: 0 24px;
    }
    .codex-archive-grid {
        grid-template-columns: repeat( 2, 1fr );
    }
}

@media ( max-width: 768px ) {
    .codex-container {
        padding: 0 16px;
    }

    /* Archive filter */
    .codex-archive-filter {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 24px;
    }

    /* Categories scroll horizontally on mobile */
    .codex-categories ul {
        gap: 16px;
        overflow-x: auto;
        padding-bottom: 4px;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .codex-categories ul::-webkit-scrollbar {
        display: none;
    }

    .codex-categories ul li a {
        white-space: nowrap;
        font-size: 13px;
    }

    /* Search full width */
    .codex-search-wrap input {
        width: 100%;
    }

    .codex-archive-search {
        width: 100%;
    }

    /* Grid 1 column */
    .codex-archive-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Page title */
    .codex-page-title {
        padding: 24px 0;
    }

    .admin-bar .codex-page-title {
        padding: 60px 24px 0;
    }

    .codex-page-title h1 {
        font-size: 24px;
    }

    /* Pagination */
    .codex-pagination {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin: 24px 0 48px;
    }

    .codex-pagination ul {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media ( max-width: 480px ) {
    .codex-archive-grid {
        grid-template-columns: 1fr;
    }

    .codex-card-img img {
        height: 180px;
    }

    .codex-pagination-btn a,
    .codex-pagination .page-numbers {
        padding: 6px 12px;
        font-size: 13px;
    }
}
/* ── Filter bar injected into Astra layout (astra_primary_content_top) ── */
.codex-archive-filter-bar {
    margin-bottom: 12px;
}

.codex-archive-filter-bar .codex-page-title {
    padding: 0 0 24px;
    text-align: center;
}

.codex-archive-filter-bar .codex-search-count {
    margin: 6px 0 0;
    color: var(--gray-color, #6b7280);
    font-size: 14px;
}

.codex-archive-filter-bar .codex-archive-filter {
    flex-wrap: wrap;
    gap: 16px;
}

/* Our filter bar already provides a search field, so hide Astra's duplicate
   search widget on the "nothing found" results page. */
.search-no-results .no-results .widget_search {
    display: none;
}
