/* ==========================================================================
   Content Section

   A main column with an optional sidebar holding buttons and links.
   ========================================================================== */

.ssb-content {

    /*
     * The sidebar sits on the section's own background, which is light.
     * Everything in it is colored from here so nothing has to guess.
     */
    --ssb-content-fg: var(--color-text);
    --ssb-content-gap: var(--space-xl, 4rem);
}


/* Vertical spacing
   --------------------------------------------------------------------------
   The same four sizes as the Section block's Padding, read from the same
   tokens rather than written out again — two scales that agree today and
   drift apart after one edit is exactly what the shared spacing tokens
   exist to prevent.

   On the section rather than on .container, so the space belongs to the
   band and a background set on it later fills that space rather than
   stopping short of it.
   ========================================================================== */

/* Backgrounds
   --------------------------------------------------------------------------
   The framework's surfaces, written the way the Section block writes
   them: the background and the text color that belongs on it. The three
   colored surfaces also repoint --color-text and --color-heading, because
   plenty of rules name those tokens outright rather than taking `color`
   from an ancestor. The two light ones deliberately do not — see below.

   --ssb-content-fg follows --color-text on its own — it is defined as
   that token at the top of this file — so the sidebar's rule and its
   divider come with it and nothing here has to name them.

   The class names matter beyond this file. A child theme matches
   [class*="--bg-dark"] to put links and eyebrows onto currentColor on any
   colored surface, blocks added later included, so naming these
   --bg-primary and --bg-dark is what makes that reach this block without
   anybody editing a selector list.
   ========================================================================== */

/*
 * The two light surfaces repoint nothing.
 *
 * Not an oversight — a correction. --color-on-surface is *defined* as
 * var(--color-text) in design-system.css, and a child theme can define
 * --color-on-subtle the same way, so writing
 * `--color-text: var(--color-on-surface)` here is a cycle: the
 * declaration is invalid at computed-value time, the custom property
 * falls back to the value it inherited, and the rule does nothing. It
 * measures correct only because the inherited value was already the
 * right one.
 *
 * These surfaces do not need it anyway. They are the page's own colors,
 * and `color` is real, inherits, and is all that changes.
 */
.ssb-content--bg-base {
    background-color: var(--color-surface, #fff);
    color: var(--color-on-surface, var(--color-text));
}

.ssb-content--bg-subtle {
    background-color: var(--color-surface-subtle, #f4f4f5);
    color: var(--color-on-subtle, var(--color-text));
}

.ssb-content--bg-primary {
    background-color: var(--color-primary);
    color: var(--color-on-primary, #fff);
    --color-text: var(--color-on-primary, #fff);
    --color-heading: var(--color-on-primary, #fff);
}

.ssb-content--bg-secondary {
    background-color: var(--color-secondary);
    color: var(--color-on-secondary, #fff);
    --color-text: var(--color-on-secondary, #fff);
    --color-heading: var(--color-on-secondary, #fff);
}

.ssb-content--bg-dark {
    background-color: var(--color-surface-dark, var(--color-dark));
    color: var(--color-on-dark, #fff);
    --color-text: var(--color-on-dark, #fff);
    --color-heading: var(--color-on-dark, #fff);
}


/* The buttons, now that this block can be a colored band
   --------------------------------------------------------------------------
   This block's buttons are the theme's ssc_render_buttons(): Button 1 is
   .btn--primary and Button 2 is .btn--secondary. That function's own
   comment explains the pairing by saying the Content block "has no
   background field and so is always on the page's light background."
   It has one now, and two things follow from that.

   .btn--primary is `background: var(--color-primary)`. On a Primary band
   that is the band's own color — a button-shaped hole — and on a Dark one
   it is the crimson at under 2:1. It inverts here the way the Buttons
   block's Solid inverts: the fill becomes the surface's text color and
   the label becomes the surface. Those two are already a vetted pair,
   because they are what the band draws its own words with, so the button
   gets exactly the band's contrast rather than a ratio somebody has to go
   and measure.

   .btn--secondary is right at rest — it is `color: var(--color-text)` and
   a currentColor border, and the rules above have just repointed that
   token. Its *hover* is not: it fills with --color-text and sets the
   label to --color-light, which on a Dark band is white on white. Same
   inversion, same reason.

   Two classes against the theme's one, and design-system.css goes out in
   the head while this is enqueued when the block renders — so this wins
   on weight and on order both.
   ========================================================================== */

.ssb-content--bg-primary .btn--primary {
    background: var(--color-on-primary, #fff);
    color: var(--color-primary);
}

.ssb-content--bg-secondary .btn--primary {
    background: var(--color-on-secondary, #fff);
    color: var(--color-secondary);
}

.ssb-content--bg-dark .btn--primary {
    background: var(--color-on-dark, #fff);
    color: var(--color-surface-dark, var(--color-dark));
}

.ssb-content--bg-primary .btn--secondary:hover,
.ssb-content--bg-primary .btn--secondary:focus-visible {
    background: var(--color-on-primary, #fff);
    color: var(--color-primary);
}

.ssb-content--bg-secondary .btn--secondary:hover,
.ssb-content--bg-secondary .btn--secondary:focus-visible {
    background: var(--color-on-secondary, #fff);
    color: var(--color-secondary);
}

.ssb-content--bg-dark .btn--secondary:hover,
.ssb-content--bg-dark .btn--secondary:focus-visible {
    background: var(--color-on-dark, #fff);
    color: var(--color-surface-dark, var(--color-dark));
}


.ssb-content--pad-none {
    padding-block: 0;
}

.ssb-content--pad-small {
    padding-block: var(--space-md, 1.5rem);
}

.ssb-content--pad-medium {
    padding-block: var(--space-xl, 4rem);
}

.ssb-content--pad-large {
    padding-block: var(--space-3xl, 8rem);
}


/* Grid
   --------------------------------------------------------------------------
   The gap used to read --ssc-space-lg, which is not a token this project
   defines — it was --space-lg all along. An unknown custom property with no
   fallback makes the whole declaration invalid, so the gap was not narrow,
   it was zero, and the two columns ran straight into each other.
   ========================================================================== */

.ssb-content--75-25 .ssb-content__grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
    gap: var(--ssb-content-gap);
    align-items: start;
}

.ssb-content--66-33 .ssb-content__grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: var(--ssb-content-gap);
    align-items: start;
}

/*
 * Title Placement: Beside. The heading gets a column of its own on the
 * left and the text, buttons and extras sit to its right.
 *
 * align-items: start so the heading stays level with the first line of
 * the text instead of being centered against a column that may run on for
 * several paragraphs.
 */
.ssb-content--title-beside .ssb-content__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: var(--ssb-content-gap);
    align-items: start;
}

/*
 * The heading loses the space under it in this layout — the space between
 * the columns is doing that job, and the margin only pushed the text in
 * the right-hand column out of line with it.
 */
.ssb-content--title-beside .ssb-content__title {
    margin-bottom: 0;
}

.ssb-content--title-beside .ssb-content__subtitle {
    margin-top: var(--space-sm, 1rem);
    margin-bottom: 0;
}

.ssb-content__content--2 {
    column-count: 2;
    column-gap: var(--space-lg, 2rem);
}

/*
 * Three, with a floor on how narrow each one may get.
 *
 * column-count on its own is a promise the browser keeps whatever the
 * width, which is fine for two and not for three: this block also runs
 * beside a sidebar, where the text has two thirds of the container, and
 * three columns in that are a stack of single words. Naming a
 * column-width as well turns the count into a ceiling — three where
 * there is room for three, two where there is not, one on a phone — so
 * it answers to the space it is actually in rather than to the width of
 * the window.
 *
 * 15rem is the floor. Narrower than that and a line holds too few words
 * to read comfortably.
 */
.ssb-content__content--3 {
    column-count: 3;
    column-width: 15rem;
    column-gap: var(--space-lg, 2rem);
}

/*
 * Where [column-break] was. An empty box that carries nothing but the
 * instruction to start the next column, so everything after the marker
 * begins at the top of column two instead of wherever the text happened
 * to reach.
 *
 * It has to be a block-level box: break-before is ignored on an inline
 * one, which is what a <span> here would have been.
 *
 * The legacy -webkit- property is listed because Safari only took the
 * standard `break-before` recently, and a break that silently does
 * nothing looks exactly like a marker that was typed wrong.
 */
.ssb-content__column-break {
    -webkit-column-break-before: always;
    break-before: column;
    height: 0;
    margin: 0;
    padding: 0;
}


/* Main column
   ========================================================================== */

.ssb-content__title {
    margin-top: 0;
    margin-bottom: var(--space-md, 1.5rem);
}

.ssb-content__subtitle {
    margin-top: 0;
    margin-bottom: var(--space-sm, 1rem);
}

.ssb-content__content > :first-child {
    margin-top: 0;
}

.ssb-content__content > :last-child {
    margin-bottom: 0;
}


/* Sidebar
   --------------------------------------------------------------------------
   Buttons stacked and full width, so the column reads as one block of
   actions rather than two odd-sized pills.

   The column used to sit straight on the section's own background with
   nothing holding it — a heading, a couple of lines and a button on the
   same white as the body copy, so it read as a second paragraph that
   happened to have a button after it. A rule across the top and hairlines
   between the lines give it an edge without putting it in a panel, which
   keeps the air the layout is built on.

   Every value here is a token with a neutral default, so a site that sets
   no condensed face and no brand colors gets a gray-ruled column rather
   than an unstyled one.

   Scoped to the sidebar on purpose. The same two fields are also printed
   under a full-width section, where they are the width of the page and
   row rules would read as a table.
   ========================================================================== */

.ssb-content__sidebar {
    color: var(--ssb-content-fg);
    border-top: 2px solid currentColor;
    padding-top: var(--space-md, 1.5rem);
}

/*
 * The sidebar's label, in both the places it can come from.
 *
 * .ssb-content__sidebar-title is the Sidebar Title field, which is how it
 * is written now. The six heading tags are blocks built before that field
 * existed, where the only way to make this label was a heading typed into
 * the content — all six, because the content field is a WYSIWYG and there
 * was no way to insist on one level.
 *
 * One rule with two selectors rather than two rules, so the old shape and
 * the new one cannot drift apart.
 *
 * The eyebrow's metrics, not the eyebrow: that class carries the brand
 * primary, and a red label stacked above a red button is a lot of red.
 * This follows the section instead.
 */
.ssb-content__sidebar .ssb-content__sidebar-title,
.ssb-content__sidebar .ssb-content__sidebar-content :is(h1, h2, h3, h4, h5, h6) {
    margin: 0 0 var(--space-sm, 1rem);
    font-family: var(--font-condensed, var(--font-body));
    font-size: var(--font-size-eyebrow, .875rem);
    line-height: var(--line-height-eyebrow, 1.2);
    font-weight: 700;
    letter-spacing: var(--letter-spacing-eyebrow, 2px);
    text-transform: uppercase;
    color: inherit;
}

/*
 * One line per row, each with a hairline under it. A WYSIWYG gives
 * paragraphs and sometimes a list, so both are covered. Anything else
 * pasted in keeps the spacing but not the rule, which is the safer way
 * round — a stray rule is more noticeable than a missing one.
 */
.ssb-content__sidebar .ssb-content__sidebar-content :is(p, li) {
    margin: 0;
    padding: .65rem 0;
    border-bottom: 1px solid var(--color-border, #ddd);
}

.ssb-content__sidebar .ssb-content__sidebar-content :is(ul, ol) {
    margin: 0;
    padding: 0;
    list-style: none;
}

/*
 * Underlined rather than colored. These sit on their own line, so there
 * is no surrounding text to tell them apart from, and color alone would
 * be the only signal that a phone number is callable. Red is kept for
 * the hover, the same way round as the list under the buttons.
 */
.ssb-content__sidebar .ssb-content__sidebar-content a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ssb-content__sidebar .ssb-content__sidebar-content a:hover,
.ssb-content__sidebar .ssb-content__sidebar-content a:focus-visible {
    color: var(--color-primary);
}

/* Clear of the last hairline. */
.ssb-content__sidebar .ssb-content__sidebar-content {
    margin-bottom: var(--space-md, 1.5rem);
}

.ssb-content__sidebar .ssc-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs, .5rem);
}

.ssb-content__sidebar .ssc-buttons .btn {
    width: 100%;
}

/*
 * The outline button is white wherever it is defined, for use on a dark
 * hero. In this section it was white text and a white border on a white
 * page — rendering at full size and completely invisible, which is why the
 * second button looked like it had gone missing. Here it follows the
 * section instead.
 */
.ssb-content .btn--outline {
    color: var(--ssb-content-fg);
    border-color: currentColor;
}

.ssb-content .btn--outline:hover,
.ssb-content .btn--outline:focus-visible {
    background: var(--ssb-content-fg);
    color: var(--color-light, #fff);
}

.ssb-content__sidebar-content {
    margin-bottom: var(--space-sm, 1rem);
}

.ssb-content__sidebar-content > :first-child {
    margin-top: 0;
}

/*
 * The list of documents under the buttons. Smaller than body copy, because
 * it is a set of references rather than something to read, and dark rather
 * than the theme's link red — two red things stacked under a red button is
 * a lot of red.
 */
.ssb-content__sidebar-content-2 {
    margin-top: var(--space-sm, 1rem);
    font-size: .875rem;
    line-height: 1.5;
}

.ssb-content__sidebar-content-2 > :first-child {
    margin-top: 0;
}

.ssb-content__sidebar-content-2 > :last-child {
    margin-bottom: 0;
}

.ssb-content__sidebar-content-2 a {
    color: var(--ssb-content-fg);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ssb-content__sidebar-content-2 a:hover {
    color: var(--color-primary);
}


/* Full-width layout
   ========================================================================== */

.ssb-content__bottom {
    margin-top: var(--space-lg, 2rem);
}

.ssb-content__bottom .ssc-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm, 1rem);
}


/* Mobile
   ========================================================================== */

@media (max-width: 768px) {

    .ssb-content--75-25 .ssb-content__grid,
    .ssb-content--66-33 .ssb-content__grid,
    .ssb-content--title-beside .ssb-content__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-lg, 2rem);
    }

    .ssb-content__content--2,
    .ssb-content__content--3 {
        column-count: 1;
    }

    /*
     * One column, so there is no second one to break to — and a forced
     * column break inside a single-column multicol container makes a
     * column anyway, which overflows sideways off the phone. The element
     * stays in the markup and stops asking for anything.
     */
    .ssb-content__column-break {
        -webkit-column-break-before: auto;
        break-before: auto;
    }

}