/* Public mortgage editorial and rate tools. */
.rb-mg-editorial, .rb-ed-term-nav {
    --rb-ed-gutter: clamp(.8rem, 1.6vw, 2rem);
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin-inline: 0;
    padding-inline: var(--rb-ed-gutter);
}
.rb-mg-editorial {
    container: rbEditorial / inline-size;
    --rb-editorial-rule: #6f9181;
    color: #18382e;
    background: #f1f7f4;
    border-block: 1px solid #cbdfd5;
    padding-block: clamp(.85rem, 1.4vw, 1.35rem);
    text-align: start;
}
.rb-mg-editorial__header {
    display: flex;
    gap: .6rem;
    align-items: center;
    margin-bottom: .65rem;
}
.rb-mg-editorial__header img { flex: 0 0 auto; width: 30px; height: 30px; object-fit: contain; }
.rb-mg-editorial__header .rb-mg-editorial__byline {
    color: #2f5947; font-size: .77rem; font-weight: 700; line-height: 1.25; margin: 0 0 .18rem;
}
.rb-mg-editorial h2 { margin: 0; color: #123b30; font-size: clamp(1.16rem, 1.7vw, 1.65rem); font-weight: 700; line-height: 1.22; }
.rb-mg-editorial__copy {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .65rem;
    max-width: 47rem;
}
.rb-mg-editorial__copy > p {
    box-sizing: border-box;
    min-width: 0;
    margin: 0;
    color: #243f37;
    font-size: 1rem;
    line-height: 1.55;
}
.rb-mg-editorial__copy > p + p {
    padding-block-start: .65rem;
    border-block-start: 1px solid var(--rb-editorial-rule);
}
.rb-mg-editorial__links { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin-top: .62rem; font-size: .83rem; color: #365448; }
.rb-mg-editorial__links a { color: #07553f; font-weight: 600; text-decoration: underline; text-underline-offset: .14em; }
.rb-mg-editorial__links a:hover { color: #063a2c; }
.rb-mg-editorial a:focus-visible, .rb-ed-term-nav a:focus-visible { outline: 3px solid #173f73; outline-offset: 3px; }
/* Side-by-side paragraphs need enough space in the editorial itself, including on pages with a sidebar. */
@container rbEditorial (min-width: 60rem) {
    .rb-mg-editorial__copy {
        --rb-column-inset: clamp(1.25rem, 2cqi, 2rem);
        max-width: 92rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 0;
    }
    .rb-mg-editorial__copy > p:first-child { padding-inline-end: var(--rb-column-inset); }
    .rb-mg-editorial__copy > p + p {
        padding-block-start: 0;
        padding-inline-start: var(--rb-column-inset);
        border-block-start: 0;
        border-inline-start: 1px solid var(--rb-editorial-rule);
    }
}

body :is(.container-xl,.container):has(> .rb-mg-editorial),
body .mortgage-comparison-page:has(> .rb-mg-editorial),
body .mortgage-comparison-page > .container-xl:has(.rb-ed-filter-intro) {
    width: 100%; max-width: none; margin-inline: 0; padding-inline: 0;
}
/* Measure the available viewport, including the space reserved for a scrollbar.
   The alternate ad-sidebar layout continues to size the editorial to its column. */
:root:has(body > main.main-content .rb-mg-editorial) {
    container-type: inline-size;
}

/* These page wrappers clip their children. Extend the clipping boundary while
   retaining the original content width for the filters, rate tables and cards. */
body > main.main-content > :is(.mortgage-comparison-page, .rb-provider-page, .rb-province-rate-page, .rb-city-rate-page):has(.rb-mg-editorial) {
    box-sizing: border-box;
    width: 100cqi;
    max-width: none;
    margin-inline: calc(50% - 50cqi);
    /* Bootstrap's px-0 utility also uses !important. */
    padding-inline: max(0px, calc(50cqi - 50%)) !important;
    background-clip: content-box;
}

/* The listing header can also place the editorial inside a regional container. */
body > main.main-content > .rb-mg-editorial,
body > main.main-content > :is(.container, .container-xl, .container-fluid, .rb-provider-page) > .rb-mg-editorial,
body > main.main-content > :is(.rb-province-rate-page, .rb-city-rate-page) > section > .container-xl > .rb-mg-editorial {
    width: 100cqi;
    margin-inline: calc(50% - 50cqi);
}
@container rbEditorial (min-width: 60rem) {
    main.main-content .rb-mg-editorial__copy { max-width: none; }
}

.rb-ed-term-nav .term-selector-group { margin-block: 0; }

/* Keep the card gutter on the list. The controls get their own full-width band. */
body .rb-rates-surface > .rb-rates-inner { padding-inline: 0; }
.rb-rates-inner > :is(#ratesListBody,#rb-card-empty,#pagination-controls,.rb-rates-notes) {
    margin-inline: var(--rb-rates-gutter, 1rem);
}
body :is(.container-xl,.container):has(> .rb-rates-surface),
body .rb-mortgage-rates-layout:has(.rb-rates-surface) > .container-xl {
    padding-inline: 0; max-width: none; width: 100%;
}
body .container-fluid:has(> .row > .col-12 > .rb-rates-surface) { padding-inline: 0 !important; }
.container-fluid:has(> .row > .col-12 > .rb-rates-surface) > .row { margin-inline: 0; }
.container-fluid > .row > .col-12:has(> .rb-rates-surface) { padding-inline: 0; }
body .rb-rates-tools { border-inline: 0; border-radius: 0; }
body .rb-rates-tools .rb-mortgage-filter-guide { border-radius: 0; }
.rb-ed-filter-intro { padding-inline: clamp(.8rem, 1.6vw, 2rem); text-align: start; }
.rb-ed-filter-intro h2 > span, .rb-rates-tools .rb-mortgage-filter-guide-copy h2 > span {
    background-color: #164c3e; color: #fff; padding: .08em .32em;
    box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.rb-ed-filter-intro p > span, .rb-rates-tools .rb-mortgage-filter-guide-copy p > span {
    color: #103b2b; background-color: #cdebdc; padding: .07em .3em;
    box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.rb-ed-filter-intro p, .rb-rates-tools .rb-mortgage-filter-guide-copy p { line-height: 1.62; margin-top: .32rem; }
body .rb-rates-tools .rb-ed-filter-tip, .rb-ed-filter-tip {
    margin-block: .1rem .65rem; padding: .4rem clamp(.8rem, 1.6vw, 2rem);
    color: #402e05; background: #fffaf0; font-size: .875rem; line-height: 1.65; text-align: start;
}
body .rb-ed-filter-tip > span {
    color: #402e05; background: #ffe49a; padding: .08em .3em;
    box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.rb-ed-filter-tip .rb-ed-tip-label { font-weight: 750; }
body .rb-ed-filter-tip > i { color: #61430a; }
.mortgage-comparison-page .comparison-tool-wrapper:has(> .comparison-table-header > .rb-ed-filter-intro) {
    padding-inline: 0;
    border-inline: 0;
}
