/* ══ Single Academy Article ══ */
.nml-asp {
    background: #F5F6FA;
    padding: 92px 0 80px;
}

.nml-asp__shell {
    display: grid;
    grid-template-columns: 353px 10px 1fr;
    align-items: start;
    gap: 20px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 10px 0 20px;
}

/* ══ Left: Playbook navigation ══ */
.nml-asp__nav {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Drawer chrome (trigger bar, overlay, drawer header) — mobile only. */
.nml-asp__nav-trigger,
.nml-asp__nav-overlay,
.nml-asp__nav-drawer-head {
    display: none;
}

.nml-asp__back {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 6px;
    max-width: max-content;
    padding: 10px 16px;
    background: rgba(22, 47, 111, 0.04);
    border: 1px solid #D5DAFA;
    border-radius: 8px;
    font-size: 14px;
    line-height: 20px;
    font-weight: 700;
    color: #162F6F;
    text-decoration: none;
    transition: all 0.3s;
}

.nml-asp__back:hover {
    background: #F5F6FA;
    border: 1px solid #889CF1;
}

.nml-asp__back:active {
    background: #EEF0FD;
    border: 1px solid #6281EC;
}

.nml-asp__nav-title {
    margin: 16px 0 0 0;
    font-size: 18px;
    line-height: 26px;
    font-weight: 700;
    color: #0B101F;
}

.nml-asp__playbook {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Accordion group = subcategory */
.nml-asp__group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    min-height: 52px;
    padding: 16px 20px 0 20px;
    background: #FFFFFF;
    border: 1px solid #D5DAFA;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

.nml-asp__group:hover {
    border: 1px solid #889CF1;
}

.nml-asp__group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 0 0 8px 0;
    background: none;
    border: none;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    line-height: 20px;
    font-weight: 700;
    color: #0B101F;
    transition: all 0.3s;
}

.nml-asp__group-head:hover {
    color: #162F6F;
}

.nml-asp__group.is-open .nml-asp__group-head {
    border-bottom: 1px solid #D5DAFA;
    color: #162F6F;
}

.nml-asp__group.is-open .nml-asp__group-head:hover {
    border-bottom: 1px solid #889CF1;
    color: #162F6F;
}

.nml-asp__group-chevron {
    flex-shrink: 0;
    color: #889CF1;
    transition: transform 0.25s;
}

.nml-asp__group.is-open .nml-asp__group-chevron {
    transform: rotate(180deg);
}

.nml-asp__group-list {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0 0 16px 0;
    list-style: none;
}

.nml-asp__group.is-open .nml-asp__group-list {
    display: flex;
}

.nml-asp__group-link {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: #303D60;
    text-decoration: none;
    transition: all 0.2s;
}

.nml-asp__group-link:hover {
    color: #FF4171;
}

.nml-asp__group-num {
    flex-shrink: 0;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: #303D60;
    position: relative;
}

.nml-asp__group-num > span {
    position: relative;
    z-index: 1;
}

.nml-asp__group-item.is-current .nml-asp__group-link {
    color: #0B101F;
}

.nml-asp__group-item.is-current .nml-asp__group-num {
    color: #FFFFFF;
}

.nml-asp__group-item.is-current .nml-asp__group-num:after {
    content: '';
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #FF4171;
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
}

/* ══ Custom scrollbar (between aside and main) ══ */
.nml-asp__scrollbar {
    position: sticky;
    top: 24px;
    align-self: start;
    width: 6px;
    height: calc(100vh - 20px);
    max-height: 788px;
    background: #FFFFFF;
    border-radius: 100px;
}

.nml-asp__scrollbar-thumb {
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    min-height: 40px;
    background: #D5DAFA;
    border-radius: 100px;
    cursor: grab;
    transition: background 0.2s;
    will-change: transform;
}

.nml-asp__scrollbar-thumb:hover {
    background: #889CF1;
}

.nml-asp__scrollbar.is-dragging .nml-asp__scrollbar-thumb,
.nml-asp__scrollbar-thumb:active {
    background: #889CF1;
    cursor: grabbing;
}

/* Hide the custom scrollbar when the block does not overflow */
.nml-asp__scrollbar.is-hidden {
    visibility: hidden;
}

/* ══ Center: Article ══ */
.nml-asp__main {
    padding: 32px 32px 48px;
    background: #FFFFFF;
    border: 1px solid #D5DAFA;
    box-shadow: 0 1px 2px rgba(76, 131, 243, 0.2);
    border-radius: 12px;
    height: calc(100vh - 20px);
    max-height: 788px;
    overflow-y: scroll;
}

.nml-asp__main::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;                /* WebKit */
}

/* Inner grid layout.
   Desktop: article column (1fr) + sticky TOC rail (268px). The TOC sits after
   the title in the DOM (so it falls under the title on mobile) but is placed in
   the right-hand column on desktop via named grid areas. */
.nml-asp__main-grid {
    display: grid;
    grid-template-columns: 1fr 268px;
    grid-auto-rows: min-content;
    align-items: start;
    column-gap: 48px;
}
.nml-asp__content-inner {
    display: grid;
    grid-template-columns: 1fr 268px;
    grid-auto-rows: min-content;
    align-items: start;
    column-gap: 48px;
}

/* Article column (col 1): header, body and footer flow top-to-bottom. */
.nml-asp__main-content,
.nml-asp__main-grid > .nml-asp__locked,
.nml-asp__main-grid > .nml-asp__content-inner,
.nml-asp__main-grid > .nml-asp__main-footer {
    grid-column: 1;
}

/* TOC pinned to the right column, spanning the full height. */
.nml-asp__main-grid > .nml-asp__toc {
    grid-column: 2;
    grid-row: 1 / -1;
}

.nml-asp__eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
    color: #FF4171;
    text-decoration: none;
}

.nml-asp__title {
    margin: 0 0 32px;
    font-size: 32px;
    line-height: 40px;
    font-weight: 700;
    color: #0B101F;
}

.nml-asp__image {
    max-height: 404px;
}

.nml-asp__image img {
    max-width: 100%;
    width: 100%;
    height: auto;
}

/* Content typography */

.nml-asp__content {
    margin: 32px 0 0;
}

.nml-asp__content h5 {
    margin: 40px 0 16px;
}

.nml-asp__content h5:first-child {
    margin: 0 0 16px;
}

.nml-asp__content p {
    margin: 0 0 16px;
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    color: #303D60;
}

.nml-asp__content p:last-child {
    margin-bottom: 0;
}

.nml-asp__content h2 {
    margin: 48px 0 16px;
}

.nml-asp__content h2:first-child {
    margin-top: 0;
}

.nml-asp__content h3 {
    margin: 36px 0 12px;
}

.nml-asp__content img {
    max-width: 100%;
    height: auto;
    margin: 16px 0;
    border-radius: 12px;
}

.nml-asp__content ul,
.nml-asp__content ol {
    margin: 0 0 20px;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nml-asp__content ul li,
.nml-asp__content ol li {
    position: relative;
    padding-left: 32px;
    font-size: 16px;
    line-height: 26px;
    font-weight: 500;
    color: #303D60;
}

.nml-asp__content ul li::before {
    content: '';
    position: absolute;
    top: 9px;
    left: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FF4171;
}

.nml-asp__content ol {
    counter-reset: ol-counter;
}

.nml-asp__content ol li {
    counter-increment: ol-counter;
}

.nml-asp__content ol li::before {
    content: counter(ol-counter) '.';
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
    color: #FF4171;
}

.nml-asp__content p a,
.nml-asp__content .wp-block-paragraph a {
    color: #FF4171;
    font-weight: 600;
    text-decoration: underline;
}

.nml-asp__content hr {
    margin: 40px 0;
    border: none;
    border-top: 1px solid #D5DAFA;
}

.nml-asp__content blockquote {
    margin: 24px 0;
    padding: 16px 24px;
    border-left: 3px solid #FF4171;
    background: #F5F6FA;
    border-radius: 0 8px 8px 0;
    font-size: 17px;
    line-height: 27px;
    font-weight: 500;
    color: #0B101F;
}

.nml-asp__content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 24px;
    font-size: 15px;
}

.nml-asp__content th,
.nml-asp__content td {
    padding: 12px 16px;
    border: 1px solid #E3E7F4;
    text-align: left;
}

.nml-asp__content th {
    background: #F5F6FA;
    font-weight: 700;
    color: #0B101F;
}

.nml-asp__content code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: #F5F6FA;
    padding: 2px 6px;
    border-radius: 4px;
    color: #FF4171;
}

.nml-asp__content pre {
    background: #0B101F;
    color: #E8EAFF;
    border-radius: 10px;
    padding: 20px 24px;
    overflow-x: auto;
    margin: 0 0 24px;
    font-size: 14px;
    line-height: 22px;
}

.nml-asp__content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ══ Right: On this page (TOC) ══ */
.nml-asp__toc {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 0;
}

.nml-asp__toc-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    line-height: 20px;
    font-weight: 700;
    color: #303D60;
}

.nml-asp__toc-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.nml-asp__toc-link {
    padding: 8px 20px;
    border-left: 2px solid #D5DAFA;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: #303D60;
    text-decoration: none;
    transition: all 0.3s;
}

.nml-asp__toc-link:hover {
    color: #0B101F;
    border-left: 2px solid #889CF1;
}

.nml-asp__toc-link--active {
    border-left-color: #FF4171;
    color: #0B101F;
    font-weight: 600;
}

.nml-asp__toc-link--active:hover {
    border-left-color: #F1005B;
}

/* ── Paywall (locked article) ── */
.nml-asp__locked {
    position: relative;
}

/* Preview: the open first half of the article, fading into the paywall. */
.nml-asp__content--preview {
    position: relative;
}

.nml-asp__content--preview::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 120px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #FFFFFF 90%);
}

.nml-asp__paywall {
    padding: 80px 0 0;
    text-align: center;
    position: relative;
}

.nml-asp__paywall-title {
    margin: 0 0 8px;
    color: #0B101F;
}

.nml-asp__paywall-text {
    margin: 0 0 40px;
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    text-align: center;
    color: #303D60;
}

.nml-asp__paywall-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 0 40px;
}

.nml-asp__paywall-signin {
    margin: 0;
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    color: #303D60;
}

.nml-asp__paywall-signin a {
    color: #162F6F;
    font-weight: 700;
    text-decoration: none;
}

.nml-asp__paywall-signin a:hover {
    text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
    .nml-asp__shell {
        grid-template-columns: 300px 10px minmax(0, 1fr);
    }
    .nml-asp__toc {
        display: none;
    }
}

@media (max-width: 991px) {
    .nml-asp__shell {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 0 12px;
    }
    /* Playbook navigation becomes a bottom drawer (see below). */

    /* Drop the inner scroll + hide the custom scrollbar on mobile */
    .nml-asp__scrollbar {
        display: none;
    }
    .nml-asp__main {
        max-height: none;
        height: auto;
        padding: 16px 16px 40px 16px;
        overflow: visible;
    }
    /* Single column; TOC sits right under the title (head), before the body. */
    .nml-asp__main-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    .nml-asp__main-content { order: 0; }
    .nml-asp__main-grid > .nml-asp__toc { order: 1; }
    .nml-asp__main-grid > .nml-asp__locked,
    .nml-asp__main-grid > .nml-asp__content-inner,
    .nml-asp__main-grid > .nml-asp__main-footer { order: 2; }

    /* Re-show the TOC on mobile (hidden in the 992–1200 tablet rail band). */
    .nml-asp__toc {
        display: flex;
        margin: 20px 0 8px;
        padding: 20px;
        background: #FFFFFF;
        border: 1px solid #D5DAFA;
        border-radius: 12px;
        position: static;
    }
    .nml-asp__content-inner {
        grid-template-columns: 1fr;
    }
    .nml-asp__title {
        font-size: 28px;
        line-height: 36px;
    }
    .nml-asp__content h5 {
        margin: 32px 0 16px;
    }
    .nml-asp__content h5:first-child {
        margin: 0 0 12px;
    }
    .nml-asp__content p {
        margin: 0 0 12px;
        font-size: 14px;
        line-height: 20px;
    }
    .nml-asp__content p:last-child {
        margin: 0;
    }
    .nml-asp__content img {
        margin: 12px 0;
    }
    .nml-asp__content hr {
        margin: 32px 0;
    }
    .nml-asp__paywall {
        padding: 48px 0 0;
    }
    .nml-asp__paywall-title {
        margin: 0 0 6px;
    }
    .nml-asp__paywall-text {
        margin: 0 0 24px;
        font-size: 14px;
        line-height: 20px;
    }
    .nml-asp__paywall-actions {
        margin: 0 0 24px;
    }

    /* ── Playbook as a bottom drawer ── */

    /* Trigger bar — always visible, pinned to the bottom of the viewport. */
    .nml-asp__nav-trigger {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        padding: 14px 20px;
        background: #FFFFFF;
        border: 1px solid #D5DAFA;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 6px 24px rgba(11, 16, 31, 0.12);
        text-align: left;
        cursor: pointer;
    }
    .nml-asp__nav-trigger-text {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .nml-asp__nav-trigger-title {
        font-size: 16px;
        line-height: 22px;
        font-weight: 700;
        color: #0B101F;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .nml-asp__nav-trigger-sub {
        font-size: 14px;
        line-height: 20px;
        font-weight: 500;
        color: #303D60;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .nml-asp__nav-trigger-chevron {
        flex-shrink: 0;
        color: #889CF1;
    }

    /* Overlay behind the open drawer. */
    .nml-asp__nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1001;
        background: rgba(11, 16, 31, 0.48);
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .nml-asp__nav-overlay.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    /* The nav itself = the drawer: pinned bottom, slides up when open. */
    .nml-asp__nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        z-index: 1002;
        gap: 12px;
        max-height: 85dvh;
        overflow-y: auto;
        padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0));
        background: #FFFFFF;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(11, 16, 31, 0.18);
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .nml-asp__nav.is-open {
        transform: translateY(0);
    }

    /* Drawer header with grab handle + close. */
    .nml-asp__nav-drawer-head {
        display: block;
        position: sticky;
        top: 0;
        z-index: 1;
        margin: 0 -16px;
        padding: 28px 48px 16px 20px;
        background: #FFFFFF;
        border-bottom: 1px solid #D5DAFA;
        border-radius: 20px 20px 0 0;
    }
    .nml-asp__nav-drawer-head::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: #D5DAFA;
        border-radius: 99px;
    }
    .nml-asp__nav-drawer-title {
        font-size: 18px;
        line-height: 26px;
        font-weight: 700;
        color: #0B101F;
    }
    .nml-asp__nav-drawer-sub {
        margin-top: 2px;
        font-size: 14px;
        line-height: 20px;
        font-weight: 500;
        color: #303D60;
    }
    .nml-asp__nav-drawer-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 24px;
        right: 16px;
        width: 28px;
        height: 28px;
        padding: 0;
        background: none;
        border: none;
        color: #303D60;
        cursor: pointer;
    }

    /* Hide the desktop "Back" link and inline title inside the drawer. */
    .nml-asp__nav > .nml-asp__back,
    .nml-asp__nav > .nml-asp__nav-title {
        display: none;
    }
}

/* ══ Prev / Next pager ══ */
.nml-asp__pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 40px;
    padding-bottom: 64px;
    border-bottom: 1px solid #D5DAFA;
}

.nml-asp__pager-link {
    max-width: 48%;
    font-size: 14px;
    line-height: 20px;
}

.nml-asp__pager-link span {
    font-size: 14px;
    line-height: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nml-asp__pager-link svg {
    flex-shrink: 0;
}

.nml-asp__pager-link--next {
    margin-left: auto;
}

.nml-asp__pager-link.is-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

/* ══ Share (copied from single post) ══ */
.nml-asp__share {
    margin-top: 64px;
}

.nml-sp__share {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nml-sp__share-title {
    width: 100%;
    margin: 0 !important;
    color: var(--color-text-primary);
}

.nml-sp__share-icons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nml-sp__share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

@media (max-width: 600px) {
    .nml-asp__pager {
        flex-direction: column;
        align-items: stretch;
    }
    .nml-asp__pager-link {
        max-width: 100%;
    }
    .nml-asp__pager-link--next {
        margin-left: 0;
    }
}
