/*
 * Campaign detail page.
 *
 * ─────────────────────────────────────────────────────────────────────────
 * The rule this file is built around: nothing reserves space it is not using.
 *
 * There is no min-height and no fixed height on any content section here. A
 * section sizes to what is in it, and a section with nothing in it is not
 * rendered at all — that decision lives in the Blade, because CSS cannot know
 * a dataset is empty. What CSS can do is make sure that when a section is
 * absent, the gap around it goes with it, which is why spacing is applied as
 * margin-top on siblings rather than padding on every block.
 * ─────────────────────────────────────────────────────────────────────────
 */

.cfp {
    --cfp-gap: clamp(1rem, 2vw, 1.5rem);
    --cfp-radius: 16px;
    --cfp-radius-sm: 10px;

    --cfp-surface: hsl(var(--white));
    --cfp-sunken: hsl(var(--base) / 0.04);
    --cfp-line: hsl(var(--border-color));
    --cfp-ink: hsl(var(--heading-color));
    --cfp-ink-soft: hsl(var(--body-color));

    /* The sticky header plus the sticky tab bar, so scrolling lands correctly. */
    --cfp-stick: 132px;

    --cfp-shadow: 0 1px 2px hsl(var(--black) / 0.04), 0 10px 28px hsl(var(--black) / 0.06);

    background: var(--cfp-sunken);
    padding-bottom: clamp(2.5rem, 5vw, 4rem);
    overflow-x: clip;
}

@media (max-width: 991.98px) {
    /* No sticky tab bar below desktop, so less offset is needed. */
    .cfp { --cfp-stick: 76px; }
}

/* ============================== Breadcrumbs ============================== */

.cfp-crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 1.1rem 0;
    font-size: 0.82rem;
    color: var(--cfp-ink-soft);
}

.cfp-crumbs a { color: var(--cfp-ink-soft); text-decoration: none; }
.cfp-crumbs a:hover { color: hsl(var(--base)); }

.cfp-crumbs li + li::before {
    content: "/";
    margin-right: 0.4rem;
    color: hsl(var(--border-color));
}

.cfp-crumbs [aria-current] { color: var(--cfp-ink); font-weight: 500; }

/* ================================== Hero ================================= */

/*
 | The page is one grid, not two.
 |
 | Hero, section nav, sections and sidebar are its four children. Stacked in
 | source order on a narrow screen; from 992px the first three take column one
 | and the sidebar spans all of them in column two.
 |
 | That span is what makes the sidebar sticky for real. Sticky is relative to
 | the element's containing block, and while the sidebar lived inside the hero
 | that block was only as tall as the hero itself — so it never moved, and its
 | own height left a void beside the shorter hero column.
 */
.cfp-layout {
    display: grid;
    gap: var(--cfp-gap);
    grid-template-columns: 1fr;
    align-items: start;
}

@media (min-width: 992px) {
    .cfp-layout {
        grid-template-columns: minmax(0, 1fr) 380px;
        /* Hero, then the sections. The rows are named so that -1 below has
           something real to count back from. */
        grid-template-rows: auto auto;
    }

    .cfp-layout > .cfp-hero { grid-column: 1; grid-row: 1; }
    .cfp-layout > .cfp-body { grid-column: 1; grid-row: 2; }

    /*
     | Spanning every row, and start-aligned rather than stretched: a grid
     | item stretched to fill its area has nowhere to travel, and sticky on a
     | stretched item does nothing at all.
     */
    .cfp-layout > .cfp-side {
        grid-column: 2;
        grid-row: 1 / -1;
        align-self: start;
    }

    /* The section nav takes a row of its own, when there is one to show. */
    .cfp-layout--nav { grid-template-rows: auto auto auto; }
    .cfp-layout--nav > .cfp-tabs { grid-column: 1; grid-row: 2; }
    .cfp-layout--nav > .cfp-body { grid-row: 3; }
}

/* The hero is now just the first block of the reading column. */
.cfp-hero {
    display: grid;
    gap: var(--cfp-gap);
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

.cfp-media {
    border-radius: var(--cfp-radius);
    overflow: hidden;
    background: var(--cfp-surface);
    box-shadow: var(--cfp-shadow);
}

/*
 | The image decides the shape of its own frame.
 |
 | This used to be a 16/9 box with `object-fit: cover`, which crops whatever
 | does not fit — and campaign images are mostly screenshots, which are rarely
 | 16/9. A phone screenshot lost both its sides; a tall one lost most of
 | itself. Nothing on this page needs every campaign's hero to be the same
 | shape, so nothing is cropped to make them so.
 |
 | No aspect-ratio means no reserved box either: the frame is exactly as tall
 | as the picture in it, capped so a very tall image cannot fill the screen
 | before a reader has seen the title.
 */
.cfp-media__main {
    display: block;
    position: relative;
    background: var(--cfp-sunken);
}

.cfp-media__main img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    /* Only reached once max-height clamps a tall image: fit it, never crop. */
    object-fit: contain;
}

/*
 | Opens the image viewer.
 |
 | Named .cfp-media__open, replacing an unused .cfp-media__zoom rule that
 | described the same affordance as an unlabelled circle. A labelled pill
 | says what it does and how many images there are, which a magnifier icon
 | on its own cannot.
 */
.cfp-media__open {
    position: absolute;
    right: 0.85rem;
    bottom: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border: 0;
    border-radius: 999px;
    background: hsl(var(--white) / 0.92);
    color: var(--cfp-ink);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.cfp-media__open:hover { background: hsl(var(--white) / 1); }

.cfp-media__open:focus-visible {
    outline: 2px solid hsl(var(--base));
    outline-offset: 2px;
}

/* Thumbnails scroll rather than wrap, so the strip never changes height. */
.cfp-thumbs {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.cfp-thumbs button {
    flex: 0 0 auto;
    width: 76px;
    aspect-ratio: 16 / 10;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    background: none;
    cursor: pointer;
}

.cfp-thumbs button[aria-current="true"] { border-color: hsl(var(--base)); }

/*
 | contain, not cover. A thumbnail is how a reader recognises which image
 | they are picking, and a cropped thumbnail of a tall screenshot is a strip
 | of its middle — indistinguishable from the next one.
 */
.cfp-thumbs img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: var(--cfp-sunken);
}

/* ---- Title block ---- */

.cfp-head { margin-top: 1.25rem; }

.cfp-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.cfp-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    background: hsl(var(--base) / 0.1);
    color: hsl(var(--base));
    text-decoration: none;
}

.cfp-title {
    font-family: var(--heading-font);
    font-size: clamp(1.5rem, 3.4vw, 2.35rem);
    line-height: 1.18;
    color: var(--cfp-ink);
    text-wrap: balance;
    margin: 0 0 0.6rem;
}

.cfp-tagline {
    color: var(--cfp-ink-soft);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
    max-width: 62ch;
}

/* ============================== Sticky tab bar =========================== */

.cfp-tabs {
    position: sticky;
    top: 68px;
    z-index: 20;
    margin-top: 1.5rem;
    background: var(--cfp-surface);
    border: 1px solid var(--cfp-line);
    border-radius: 999px;
    box-shadow: var(--cfp-shadow);
}

@media (max-width: 991.98px) {
    /* Below desktop the site header is not sticky, so neither is this. */
    .cfp-tabs { position: static; }
}

.cfp-tabs__scroll {
    display: flex;
    gap: 0.2rem;
    padding: 0.35rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.cfp-tabs__scroll::-webkit-scrollbar { display: none; }

.cfp-tabs__link {
    flex: 0 0 auto;
    padding: 0.6rem 1.05rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--cfp-ink-soft);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.cfp-tabs__link:hover { color: hsl(var(--base)); }

.cfp-tabs__link[aria-current="true"] {
    background: hsl(var(--base));
    color: hsl(var(--white));
}

.cfp-tabs__link:focus-visible {
    outline: 2px solid hsl(var(--base));
    outline-offset: 2px;
}

/* ================================ Layout ================================= */

.cfp-body {
    display: grid;
    gap: var(--cfp-gap);
    grid-template-columns: 1fr;
    margin-top: var(--cfp-gap);
    align-items: start;
}

/*
 | One column.
 |
 | This was 70/30 with nothing in the 30: the markup puts only <main> inside
 | it, so a 352px strip ran empty down the whole length of the campaign. The
 | sidebar that column was shaped for is now beside it in the page grid.
 */

/* ================================ Sections =============================== */

/*
 | Spacing is a top margin on the following section, never a fixed height or a
 | symmetrical padding. Remove a section and its space leaves with it, which is
 | the whole point — a hidden section must cost nothing.
 */
.cfp-section {
    background: var(--cfp-surface);
    border: 1px solid var(--cfp-line);
    border-radius: var(--cfp-radius);
    padding: clamp(1.15rem, 2.5vw, 1.85rem);
    scroll-margin-top: var(--cfp-stick);
}

.cfp-section + .cfp-section { margin-top: var(--cfp-gap); }

.cfp-section__title {
    font-family: var(--heading-font);
    font-size: 1.15rem;
    color: var(--cfp-ink);
    margin: 0 0 1rem;
}

.cfp-section__title:only-child { margin-bottom: 0; }

/* Rich text from the creator: keep it readable and inside its column. */
.cfp-prose { color: var(--cfp-ink-soft); line-height: 1.75; }
.cfp-prose > :last-child { margin-bottom: 0; }
.cfp-prose img { max-width: 100%; height: auto; border-radius: var(--cfp-radius-sm); }
.cfp-prose table { width: 100%; display: block; overflow-x: auto; }
.cfp-prose h1, .cfp-prose h2, .cfp-prose h3, .cfp-prose h4 {
    color: var(--cfp-ink);
    font-family: var(--heading-font);
}

/* ---- Read more ---- */

/*
 | Collapsed by a max-height, which is a cap rather than a reservation: short
 | content is unaffected and no space is held open for text that is not there.
 */
.cfp-clamp { position: relative; }

/* Positioned, so the fade below can anchor to the text rather than to the
   whole block — see the note on the gradient. */
.cfp-clamp__body { position: relative; }

.cfp-clamp[data-clamped="true"] .cfp-clamp__body {
    max-height: 22rem;
    overflow: hidden;
}

/*
 | The fade sits at the bottom of the clamped text.
 |
 | It used to be placed against .cfp-clamp with `bottom: 2.5rem`, a number
 | chosen to clear the button underneath — so growing the button pushed the
 | gradient up over it. Anchored to the body instead, and clipped by the same
 | overflow that does the clamping, it stays put whatever the button becomes.
 */
.cfp-clamp[data-clamped="true"] .cfp-clamp__body::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 5rem;
    background: linear-gradient(to bottom, transparent, var(--cfp-surface));
    pointer-events: none;
}

/* .cfp-clamp__more is styled with .cfp-more__btn, further down: the two are
   the same control in two places and are kept in one rule so they cannot
   drift apart again. */

/* ============================== Metric tiles ============================= */

.cfp-metrics {
    display: grid;
    gap: 1px;
    background: var(--cfp-line);
    border: 1px solid var(--cfp-line);
    border-radius: var(--cfp-radius);
    overflow: hidden;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) { .cfp-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .cfp-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.cfp-metric {
    background: var(--cfp-surface);
    padding: 1rem 0.85rem;
    text-align: center;
}

.cfp-metric__value {
    display: block;
    font-family: var(--heading-font);
    font-size: 1.15rem;
    line-height: 1.15;
    color: var(--cfp-ink);
    font-variant-numeric: tabular-nums;
}

.cfp-metric__label {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.74rem;
    color: var(--cfp-ink-soft);
}

/* ================================ Sidebar ================================ */

.cfp-side { display: grid; gap: var(--cfp-gap); }

@media (min-width: 992px) {
    .cfp-side {
        position: sticky;
        top: var(--cfp-stick);
        /*
         | Scroll the sidebar itself only if it is taller than the viewport,
         | so a long rewards list stays reachable without the column growing
         | a scrollbar it does not need.
         */
        max-height: calc(100vh - var(--cfp-stick) - 1rem);
        overflow-y: auto;
        scrollbar-width: thin;
    }
}

.cfp-card {
    background: var(--cfp-surface);
    border: 1px solid var(--cfp-line);
    border-radius: var(--cfp-radius);
    padding: 1.35rem;
}

.cfp-raised {
    font-family: var(--heading-font);
    font-size: 1.6rem;
    line-height: 1.1;
    color: hsl(var(--base));
    font-variant-numeric: tabular-nums;
}

.cfp-goal { font-size: 0.85rem; color: var(--cfp-ink-soft); }

.cfp-meter {
    height: 8px;
    border-radius: 999px;
    background: hsl(var(--base) / 0.12);
    overflow: hidden;
    margin: 0.85rem 0;
}

.cfp-meter__fill { height: 100%; border-radius: inherit; background: hsl(var(--base)); }
.cfp-meter__fill--done { background: hsl(var(--success)); }

.cfp-split2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 1rem 0;
}

.cfp-stat {
    background: var(--cfp-sunken);
    border-radius: var(--cfp-radius-sm);
    padding: 0.7rem;
    text-align: center;
}

.cfp-stat__value {
    display: block;
    font-family: var(--heading-font);
    font-size: 1.05rem;
    color: var(--cfp-ink);
    font-variant-numeric: tabular-nums;
}

.cfp-stat__label { font-size: 0.72rem; color: var(--cfp-ink-soft); }

/* ---- Countdown ---- */

.cfp-count {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.cfp-count__cell {
    background: var(--cfp-sunken);
    border-radius: 8px;
    padding: 0.5rem 0.25rem;
    text-align: center;
}

.cfp-count__n {
    display: block;
    font-family: var(--heading-font);
    font-size: 1.05rem;
    color: var(--cfp-ink);
    font-variant-numeric: tabular-nums;
}

.cfp-count__u {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cfp-ink-soft);
}

.cfp-count--over {
    grid-template-columns: 1fr;
    text-align: center;
    font-weight: 600;
    color: var(--cfp-ink-soft);
}

/* ============================== Mobile CTA bar =========================== */

/*
 | Fixed, and only below desktop. It is hidden until the sidebar's own button
 | has scrolled away, so the two are never on screen together.
 */
.cfp-dock {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1040;
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
    background: var(--cfp-surface);
    border-top: 1px solid var(--cfp-line);
    box-shadow: 0 -4px 20px hsl(var(--black) / 0.08);
    transform: translateY(110%);
    transition: transform 0.22s ease;
}

@media (max-width: 991.98px) { .cfp-dock { display: flex; } }

.cfp-dock[data-shown="true"] { transform: translateY(0); }

.cfp-dock__figures { flex: 1 1 auto; min-width: 0; }

.cfp-dock__raised {
    display: block;
    font-family: var(--heading-font);
    font-size: 0.98rem;
    color: var(--cfp-ink);
    line-height: 1.2;
}

.cfp-dock__sub {
    font-size: 0.74rem;
    color: var(--cfp-ink-soft);
}

.cfp-dock .cfx-btn { flex: 0 0 auto; }

/* Keep the last section clear of the docked bar. */
@media (max-width: 991.98px) {
    .cfp { padding-bottom: 5.5rem; }
}

/* ================================= Charts ================================ */

/*
 | Bounded so Chart.js has something to resize into. This is a chart canvas,
 | not a content section — the no-fixed-height rule is about not reserving
 | space for absent data, and a chart with no data is never rendered.
 */
.cfp-chart {
    position: relative;
    height: 260px;
    width: 100%;
}

@media (max-width: 575.98px) { .cfp-chart { height: 210px; } }

.cfp-legend {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cfp-legend li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.86rem;
    color: var(--cfp-ink-soft);
}

.cfp-legend__dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 3px;
    flex-shrink: 0;
}

.cfp-legend__label { flex: 1 1 auto; min-width: 0; }
.cfp-legend__val { font-weight: 600; color: var(--cfp-ink); font-variant-numeric: tabular-nums; }

/* =============================== Timeline ================================ */

.cfp-time {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1.6rem;
    position: relative;
}

.cfp-time::before {
    content: "";
    position: absolute;
    left: 0.42rem;
    top: 0.3rem;
    bottom: 0.3rem;
    width: 2px;
    background: var(--cfp-line);
}

.cfp-time__item { position: relative; padding-bottom: 1.35rem; }
.cfp-time__item:last-child { padding-bottom: 0; }

.cfp-time__item::before {
    content: "";
    position: absolute;
    left: -1.6rem;
    top: 0.28rem;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    background: var(--cfp-surface);
    border: 2px solid var(--cfp-line);
}

.cfp-time__item[data-state="done"]::before {
    background: hsl(var(--base));
    border-color: hsl(var(--base));
}

.cfp-time__item[data-state="now"]::before {
    border-color: hsl(var(--base));
    box-shadow: 0 0 0 4px hsl(var(--base) / 0.15);
}

.cfp-time__title {
    font-family: var(--heading-font);
    font-size: 0.96rem;
    color: var(--cfp-ink);
    margin: 0 0 0.2rem;
}

.cfp-time__meta { font-size: 0.78rem; color: var(--cfp-ink-soft); }
.cfp-time__text { font-size: 0.87rem; color: var(--cfp-ink-soft); margin: 0.35rem 0 0; line-height: 1.6; }

/* ============================== Empty states ============================= */

/*
 | Inline and compact. This is for a section that exists but is momentarily
 | empty — a campaign with no updates yet. A section with no data at all is
 | not rendered, so this is never a stand-in for a missing heading.
 */
.cfp-none {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.87rem;
    color: var(--cfp-ink-soft);
    margin: 0;
}

.cfp-none i { color: hsl(var(--base) / 0.55); }

/* =============================== Skeletons =============================== */

.cfp-skel {
    background: linear-gradient(90deg,
        hsl(var(--black) / 0.05) 25%,
        hsl(var(--black) / 0.09) 37%,
        hsl(var(--black) / 0.05) 63%);
    background-size: 400% 100%;
    animation: cfp-shimmer 1.3s ease infinite;
    border-radius: var(--cfp-radius-sm);
}

@keyframes cfp-shimmer {
    from { background-position: 100% 50%; }
    to   { background-position: 0 50%; }
}

/* ================================ Utilities ============================== */

.cfp-list { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }

.cfp-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--cfp-line);
}

.cfp-row:last-child { border-bottom: 0; padding-bottom: 0; }
.cfp-row:first-child { padding-top: 0; }

@media (prefers-reduced-motion: reduce) {
    .cfp-dock { transition: none; }
    .cfp-skel { animation: none; }
    html { scroll-behavior: auto !important; }
}

/* ------------------------- Budget, line by line --------------------------
   |
   | The chart says how the money splits; this says what each slice pays for.
   | One line open at a time, so the section stays the length of the list plus
   | one panel rather than growing with every campaign that itemises properly.
   -------------------------------------------------------------------------- */

.cfp-detail {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--cfp-line, #e4eae6);
    border-radius: 12px;
    overflow: hidden;
}

.cfp-detail__item + .cfp-detail__item {
    border-top: 1px solid var(--cfp-line, #e4eae6);
}

.cfp-detail__head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: none;
    border: 0;
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: background-color 140ms ease;
}

.cfp-detail__head:hover,
.cfp-detail__head[aria-expanded='true'] {
    background-color: hsl(var(--base) / 0.05);
}

.cfp-detail__head:focus-visible {
    outline: 2px solid hsl(var(--base));
    outline-offset: -2px;
}

.cfp-detail__label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.cfp-detail__pct {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.9rem;
}

.cfp-detail__chev {
    flex: 0 0 auto;
    font-size: 1rem;
    opacity: 0.55;
    transition: transform 140ms ease;
}

.cfp-detail__head[aria-expanded='true'] .cfp-detail__chev {
    transform: rotate(180deg);
}

.cfp-detail__panel {
    padding: 2px 14px 16px 34px;
}

.cfp-detail__dl {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
    margin: 0 0 10px;
}

.cfp-detail__dl dt {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.65;
    font-weight: 600;
    margin-bottom: 2px;
}

.cfp-detail__dl dd {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.cfp-detail__note {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.cfp-detail__total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 12px 2px 0;
    font-size: 0.9rem;
}

.cfp-detail__total strong {
    font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
    .cfp-detail__head,
    .cfp-detail__chev { transition: none; }
}

/* =============================== Earnings ================================
   What the project has made, as one sentence and one bar.

   The bar is a proportion of revenue, not a chart: two segments whose widths
   are set inline because they are the only genuinely dynamic values on the
   page. It has no fixed height of its own beyond its own thickness, and the
   whole block renders only when there are settled figures to put in it -- a
   campaign that has reported nothing shows nothing here rather than an empty
   frame.

   Colour is not the only carrier: each segment is named in the key beneath
   with its amount and its share, and the bar itself has an aria-label saying
   the same thing in words.
   ========================================================================= */

.cfp-earn {
    margin-bottom: var(--cfp-gap);
}

.cfp-earn__lead {
    margin: 0 0 .9rem;
    font-size: .95rem;
    line-height: 1.6;
}

.cfp-earn__bar {
    display: flex;
    width: 100%;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: hsl(var(--border-color) / .5);
}

.cfp-earn__seg { display: block; height: 100%; }

.cfp-earn__seg--cost { background: hsl(0 100% 63% / .75); }
.cfp-earn__seg--net  { background: hsl(var(--base)); }

.cfp-earn__key {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.4rem;
    margin: .7rem 0 0;
    padding: 0;
    list-style: none;
    font-size: .88rem;
}

.cfp-earn__key li { display: flex; align-items: center; gap: .45rem; }

.cfp-earn__dot--cost { background: hsl(0 100% 63% / .75); }
.cfp-earn__dot--net  { background: hsl(var(--base)); }

.cfp-earn__caveat {
    margin: .8rem 0 0;
    font-size: .82rem;
}


/* ============================== Image viewer ============================= */

/*
 | Full-screen, fixed, and above everything. There is no height reserved
 | anywhere: the dialog does not exist in the layout until it is opened, and
 | `hidden` on the element is what closes it.
 */
.cfp-shots {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: grid;
    place-items: center;
    background: hsl(0 0% 4% / 0.92);
}

.cfp-shots[hidden] { display: none; }

/* The window the track slides inside. */
.cfp-shots__stage {
    width: min(100%, 1180px);
    overflow: hidden;
}

.cfp-shots__track {
    display: flex;
    transition: transform 0.32s ease;
}

.cfp-shots__slide {
    flex: 0 0 100%;
    display: grid;
    place-items: center;
    padding: 1rem;
}

/*
 | The image is capped by the viewport, not by a fixed size: a tall
 | screenshot and a wide one both fit whole, and neither is cropped to suit
 | the other.
 */
.cfp-shots__slide img {
    max-width: 100%;
    max-height: 82vh;
    width: auto;
    height: auto;
    /*
     | The literal, not var(--cfp-radius-sm). The tokens are declared on .cfp
     | and inherit to its descendants, and the viewer is appended to <body> so
     | that .cfp's `overflow-x: clip` cannot crop a fixed-position dialog. It
     | therefore sits outside the token scope, where the variable resolves to
     | nothing and the whole declaration is dropped.
     */
    border-radius: 10px;
}

.cfp-shots__close,
.cfp-shots__nav {
    position: absolute;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 50%;
    background: hsl(0 0% 100% / 0.14);
    color: hsl(0 0% 100%);
    font-size: 1.2rem;
    cursor: pointer;
}

.cfp-shots__close:hover,
.cfp-shots__nav:hover { background: hsl(0 0% 100% / 0.26); }

.cfp-shots__close:focus-visible,
.cfp-shots__nav:focus-visible {
    outline: 2px solid hsl(0 0% 100%);
    outline-offset: 2px;
}

.cfp-shots__close { top: 1rem; right: 1rem; }
.cfp-shots__nav--prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.cfp-shots__nav--next { right: 1rem; top: 50%; transform: translateY(-50%); }

.cfp-shots__count {
    position: absolute;
    bottom: 1rem;
    margin: 0;
    color: hsl(0 0% 100% / 0.75);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

/* The page behind the viewer must not scroll under it. */
.cfp-noscroll { overflow: hidden; }

@media (max-width: 575.98px) {
    .cfp-shots__nav { width: 2.25rem; height: 2.25rem; }
    .cfp-shots__nav--prev { left: 0.35rem; }
    .cfp-shots__nav--next { right: 0.35rem; }
    .cfp-shots__slide { padding: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .cfp-shots__track { transition: none; }
}

/* ============================ Fetched sections =========================== */

/*
 | An excerpt with the rest a click away. No fade and no clamp on THAT one:
 | unlike .cfp-clamp, the remaining text is genuinely not on the page yet, so
 | suggesting it is behind a gradient would be a lie about where it lives.
 */

/*
 | A button, not a tinted word.
 |
 | Both controls that reveal more text share this rule: "View more" under a
 | policy excerpt, and "Read more" under the clamped description. They were
 | two different things on the same page for no reason -- one a plain tinted
 | word, one a button -- and a reader who learned to look for one had to learn
 | the other separately.
 |
 | One selector rather than two rules, so they cannot drift apart again.
 */
.cfp-more__btn,
.cfp-clamp__more {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 1rem;
    padding: 0.68rem 1.3rem;
    border: 1px solid hsl(var(--base));
    border-radius: 999px;
    /*
     | Filled from the start, not on hover.
     |
     | A faint tint that only becomes the accent colour when the pointer
     | arrives is invisible to anyone who has not already found the control —
     | which is the whole problem it was meant to solve, and no help at all on
     | a touch screen, where there is no hover state to discover.
     */
    background: hsl(var(--base));
    color: hsl(var(--white));
    font-weight: 600;
    /*
     | Not smaller than the body text it sits under. At 0.92rem it was a
     | fraction under the surrounding prose, which is exactly the size
     | relationship that makes a control read as a footnote.
     */
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    /* Buttons do not inherit the page font; the anchor does, so without this
       the two controls would be the same size in different typefaces. */
    font-family: inherit;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

/*
 | Hover deepens the same colour rather than introducing one.
 |
 | Done with lightness off --base-l rather than a filter, so the shift lands
 | on the button's own hue whatever accent the site is themed with.
 */
.cfp-more__btn:hover,
.cfp-more__btn:focus-visible,
.cfp-clamp__more:hover,
.cfp-clamp__more:focus-visible {
    background: hsl(var(--base-h) var(--base-s) calc(var(--base-l) - 8%));
    border-color: hsl(var(--base-h) var(--base-s) calc(var(--base-l) - 8%));
    color: hsl(var(--white));
    text-decoration: none;
}

.cfp-more__btn:focus-visible,
.cfp-clamp__more:focus-visible {
    outline: 2px solid hsl(var(--base));
    outline-offset: 2px;
}

/* The chevron leans down, towards the text it is about to reveal. */
.cfp-more__btn .las,
.cfp-clamp__more .las { font-size: 1rem; transition: transform 0.18s ease; }

/* Once the description is open, the chevron points back the way it came. */
.cfp-clamp__more[aria-expanded="true"] .las { transform: rotate(180deg); }

@media (prefers-reduced-motion: reduce) {
    .cfp-more__btn,
    .cfp-clamp__more,
    .cfp-clamp__more .las { transition: none; }
}

.cfp-more__btn[aria-busy="true"] {
    opacity: 0.6;
    cursor: progress;
}

.cfp-more__btn[aria-busy="true"] .las { display: none; }
