﻿/* Single post sidebar â€” sticky on desktop */
.post-with-sidebar__layout {
    display: flex;
    flex-direction: column;
}

.post-with-sidebar__main {
    flex: 1 1 auto;
    min-width: 0;
}

.post-with-sidebar__aside {
    flex-shrink: 0;
}

.post-single-intro {
    width: 100%;
    max-width: 42rem;
}

.post-featured-figure {
    margin: 0;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.post-featured-figure__img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 22rem;
    object-fit: cover;
    object-position: center;
}

.post-sidebar-shell {
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 2rem 1.25rem 2.5rem;
}

.post-sidebar-inner {
    max-width: 26rem;
    margin-left: auto;
    margin-right: auto;
}

.post-sidebar-section {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.post-sidebar-section--last {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}

.post-sidebar-cta-pin {
    flex-shrink: 0;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.post-sidebar-scroll {
    min-height: 0;
}

.post-sidebar-card {
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 1.25rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.post-sidebar-card--highlight {
    border-color: rgba(44, 87, 178, 0.2);
    background: linear-gradient(135deg, rgba(44, 87, 178, 0.08) 0%, #fff 100%);
}

.post-sidebar-kicker,
.post-sidebar-cta-kicker {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #2c57b2;
    margin-bottom: 0.5rem;
}

.post-sidebar-title-sm {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    color: #0f172a;
    margin-bottom: 0.875rem;
}

.post-sidebar-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.post-sidebar-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
}

.post-sidebar-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #2c57b2;
    transition: gap 0.2s ease;
}

.post-sidebar-back:hover {
    gap: 0.75rem;
}

.post-sidebar-heading {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #0f172a;
    margin-bottom: 1rem;
}

.post-sidebar-heading-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.625rem;
    background: rgba(44, 87, 178, 0.1);
    color: #2c57b2;
}

.post-sidebar-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.post-sidebar-toc-link {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    color: #475569;
    font-size: 0.875rem;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.post-sidebar-toc-link:hover {
    background: #fff;
    border-color: rgba(44, 87, 178, 0.15);
    color: #2c57b2;
    box-shadow: 0 4px 14px rgba(44, 87, 178, 0.08);
}

.post-sidebar-toc-item--level-3 .post-sidebar-toc-link {
    margin-left: 0.75rem;
}

.post-sidebar-toc-num {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding-top: 0.125rem;
}

.post-sidebar-toc-link:hover .post-sidebar-toc-num {
    color: #2c57b2;
}

.post-sidebar-posts {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.post-sidebar-post-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem;
    border-radius: 0.875rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    transition: all 0.25s ease;
}

.post-sidebar-post-link:hover {
    border-color: rgba(44, 87, 178, 0.25);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.post-sidebar-post-thumb {
    flex-shrink: 0;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #f1f5f9;
}

.post-sidebar-post-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(44, 87, 178, 0.08);
}

.post-sidebar-post-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-sidebar-post-body {
    flex: 1 1 auto;
    min-width: 0;
}

.post-sidebar-post-date {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.25rem;
}

.post-sidebar-post-title {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
    color: #0f172a;
}

.post-sidebar-post-link:hover .post-sidebar-post-title {
    color: #2c57b2;
}

.post-sidebar-post-arrow {
    color: #cbd5e1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.post-sidebar-post-link:hover .post-sidebar-post-arrow {
    color: #2c57b2;
    transform: translateX(2px);
}

.post-sidebar-cta {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #2c57b2 0%, #1e3a8a 100%);
    color: #fff;
}

.post-sidebar-cta-glow {
    position: absolute;
    top: -3rem;
    right: -3rem;
    width: 9rem;
    height: 9rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

.post-sidebar-cta-kicker {
    position: relative;
    color: rgba(255, 255, 255, 0.75);
}

.post-sidebar-cta-title {
    position: relative;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 0.625rem;
}

.post-sidebar-cta-text {
    position: relative;
    font-size: 0.875rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 1.25rem;
}

.post-sidebar-cta-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    border-radius: 0.625rem;
    background: #fff;
    color: #2c57b2;
    font-size: 0.875rem;
    font-weight: 700;
    transition: transform 0.2s ease;
}

.post-sidebar-cta-btn:hover {
    transform: translateY(-1px);
}

.post-sidebar-cta-actions {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.post-sidebar-cta-btn--secondary {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.85);
}

.post-sidebar-cta-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.post-sidebar-cta-link {
    position: relative;
    display: block;
    margin-top: 0.875rem;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-sidebar-cta-link:hover {
    color: #fff;
}

/* Mobile drawer */
.post-sidebar-open {
    display: none;
}

.post-sidebar-backdrop {
    display: none;
}

.post-sidebar-close {
    display: none;
}

@media (max-width: 1023px) {
    .post-sidebar-open {
        position: fixed;
        right: 0.875rem;
        bottom: 3.5rem;
        z-index: 45;
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
        padding: 0.625rem 0.875rem;
        border: 0;
        border-radius: 9999px;
        background: linear-gradient(135deg, #2c57b2 0%, #1e3a8a 100%);
        color: #fff;
        font-size: 0.75rem;
        font-weight: 700;
        line-height: 1;
        box-shadow: 0 8px 20px rgba(44, 87, 178, 0.28);
        cursor: pointer;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .post-sidebar-open:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 24px rgba(44, 87, 178, 0.32);
    }

    .post-sidebar-open__icon {
        width: 0.875rem;
        height: 0.875rem;
        flex-shrink: 0;
    }

    .post-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 90;
        background: rgba(15, 23, 42, 0.45);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.28s ease, visibility 0.28s ease;
    }

    .post-sidebar-backdrop.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .post-with-sidebar__aside {
        position: fixed;
        top: 0;
        right: 0;
        width: min(100vw - 1.5rem, 22rem);
        height: 100%;
        height: 100dvh;
        z-index: 100;
        transform: translateX(100%);
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.28s ease, visibility 0.28s ease;
    }

    .post-with-sidebar__aside.is-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    .post-sidebar-shell {
        position: relative;
        height: 100%;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        border-top: 0;
        border-left: 1px solid #e2e8f0;
        box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
        padding-top: 3.25rem;
    }

    .post-sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0.875rem;
        right: 0.875rem;
        z-index: 5;
        width: 2.25rem;
        height: 2.25rem;
        border: 1px solid #e2e8f0;
        border-radius: 9999px;
        background: #fff;
        color: #334155;
        cursor: pointer;
        transition: background 0.2s ease, color 0.2s ease;
    }

    .post-sidebar-close:hover {
        background: #f8fafc;
        color: #2c57b2;
    }

    body.post-sidebar-drawer-open {
        overflow: hidden;
    }
}

@media (min-width: 1024px) {
    .post-with-sidebar__layout {
        flex-direction: row;
        align-items: flex-start;
        gap: 2rem;
        padding-left: clamp(1rem, 2vw, 1.75rem);
    }

    .post-with-sidebar__main {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        padding-right: 0.5rem;
    }

    .post-with-sidebar__main .max-w-3xl {
        max-width: none;
        width: 100%;
    }

    .post-with-sidebar__main .post-single-intro {
        max-width: min(100%, 44rem);
    }

    .post-featured-figure__img {
        max-height: 20rem;
    }

    .post-with-sidebar__aside {
        position: sticky;
        top: 5.5rem;
        align-self: flex-start;
        width: min(420px, 32vw);
        flex-shrink: 0;
        max-height: calc(100vh - 5.5rem);
        z-index: 20;
    }

    .admin-bar .post-with-sidebar__aside {
        top: calc(5.5rem + 32px);
        max-height: calc(100vh - 5.5rem - 32px);
    }

    .post-sidebar-shell {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 5.5rem);
        max-height: calc(100vh - 5.5rem);
        overflow: hidden;
        border-top: 0;
        border-left: 1px solid #e2e8f0;
        padding: 1.5rem 1.75rem 1.25rem;
        box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.8);
    }

    .admin-bar .post-sidebar-shell {
        height: calc(100vh - 5.5rem - 32px);
        max-height: calc(100vh - 5.5rem - 32px);
    }

    .post-sidebar-inner {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        max-width: none;
        margin: 0;
        padding-right: 0;
        overflow: hidden;
    }

    .post-sidebar-shell--with-cta .post-sidebar-cta-pin {
        flex-shrink: 0;
        z-index: 2;
    }

    .post-sidebar-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding-right: 0.15rem;
        scrollbar-width: thin;
        scrollbar-color: rgba(44, 87, 178, 0.35) transparent;
    }

    .post-sidebar-scroll::-webkit-scrollbar {
        width: 5px;
    }

    .post-sidebar-scroll::-webkit-scrollbar-thumb {
        background: rgba(44, 87, 178, 0.35);
        border-radius: 9999px;
    }
}
