/*
 * Rendering for the "safe-but-inert" data-align / data-caption attributes
 * that core.richtext.sanitize_filtered_html (see FILTERED_HTML_ALLOWED_ATTRS
 * in myri/settings/base.py) lets survive on <img> and <blockquote> tags
 * in Article/Question/Situational rich-text fields.
 *
 * Important: a bare data-* attribute does NOTHING in a browser on its own —
 * it's just inert text sitting on the tag, which is exactly why it was
 * safe to let the sanitizer keep it. This stylesheet is what actually
 * gives data-align/data-caption visible meaning. Without it, the attribute
 * would survive in the saved HTML but the page would look no different.
 *
 * Scoped to `.rtf-content` — the wrapper class added around every place an
 * Article.body / Question.*_text / Situation.*_text field is rendered with
 * |safe (templates/content/article_detail.html, templates/admin/questions/
 * {question,situation}_preview.html) — rather than a bare `img[data-align]`
 * selector, so this can never accidentally style site chrome like
 * the navbar logo image.
 *
 * <img data-caption="..."> additionally needs static/js/richtext_content.js:
 * CSS generated content (::before/::after) is not rendered on replaced
 * elements like <img> in any current browser (Chrome/Firefox/Safari all
 * silently skip it), so a caption below an image can't be pure CSS the way
 * blockquote's caption below is. <blockquote> is an ordinary block element
 * (not "replaced"), so its data-align/data-caption are handled entirely in
 * CSS here — no JS involved for blockquote.
 *
 * Load this after brand.css (same order in every template that includes
 * both) so it can use brand.css's theme tokens directly; every color
 * here is a token, so this file follows the light and dark themes.
 */

.rtf-content {
    /* Clearfix: keeps a floated aligned image from collapsing this box to
       zero height when the image is the only/last thing inside it. */
    overflow: auto;
}

/* ---- Article page body panel -----------------------------------------------
   .article-body gives Article.body the same --bg-card surface as every
   other rich-text panel on the site (Question/Situational preview text
   sits inside a Bootstrap .card), so an illustration whose own
   background is painted --bg-card blends in seamlessly. Only
   templates/content/article_detail.html adds this class —
   Question/Situational previews use the surrounding .card for the same
   background, which avoids a box-within-a-box. */
.rtf-content.article-body {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
}
@media (max-width: 575.98px) {
    .rtf-content.article-body {
        padding: 1rem;
    }
}

/* ---- Headings inside rich-text content -----------------------------------
   Heading colors and sizes are defined once, in static/css/brand.css's
   own "Headings" section (loaded before this file in every template) —
   its plain h2–h5 rules already cover every <h2>-<h5> a Filtered/Full HTML author puts inside
   .rtf-content (FILTERED_HTML_ALLOWED_TAGS caps content headings at h2-h5;
   h1 is reserved for the page's own title, e.g. the Article template's
   <h1>{{ article.title }}</h1> outside this wrapper). Nothing
   .rtf-content-specific is needed here. */

/* ---- <code> — inline code ------------------------------------------------
   Filtered/Full HTML only ever produces inline <code> here (there's no
   <pre> in FILTERED_HTML_ALLOWED_TAGS, and the toolbar's "</>" button
   only wraps the current selection in <code>...</code> — see
   core/editor_widget.py's _SIMPLE_BUTTONS) — so this is sized/padded as
   an inline snippet, not a code block. Colors are brand.css's --code-*
   tokens: a pale yellow chip in the light theme, a near-black one in
   the dark theme, so code stands apart from the card it sits on. */
.rtf-content code {
    font-family: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
    font-size: 0.9em;
    background-color: var(--code-bg);
    color: var(--code-fg);
    padding: 0.15em 0.4em;
    border: 1px solid var(--code-border);
    border-radius: 4px;
}

/* ---- <blockquote> — indented, quote-marked, distinctively set ----------
   The quote icon is a big serif quotation mark via ::before rather than
   an icon font (this site only loads Bootstrap's CSS/JS and MathJax) —
   it recolors with the theme for free (plain `color`) and needs no extra
   network request. The quote text itself uses an italic serif face,
   distinct from the site's default sans-serif body copy.
   data-align/data-caption (below) layer on top of this. */
.rtf-content blockquote {
    position: relative;
    margin: 1.5em 0;
    margin-left: 2.5rem;
    padding: 0.9em 1.25em 0.9em 3.25rem;
    background-color: var(--bg-tint);
    border-left: 4px solid var(--link);
    border-radius: 0 8px 8px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    color: var(--text-secondary);
}
.rtf-content blockquote::before {
    content: "\201C";
    position: absolute;
    left: 0.6rem;
    top: 0.05em;
    font-family: Georgia, "Times New Roman", serif;
    font-style: normal;
    font-size: 2.75rem;
    line-height: 1;
    color: var(--link);
    opacity: 0.85;
}

/* ---- <img> spacing, all alignments including "none" ---------------------
   Each alignment (left, right, center) has its own padding/margin.
   box-sizing: border-box on the shared base rule keeps that padding from
   fighting max-width: 50% on the floated variants below. A bare <img>
   with no data-align gets the same base padding plus a small margin of
   its own, and stays inline (not display:block) so it flows with the
   surrounding text.
   When an image also carries data-caption, static/js/richtext_content.js
   MOVES that attribute from the <img> onto the .rtf-caption-wrap span it
   builds around it (see that file) — so the [data-align] rules below only
   ever match a bare, uncaptioned <img>, never one that's already inside a
   caption wrapper. That avoids two different rules fighting to
   float/center the same element. */
.rtf-content img {
    box-sizing: border-box;
    max-width: 100%;
    height: auto;
    padding: 0.35em;
}
.rtf-content img:not([data-align]) {
    margin: 0.5em;
}
/* An inline <svg> in a Page/Article body with fixed width/height
   attributes would overflow the screen on mobile. Same shrink-to-fit an
   <img> gets; the SVG's viewBox keeps the aspect ratio once the width is
   capped. */
.rtf-content svg {
    max-width: 100%;
    height: auto;
}
.rtf-content img[data-align="left"] {
    float: left;
    margin: 0.25em 1.5em 0.75em 0;
    padding: 0.35em 0.35em 0.35em 0;
    max-width: 50%;
}
.rtf-content img[data-align="right"] {
    float: right;
    margin: 0.25em 0 0.75em 1.5em;
    padding: 0.35em 0 0.35em 0.35em;
    max-width: 50%;
}
.rtf-content img[data-align="center"] {
    display: block;
    margin: 0.75em auto;
    padding: 0.35em 0;
    max-width: 100%;
}

/* ---- <img data-caption="...">, with or without data-align ---------------
   Structure built by richtext_content.js:
     <span class="rtf-caption-wrap" data-align="...">   (data-align optional)
       <img ...>                                         (data-align removed)
       <span class="rtf-caption">the caption text</span>
     </span> */
.rtf-content .rtf-caption-wrap {
    display: inline-block;
    max-width: 100%;
    vertical-align: top;
}
.rtf-content .rtf-caption-wrap[data-align="left"] {
    float: left;
    margin: 0.25em 1.25em 0.75em 0;
}
.rtf-content .rtf-caption-wrap[data-align="right"] {
    float: right;
    margin: 0.25em 0 0.75em 1.25em;
}
.rtf-content .rtf-caption-wrap[data-align="center"] {
    display: block;
    margin: 0.75em auto;
    text-align: center;
}
.rtf-content .rtf-caption-wrap img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0;
}
.rtf-content .rtf-caption {
    display: block;
    font-size: 0.875em;
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 0.35em;
    text-align: center;
}

/* ---- <blockquote data-align="..."> / data-caption="..."> ----------------
   blockquote is an ordinary block element, not a "replaced" one like img,
   so both attributes can be handled in pure CSS — no JS wrapping needed. */
.rtf-content blockquote[data-align="left"] {
    text-align: left;
}
.rtf-content blockquote[data-align="right"] {
    text-align: right;
}
.rtf-content blockquote[data-align="center"] {
    text-align: center;
}
.rtf-content blockquote[data-caption]::after {
    content: attr(data-caption);
    display: block;
    font-size: 0.875em;
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 0.5em;
}


/* ---- Two-column answer choices on desktop/laptop -----------------------
   Board-exam MCQ/Situational answer sheets are laid out in two columns
   -- A/B down the left, C/D down the right -- not one long vertical
   list. `.qp-choices` is the one wrapper class shared, verbatim,
   across every place a Question/Situational choice list is rendered on
   the site: templates/exams/take_attempt.html, attempt_result.html,
   both templates/admin/questions/{question,situation}_preview.html
   templates, and templates/content/_quiz_widget.html's "Test Yourself"
   widget. This file is the one place that loads on ALL of those pages
   (base.html loads it site-wide for Article/Page; the exam and admin
   preview templates each also explicitly include it in their own
   extra_head, per their own templates), so one rule here covers every
   surface instead of duplicating it across question_preview.css,
   exam_attempt.css, and article_quiz.css separately.

   CSS multi-column (not CSS grid) is what makes the fill order come out
   right without hardcoding a row count: `column-count: 2` fills the
   FIRST column top-to-bottom before spilling into the second -- exactly
   A,B in column 1 / C,D in column 2 for the normal 4-choice case -- and
   it degrades reasonably for any other choice count too, since the
   browser balances column height on its own rather than needing an
   exact row count up front.

   Multi-column reflow breaks Bootstrap's normal "joined vertical list"
   assumptions for `.list-group-item` (shared borders between physically
   adjacent DOM siblings, corner radius only on the very first/last
   child) -- those assumptions silently produce a missing top border on
   whichever item lands first in the second column, since Bootstrap's
   own `.list-group-item + .list-group-item { border-top-width: 0 }`
   rule only knows about DOM order, not which column an item visually
   reflows into. Below, at this same breakpoint, every choice becomes
   its own fully-bordered, fully-rounded standalone box instead, with a
   real gap between rows -- reads correctly regardless of which column
   an item lands in.

   Below md (768px, Bootstrap's tablet/laptop breakpoint), none of this
   applies -- `.list-group`'s normal single joined vertical list
   renders. */
@media (min-width: 768px) {
    .qp-choices {
        display: block;
        column-count: 2;
        column-gap: 1.25rem;
    }
    .qp-choices > .list-group-item {
        break-inside: avoid;
        -webkit-column-break-inside: avoid;
        margin-bottom: 0.6rem;
        border-radius: 0.375rem !important;
        border-top-width: 1px !important;
    }
    .qp-choices > .list-group-item:last-child {
        margin-bottom: 0;
    }
}


/* ---- Tables inside rich-text content ---------------------------------------
   FILTERED_HTML_ALLOWED_ATTRS (myri/settings/base.py) gives table/th/td
   no `border`/`cellpadding`-equivalent attributes at all (just class/id on
   <table>, colspan/rowspan on <th>/<td>), so visible cell borders and
   padding come from here for Filtered HTML and Full HTML alike. Reuses
   brand.css's --border/--bg-card tokens (same ones .article-body above
   uses) and applies to every table any rich-text body renders on the
   site. */
.rtf-content table {
    border-collapse: collapse;
    width: 100%;
}
.rtf-content table th,
.rtf-content table td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}
.rtf-content table thead th {
    background-color: var(--bg-tint);
}

/* ---- Privacy Policy cookies table column widths ---------------------------
   Scoped to this one table's id (<table id="cookie-table">), not a
   blanket nth-child rule, so it never warps the proportions of some
   unrelated table a Filtered/Full HTML author builds elsewhere. Purpose
   holds the longest sentences and would otherwise dominate the row;
   fixed widths give Cookie/Set by/Typical lifetime their share. */
#cookie-table th:nth-child(1),
#cookie-table td:nth-child(1) { width: 15%; }
#cookie-table th:nth-child(2),
#cookie-table td:nth-child(2) { width: 25%; }
#cookie-table th:nth-child(3),
#cookie-table td:nth-child(3) { width: 35%; }
#cookie-table th:nth-child(4),
#cookie-table td:nth-child(4) { width: 25%; }

/* ---- Stack-on-mobile tables -----------------------------------------------
   Opt-in: put class="stack-mobile" on the <table>. Desktop/tablet (768px
   and up) is untouched -- the normal multi-column table. Below 768px every
   row becomes one column: the figure cell on top, its equations cell right
   under it, then the next row's figure, and so on. The header row
   (Diagrams | Equations) is hidden on phones since it no longer sits
   above its columns; richtext_content.js copies each header's text into
   a .stack-label at the top of the matching cell instead. Images in the
   stacked cells fill the full width instead of a fixed small column. */
@media (max-width: 767.98px) {
    .rtf-content table.stack-mobile,
    .rtf-content table.stack-mobile tbody,
    .rtf-content table.stack-mobile tr,
    .rtf-content table.stack-mobile td {
        display: block;
        width: 100%;
    }
    .rtf-content table.stack-mobile thead {
        display: none;
    }
    .rtf-content table.stack-mobile td {
        border-top-width: 0;
    }
    .rtf-content table.stack-mobile tr {
        border-top: 1px solid var(--border);
    }
    .rtf-content table.stack-mobile td img,
    .rtf-content table.stack-mobile td svg {
        width: 100%;
        max-width: 100%;
        height: auto;
    }
}

/* Column labels copied from the header row by richtext_content.js (labelStackedTables).
   Hidden everywhere except the stacked phone layout. */
.rtf-content table.stack-mobile .stack-label {
    display: none;
}
@media (max-width: 767.98px) {
    .rtf-content table.stack-mobile .stack-label {
        display: block;
        font-weight: 600;
        font-size: 0.9em;
        color: var(--text-secondary);
        margin-bottom: 0.25rem;
    }
}

/* ---- Multi-column lists -------------------------------------------------
   (Balanced split -- 11 items: 6+5 / 4+4+3 / 3+3+3+2 -- is done by
   richtext_content.js's layoutColumnList(); the rules here are the layout
   it builds on AND the no-JS fallback, which gives every column
   ceil(items/N) rows, i.e. a short or empty last column.)
   Opt-in: put class="cols-2", "cols-3" or "cols-4" on a <ul> or <ol>
   (Filtered HTML already allows class on every tag). cols-1 is simply a
   normal list, so it needs no rule. Items fill the columns top to bottom,
   left to right, in blocks of ceil(items / columns): with cols-2, 4 items =
   2 + 2 and 3 items = 2 + 1; with cols-3, 7 items = 3 + 3 + 1. The split is
   by ITEM COUNT, never by height (a plain CSS-columns split balances by
   height, so a tall fraction would leave 3 items in the left column).
   Items flow down the columns of an N-column grid whose row count is
   ceil(items / N); that count is set by the :has() rules below (one per
   row, up to 30 rows). Browsers without :has() fall back to CSS columns.
   One column below 768px, like the answer choices. Lists without the class
   are untouched. */
.rtf-content :is(ul, ol).cols-2 { column-count: 2; }
.rtf-content :is(ul, ol).cols-3 { column-count: 3; }
.rtf-content :is(ul, ol).cols-4 { column-count: 4; }
.rtf-content :is(ul, ol):is(.cols-2, .cols-3, .cols-4) {
    column-gap: 2.5rem;
}
.rtf-content :is(ul, ol):is(.cols-2, .cols-3, .cols-4) > li {
    break-inside: avoid;
}
@supports selector(:has(a)) {
    .rtf-content :is(ul, ol):is(.cols-2, .cols-3, .cols-4) {
        column-count: auto;
        display: grid;
        grid-auto-flow: column;
        grid-template-rows: auto;
        column-gap: 2.5rem;
        align-items: start;
    }
    .rtf-content :is(ul, ol).cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rtf-content :is(ul, ol).cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rtf-content :is(ul, ol).cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(3)) { grid-template-rows: repeat(2, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(5)) { grid-template-rows: repeat(3, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(7)) { grid-template-rows: repeat(4, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(9)) { grid-template-rows: repeat(5, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(11)) { grid-template-rows: repeat(6, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(13)) { grid-template-rows: repeat(7, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(15)) { grid-template-rows: repeat(8, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(17)) { grid-template-rows: repeat(9, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(19)) { grid-template-rows: repeat(10, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(21)) { grid-template-rows: repeat(11, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(23)) { grid-template-rows: repeat(12, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(25)) { grid-template-rows: repeat(13, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(27)) { grid-template-rows: repeat(14, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(29)) { grid-template-rows: repeat(15, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(31)) { grid-template-rows: repeat(16, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(33)) { grid-template-rows: repeat(17, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(35)) { grid-template-rows: repeat(18, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(37)) { grid-template-rows: repeat(19, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(39)) { grid-template-rows: repeat(20, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(41)) { grid-template-rows: repeat(21, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(43)) { grid-template-rows: repeat(22, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(45)) { grid-template-rows: repeat(23, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(47)) { grid-template-rows: repeat(24, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(49)) { grid-template-rows: repeat(25, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(51)) { grid-template-rows: repeat(26, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(53)) { grid-template-rows: repeat(27, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(55)) { grid-template-rows: repeat(28, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(57)) { grid-template-rows: repeat(29, auto); }
    .rtf-content :is(ul, ol).cols-2:has(> li:nth-child(59)) { grid-template-rows: repeat(30, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(4)) { grid-template-rows: repeat(2, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(7)) { grid-template-rows: repeat(3, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(10)) { grid-template-rows: repeat(4, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(13)) { grid-template-rows: repeat(5, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(16)) { grid-template-rows: repeat(6, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(19)) { grid-template-rows: repeat(7, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(22)) { grid-template-rows: repeat(8, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(25)) { grid-template-rows: repeat(9, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(28)) { grid-template-rows: repeat(10, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(31)) { grid-template-rows: repeat(11, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(34)) { grid-template-rows: repeat(12, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(37)) { grid-template-rows: repeat(13, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(40)) { grid-template-rows: repeat(14, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(43)) { grid-template-rows: repeat(15, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(46)) { grid-template-rows: repeat(16, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(49)) { grid-template-rows: repeat(17, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(52)) { grid-template-rows: repeat(18, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(55)) { grid-template-rows: repeat(19, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(58)) { grid-template-rows: repeat(20, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(61)) { grid-template-rows: repeat(21, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(64)) { grid-template-rows: repeat(22, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(67)) { grid-template-rows: repeat(23, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(70)) { grid-template-rows: repeat(24, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(73)) { grid-template-rows: repeat(25, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(76)) { grid-template-rows: repeat(26, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(79)) { grid-template-rows: repeat(27, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(82)) { grid-template-rows: repeat(28, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(85)) { grid-template-rows: repeat(29, auto); }
    .rtf-content :is(ul, ol).cols-3:has(> li:nth-child(88)) { grid-template-rows: repeat(30, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(5)) { grid-template-rows: repeat(2, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(9)) { grid-template-rows: repeat(3, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(13)) { grid-template-rows: repeat(4, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(17)) { grid-template-rows: repeat(5, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(21)) { grid-template-rows: repeat(6, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(25)) { grid-template-rows: repeat(7, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(29)) { grid-template-rows: repeat(8, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(33)) { grid-template-rows: repeat(9, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(37)) { grid-template-rows: repeat(10, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(41)) { grid-template-rows: repeat(11, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(45)) { grid-template-rows: repeat(12, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(49)) { grid-template-rows: repeat(13, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(53)) { grid-template-rows: repeat(14, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(57)) { grid-template-rows: repeat(15, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(61)) { grid-template-rows: repeat(16, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(65)) { grid-template-rows: repeat(17, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(69)) { grid-template-rows: repeat(18, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(73)) { grid-template-rows: repeat(19, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(77)) { grid-template-rows: repeat(20, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(81)) { grid-template-rows: repeat(21, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(85)) { grid-template-rows: repeat(22, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(89)) { grid-template-rows: repeat(23, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(93)) { grid-template-rows: repeat(24, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(97)) { grid-template-rows: repeat(25, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(101)) { grid-template-rows: repeat(26, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(105)) { grid-template-rows: repeat(27, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(109)) { grid-template-rows: repeat(28, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(113)) { grid-template-rows: repeat(29, auto); }
    .rtf-content :is(ul, ol).cols-4:has(> li:nth-child(117)) { grid-template-rows: repeat(30, auto); }
}
@media (max-width: 767.98px) {
    .rtf-content :is(ul, ol):is(.cols-2, .cols-3, .cols-4) {
        column-count: 1;
        display: block;
    }
}
