/*
 * Pages read from the Payload CMS (AP-802), rendered by CuroCmsPageRenderer inside
 * `.cms-page.ap-cms`; each HTML section is wrapped in `.ap-cms-block`. Every rule is
 * scoped to `.ap-cms`, so the rest of Curo keeps its look. Colours and spacing come
 * from Curo's design tokens.
 *
 * Layout: sections sit directly on the page in Curo's 1140px container, separated by
 * an even 64px instead of curo.css's ~190px (48px padding + 96px margin).
 */

.ap-cms {
    padding-top: var(--ap-space-7);
    padding-bottom: var(--ap-space-8);
}

/* ---- Sections ---------------------------------------------------------------------- */

/* curo.css puts 96px under every child of .cms-page. */
.ap-cms > * {
    margin-bottom: 64px;
}

.ap-cms > :last-child {
    margin-bottom: 0;
}

/* Text right above one of Curo's fund widgets introduces it. */
.ap-cms > .ap-cms-block:has(+ :not(.ap-cms-block)) {
    margin-bottom: var(--ap-space-6);
}

.ap-cms .ap-cms-block > .cms-section,
.ap-cms > .cms-section {
    margin-top: 0;
    padding-block: 0;
}

/* ---- Headings ------------------------------------------------------------------------
 * Left-aligned with a short brand bar, like a document; curo.css forces every
 * .ap__header to 20px !important and centres column headings, hence the specificity. */

html body .ap-cms h2.ap__header,
html body .ap-cms .ap-textimage_title {
    position: relative;
    margin: 0 0 var(--ap-space-6);
    padding: var(--ap-space-5) 0 0 !important;
    font-size: 28px !important;
    font-weight: 800;
    line-height: 1.25 !important;
    text-align: left !important;
    color: var(--ap-color-text-bold);
}

html body .ap-cms h2.ap__header::before,
html body .ap-cms .ap-textimage_title::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: var(--ap-color-border-expressive);
}

/* The first heading on the page is its title, whether it is the block's title
 * or the first heading of its text. */
html body .ap-cms > .ap-cms-block:first-child :is(h2.ap__header, .ap-textimage_title),
html body .ap-cms > .ap-cms-block:first-child .ap-textimage_content:not(:has(.ap-textimage_title)) .html > :is(h1, h2, h3):first-child {
    position: relative;
    margin: 0 0 var(--ap-space-6);
    padding: var(--ap-space-5) 0 0 !important;
    font-size: 36px !important;
    font-weight: 800;
    line-height: 1.2 !important;
    color: var(--ap-color-text-bold);
}

html body .ap-cms > .ap-cms-block:first-child .ap-textimage_content:not(:has(.ap-textimage_title)) .html > :is(h1, h2, h3):first-child::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: var(--ap-color-border-expressive);
}

.ap-cms .html h1 {
    margin: 0 0 var(--ap-space-5);
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--ap-color-text-bold);
}

.ap-cms .html h2,
.ap-cms .html h3,
.ap-cms .html h4 {
    margin: var(--ap-space-7) 0 var(--ap-space-4);
    font-weight: 700;
    line-height: 1.3;
    color: var(--ap-color-text-bold);
}

.ap-cms .html h2 {
    font-size: 24px;
}

.ap-cms .html h3 {
    font-size: 20px;
}

.ap-cms .html h4 {
    font-size: 16px;
}

.ap-cms .html > :is(h1, h2, h3, h4):first-child {
    margin-top: 0;
}

/* ---- Text -------------------------------------------------------------------------- */

.ap-cms .html {
    font-size: 15px;
    line-height: 1.65;
    color: var(--ap-color-text-text);
}

.ap-cms .html p {
    max-width: 100ch;
    margin: 0 0 var(--ap-space-5);
}

.ap-cms .html > :last-child,
.ap-cms .html li > :last-child {
    margin-bottom: 0;
}

.ap-cms .html a:not(.ap-cms-card) {
    color: var(--ap-color-text-action);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 30%, transparent);
    text-underline-offset: 3px;
}

.ap-cms .html a:not(.ap-cms-card):hover {
    text-decoration-color: currentColor;
}

.ap-cms .html ul,
.ap-cms .html ol {
    max-width: 100ch;
    margin: 0 0 var(--ap-space-5);
    padding-left: var(--ap-space-6);
}

.ap-cms .html ol {
    list-style: decimal;
}

.ap-cms .html ol ol {
    list-style: lower-alpha;
}

.ap-cms .html ul {
    list-style: disc;
}

.ap-cms .html ul ul {
    list-style: circle;
}

.ap-cms .html li {
    padding-left: var(--ap-space-2);
}

.ap-cms .html li::marker {
    color: var(--ap-color-text-subtler);
}

.ap-cms .html ol > li::marker {
    font-weight: 600;
    color: var(--ap-color-text-action);
}

.ap-cms .html li + li {
    margin-top: var(--ap-space-3);
}

.ap-cms .html li > :is(ul, ol) {
    margin-top: var(--ap-space-3);
}

.ap-cms .html blockquote {
    max-width: 100ch;
    margin: 0 0 var(--ap-space-5);
    padding: var(--ap-space-5) var(--ap-space-6);
    border-left: 4px solid var(--ap-color-border-expressive);
    border-radius: 0 12px 12px 0;
    background: var(--ap-color-background-expressive-subtlest);
}

.ap-cms .html hr {
    margin: var(--ap-space-7) 0;
    border-color: var(--ap-color-border-neutral-subtle);
}

/* ---- Text and image --------------------------------------------------------------------- */

.ap-cms .ap-textimage {
    gap: var(--ap-space-8);
    align-items: center;
}

@media (min-width: 768px) {
    .ap-cms .ap-textimage:not(.ap-cms-textonly) {
        flex-wrap: nowrap;
    }

    .ap-cms .ap-textimage:not(.ap-cms-textonly) .ap-textimage_image {
        flex: 0 0 38%;
        max-width: 38%;
    }

    .ap-cms .ap-textimage[class*="-small"] .ap-textimage_image {
        flex-basis: 28%;
        max-width: 28%;
    }

    .ap-cms .ap-textimage:not(.ap-cms-textonly) .ap-textimage_content {
        flex: 1 1 auto;
        max-width: none;
        padding: 0;
    }
}

.ap-cms .ap-cms-textonly {
    display: block;
}

.ap-cms .ap-cms-textonly .ap-textimage_content {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
}

/* ---- Column text ---------------------------------------------------------------------- */

.ap-cms .cms-columnblock {
    margin: 0;
}

.ap-cms .cms-columnblock > .col {
    padding: 0;
}

/* ---- Images ------------------------------------------------------------------------------ */

.ap-cms .ap-cms-block .container > img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
}

/* ---- Tables ------------------------------------------------------------------------------ */

.ap-cms .table-responsive {
    margin: 0 0 var(--ap-space-7);
    /* Clips the rows to the rounded corners; a table wider than the page scrolls. */
    overflow-x: auto;
    border: 1px solid var(--ap-color-border-neutral-subtle);
    border-radius: 12px;
    background: var(--ap-color-elevation-surface-default);
}

.ap-cms .table-responsive:last-child {
    margin-bottom: 0;
}

/* curo.css draws a dark outline and zebra stripes on CMS tables with !important. */
html body .ap-cms .table,
html body .ap-cms .table.border {
    margin: 0;
    border: 0 !important;
    /* Separate borders, so cells' borders don't merge into a dark outline. */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    --bs-table-bg: transparent;
    --bs-table-accent-bg: transparent;
    --bs-table-striped-bg: transparent;
}

.ap-cms .table > :not(caption) > * > * {
    padding: var(--ap-space-4) var(--ap-space-5);
    border: 0;
    border-bottom: 1px solid var(--ap-color-border-neutral-subtlest);
    background: transparent;
    box-shadow: none;
    vertical-align: middle;
    color: var(--ap-color-text-text);
}

/* curo.css colours every td border with --ap-color-line !important, near white in dark
 * mode; point it at the borders above instead. */
html body .ap-cms .table > :not(caption) > * > * {
    --ap-color-line: var(--ap-color-border-neutral-subtlest);
}

html body .ap-cms .table > thead > tr > *,
html body .ap-cms .table > tbody > tr:is(.ap-cms-head, .ap-cms-spacer) > * {
    --ap-color-line: var(--ap-color-border-neutral-subtle);
}

/* Bootstrap draws a 2px currentColor rule above the body. */
html body .ap-cms .table > :not(caption) {
    border: 0 !important;
}

html body .ap-cms .table > :is(thead, tbody) > tr {
    background-color: transparent !important;
}

.ap-cms .table > tbody > tr:last-child > * {
    border-bottom: 0;
}

/* curo.css paints header cells white, and sets <thead> cells larger (14px/20px) than other
 * cells (15px lines), all with !important. A header row further down (.ap-cms-head) starts a
 * part of the table with columns of its own, and looks the same as the table's first. */
html body .ap-cms .table > thead > tr > *,
html body .ap-cms .table > tbody > tr.ap-cms-head > * {
    padding-block: var(--ap-space-4);
    border-bottom: 1px solid var(--ap-color-border-neutral-subtle);
    background: var(--ap-color-elevation-surface-sunken-default) !important;
    font-size: 13px !important;
    line-height: 15px !important;
    font-weight: 700;
    color: var(--ap-color-text-bold);
    white-space: nowrap;
}

/* The last column's label may wrap ("Avtal om portföljförvaltning"), so the rows below keep
 * to one line. */
html body .ap-cms .table > thead > tr > :last-child,
html body .ap-cms .table > tbody > tr.ap-cms-head > :last-child {
    white-space: normal;
}

/* A note under a column's label: "inkl. moms", on a line of its own or after a line
 * break in superscript. */
.ap-cms .table > thead > tr > * > :is(small, sup),
.ap-cms .table > tbody > tr.ap-cms-head > * > :is(small, sup) {
    display: block;
    position: static;
    font-size: 11px;
    font-weight: 400;
    line-height: 14px;
    color: var(--ap-color-text-subtlest);
}

.ap-cms .table > tbody > tr:not(.ap-cms-head, .ap-cms-spacer, .ap-cms-group, .ap-cms-note):hover > * {
    background: var(--ap-color-background-action-subtlest);
}

/* A row with text in its first cell only heads a group of rows. */
.ap-cms .table > tbody > tr.ap-cms-group > * {
    padding-top: var(--ap-space-5);
    background: var(--ap-color-background-expressive-subtlest);
    font-weight: 700;
    color: var(--ap-color-text-bold);
}

/* Group rows in a row read as one band: a group and its subgroup ("Tilläggstjänst
 * Portföljförvaltning", then "ISK/R-Depå"). */
html body .ap-cms .table > tbody > tr.ap-cms-group:has(+ tr.ap-cms-group) > * {
    padding-bottom: var(--ap-space-2);
    border-bottom-color: transparent;
    --ap-color-line: transparent;
}

.ap-cms .table > tbody > tr.ap-cms-group + tr.ap-cms-group > * {
    padding-top: var(--ap-space-2);
}

/* A full-width row in italics is a note on the table. */
.ap-cms .table > tbody > tr.ap-cms-note > * {
    padding-block: var(--ap-space-5);
    font-size: 12px;
    color: var(--ap-color-text-subtle);
}

.ap-cms .table > tbody > tr.ap-cms-note p {
    max-width: none;
    margin: 0;
}

/* An empty row separates groups: a little air, no row. */
.ap-cms .table > tbody > tr.ap-cms-spacer > * {
    height: var(--ap-space-4);
    padding: 0;
    border-bottom: 1px solid var(--ap-color-border-neutral-subtle);
    background: var(--ap-color-elevation-surface-sunken-default);
}

/* Prices and fees line up digit for digit. A row of them reads on one line, its name included. */
.ap-cms .table .text-end {
    font-variant-numeric: tabular-nums;
}

.ap-cms .table > tbody > tr:not(.ap-cms-head) > .text-end,
.ap-cms .table > tbody > tr:not(.ap-cms-head):has(> .text-end) > :first-child {
    white-space: nowrap;
}

/* Document, report and mail links in tables are small buttons with an icon. */
html body .ap-cms .html .table td a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--ap-color-background-action-subtle);
    color: var(--ap-color-text-action);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

html body .ap-cms .html .table td a:hover {
    background: var(--ap-color-background-action-subtle-hover);
    text-decoration: none;
}

.ap-cms .table td a::before {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    background: currentColor;
    -webkit-mask: var(--ap-cms-icon) center / contain no-repeat;
    mask: var(--ap-cms-icon) center / contain no-repeat;
    --ap-cms-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E");
}

.ap-cms .table td a[href^="/Cms/Files/"]::before {
    --ap-cms-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11m0 0-4.5-4.5M12 15l4.5-4.5M5 20h14'/%3E%3C/svg%3E");
}

.ap-cms .table td a[href^="mailto:"]::before {
    --ap-cms-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E");
}

/* ---- Intro (accordion and link cards) --------------------------------------------- */

.ap-cms .ap-cms-intro {
    margin-bottom: var(--ap-space-7);
}

.ap-cms .ap-cms-intro p {
    max-width: 70ch;
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: var(--ap-color-text-subtle);
}

/* ---- Accordion ------------------------------------------------------------------------ */

.ap-cms .ap-accordion {
    display: flex;
    flex-direction: column;
    gap: var(--ap-space-3);
}

.ap-cms .ap-accordion_item {
    border: 1px solid var(--ap-color-border-neutral-subtle);
    border-radius: 12px;
    background: var(--ap-color-elevation-surface-default);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ap-cms .ap-accordion_item:hover {
    border-color: var(--ap-color-border-action);
}

.ap-cms .ap-accordion_item[open] {
    border-color: var(--ap-color-border-action);
    box-shadow: 0 4px 14px rgba(39, 18, 94, 0.06);
}

.ap-cms .ap-accordion_item > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ap-space-5);
    padding: var(--ap-space-5) var(--ap-space-6);
    font-size: 16px;
    font-weight: 600;
    color: var(--ap-color-text-bold);
    cursor: pointer;
    list-style: none;
    border-radius: 12px;
}

.ap-cms .ap-accordion_item > summary::-webkit-details-marker {
    display: none;
}

.ap-cms .ap-accordion_item > summary::after {
    content: "";
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ap-color-background-action-subtle) center / 12px no-repeat
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234309a4' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    transition: transform 0.2s ease;
}

.ap-cms .ap-accordion_item[open] > summary::after {
    transform: rotate(180deg);
}

.ap-cms .ap-accordion_item[open] > summary,
.ap-cms .ap-accordion_item > summary:hover {
    color: var(--ap-color-text-action);
}

.ap-cms .ap-accordion_item > summary:focus-visible {
    outline: 2px solid var(--ap-color-border-focus);
    outline-offset: 2px;
}

.ap-cms .ap-accordion_item > .html {
    padding: 0 var(--ap-space-6) var(--ap-space-6);
}

/* ---- Link cards ------------------------------------------------------------------------- */

.ap-cms .ap-cms-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--ap-space-6);
}

.ap-cms a.ap-cms-card {
    display: flex;
    flex-direction: column;
    gap: var(--ap-space-3);
    padding: var(--ap-space-6);
    border: 1px solid var(--ap-color-border-neutral-subtlest);
    border-radius: 16px;
    background: var(--ap-color-elevation-surface-default);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    color: var(--ap-color-text-text);
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

/* Play badge for video links, a generic arrow otherwise. */
.ap-cms a.ap-cms-card::before {
    content: "";
    width: 44px;
    height: 44px;
    margin-bottom: var(--ap-space-3);
    border-radius: 50%;
    background: var(--ap-color-background-expressive-subtlest) center / 18px no-repeat
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234309a4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E");
}

.ap-cms a.ap-cms-card[href*="youtube.com/"]::before,
.ap-cms a.ap-cms-card[href*="youtu.be/"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234309a4' d='M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z'/%3E%3C/svg%3E");
    background-position: 55% center;
}

.ap-cms a.ap-cms-card:hover {
    border-color: var(--ap-color-border-action);
    box-shadow: 0 10px 24px rgba(39, 18, 94, 0.1);
    transform: translateY(-2px);
    text-decoration: none;
}

.ap-cms a.ap-cms-card:focus-visible {
    outline: 2px solid var(--ap-color-border-focus);
    outline-offset: 2px;
}

.ap-cms .ap-cms-card_title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--ap-color-text-bold);
}

.ap-cms .ap-cms-card_text {
    flex: 1;
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ap-color-text-subtle);
}

.ap-cms .ap-cms-card_cta {
    margin-top: var(--ap-space-4);
    font-weight: 600;
    color: var(--ap-color-text-action);
}

.ap-cms a.ap-cms-card[target="_blank"] .ap-cms-card_cta::after {
    content: " \2197";
}

@media (prefers-reduced-motion: reduce) {
    .ap-cms a.ap-cms-card,
    .ap-cms .ap-accordion_item,
    .ap-cms .ap-accordion_item > summary::after {
        transition: none;
    }

    .ap-cms a.ap-cms-card:hover {
        transform: none;
    }
}

/* ---- Dark mode -------------------------------------------------------------------
 * curo.css re-declares some tokens on `html body.dark-mode .cms-section` with light-mode
 * values, so CMS text stays dark on the dark page (Piranha's pages were unreadable in
 * dark mode). Here those tokens take the page's own dark-mode values again. */

html body.dark-mode .ap-cms .cms-section {
    --ap-color-primary: inherit;
    --ap-color-white: inherit;
    --ap-color-background-neutral: inherit;
    --ap-color-background-action: inherit;
    --ap-color-text-bold: inherit;
    --ap-color-text-text: inherit;
    --ap-color-text-inverse: inherit;
    color: var(--ap-color-text-text);
}

/* The dark-mode action purple (#7749ff) is too dark for text on the dark page (about 3:1),
 * so links, table buttons and card links use the light expressive purple instead. */
html body.dark-mode .ap-cms,
html body.dark-mode .ap-cms .cms-section {
    --ap-color-text-action: var(--ap-color-text-expressive);
    --ap-color-text-action-hover: var(--ap-color-background-expressive-bolder);
}

/* The chevron, arrow and play icons are drawn in light-mode purple; redraw them light. */
html body.dark-mode .ap-cms .ap-accordion_item > summary::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23afa9f7' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

html body.dark-mode .ap-cms a.ap-cms-card::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23afa9f7' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E");
}

html body.dark-mode .ap-cms a.ap-cms-card[href*="youtube.com/"]::before,
html body.dark-mode .ap-cms a.ap-cms-card[href*="youtu.be/"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23afa9f7' d='M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z'/%3E%3C/svg%3E");
}

/* The illustrations are black line art, partly on transparent backgrounds; a faint light
 * edge keeps their outlines visible on the dark page. */
html body.dark-mode .ap-cms .ap-textimage_image img {
    filter: drop-shadow(0 0 0.5px var(--ap-color-text-subtle)) drop-shadow(0 0 0.5px var(--ap-color-text-subtle));
}

/* ---- Fund carousel (Curo's FundListCarouselContainer) -------------------------------
 * Shown without its dark gradient band: title, text and a clear button beside a row of
 * fund cards that fades out at both ends instead of being cut off. The row scrolls on
 * its own like before, pauses on hover, and can be scrolled by hand when motion is
 * reduced. */

.ap-cms .ap__fundcarousel {
    position: relative;
    align-items: center;
    gap: var(--ap-space-8);
}

.ap-cms .ap__fundcarousel::before,
.ap-cms .ap__fundcarousel::after {
    display: none;
}

.ap-cms .ap__fundcarousel_side {
    flex: 0 0 26%;
    gap: var(--ap-space-5);
}

/* A subheading: the section above usually introduces the fund marketplace. */
html body .ap-cms .ap__fundcarousel_side .ap__header {
    margin: 0;
    padding: 0 !important;
    font-size: 20px !important;
    font-weight: 700;
    line-height: 1.3 !important;
    color: var(--ap-color-text-bold);
}

.ap-cms .ap__fundcarousel_side p {
    margin: 0;
    color: var(--ap-color-text-subtle);
}

/* The link in the text is the section's call to action. */
html body .ap-cms .ap__fundcarousel_side a {
    display: inline-flex;
    align-items: center;
    gap: var(--ap-space-3);
    width: fit-content;
    padding: var(--ap-space-4) var(--ap-space-6);
    border-radius: 999px;
    background: var(--ap-color-background-action);
    color: var(--ap-color-text-on-dark);
    font-weight: 600;
    text-decoration: none;
}

html body .ap-cms .ap__fundcarousel_side a::after {
    content: "\2192";
}

html body .ap-cms .ap__fundcarousel_side a:hover {
    background: var(--ap-color-background-action-hover);
    color: var(--ap-color-text-on-dark);
}

/* The dark-mode hover purple is lighter and leaves white text at about 3:1. */
html body.dark-mode .ap-cms .ap__fundcarousel_side a:hover {
    background: var(--ap-color-background-expressive);
}

.ap-cms .ap__fundcarousel_list {
    flex: 1 1 auto;
    min-width: 0;
    padding-block: var(--ap-space-3);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 64px, #000 calc(100% - 64px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 64px, #000 calc(100% - 64px), transparent);
}

.ap-cms .ap__fundcarousel_list:hover .ap__fundcarousel_track {
    animation-play-state: paused;
}

html body .ap-cms .ap__fundcarousel .ap-btn-card {
    min-width: 280px !important;
    max-width: 280px;
    padding: var(--ap-space-6);
    border: 1px solid var(--ap-color-border-neutral-subtle);
    border-radius: 16px;
    background: var(--ap-color-elevation-surface-default);
    color: var(--ap-color-text-text);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

html body .ap-cms .ap__fundcarousel .ap-btn-card:hover {
    border-color: var(--ap-color-border-action);
    box-shadow: 0 8px 20px rgba(39, 18, 94, 0.1);
    background: var(--ap-color-elevation-surface-default);
}

.ap-cms .ap__fundcarousel .ap-btn-card dt {
    font-size: 12px;
    font-weight: 400;
    color: var(--ap-color-text-subtle);
}

.ap-cms .ap__fundcarousel .ap-btn-card dd {
    margin: 0;
    font-weight: 700;
    color: var(--ap-color-text-bold);
}

/* The fund name between the two rows of figures. */
.ap-cms .ap__fundcarousel .ap-btn-card > .d-flex {
    min-height: 64px !important;
    margin-block: var(--ap-space-4) !important;
    justify-content: center;
    border-color: var(--ap-color-border-neutral-subtle) !important;
    color: var(--ap-color-text-bold);
    font-size: 15px;
}

@media (max-width: 767px) {
    .ap-cms .ap__fundcarousel_side {
        flex-basis: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ap-cms .ap__fundcarousel_list {
        overflow-x: auto;
    }

    .ap-cms .ap__fundcarousel_track {
        animation: none;
    }
}

/* ---- Alpcot funds (Curo's AlpcotFunds widget) -------------------------------------
 * The widget puts its text card and two 300px fund cards in a wrapping row, which does
 * not fit the container, so the second fund wrapped onto a row of its own. Here: the
 * text across the top as a section heading and intro, the two funds side by side. */

.ap-cms section.d-flex:has(> .ap-btn-card) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ap-space-6);
}

html body .ap-cms section.d-flex:has(> .ap-btn-card) > .ap__card {
    grid-column: 1 / -1;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
}

html body .ap-cms section.d-flex:has(> .ap-btn-card) > .ap__card .ap__card_header {
    position: relative;
    margin: 0 0 var(--ap-space-6);
    padding: var(--ap-space-5) 0 0 !important;
    border: 0;
    background: none;
    font-size: 28px !important;
    font-weight: 800;
    line-height: 1.25 !important;
    color: var(--ap-color-text-bold);
}

html body .ap-cms section.d-flex:has(> .ap-btn-card) > .ap__card .ap__card_header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: var(--ap-color-border-expressive);
}

html body .ap-cms section.d-flex:has(> .ap-btn-card) > .ap__card .ap__card_header {
    overflow: visible;
}

.ap-cms section.d-flex:has(> .ap-btn-card) > .ap__card .ap__card_body {
    padding: 0;
    font-size: 15px;
    line-height: 1.65;
    color: var(--ap-color-text-text);
}

.ap-cms section.d-flex:has(> .ap-btn-card) > .ap__card .ap__card_body p {
    max-width: 100ch;
    margin: 0 0 var(--ap-space-5);
}

.ap-cms section.d-flex:has(> .ap-btn-card) > .ap__card .ap__card_body p:last-child {
    margin-bottom: 0;
}

html body .ap-cms section.d-flex:has(> .ap-btn-card) > .ap-btn-card {
    min-width: 0 !important;
    max-width: none;
    width: auto;
    padding: var(--ap-space-6);
    border: 1px solid var(--ap-color-border-neutral-subtle);
    border-radius: 16px;
    background: var(--ap-color-elevation-surface-default);
    color: var(--ap-color-text-text);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

html body .ap-cms section.d-flex:has(> .ap-btn-card) > .ap-btn-card:hover {
    border-color: var(--ap-color-border-action);
    box-shadow: 0 8px 20px rgba(39, 18, 94, 0.1);
    background: var(--ap-color-elevation-surface-default);
}

/* The card centres its content, which shrinks the chart to ApexCharts' default 300px;
 * stretched, the chart measures and fills the card's width. */
.ap-cms section.d-flex:has(> .ap-btn-card) > .ap-btn-card > span,
.ap-cms section.d-flex:has(> .ap-btn-card) > .ap-btn-card .text-start {
    align-self: stretch;
    width: 100%;
}

html body .ap-cms section.d-flex:has(> .ap-btn-card) > .ap-btn-card .ap__header {
    margin: 0 0 var(--ap-space-4);
    font-size: 20px !important;
    font-weight: 700;
    color: var(--ap-color-text-bold);
}

html body .ap-cms section.d-flex:has(> .ap-btn-card) > .ap-btn-card .ap__header-small {
    margin: var(--ap-space-5) 0 var(--ap-space-3);
    font-size: 13px !important;
    font-weight: 600;
    color: var(--ap-color-text-subtle);
}

@media (max-width: 767px) {
    .ap-cms section.d-flex:has(> .ap-btn-card) {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* The fund charts (ApexCharts) draw light-mode axis labels and gridlines; curo.css forces
 * the labels black with !important. */
html body.dark-mode .ap-cms .apexcharts-text,
html body.dark-mode .ap-cms .apexcharts-legend-text,
html body.dark-mode .ap-cms .apexcharts-title-text {
    fill: var(--ap-color-text-subtle) !important;
    color: var(--ap-color-text-subtle) !important;
}

html body.dark-mode .ap-cms .apexcharts-gridline {
    stroke: var(--ap-color-border-neutral-subtle) !important;
}
