/* Shared component roles. Heroes, image banners and editorial artwork keep their scale. */
:root, .editor-styles-wrapper {
    --bb-card-title-size: 1.5rem;
    --bb-card-title-leading: 1.333333;
    --bb-content-gap: var(--wp--preset--spacing--48);
}

/* A common rhythm for content sections, independent of their background. */
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-capabilities, .bb-intelligence, .bb-news,
.bb-about-story, .bb-about-buddy, .bb-about-approach, .bb-about-connected, .bb-about-promise,
.bb-about-cta, .bb-work-showcase, .bb-work-principle, .bb-work-cta,
.bb-services-catalog, .bb-contact-section, .bb-contact-next, .bb-insight-feed) {
    padding-block: var(--bb-section-space);
}
:is(.wp-site-blocks, .editor-styles-wrapper) .bb-growth__inner { padding-block: var(--bb-section-space); }
.bb-services-service { padding-block: var(--bb-section-space); }
.bb-services-service:last-child { padding-block-end: 0; }

/* Grid gap, rather than WordPress flow margins, separates siblings. */
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-about-story__body,
.bb-about-story__heading, .bb-about-approach__heading, .bb-about-promise__heading,
.bb-about-story__principles, .bb-about-approach__steps, .bb-work-principle__grid,
.bb-news__grid, .bb-insight-grid, .bb-contact-steps) > * { margin-block: 0; min-width: 0; }
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-about-story__principles,
.bb-about-approach__steps, .bb-work-principle__grid, .bb-news__grid, .bb-contact-steps) {
    gap: var(--bb-grid-gap);
}
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-news__grid, .bb-intelligence__carousel,
.bb-about-story__principles, .bb-about-approach__steps, .bb-work-principle__grid) {
    margin-block-start: var(--bb-content-gap);
}

/* Section heading metrics match the homepage reference, including weight and tracking. */
:is(.wp-site-blocks, .editor-styles-wrapper) h2:not(:where([class*="hero"], [class*="banner"], .wp-block-cover, [class*="card"], .bb-work-project)):not(:where([class*="hero"], [class*="banner"], .wp-block-cover, [class*="card"], .bb-work-project) *) {
    font-weight: 400;
    letter-spacing: -.025em;
}
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-about-label, .bb-work-label,
.bb-section-eyebrow, .bb-contact-section__label) + h2 { margin-block-start: 0 !important; }
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-about-cta__inner, .bb-work-cta__inner) > h2:first-child {
    margin-block: 0;
}

/* Card titles share one scale; compact accordion labels retain their body-sized role. */
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-platform-card h3, .bb-insight-card h3,
.bb-work-project__meta h2, .bb-about-principle h3, .bb-about-step h3,
.bb-work-principle__grid h3, .bb-contact-step h3) {
    font-size: var(--bb-card-title-size);
    line-height: var(--bb-card-title-leading);
    font-weight: 500;
    letter-spacing: -.025em;
}

/* Body copy is 16/24; metadata and form help retain the smaller 14/22 role. */
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-capabilities__description,
.bb-intelligence__summary p, .bb-growth__statement, .bb-platform-card p,
.bb-insight-card .wp-block-post-excerpt, .bb-insight-card .wp-block-post-excerpt__excerpt,
.bb-work-project__summary p, .bb-services-service__intro, .bb-services-item__body,
.bb-about-principle h3 + p, .bb-about-step h3 + p, .bb-work-principle__grid h3 + p,
.bb-contact-step p, .bb-about-cta__inner > p, .bb-work-cta__inner > p,
.bb-contact-section__aside > .is-style-body-large) {
    font-size: var(--wp--preset--font-size--body);
    line-height: 1.5;
}
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-capabilities__description,
.bb-intelligence__summary p, .bb-insight-card .wp-block-post-excerpt,
.bb-work-project__summary p, .bb-services-service__intro, .bb-services-item__body,
.bb-about-approach__heading > p:last-child) { color: var(--wp--preset--color--body); }
:is(.wp-site-blocks, .editor-styles-wrapper) .bb-about-editorial {
    font-size: var(--wp--preset--font-size--body);
    line-height: 1.5;
}
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-about-principle, .bb-about-step,
.bb-work-principle__grid article, .bb-contact-step) h3 + p { margin-block-start: var(--wp--preset--spacing--16); }
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-about-cta__inner, .bb-work-cta__inner) > p {
    max-width: 640px;
    margin: var(--wp--preset--spacing--24) auto 0;
}
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-about-cta__inner, .bb-work-cta__inner) .wp-block-buttons {
    margin-block-start: var(--wp--preset--spacing--32);
}
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-about-principle > p:first-child,
.bb-about-step > p:first-child, .bb-contact-step > span, .bb-services-service__number,
.bb-work-project__index, .bb-work-principle__grid article > span) {
    font-size: 16px;
    line-height: 1.5;
}

/* Text colors follow the surface, including light form panels within dark sections. */
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.is-style-brand-dark, .bb-about-promise) :is(.bb-section-eyebrow,
.bb-growth__eyebrow, .bb-about-label, .bb-work-label, .bb-contact-section__label) {
    color: var(--wp--preset--color--accent);
}
:is(.wp-site-blocks, .editor-styles-wrapper) .bb-contact-section__title em { color: var(--wp--preset--color--accent); }
:is(.wp-site-blocks, .editor-styles-wrapper) :is(.bb-about-buddy__content .bb-about-editorial,
.bb-work-principle__grid p, .bb-contact-section__aside > .is-style-body-large, .bb-contact-option p) {
    color: var(--wp--custom--color--black--200);
}
:is(.wp-site-blocks, .editor-styles-wrapper) .bb-contact-form-wrap {
    --bb-heading: var(--wp--preset--color--ink);
    --bb-copy: var(--wp--preset--color--body);
    --bb-link: var(--wp--preset--color--accent-text);
}
:is(.wp-site-blocks, .editor-styles-wrapper) .bb-about-buddy__list li { border-color: rgba(255,255,255,.07); }
.bb-contact-field :is(input, select, textarea) { border-color: var(--wp--preset--color--border); }

@media (max-width: 767px) {
    :root, .editor-styles-wrapper {
        --bb-card-title-size: 1.25rem;
        --bb-card-title-leading: 1.4;
        --bb-content-gap: var(--wp--preset--spacing--32);
    }
}

/* Override the legacy featured-card selector using the same shared card scale. */
:is(.wp-site-blocks, .editor-styles-wrapper) .bb-work-projects .bb-work-project .bb-work-project__meta h2 {
    font-size: var(--bb-card-title-size);
    line-height: var(--bb-card-title-leading);
}

/* Serif heading accents use bold italic across the site and Site Editor. */
:is(.wp-site-blocks, .editor-styles-wrapper) :is(h1, h2, h3, h4, h5, h6) em,
:is(.wp-site-blocks, .editor-styles-wrapper) .wp-block-heading.is-style-accent-display {
    font-family: var(--wp--preset--font-family--cormorant-garamond);
    font-weight: 700;
    font-style: italic;
}
