body {
    background-color: #fff !important;
}

.codex-single-date {
    font-size: 13px;
    color: #888;
}

/* ── Share Button ── */
.codex-single-share-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.codex-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid #ddd;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.codex-share-btn:hover,
.codex-share-btn:focus {
    background: none;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ── Share Popup Overlay ── */
.codex-share-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.codex-share-popup.codex-active {
    display: block;
}

/* ── Popup Content ── */
.codex-share-popup-inner {
    background: #fff;
    width: 560px;
    padding: 48px 50px;
    border-radius: 8px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.codex-share-popup-inner h3 {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0 0 28px;
}

.codex-share-popup-inner h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0 0 14px;
}

/* ── Copy Link ── */
.codex-share-copy {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.codex-share-copy input {
    flex: 1;
    padding: 12px 16px;
    background: #eceeff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
    outline: none;
    height: 44px;
    box-sizing: border-box;
}

.codex-copy-btn-wrap button {
    background: #151d48;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    height: 44px;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.codex-copy-btn-wrap button:hover {
    opacity: 0.85;
}

/* ── Social Links ── */
.codex-social-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 10px;
}

.codex-social-links li a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(82, 82, 82, 0.15);
    border-radius: 50%;
    transition: border-color 0.3s;
}

.codex-social-links li a:hover {
    border-color: var(--primary-color);
}

/* ── Close Button ── */
.codex-share-close {
    width: 42px;
    height: 42px;
    background: rgba(88, 108, 129, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    position: absolute;
    top: 20px;
    right: 24px;
    border: 1px solid rgba(88, 108, 129, 0.1);
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
}

.codex-share-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* ── Meta row (replaces Astra's default entry-meta, which is emptied via the
   astra_single_post_meta filter) ── */
.codex-single-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 0 28px;
}

.codex-meta-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.codex-single-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.codex-single-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.codex-single-author a {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark-color);
    text-decoration: none;
}

.codex-meta-divider {
    width: 1px;
    height: 16px;
    background: #e2e8f0;
}

.codex-single-date {
    font-size: 14px;
    color: var(--gray-color, #6b7280);
}

.codex-single-cats {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.codex-single-cats a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
}

.codex-single-cats a::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
}

.codex-meta-right {
    flex-shrink: 0;
}

/* ── Featured Image ── */
.codex-single-thumbnail {
    margin: 0 0 32px;
    border-radius: 12px;
    overflow: hidden;
}

.codex-single-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

/* ── FAQ ── */
.codex-faq-section {
    margin-top: 48px;
    padding-top: 40px;
}

.codex-faq-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--dark-color);
}

.codex-faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.codex-faq-item {
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
}

.codex-faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: rgb(250, 248, 254);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-size: 17px;
    font-weight: 700;
    color: rgb(17, 24, 39);
    transition: background 0.2s;
    box-shadow: none;
}

.codex-faq-question:focus {
    background: rgb(250, 248, 254);
    border: none;
    color: rgb(17, 24, 39);
}

.codex-faq-question:hover {
    border: none;
    background: #f9f6ff;
    color: rgb(17, 24, 39);
}

.codex-faq-question.codex-faq-open {
    border: none;
    background: #f9f6ff;
    color: rgb(17, 24, 39);
}

.codex-faq-icon {
    flex-shrink: 0;
    transition: transform 0.3s;
}

.codex-faq-answer {
    display: none;
    padding: 0 20px 16px;
    font-size: 16px;
    line-height: 1.7;
    color: #4B5563;
    background: #f9f6ff;
}

.codex-faq-answer p { margin: 0; }

/* ── Author Bio ── */
.codex-author-bio {
    display: flex;
    gap: 28px;
    align-items: center;
    margin: 48px 0px;
    padding: 36px 40px;
    background: #ffffff;
    border: 1px solid rgb(240, 234, 251);
    border-radius: 18px;
}

.codex-author-bio > img {
    width: 92px;
    height: 92px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
}

.codex-author-bio-info { flex: 1; }

.codex-author-bio-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.codex-author-bio-top h3 { margin: 0; font-size: 28px; font-weight: 800; color: rgb(17, 24, 39); }

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

.codex-author-socials ul li a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #eee;
    color: #555;
    transition: all 0.2s;
}

.codex-author-socials ul li a:hover {
    background: var(--primary-color);
    color: #fff;
}

.codex-author-bio-info p {
    font-size: 14px;
    color: #666;
    line-height: 1.7;
    margin: 0;
}

/* ── Related Posts ── */
.codex-related-title {
    font-size: 24px;
    font-weight: 700;
    margin: 48px 0 24px;
    color: var(--dark-color);
}

.codex-read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 14px;
    color: rgb(17, 24, 39);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: .3s;
}

.codex-read-more:hover {
    color: var(--primary-color);
}

/* ── Side rails over the gutters ──
   Astra renders the post content unchanged (narrow container, viewport-centred).
   The TOC and sticky sidebar are absolutely positioned in the left/right gutters
   around the content, so the content area itself is never resized or shifted. */
.codex-single-wrap {
    position: relative;
    display: block;
}

/* ── Side rails (left = TOC/AI, right = sticky sidebar) ── */
.codex-single-sidebar {
    position: absolute;
    top: 0;
    height: 100%;
}

.codex-single-sidebar--left {
    right: calc(100% + 32px);
    width: 240px;
}

.codex-single-sidebar--right {
    left: calc(100% + 32px);
    width: 320px;
}

.codex-single-sidebar-inner {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── AI Summarize (above the TOC) ── */
.codex-blog-ai {
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
}

.codex-blog-ai-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dark-color);
    margin-bottom: 16px;
}

.codex-blog-ai-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.codex-blog-ai-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgb(229, 231, 235);
    border-radius: 8px;
    background: #ffffff;
    color: var(--gray-color);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

/* Icons use fill="currentColor" — they follow the button's color in every state. */
.codex-blog-ai-button svg {
    flex-shrink: 0;
}

.codex-blog-ai-button:hover,
.codex-blog-ai-button:focus,
.codex-blog-ai-button:focus-visible,
.codex-blog-ai-button:active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(4, 107, 210, 0.08);
    outline: none;
}

.codex-toc-widget {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #eee;
}

.codex-toc-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 16px;
    color: var(--dark-color);
}

.codex-toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #888;
}

.codex-toc-toggle:hover,
.codex-toc-toggle:focus {
    background: none;
    border: none;
    color: #888;
}

.codex-toc-toggle.codex-toc-open svg {
    transform: rotate(180deg);
}

.codex-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 70vh;
    overflow-y: auto;
}

.codex-toc-list::-webkit-scrollbar { width: 4px; }
.codex-toc-list::-webkit-scrollbar-track { background: #f1f1f1; }
.codex-toc-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.codex-toc-list a {
    font-size: 14px;
    color: #666;
    text-decoration: none;
    display: block;
    padding: 5px 5px 5px 10px;
    border-left: 2px solid transparent;
    line-height: 1.4;
    transition: all 0.2s;
}

.codex-toc-list a:hover,
.codex-toc-list a.codex-toc-active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.codex-toc-h3 a { padding-left: 20px; font-size: 13px; }

/* Sticky CTA */
.codex-sidebar-cta {
    background: var(--primary-color);
    border-radius: 16px;
    padding: 24px;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    justify-content: center;
    text-align: center;

    min-height: 120px;
    box-sizing: border-box;
}

.codex-sidebar-cta h3 {
    font-size: 23px;
    font-weight: 500;
    margin: 0;
    color: #fff;
    margin-bottom: 4px;
}

.codex-sidebar-cta .codex-product-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.codex-sidebar-cta .codex-product-card {
    background: #FFFFFF0D;
    border: 1px solid #FFFFFF1A;
    border-radius: 8px;
    padding: 12px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-height: 95px;
    text-align: center;
}

.codex-sidebar-cta .codex-product-list .codex-product-card p {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    line-height: 100%;
    margin-top: 8px;
    margin-bottom: 0;
}

.codex-sidebar-cta .codex-product-list .codex-product-card span {
    font-size: 11px;
    font-weight: 400;
    color: #fff;
    line-height: 100%;
    margin-top: 0;
}

/* Social Widget */
.codex-sidebar-social h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    color: rgb(17, 24, 39);
}

.codex-sidebar-social-icons {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.codex-sidebar-social-icons a {
    width: 40px;
    height: 40px;
    border: 1.5px solid rgb(229, 231, 235);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    text-decoration: none;
    transition: all 0.2s;
}

.codex-sidebar-social-icons a:hover {
    background: #f0ebff;
    color: var(--primary-color);
}

/* ── Dynamic Sidebar ── */
.codex-dynamic-sidebar {
    border-radius: 16px;
    padding: 24px;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.codex-sidebar-logo {
    width: 140px;
    height: auto;
}

.codex-dynamic-sidebar h3 {
    font-size: 23px;
    font-weight: 500;
    color: #fff;
    margin: 0;
    line-height: 1.3;
}

.codex-dynamic-sidebar p {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    margin: 0;
    line-height: 1.6;
}

/* List Items */
.codex-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.codex-sidebar-list.list-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.codex-sidebar-list.list-view .codex-sidebar-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #EEF0FF33;
}

.codex-sidebar-list.list-view .codex-sidebar-item-text {
    text-align: left;
}

/* List view shows the label only — the description is for card view. */
.codex-sidebar-list.list-view .codex-sidebar-item-text span {
    display: none;
}

.codex-sidebar-list.card-view {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.codex-sidebar-list.card-view .codex-sidebar-list-item {
    width: 100%;
    min-height: 95px;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    text-align: center;
    background: #FFFFFF0D;
    border: 1px solid #FFFFFF1A;
    border-radius: 8px;
    padding: 16px;
}

.codex-sidebar-list.card-view .codex-sidebar-item-text p {
    margin-top: 8px;
}

.codex-sidebar-list.card-view .codex-sidebar-item-text span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #ffffff;
}

/* CTA Button */
.codex-sidebar-cta-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ffffff !important;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 14px;
    text-align: center;
    transition: opacity 0.2s;
    margin-top: 4px;
}

.codex-sidebar-cta-btn:hover {
    opacity: 0.9;
}

/* Below this width the gutters are too small for the rails — restack them in
   normal flow (TOC above, sidebar below the content). */
@media ( max-width: 1400px ) {
    .codex-single-sidebar {
        position: static;
        width: auto;
        height: auto;
    }

    .codex-single-sidebar-inner {
        position: static;
    }

    .codex-single-sidebar--right {
        margin-top: 32px;
    }
}

/* ── Comments ── */
.comment-respond {
    padding: 0 !important;
}

.comment-reply-title {
    font-family: var(--inter) !important;
    font-size: 28px !important;
    font-weight: 800 !important;
    color: rgb(17, 24, 39) !important;
    margin-bottom: 0 !important;
    margin-top: 24px !important;
}

.comment-reply-title small a {
    color: var(--primary-color);
}

.logged-in-as {
    font-family: var(--inter) !important;
    font-size: 14px !important;
    color:  rgb(156, 163, 175) !important;
    margin-bottom: 24px !important;
}

.logged-in-as a {
    color: var(--primary-color);
}

/* Links inside the comments area are underlined. */
.comments-area a {
    text-decoration: underline;
}

.comments-area textarea#comment,
.comments-area .ast-comment-formwrap input[type="text"],
.comments-area .ast-comment-formwrap input[type="email"],
.comments-area .ast-comment-formwrap input[type="url"] {
    width: 100%;
    padding: 12px 16px !important;
    border: 1.5px solid rgb(229, 231, 235) !important;
    background: rgb(250, 250, 250) !important;
    border-radius: 12px !important;
    font-family: var(--inter) !important;
    font-size: 15px !important;
    color: var(--dark-color) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comments-area textarea#comment:focus,
.comments-area .ast-comment-formwrap input[type="text"]:focus,
.comments-area .ast-comment-formwrap input[type="email"]:focus,
.comments-area .ast-comment-formwrap input[type="url"]:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(4, 107, 210, 0.12) !important;
    outline: none !important;
}

.comments-area .comment-form-comment {
    margin-bottom: 16px;
}

.comments-area .form-submit {
    margin-top: 8px;
}

input#submit,
input[type="submit"],
.comments-area .submit,
#comments .submit {
    display: inline-block;
    width: auto;
    padding: 12px 28px !important;
    background: var(--primary-color) !important;
    border: 1px solid var(--primary-color) !important;
    border-radius: 10px !important;
    color: #fff !important;
    font-family: var(--inter) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

input#submit:hover,
input[type="submit"]:hover,
.comments-area .submit:hover,
#comments .submit:hover {
    opacity: 0.9;
    color: #fff !important;
}

.ast-comment-cite-wrap a {
    color: var(--primary-color);
}

.ast-comment-time a {
    color: var(--primary-color);
}

.ast-comment-edit-reply-wrap a {
    color: var(--primary-color);
}

.ast-reply-link a:hover {
    background: var(--primary-color) !important;
}

/* ── Responsive ── */
@media ( max-width: 768px ) {
    /* Share popup */
    .codex-share-popup-inner {
        width: calc( 100% - 32px );
        padding: 32px 20px;
    }

    .codex-share-popup-inner h3 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .codex-share-copy {
        flex-direction: column;
        align-items: stretch;
    }

    .codex-copy-btn-wrap button {
        width: 100%;
    }

    /* Author bio */
    .codex-author-bio {
        flex-direction: column;
        padding: 24px 20px;
        gap: 16px;
    }

    .codex-author-bio > img {
        width: 72px;
        height: 72px;
    }

    .codex-author-bio-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .codex-author-bio-top h3 {
        font-size: 22px;
    }

    /* FAQ */
    .codex-faq-question {
        font-size: 15px;
        padding: 16px 18px;
    }

    .codex-faq-answer {
        font-size: 14px;
        padding: 0 16px 14px;
    }

    /* Related posts */
    .codex-archive-grid {
        grid-template-columns: 1fr;
    }

    .codex-related-title {
        font-size: 20px;
        margin: 32px 0 16px;
    }

    /* TOC */
    .codex-toc-widget {
        padding: 16px;
    }

    /* Comments */
    .comment-reply-title {
        font-size: 22px !important;
    }
}

@media ( max-width: 480px ) {
    .codex-faq-section {
        margin-bottom: 48px;
        padding-top: 0;
    }

    .codex-faq-title {
        font-size: 20px;
    }

    .codex-faq-question {
        font-size: 14px;
        padding: 14px 16px;
    }

    .codex-share-popup-inner {
        padding: 24px 16px;
    }

    .codex-share-popup-inner h3 {
        font-size: 18px;
    }

    .codex-author-bio {
        padding: 20px 16px;
    }

    .codex-author-bio-top h3 {
        font-size: 18px;
    }

    /* Social icons row wrap */
    .codex-sidebar-social-icons {
        flex-wrap: wrap;
    }

    /* Dynamic sidebar */
    .codex-dynamic-sidebar {
        padding: 20px;
    }

    .codex-sidebar-list.card-view {
        grid-template-columns: repeat( 2, 1fr );
    }
}
