/* ── Single Post (single.php) ────────────────────────────── */

/* ── Hero ─────────────────────────────────────────────────── */
.sp-hero {
    position: relative;
    isolation: isolate; /* contains the ::before stacking context so it can't float above z-index:1 content */
    background-size: cover;
    background-position: center;
    background-color: var(--wp--preset--color--secondary, #0B2169);
    padding: 4.5rem 0 3.5rem;
    min-height: 300px;
    display: flex;
    align-items: center;
}

.sp-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0; /* Must be below sp-hero__inner z-index:1; opacity<1 creates a stacking context */
    background: var(--sp-overlay-bg, #000);
    opacity: var(--sp-overlay-opacity, 0.5);
}

.sp-hero__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: var(--sp-align-items, flex-start);
    text-align: var(--sp-text-align, left);
}

/* Breadcrumbs — colours applied directly on elements (no opacity compounding) */
.sp-breadcrumbs ol {
    display: flex;
    align-items: center;
    justify-content: var(--sp-justify, flex-start);
    flex-wrap: wrap;
    gap: .375rem;
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    font-size: 1rem;
    font-weight: 600;
}
.sp-breadcrumbs li {
    display: flex;
    align-items: center;
    color: rgba(255,255,255,.45); /* separator / non-link items — static dim */
}
.sp-breadcrumbs li + li::before {
    content: '/';
    margin-right: .375rem;
    opacity: .4;
}
.sp-breadcrumbs a {
    color: var(--sp-bc, rgba(255,255,255,.75));
    text-decoration: none;
    transition: color .15s;
}
.sp-breadcrumbs a:hover {
    color: var(--sp-bc-hover, #fff);
}
.sp-breadcrumbs [aria-current="page"] {
    color: var(--sp-bc, rgba(255,255,255,.5));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Category badge */
.sp-hero__badge {
    display: inline-block;
    background: var(--wp--preset--color--primary, #B00000);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: .3rem .625rem;
    border-radius: 4px;
    margin-bottom: .875rem;
}

/* Post title */
.sp-hero__title {
    font-size: clamp(2rem, 4.5vw, 3.25rem);
    font-weight: 900;
    color: var(--sp-title, #fff);
    letter-spacing: -.03em;
    line-height: 1.1;
    margin: 0 0 1rem;
}

/* Excerpt blurb */
.sp-hero__excerpt {
    font-size: 1rem;
    color: var(--sp-body-text, #fff);
    opacity: .8;
    line-height: 1.65;
    margin: 0;
    max-width: 640px;
}

/* ── Mobile sticky contents bar (hidden on desktop) ──────── */
.sp-contents-bar {
    display: none;
}

/* ── Main layout grid ─────────────────────────────────────── */
.single-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
    align-items: start;
    padding: 3.5rem 0 5rem;
}

/* ── Content area (70%) ───────────────────────────────────── */
.single-content {
    min-width: 0; /* prevent grid blowout */
}

/* Divider above H2s */
.sp-divider {
    border: none;
    border-top: 1px solid rgba(0,0,0,.1);
    margin: 2.5rem 0 2rem;
}

/* ── Headings ─────────────────────────────────────────────── */
.sp-heading {
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.01em;
    margin: 0 0 .875rem;
}
.sp-heading--h2 {
    font-size: clamp(1.375rem, 2.5vw, 1.875rem);
    color: var(--wp--preset--color--primary, #B00000);
}
.sp-heading--h3 {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    color: var(--wp--preset--color--secondary, #0B2169);
}
.sp-heading--h4 { font-size: 1.125rem; color: var(--wp--preset--color--secondary, #0B2169); }
.sp-heading--h5 { font-size: 1rem;     color: var(--wp--preset--color--secondary, #0B2169); }
.sp-heading--h6 { font-size: 1rem;     color: var(--wp--preset--color--secondary, #0B2169); }

/* ── Body text ────────────────────────────────────────────── */
.sp-body {
    color: var(--wp--preset--color--off-black, #2A2A2A);
    font-size: 1.0625rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.sp-body p { margin: 0 0 1.25rem; }
.sp-body p:last-child { margin-bottom: 0; }

.sp-body ul,
.sp-body ol {
    margin: 0 0 1.25rem;
    padding-left: 1.5rem;
}
.sp-body li { margin-bottom: .5rem; }

.sp-body a {
    color: var(--wp--preset--color--primary, #B00000);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity .15s;
}
.sp-body a:hover { opacity: .75; }

.sp-body strong { font-weight: 700; }
.sp-body em { font-style: italic; }

.sp-body h2, .sp-body h3, .sp-body h4 {
    color: var(--wp--preset--color--primary, #B00000);
    margin: 1.5rem 0 .75rem;
    font-weight: 700;
}

/* Images within body content */
.sp-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 1.5rem 0;
}
.sp-body figcaption {
    font-size: .875rem;
    color: #6b7280;
    text-align: center;
    margin-top: .5rem;
}

/* Drop cap on first body block */
.sp-body--intro > p:first-child::first-letter,
.sp-body--gutenberg > p:first-child::first-letter {
    font-size: 3.5em;
    font-weight: 900;
    float: left;
    line-height: 0.82;
    margin: 0.06em 0.1em 0 0;
    color: var(--wp--preset--color--primary, #B00000);
}

/* ── Tip Banner ───────────────────────────────────────────── */
.sp-tip {
    border-left: 4px solid var(--wp--preset--color--secondary, #0B2169);
    background: rgb(var(--nifty-secondary-rgb) / .04);
    border-radius: 0 6px 6px 0;
    margin: 1.75rem 0;
    overflow: hidden;
}

.sp-tip__header {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .625rem 1rem .375rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--wp--preset--color--secondary, #0B2169);
}

.sp-tip__content {
    padding: .25rem 1rem .875rem;
    font-size: 1rem;
    color: var(--wp--preset--color--off-black, #2A2A2A);
    line-height: 1.7;
}
.sp-tip__content p { margin: 0 0 .5rem; }
.sp-tip__content p:last-child { margin-bottom: 0; }
.sp-tip__content a {
    color: var(--wp--preset--color--primary, #B00000);
    text-decoration: underline;
}

/* ── List Box ─────────────────────────────────────────────── */
.sp-list {
    background: rgb(var(--nifty-secondary-rgb) / .05);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgb(var(--nifty-secondary-rgb) / .1);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 4px 20px rgb(var(--nifty-secondary-rgb) / .06);
    border-radius: 8px;
    margin: 1.75rem 0;
    overflow: hidden;
}

.sp-list__header {
    padding: .75rem 1.25rem;
    border-bottom: 2px solid var(--wp--preset--color--primary, #B00000);
    background: rgba(255,255,255,.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sp-list__title {
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--wp--preset--color--secondary, #0B2169);
    margin: 0;
}

.sp-list__items {
    list-style: none;
    margin: 0;
    padding: .625rem 0;
}

.sp-list__item {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .4rem 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--wp--preset--color--off-black, #2A2A2A);
    line-height: 1.5;
}

.sp-list__item svg { flex-shrink: 0; margin-top: .15em; }

.sp-list__item--check svg { color: var(--wp--preset--color--primary, #B00000); }
.sp-list__item--x     svg { color: #6b7280; }

/* ── Inline CTA block ─────────────────────────────────────── */
.sp-inline-cta {
    background: var(--wp--preset--color--secondary, #0B2169);
    border-radius: 10px;
    padding: 2rem 2.25rem;
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sp-inline-cta__heading {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 800;
    color: #fff;
    margin: 0;
    letter-spacing: -.01em;
}

.sp-inline-cta__body {
    font-size: 1rem;
    color: rgba(255,255,255,.8);
    line-height: 1.65;
}
.sp-inline-cta__body p { margin: 0 0 .5rem; }
.sp-inline-cta__body p:last-child { margin-bottom: 0; }
.sp-inline-cta__body a { color: rgba(255,255,255,.9); text-decoration: underline; }

.sp-inline-cta__btn {
    align-self: flex-start;
    display: inline-block;
    padding: .75rem 1.75rem;
    border-radius: 5px;
    font-size: .875rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: filter .2s;
    white-space: nowrap;
}
.sp-inline-cta__btn:hover { filter: brightness(.88); }

/* ── Sidebar ──────────────────────────────────────────────── */
.single-sidebar {
    position: sticky;
    top: calc( var(--site-header-height, 70px) + 1.5rem );
    align-self: start; /* critical: prevents grid stretch from blocking sticky */
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Shared widget wrapper */
.sp-widget {
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 10px;
    padding: 1.25rem;
}

.sp-widget__title {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--wp--preset--color--secondary, #0B2169);
    margin: 0 0 1rem;
    padding-bottom: .625rem;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

/* ── TOC widget ───────────────────────────────────────────── */
.sp-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: none;
}

.sp-toc__item { margin-bottom: .125rem; }

.sp-toc__link {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: .375rem .5rem;
    border-radius: 5px;
    text-decoration: none;
    transition: background .15s, color .15s;
    color: var(--wp--preset--color--off-black, #2A2A2A);
    font-size: .8125rem;
    line-height: 1.4;
}
.sp-toc__link:hover {
    background: var(--wp--preset--color--off-white, #F1F1F1);
    color: var(--wp--preset--color--secondary, #0B2169);
}
.sp-toc__link.is-active {
    background: var(--wp--preset--color--primary, #B00000);
    color: #fff;
}

.sp-toc__num {
    flex-shrink: 0;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .06em;
    opacity: .5;
    min-width: 20px;
}
.sp-toc__link.is-active .sp-toc__num { opacity: .8; }

.sp-toc__text { flex: 1; }

/* ── CTA card — background set via inline style from Website Settings ─ */
.sp-sidebar-cta {
    display: flex;
    flex-direction: column;
    gap: .875rem;
    align-items: center;
    text-align: center;
}

.sp-sidebar-cta__blurb {
    font-size: .875rem;
    color: rgba(255,255,255,.8);
    line-height: 1.6;
    margin: 0;
    text-align: center;
}

.sp-sidebar-cta__btn {
    display: block;
    text-align: center;
    padding: .75rem 1rem;
    border-radius: 5px;
    font-size: .8125rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-decoration: none;
    transition: filter .2s;
}
.sp-sidebar-cta__btn:hover { filter: brightness(.88); }

.sp-sidebar-cta__phone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    font-size: .875rem;
    font-weight: 700;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    transition: color .15s;
}
.sp-sidebar-cta__phone:hover { color: #fff; }

/* ── Related posts ────────────────────────────────────────── */
.sp-related__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.sp-related__link {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    transition: opacity .15s;
}
.sp-related__link:hover { opacity: .8; }

.sp-related__thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-color: var(--wp--preset--color--secondary, #0B2169);
}

.sp-related__title {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--wp--preset--color--secondary, #0B2169);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Browse topics ────────────────────────────────────────── */
.sp-cats__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.sp-cats__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .4rem .5rem;
    border-radius: 5px;
    font-size: .8125rem;
    color: var(--wp--preset--color--off-black, #2A2A2A);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.sp-cats__link:hover {
    background: var(--wp--preset--color--off-white, #F1F1F1);
    color: var(--wp--preset--color--secondary, #0B2169);
}
.sp-cats__link.is-active {
    color: var(--wp--preset--color--primary, #B00000);
    font-weight: 700;
}

.sp-cats__count {
    font-size: .7rem;
    color: #9ca3af;
    font-weight: 400;
}

/* ── WPSEOPress FAQ (Legacy) block — single posts only ───── */

.single-post .wpseopress-faqs {
    display: flex;
    flex-direction: column;
    gap: .625rem;
    margin: 1.75rem 0;
}

.single-post .wpseopress-faq {
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid var(--wp--preset--color--secondary, #0B2169);
}

/* ── Question button ──────────────────────────────────────── */

.single-post .wpseopress-accordion-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.125rem 1.375rem;
    background: var(--wp--preset--color--secondary, #0B2169);
    color: #fff;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background .2s, color .2s;
}

/* Open state — site theme background and text */
.single-post .wpseopress-accordion-button[aria-expanded="true"] {
    background: var(--nifty-page-bg, #fff);
    color: var(--nifty-page-text, #2A2A2A);
    border-bottom: 1px solid rgba(0,0,0,.08);
}

/* Chevron — uses currentColor so it matches closed (white) and open (dark) */
.single-post .wpseopress-accordion-button::after {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-right: 2.5px solid currentColor;
    border-bottom: 2.5px solid currentColor;
    transform: rotate(45deg);
    flex-shrink: 0;
    transition: transform .3s ease;
    margin-top: -3px;
}
.single-post .wpseopress-accordion-button[aria-expanded="true"]::after {
    transform: rotate(225deg);
    margin-top: 3px;
}

/* h3 question heading */
.single-post .wpseopress-faq-question {
    margin: 0;
    color: #fff;
    line-height: 1.25;
    letter-spacing: -.01em;
    /* font-size: global h3 scale — clamp(1.375rem, 2.5vw, 1.875rem) */
}
.single-post .wpseopress-accordion-button[aria-expanded="true"] .wpseopress-faq-question {
    color: var(--nifty-page-text, #2A2A2A);
}

/* ── Answer panel ─────────────────────────────────────────── */

.single-post .wpseopress-faq-answer {
    background: var(--nifty-page-bg, #fff);
    color: var(--nifty-page-text, #2A2A2A);
    padding: 1rem 1.375rem 1.25rem;
}

.single-post .wpseopress-faq-answer-desc {
    font-size: 1rem;
    line-height: 1.75;
    margin: 0;
}

.single-post .wpseopress-faq-answer a {
    color: var(--wp--preset--color--primary, #B00000);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.single-post .wpseopress-faq-answer strong { font-weight: 700; }
.single-post .wpseopress-faq-answer ul,
.single-post .wpseopress-faq-answer ol {
    margin: 0 0 .75rem;
    padding-left: 1.375rem;
}
.single-post .wpseopress-faq-answer li { margin-bottom: .375rem; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .single-layout {
        grid-template-columns: 1fr 280px;
        gap: 2.5rem;
    }
}

@media (max-width: 768px) {

    /* Stack to single column */
    .single-layout {
        grid-template-columns: 1fr;
        padding: 2.5rem 0 4rem;
    }

    /* Hide desktop sidebar */
    .single-sidebar {
        display: none;
    }

    /* Show mobile sticky contents bar */
    .sp-contents-bar {
        display: block;
        position: sticky;
        top: var(--site-header-height, 70px);
        z-index: 90;
        background: #fff;
        border-bottom: 1px solid rgba(0,0,0,.08);
        box-shadow: 0 2px 8px rgba(0,0,0,.05);
    }

    .sp-contents-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: .875rem 0;
        background: none;
        border: none;
        cursor: pointer;
        font-family: inherit;
        font-size: .8125rem;
        font-weight: 700;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--wp--preset--color--secondary, #0B2169);
    }

    .sp-contents-chevron {
        transition: transform .3s ease;
        flex-shrink: 0;
    }
    .sp-contents-toggle[aria-expanded="true"] .sp-contents-chevron {
        transform: rotate(180deg);
    }

    .sp-contents-panel {
        padding: .75rem 0 1rem;
        border-top: 1px solid rgba(0,0,0,.06);
    }

    .sp-contents-panel .sp-toc__list {
        display: flex;
        flex-direction: column;
        gap: .125rem;
    }

    /* Adjust hero on mobile */
    .sp-hero {
        padding: 3rem 0 2.5rem;
        min-height: 220px;
    }

    .sp-hero__title {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
    }
}

@media (max-width: 480px) {
    .sp-hero__title { font-size: 1.875rem; }
    .sp-divider { margin: 2rem 0 1.5rem; }
}
