/*
 * Rich-text body — sanitized editor HTML rendered as markup: Host's /terms-of-use, and
 * Admin.Client's editor surface and Terms of Use preview. Served at
 * _content/ClarkConnect.Styles/css/cc-rich-text.css; linked after cc-base.css in Host (both
 * render pipelines) and tokens-first in Admin.Client and the AdminPortal embed.
 *
 * Opt-in by class, one class of specificity, so it beats any element base (cc-base.css,
 * app.css) without :where() on the class; the editor's output carries no classes of its own
 * to compete. Lives in a global sheet because MarkupString content carries no scope attribute.
 *
 * No font-family anywhere: the body inherits the surrounding surface's face (DM Sans in Host,
 * Inter in the Admin embed), so only size/weight/line-height are set here.
 *
 * Two heading tiers, not six: h1/h2 are the page-level heading, h3-h6 the Figma section
 * heading — authors still pick levels for outline, just within two visible tiers.
 */

.cc-rich-text {
    font-weight: var(--fontWeightRegular);
    font-size: var(--fontSizeLG);
    line-height: var(--lineHeightLG);
    font-variation-settings: "opsz" 14;
    color: var(--colorText);
    overflow-wrap: break-word;
}

.cc-rich-text :where(h1, h2) {
    margin: var(--spacingXL) 0 0;
    font-weight: var(--fontWeightStrong);
    font-size: var(--fontSizeHeading4);
    line-height: var(--lineHeightHeading4);
    font-variation-settings: inherit;
    color: var(--colorText);
}

.cc-rich-text :where(h3, h4, h5, h6) {
    margin: var(--spacingXL) 0 0;
    font-weight: var(--fontWeightStrong);
    font-size: var(--fontSizeLG);
    line-height: var(--lineHeightLG);
    font-variation-settings: inherit;
    color: var(--colorText);
}

/* `font: inherit` undoes the element base's p/list sizing (and hands back the inherited
   face) so body copy tracks the .cc-rich-text root above. */
.cc-rich-text :where(p, ul, ol, blockquote) {
    margin: var(--spacingLG) 0 0;
    font: inherit;
    font-variation-settings: inherit;
    color: inherit;
}

.cc-rich-text :where(h1, h2, h3, h4, h5, h6) + :where(p, ul, ol, blockquote) {
    margin-top: var(--spacingXS);
}

.cc-rich-text > :first-child {
    margin-top: 0;
}

.cc-rich-text :where(ul, ol) {
    padding-left: var(--spacingLG);
}

.cc-rich-text ul {
    list-style: disc outside;
}

.cc-rich-text ol {
    list-style: decimal outside;
}

.cc-rich-text :where(li > ul, li > ol) {
    margin-top: 0;
}

/* Hover takes link-active (7.72:1 on white), a step darker than --colorLinkHover (5.95:1).
   Underlined so a link inside running text is not identified by colour alone (WCAG 1.4.1). */
.cc-rich-text a {
    color: var(--colorLink);
    text-decoration: underline;

    &:hover {
        color: var(--colorLinkActive);
    }
}

.cc-rich-text blockquote {
    padding-left: var(--spacingMD);
    border-left: 4px solid var(--colorBorder);
}
