/*
 * Long-form articles (inc/news-longform.php), Marcom 2026 design.
 * Layout and heading numbers are scoped to .is-longform; the block styles (.is-style-bbu-*) are opt-in and
 * also load in the editor so writers see the real result.
 */
:root {
    --bbu-lf-navy: #071127;
    --bbu-lf-ink: #08162d;
    --bbu-lf-muted: #68768a;
    --bbu-lf-mist: #f2f6fa;
    --bbu-lf-line: #dce5ee;
    --bbu-lf-link: #2b7f74;
    --bbu-lf-green: #43b263;
    --bbu-lf-teal: #3ba295;
    --bbu-lf-gradient: linear-gradient(90deg, #43b263, #3ba295 28%, #3b7ab5 56%, #7147a7 80%, #814272);
    --bbu-lf-gradient-v: linear-gradient(180deg, #43b263, #3ba295 28%, #3b7ab5 56%, #7147a7 80%, #814272);
    --bbu-lf-soft: linear-gradient(110deg, #d9f5e7 0%, #dce9f8 100%);
}

/* Inner wrapper of Group blocks on the page (classic theme) and in the editor. */
.bbu-lf-inner,
[class*="is-style-bbu-"] > .wp-block-group__inner-container {
    display: contents;
}

/* ---------- Article header and cover ---------- */
.is-longform .community-detail-header {
    padding: 64px 0 40px;
}

.is-longform .community-detail-header .community-detail-narrow {
    max-width: 1140px;
}

.bambu-page .is-longform .community-detail-header h1 {
    margin: 0 0 22px;
    font-size: clamp(32px, 4.3vw, 58px);
    font-weight: 700;
    line-height: 1.14;
    letter-spacing: -0.025em;
}

.is-longform .community-detail-meta {
    margin-bottom: 20px;
    color: #e3e9f2;
    font-size: 17px;
    font-weight: 500;
}

.is-longform .community-detail-topics {
    gap: 10px;
    margin: 0;
}

.is-longform .community-detail-topics a {
    padding: 7px 14px;
    border-color: rgba(255, 255, 255, 0.32);
    color: #fff;
    font-size: 14.5px;
    font-weight: 500;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.is-longform .community-detail-topics a:hover {
    border-color: var(--bbu-lf-green);
    color: #9be0b2;
}

.is-longform .community-detail-cover {
    max-width: 1140px;
    margin: 50px auto 40px;
    padding-top: 0;
}

.is-longform .community-detail-cover img {
    aspect-ratio: 16 / 9;
    max-height: none;
    border-radius: 18px;
    background: var(--bbu-lf-soft);
}

.is-longform .community-detail-cover figcaption {
    margin-top: 10px;
    color: var(--bbu-lf-muted);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

/* ---------- Body ---------- */
.is-longform .community-detail-narrow.community-prose {
    max-width: 800px;
    padding: 0 20px 72px;
    color: var(--bbu-lf-ink);
    font-size: 17px;
    counter-reset: bbu-h2 bbu-q;
}

.bambu-page .is-longform .community-prose p,
.bambu-page .is-longform .community-prose li {
    line-height: 1.72;
}

.is-longform .community-prose > p {
    margin: 0 0 18px;
}

.is-longform .community-prose a {
    color: var(--bbu-lf-link);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.is-longform .community-prose a:hover {
    color: var(--bbu-lf-ink);
}

/* reset.min.css flattens bold text; articles need it back. */
.is-longform .community-prose strong,
.is-longform .community-prose b {
    font-weight: 700;
}

/* Section headings: gradient bar above, numbers 1. / 1.1. */
.is-longform .community-prose > h2 {
    margin: 52px 0 18px;
    padding-top: 20px;
    background: var(--bbu-lf-gradient) top left / 44px 4px no-repeat;
    color: var(--bbu-lf-ink);
    font-size: clamp(25px, 3.2vw, 31px);
    font-weight: 600;
    line-height: 1.24;
    letter-spacing: -0.03em;
    counter-increment: bbu-h2;
    counter-reset: bbu-h3 bbu-q;
    scroll-margin-top: 110px;
}

.is-longform .community-prose > h2::before {
    content: counter(bbu-h2) ". ";
    color: var(--bbu-lf-link);
    font-variant-numeric: tabular-nums;
}

.is-longform .community-prose > h3:not(.is-style-bbu-question) {
    margin: 34px 0 12px;
    color: var(--bbu-lf-ink);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.32;
    letter-spacing: -0.02em;
    counter-increment: bbu-h3;
    scroll-margin-top: 110px;
}

.is-longform .community-prose > h3:not(.is-style-bbu-question)::before {
    content: counter(bbu-h2) "." counter(bbu-h3) ". ";
    color: var(--bbu-lf-link);
    font-variant-numeric: tabular-nums;
}

.is-longform .community-prose .wp-block-image {
    margin: 26px 0 28px;
}

.is-longform .community-prose .wp-block-image img {
    width: 100%;
    border: 1px solid var(--bbu-lf-line);
    border-radius: 12px;
}

.is-longform .community-prose .wp-block-image figcaption {
    margin-top: 10px;
    color: var(--bbu-lf-muted);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

/* ---------- Hook (opening paragraph) ---------- */
p.is-style-bbu-hook {
    position: relative;
    margin: 0 0 28px;
    padding: 56px 26px 24px 34px;
    border: 1px solid var(--bbu-lf-line);
    border-radius: 4px 14px 14px 4px;
    background: var(--bbu-lf-mist) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233BA295'%3E%3Cpath d='M9.6 5C6.1 6.3 4 9.2 4 13v6h6.5v-6.5H7.3c.2-2.3 1.4-4 3.4-5L9.6 5zm10 0c-3.5 1.3-5.6 4.2-5.6 8v6h6.5v-6.5h-3.2c.2-2.3 1.4-4 3.4-5L19.6 5z'/%3E%3C/svg%3E") 34px 22px / 26px no-repeat;
    color: var(--bbu-lf-ink);
    font-size: 19px;
    font-weight: 500;
    line-height: 1.6 !important;
}

p.is-style-bbu-hook::before {
    content: "";
    position: absolute;
    top: -1px;
    bottom: -1px;
    left: -1px;
    width: 5px;
    border-radius: 4px 0 0 4px;
    background: var(--bbu-lf-gradient-v);
}

/* ---------- Table of contents ---------- */
.bbu-toc {
    margin: 0 0 24px;
    padding: 18px 22px;
    border: 1px solid var(--bbu-lf-line);
    border-radius: 14px;
    background: #fff;
}

.bbu-toc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bbu-toc-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
    color: var(--bbu-lf-ink);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.bbu-toc-title svg {
    width: 18px;
    height: 18px;
    color: var(--bbu-lf-teal);
}

.bbu-toc-note {
    margin: 8px 0 0 !important;
    color: var(--bbu-lf-muted);
    font-size: 14px;
}

.bbu-toc-toggle {
    flex: none;
    padding: 8px 12px;
    border: 1px solid var(--bbu-lf-line);
    border-radius: 999px;
    background: transparent;
    color: var(--bbu-lf-ink);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.bbu-toc-toggle:hover {
    border-color: var(--bbu-lf-muted);
}

.bbu-toc-list,
.bbu-toc-list ol {
    margin: 0;
    padding: 0 !important;
    list-style: none !important;
}

.bbu-toc-list {
    margin-top: 14px;
    padding-top: 10px !important;
    border-top: 1px solid var(--bbu-lf-line);
}

.bbu-toc-list ol {
    margin-bottom: 6px;
    padding-left: 34px !important;
}

.bbu-toc-list li {
    margin: 0;
}

.community-prose .bbu-toc a {
    display: flex;
    gap: 8px;
    padding: 5px 0;
    color: var(--bbu-lf-ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    text-decoration: none;
}

.bbu-toc-num {
    flex: none;
    min-width: 22px;
    color: var(--bbu-lf-link);
    font-variant-numeric: tabular-nums;
}

.community-prose .bbu-toc ol ol a {
    color: var(--bbu-lf-muted);
    font-size: 14.5px;
    font-weight: 500;
}

.bbu-toc ol ol .bbu-toc-num {
    min-width: 30px;
    color: var(--bbu-lf-muted);
}

.community-prose .bbu-toc a:hover,
.community-prose .bbu-toc a.is-active,
.bbu-toc a:hover .bbu-toc-num,
.bbu-toc a.is-active .bbu-toc-num {
    color: var(--bbu-lf-link);
}

.bbu-toc.is-collapsed .bbu-toc-list {
    display: none;
}

/* ---------- Downloads ---------- */
.wp-block-group.is-style-bbu-downloads {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin: 0 0 52px;
}

.is-style-bbu-downloads p {
    position: relative;
    display: grid;
    align-content: center;
    min-height: 68px;
    margin: 0 !important;
    padding: 14px 16px 14px 70px;
    border: 1px solid var(--bbu-lf-line);
    border-radius: 12px;
    background: #fff;
    line-height: 1.4 !important;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.is-style-bbu-downloads p::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 16px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E8B47' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10l5 5 5-5M5 20h14'/%3E%3C/svg%3E") center / 20px no-repeat, var(--bbu-lf-soft);
    transform: translateY(-50%);
}

.is-style-bbu-downloads p:hover {
    border-color: var(--bbu-lf-teal);
    background: var(--bbu-lf-mist);
}

.is-style-bbu-downloads strong {
    color: var(--bbu-lf-muted);
    font-size: 12px;
    font-weight: 600;
}

.community-prose .is-style-bbu-downloads a,
.is-style-bbu-downloads a {
    color: var(--bbu-lf-ink);
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none;
}

/* The whole card is the link. */
.is-style-bbu-downloads a::after {
    content: "";
    position: absolute;
    inset: 0;
}

/* ---------- Read more ---------- */
.wp-block-group.is-style-bbu-read-more {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin: 22px 0;
    padding: 12px 16px;
    border-left: 3px solid var(--bbu-lf-teal);
    border-radius: 0 10px 10px 0;
    background: var(--bbu-lf-mist);
    font-size: 15px;
}

.wp-block-group.is-style-bbu-read-more::before {
    content: var(--bbu-read-more-label, "Read more");
    flex: none;
    color: var(--bbu-lf-muted);
    font-size: 13px;
    font-weight: 700;
}

.is-style-bbu-read-more ul {
    display: grid;
    flex: 1 1 260px;
    gap: 4px;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.bambu-page .is-style-bbu-read-more li {
    margin: 0;
    line-height: 1.5;
}

.is-style-bbu-read-more a {
    font-weight: 600;
}

/* ---------- Question ---------- */
.wp-block-heading.is-style-bbu-question {
    margin: 30px 0 10px;
    color: var(--bbu-lf-ink);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.015em;
    counter-increment: bbu-q;
}

.wp-block-heading.is-style-bbu-question::before {
    content: var(--bbu-question-label, "Question ") counter(bbu-q);
    display: table;
    margin-bottom: 8px;
    padding: 4px 10px;
    border: 1px solid var(--bbu-lf-line);
    border-radius: 999px;
    background: var(--bbu-lf-mist);
    color: var(--bbu-lf-link);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0;
}

/* ---------- Sources (core Footnotes) ---------- */
.is-longform sup.fn a {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    margin: 0 1px;
    padding: 0 5px;
    border: 1px solid var(--bbu-lf-line);
    border-radius: 6px;
    background: var(--bbu-lf-mist);
    color: var(--bbu-lf-link);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    vertical-align: 2px;
}

.is-longform sup.fn a:hover {
    border-color: var(--bbu-lf-teal);
    background: var(--bbu-lf-teal);
    color: #fff;
}

.is-longform .wp-block-footnotes {
    margin: 0 0 40px;
    padding: 20px 22px 20px 44px !important;
    border: 1px solid var(--bbu-lf-line);
    border-radius: 14px;
    color: var(--bbu-lf-muted);
    font-size: 14px;
}

.is-longform .wp-block-footnotes::before {
    content: var(--bbu-sources-label, "Sources");
    display: block;
    margin: 0 0 8px -22px;
    color: var(--bbu-lf-ink);
    font-size: 15px;
    font-weight: 700;
}

.bambu-page .is-longform .wp-block-footnotes li {
    margin: 4px 0;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

/* ---------- Summary ---------- */
.wp-block-group.is-style-bbu-summary {
    margin: 8px 0 44px;
    padding: 26px 28px;
    border: 1.5px solid var(--bbu-lf-green);
    border-radius: 16px;
    background: var(--bbu-lf-soft);
}

.is-style-bbu-summary > p:first-child,
.is-style-bbu-summary > .wp-block-group__inner-container > p:first-child {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

.is-style-bbu-summary ul {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.is-style-bbu-summary li {
    position: relative;
    margin: 10px 0;
    padding-left: 32px;
}

.is-style-bbu-summary li::before {
    content: "";
    position: absolute;
    top: calc((1.72em - 20px) / 2);
    left: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bbu-lf-green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.6 6.3l2.2 2.2 4.6-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}

/* ---------- Program (call to action) ---------- */
.wp-block-group.is-style-bbu-program {
    overflow: hidden;
    margin: 0 0 16px;
    padding: 0 0 32px;
    border-top: 5px solid transparent;
    border-radius: 18px;
    background: linear-gradient(var(--bbu-lf-navy), var(--bbu-lf-navy)) padding-box, var(--bbu-lf-gradient) border-box;
    color: #fff;
}

.is-style-bbu-program .wp-block-image {
    margin: 0 0 30px !important;
}

.is-style-bbu-program .wp-block-image img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 7;
    border: 0 !important;
    border-radius: 0 !important;
    object-fit: cover;
}

.is-style-bbu-program h2,
.is-style-bbu-program h3,
.is-style-bbu-program > p,
.is-style-bbu-program > .wp-block-group__inner-container > p,
.is-style-bbu-program .wp-block-group.is-style-bbu-register {
    margin-right: 32px !important;
    margin-left: 32px !important;
}

.bambu-page .is-longform .is-style-bbu-program h2,
.is-style-bbu-program h2,
.is-style-bbu-program h3 {
    margin-top: 0;
    margin-bottom: 12px;
    padding: 0;
    background: none;
    color: #fff;
    font-size: clamp(23px, 3vw, 28px);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.03em;
}

.is-longform .community-prose .is-style-bbu-program h2::before {
    content: none;
}

.is-style-bbu-program > p,
.is-style-bbu-program > .wp-block-group__inner-container > p {
    margin-bottom: 24px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    line-height: 1.65 !important;
}

.wp-block-group.is-style-bbu-register {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 24px;
    padding: 20px 22px;
    border-radius: 14px;
    background: #fff;
    color: var(--bbu-lf-ink);
}

/* Offer tag on top, note under it, button on the right across both rows. */
.is-style-bbu-register p {
    grid-column: 1;
    margin: 0 !important;
    color: var(--bbu-lf-muted);
    font-size: 14.5px;
    line-height: 1.55 !important;
}

.is-style-bbu-register p strong {
    color: var(--bbu-lf-ink);
}

p.is-style-bbu-offer {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 6px;
    margin: 0 !important;
    padding: 6px 12px;
    border-radius: 999px;
    background: #e4f5ea;
    color: #1f6b37 !important;
    font-size: 13px !important;
    font-weight: 700;
    line-height: 1.3 !important;
}

p.is-style-bbu-offer::before {
    content: "";
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231F6B37' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12l-8 8-8-8V4h8l8 8z'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.3' fill='%231F6B37'/%3E%3C/svg%3E") center / contain no-repeat;
}

.is-style-bbu-register .wp-block-buttons {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0 !important;
}

.is-style-bbu-register .wp-block-button__link,
.community-prose .is-style-bbu-register .wp-block-button__link {
    display: inline-flex;
    align-items: center;
    height: 50px;
    padding: 0 28px;
    border-radius: 999px;
    background: var(--bbu-lf-ink);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.is-style-bbu-register .wp-block-button__link:hover {
    background: #142744;
    color: #fff;
}

.is-style-bbu-register .wp-block-button__link::after {
    content: "↗";
    margin-left: 8px;
}

/* ---------- Follow BambuUP (end-of-article box) ---------- */
.is-longform .bbu-article-cta {
    margin-top: 16px;
}

.is-longform .bbu-article-follow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 18px 22px;
    border: 1px solid var(--bbu-lf-line);
    border-radius: 14px;
}

.is-longform .bbu-article-follow span {
    margin-right: auto;
    color: var(--bbu-lf-ink);
    font-size: 15px;
    font-weight: 700;
}

.is-longform .community-prose .bbu-article-follow a {
    padding: 9px 16px;
    border: 1px solid var(--bbu-lf-line);
    border-radius: 999px;
    color: var(--bbu-lf-ink);
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.is-longform .community-prose .bbu-article-follow a:hover {
    border-color: var(--bbu-lf-teal);
    color: var(--bbu-lf-link);
}

@media (max-width: 560px) {
    .is-longform .community-detail-header {
        padding: 36px 0 30px;
    }

    .is-longform .community-detail-cover {
        margin: 28px auto;
    }

    .is-longform .community-detail-meta {
        font-size: 15px;
    }

    .is-longform .community-detail-narrow.community-prose {
        font-size: 16px;
    }

    p.is-style-bbu-hook {
        padding: 52px 18px 20px 26px;
        background-position: 26px 20px;
        font-size: 17.5px;
    }

    .wp-block-group.is-style-bbu-summary {
        padding: 22px 20px;
    }

    .is-style-bbu-program h2,
    .is-style-bbu-program h3,
    .is-style-bbu-program > p,
    .is-style-bbu-program > .wp-block-group__inner-container > p,
    .is-style-bbu-program .wp-block-group.is-style-bbu-register {
        margin-right: 20px !important;
        margin-left: 20px !important;
    }

    .wp-block-group.is-style-bbu-register {
        grid-template-columns: minmax(0, 1fr);
        padding: 18px 16px;
    }

    .is-style-bbu-register .wp-block-buttons {
        grid-column: 1;
        grid-row: auto;
    }

    .is-style-bbu-register .wp-block-buttons,
    .is-style-bbu-register .wp-block-button,
    .is-style-bbu-register .wp-block-button__link {
        width: 100%;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: no-preference) {
    html:has(.is-longform) {
        scroll-behavior: smooth;
    }
}
