/*
 * Crowdfunding homepage design system.
 *
 * Everything here draws its colour from the tokens the theme already
 * publishes -- --base comes from color.php, so an admin changing the accent
 * moves this page with it, and switching back to a HYIPLAB skin never loads
 * this file at all. No literal colours; that is what keeps the theme switch
 * presentation-only.
 *
 * The scale below is the whole type and spacing system for the page. Sections
 * compose from it rather than setting their own sizes, which is what stops a
 * long page drifting into a dozen slightly different paddings.
 */

.cfx {
    --cfx-gap: clamp(1rem, 2vw, 1.5rem);
    --cfx-section-y: clamp(3.5rem, 7vw, 6.5rem);
    --cfx-radius: 16px;
    --cfx-radius-sm: 10px;

    /* Neutral surfaces derived from the theme, so both grounds stay coherent. */
    --cfx-surface: hsl(var(--white));
    --cfx-sunken: hsl(var(--base) / 0.04);
    --cfx-line: hsl(var(--border-color));
    --cfx-ink: hsl(var(--heading-color));
    --cfx-ink-soft: hsl(var(--body-color));

    --cfx-shadow: 0 1px 2px hsl(var(--black) / 0.04), 0 12px 32px hsl(var(--black) / 0.06);
    --cfx-shadow-lift: 0 2px 4px hsl(var(--black) / 0.05), 0 20px 48px hsl(var(--black) / 0.1);
}

/* ============================== Section shell ============================= */

.cfx-section {
    padding-block: var(--cfx-section-y);
    position: relative;
}

.cfx-section--sunken {
    background: var(--cfx-sunken);
}

.cfx-section--ink {
    background: hsl(var(--base-two));
    color: hsl(var(--white) / 0.75);
}

.cfx-section--ink .cfx-head__title,
.cfx-section--ink .cfx-stat__value {
    color: hsl(var(--white));
}

/* ---- Section heading system ---- */

.cfx-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--cfx-gap);
    flex-wrap: wrap;
    margin-bottom: clamp(1.75rem, 3vw, 2.75rem);
}

.cfx-head__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: hsl(var(--base));
    margin-bottom: 0.75rem;
}

.cfx-head__eyebrow::before {
    content: "";
    width: 1.75rem;
    height: 2px;
    background: hsl(var(--base));
}

.cfx-head__title {
    font-family: var(--heading-font);
    font-size: clamp(1.6rem, 3.4vw, 2.5rem);
    line-height: 1.15;
    color: var(--cfx-ink);
    text-wrap: balance;
    margin: 0;
}

.cfx-head__sub {
    color: var(--cfx-ink-soft);
    margin: 0.65rem 0 0;
    max-width: 56ch;
}

.cfx-head__aside {
    flex-shrink: 0;
}

/* ================================= Buttons ================================ */

.cfx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.85rem 1.6rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease,
        border-color 0.18s ease, color 0.18s ease;
}

.cfx-btn:hover { transform: translateY(-1px); }
.cfx-btn:focus-visible {
    outline: 2px solid hsl(var(--base));
    outline-offset: 3px;
}

.cfx-btn--primary {
    background: hsl(var(--base));
    color: hsl(var(--white));
}
.cfx-btn--primary:hover {
    background: hsl(var(--base-d-200));
    color: hsl(var(--white));
}

.cfx-btn--ghost {
    border-color: var(--cfx-line);
    color: var(--cfx-ink);
    background: var(--cfx-surface);
}
.cfx-btn--ghost:hover {
    border-color: hsl(var(--base));
    color: hsl(var(--base));
}

.cfx-btn--onink {
    border-color: hsl(var(--white) / 0.25);
    color: hsl(var(--white));
    background: transparent;
}
.cfx-btn--onink:hover {
    background: hsl(var(--white) / 0.1);
    color: hsl(var(--white));
}

.cfx-btn--sm { padding: 0.6rem 1.15rem; font-size: 0.85rem; }
.cfx-btn--block { width: 100%; }

/* ============================== Link with arrow =========================== */

.cfx-more {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: hsl(var(--base));
    text-decoration: none;
}
.cfx-more i { transition: transform 0.18s ease; }
.cfx-more:hover { color: hsl(var(--base-d-200)); }
.cfx-more:hover i { transform: translateX(3px); }

/* ================================== Hero ================================== */

.cfx-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(60% 90% at 85% 10%, hsl(var(--base) / 0.13), transparent 60%),
        radial-gradient(50% 70% at 5% 90%, hsl(var(--base) / 0.08), transparent 60%),
        hsl(var(--white));
    padding-block: clamp(3rem, 7vw, 6rem) clamp(3.5rem, 8vw, 7rem);
}

.cfx-hero__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(2.5rem, 5vw, 4rem);
    align-items: center;
}

@media (min-width: 992px) {
    .cfx-hero__grid { grid-template-columns: 1.05fr 0.95fr; }
}

.cfx-hero__title {
    font-family: var(--heading-font);
    font-size: clamp(2.1rem, 5.2vw, 3.9rem);
    line-height: 1.06;
    letter-spacing: -0.01em;
    color: var(--cfx-ink);
    text-wrap: balance;
    margin: 0 0 1.15rem;
}

.cfx-hero__title em {
    font-style: normal;
    color: hsl(var(--base));
}

.cfx-hero__lead {
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    line-height: 1.65;
    color: var(--cfx-ink-soft);
    max-width: 54ch;
    margin: 0 0 2rem;
}

.cfx-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-bottom: 2.5rem;
}

/* ---- The IDEA → FUND → BUILD → LAUNCH → GROW ribbon ---- */

.cfx-flow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.55rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.cfx-flow__step {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--cfx-ink-soft);
}

.cfx-flow__step::after {
    content: "\f061"; /* fa arrow-right */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 0.6rem;
    color: hsl(var(--base) / 0.5);
}

.cfx-flow__step:last-child::after { content: none; }

.cfx-flow__step--now {
    color: hsl(var(--base));
}

/* ---- Hero art: the illustration, its accents, and real campaign figures --- */

/*
 | The illustration sets the height of this column, so there is no min-height
 | here and none in the wide-screen block below either. The previous version
 | held 340px/430px open because it had nothing but absolutely-positioned
 | cards inside it and would otherwise have collapsed to nothing; an image
 | with intrinsic proportions makes the column exactly as tall as its content.
 */
.cfx-hero__art {
    position: relative;
}

.cfx-hero__illus {
    position: relative;
    width: 100%;
    max-width: 31rem;
    margin-inline: auto;
}

.cfx-hero__illus img {
    display: block;
    width: 100%;
    height: auto;
}

/*
 | The drifting accents.
 |
 | The wave artwork is applied as a mask over a solid fill rather than dropped
 | in as an <img>, so the colour comes from the site's accent token: change
 | base_color in General Setting and these follow it. A flat PNG would stay
 | the colour it was drawn in and clash the moment anyone touched that field.
 */
.cfx-hero__wave {
    position: absolute;
    width: 7rem;
    height: 1.4rem;
    background-color: hsl(var(--base));
    opacity: 0.5;
    pointer-events: none;
    -webkit-mask-image: url("../images/thumbs/hero-wave.png");
    mask-image: url("../images/thumbs/hero-wave.png");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    animation: cfx-drift 6s linear infinite;
}

/* Kept clear of the campaign card that sits over the top-left corner. */
.cfx-hero__wave--a { top: 27%;    left: 0;    animation-delay: 0s; }
.cfx-hero__wave--b { top: 9%;     right: 1%;  animation-delay: 1s; }
.cfx-hero__wave--c { bottom: 36%; left: 10%;  animation-delay: 2s; }

@keyframes cfx-drift {
    0%, 100% { transform: translateX(0); }
    50%      { transform: translateX(40%); }
}

/* On a phone they crowd the artwork instead of decorating it. */
@media (max-width: 575.98px) {
    .cfx-hero__wave { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .cfx-hero__wave { animation: none; }
}

/* ---- The figures laid over it: a real campaign, and real platform totals -- */

.cfx-float {
    background: var(--cfx-surface);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
    box-shadow: var(--cfx-shadow);
    padding: 1.1rem;
}

.cfx-float--lead { position: relative; z-index: 2; }

.cfx-float--stat {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1.15rem;
}

.cfx-float__icon {
    width: 2.6rem;
    height: 2.6rem;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: hsl(var(--base) / 0.12);
    color: hsl(var(--base));
    font-size: 1.05rem;
}

.cfx-float__value {
    font-family: var(--heading-font);
    font-size: 1.2rem;
    line-height: 1.1;
    color: var(--cfx-ink);
}

.cfx-float__label {
    font-size: 0.78rem;
    color: var(--cfx-ink-soft);
}

/*
 | Wide screens lay the cards over the illustration for depth; below that they
 | stack under it as an ordinary column. Absolute positioning at small sizes is
 | what produces overlapping text on phones, so it is scoped to where there is
 | room for it.
 */
@media (min-width: 992px) {
    .cfx-hero__art .cfx-float--a {
        position: absolute;
        left: 0;
        top: 0;
        width: min(18rem, 64%);
    }
    .cfx-hero__art .cfx-float--b {
        position: absolute;
        right: 0;
        top: 34%;
        width: min(15rem, 54%);
        z-index: 3;
    }
    .cfx-hero__art .cfx-float--c {
        position: absolute;
        right: 0;
        bottom: 2%;
        width: min(15rem, 54%);
        z-index: 3;
    }
}

@media (max-width: 991.98px) {
    .cfx-hero__art {
        display: grid;
        gap: 1rem;
    }

    /* The artwork keeps its place at the top of the stack. */
    .cfx-hero__illus { margin-bottom: 0.5rem; }
}

/* =============================== Stat strip ============================== */

.cfx-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--cfx-line);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
    overflow: hidden;
}

@media (min-width: 576px) { .cfx-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 992px) { .cfx-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.cfx-stat {
    background: var(--cfx-surface);
    padding: clamp(1.1rem, 2.4vw, 1.75rem) 1rem;
    text-align: center;
}

.cfx-stat__value {
    font-family: var(--heading-font);
    font-size: clamp(1.35rem, 2.6vw, 1.9rem);
    line-height: 1.1;
    color: var(--cfx-ink);
    font-variant-numeric: tabular-nums;
    display: block;
}

.cfx-stat__label {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--cfx-ink-soft);
    line-height: 1.35;
}

/* ============================= Campaign card ============================= */

.cfx-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--cfx-surface);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cfx-card:hover {
    transform: translateY(-4px);
    border-color: hsl(var(--base) / 0.45);
    box-shadow: var(--cfx-shadow-lift);
}

.cfx-card:focus-within {
    border-color: hsl(var(--base));
    box-shadow: var(--cfx-shadow-lift);
}

.cfx-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--cfx-sunken);
}

.cfx-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.cfx-card:hover .cfx-card__media img { transform: scale(1.04); }

.cfx-card__tags {
    position: absolute;
    inset: auto auto 0.75rem 0.75rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    max-width: calc(100% - 1.5rem);
}

.cfx-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    background: hsl(var(--white) / 0.94);
    color: var(--cfx-ink);
    text-decoration: none;
    backdrop-filter: blur(4px);
}

.cfx-tag--accent { background: hsl(var(--base)); color: hsl(var(--white)); }

.cfx-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.25rem;
    flex: 1 1 auto;
}

.cfx-card__title {
    font-family: var(--heading-font);
    font-size: 1.08rem;
    line-height: 1.35;
    margin: 0;
}

.cfx-card__title a {
    color: var(--cfx-ink);
    text-decoration: none;
}
.cfx-card__title a:hover { color: hsl(var(--base)); }

.cfx-card__desc {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--cfx-ink-soft);
    margin: 0;
}

.cfx-card__by {
    font-size: 0.8rem;
    color: var(--cfx-ink-soft);
}
.cfx-card__by a { color: hsl(var(--base)); text-decoration: none; }

.cfx-card__foot {
    margin-top: auto;
    padding-top: 0.25rem;
}

/* ---- Progress ---- */

.cfx-meter {
    height: 7px;
    border-radius: 999px;
    background: hsl(var(--base) / 0.12);
    overflow: hidden;
}

.cfx-meter__fill {
    height: 100%;
    border-radius: inherit;
    background: hsl(var(--base));
    transition: width 0.6s ease;
}

.cfx-meter__fill--done { background: hsl(var(--success)); }

.cfx-figures {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.7rem;
}

.cfx-figure__value {
    font-family: var(--heading-font);
    font-size: 1rem;
    color: var(--cfx-ink);
    font-variant-numeric: tabular-nums;
    display: block;
    line-height: 1.2;
}

.cfx-figure__label {
    font-size: 0.72rem;
    color: var(--cfx-ink-soft);
}

.cfx-figure--end { text-align: right; }

.cfx-metaline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--cfx-ink-soft);
    border-top: 1px solid var(--cfx-line);
    margin-top: 1rem;
    padding-top: 0.85rem;
}

.cfx-metaline i { color: hsl(var(--base)); }

/* ============================== Card grid ================================ */

/*
 | One column on phones, two on tablets, three from desktop and four on wide
 | screens -- the brief's requirement, expressed once here so no section has to
 | repeat a column class and none can disagree.
 */
.cfx-grid {
    display: grid;
    gap: var(--cfx-gap);
    grid-template-columns: 1fr;
}

@media (min-width: 576px) { .cfx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .cfx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .cfx-grid--wide { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ============================ Empty / states ============================= */

.cfx-empty {
    border: 1px dashed var(--cfx-line);
    border-radius: var(--cfx-radius);
    padding: clamp(2rem, 5vw, 3.5rem) 1.5rem;
    text-align: center;
    color: var(--cfx-ink-soft);
}

.cfx-empty__icon {
    font-size: 2rem;
    color: hsl(var(--base) / 0.5);
    margin-bottom: 0.75rem;
}

/* ============================== Lifecycle ================================ */

.cfx-flowline {
    display: grid;
    gap: 1px;
    background: var(--cfx-line);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
    overflow: hidden;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) { .cfx-flowline { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .cfx-flowline { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

.cfx-node {
    background: var(--cfx-surface);
    padding: 1.35rem 1rem;
    text-align: center;
}

.cfx-node__dot {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 0.7rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: hsl(var(--base) / 0.1);
    color: hsl(var(--base));
    font-size: 1rem;
}

.cfx-node__step {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: hsl(var(--base));
    margin-bottom: 0.3rem;
}

.cfx-node__label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--cfx-ink);
    line-height: 1.35;
}

.cfx-node__hint {
    font-size: 0.76rem;
    color: var(--cfx-ink-soft);
    margin-top: 0.25rem;
    line-height: 1.45;
}

/* ============================== Info blocks ============================== */

.cfx-info {
    display: flex;
    gap: 1rem;
    padding: 1.4rem;
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
    background: var(--cfx-surface);
    height: 100%;
}

.cfx-info__icon {
    flex-shrink: 0;
    width: 2.9rem;
    height: 2.9rem;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: hsl(var(--base) / 0.1);
    color: hsl(var(--base));
    font-size: 1.2rem;
}

.cfx-info__title {
    font-family: var(--heading-font);
    font-size: 1rem;
    color: var(--cfx-ink);
    margin: 0 0 0.35rem;
}

.cfx-info__text {
    font-size: 0.87rem;
    line-height: 1.6;
    color: var(--cfx-ink-soft);
    margin: 0;
}

/* ============================== Category chips =========================== */

.cfx-cats {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) { .cfx-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .cfx-cats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.cfx-cat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius-sm);
    background: var(--cfx-surface);
    color: var(--cfx-ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: border-color 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.cfx-cat:hover {
    border-color: hsl(var(--base));
    color: hsl(var(--base));
    transform: translateY(-2px);
}

.cfx-cat__count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cfx-ink-soft);
    background: var(--cfx-sunken);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-variant-numeric: tabular-nums;
}

/* ================================ Split CTA ============================== */

.cfx-split {
    display: grid;
    gap: clamp(2rem, 5vw, 3.5rem);
    align-items: center;
    grid-template-columns: 1fr;
}

@media (min-width: 992px) { .cfx-split { grid-template-columns: 1fr 1fr; } }

.cfx-checks {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    display: grid;
    gap: 0.7rem;
}

.cfx-checks li {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    color: var(--cfx-ink-soft);
    font-size: 0.93rem;
    line-height: 1.55;
}

.cfx-checks i {
    color: hsl(var(--base));
    margin-top: 0.2rem;
    flex-shrink: 0;
}

/* ================================== FAQ ================================== */

.cfx-faq { display: grid; gap: 0.75rem; }

.cfx-faq__item {
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius-sm);
    background: var(--cfx-surface);
    overflow: hidden;
}

.cfx-faq__q {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.3rem;
    background: none;
    border: 0;
    text-align: left;
    font-family: var(--heading-font);
    font-size: 0.98rem;
    color: var(--cfx-ink);
    cursor: pointer;
}

/* The disclosure is a <details>, so the native marker is replaced by our own. */
.cfx-faq__q { list-style: none; }
.cfx-faq__q::-webkit-details-marker { display: none; }
.cfx-faq__q::marker { content: ""; }

.cfx-faq__q:focus-visible {
    outline: 2px solid hsl(var(--base));
    outline-offset: -2px;
}

.cfx-faq__q i { color: hsl(var(--base)); transition: transform 0.2s ease; flex-shrink: 0; }
.cfx-faq__item[open] .cfx-faq__q i { transform: rotate(180deg); }

.cfx-faq__a {
    padding: 0 1.3rem 1.25rem;
    color: var(--cfx-ink-soft);
    font-size: 0.9rem;
    line-height: 1.65;
}

/* =============================== Final CTA =============================== */

.cfx-finale {
    text-align: center;
    border-radius: var(--cfx-radius);
    padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.25rem, 4vw, 3rem);
    background:
        radial-gradient(70% 120% at 50% 0%, hsl(var(--base) / 0.28), transparent 65%),
        hsl(var(--base-two));
}

.cfx-finale__title {
    font-family: var(--heading-font);
    font-size: clamp(1.7rem, 4vw, 2.7rem);
    line-height: 1.15;
    color: hsl(var(--white));
    text-wrap: balance;
    margin: 0 0 0.9rem;
}

.cfx-finale__sub {
    color: hsl(var(--white) / 0.7);
    max-width: 52ch;
    margin: 0 auto 2rem;
}

.cfx-finale__actions {
    display: flex;
    gap: 0.85rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========================= Load More / async states ====================== */

/*
 | The interaction layer for the discovery rails: the button, the placeholder
 | cards shown while a page is in flight, and the toast that explains a
 | failure.
 |
 | The governing rule is the same one the campaign page follows -- nothing
 | here reserves space it is not currently using. There is no fixed height on
 | the button row, no empty toast rail parked at the corner of the viewport,
 | and no skeleton in the markup: the skeletons are created when a request
 | starts and removed when it settles, so a failed request leaves the grid the
 | exact height it was.
 */

.cfx-more-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: clamp(1.75rem, 4vw, 2.75rem);
}

.cfx-loadmore {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.85rem;
    border: 1px solid var(--cfx-line);
    border-radius: 999px;
    background: var(--cfx-surface);
    color: var(--cfx-ink);
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.cfx-loadmore:hover,
.cfx-loadmore:focus-visible {
    border-color: hsl(var(--base));
    color: hsl(var(--base-d-200));
    background: hsl(var(--base) / 0.06);
}

/*
 | Loading. aria-disabled rather than the disabled attribute, because an
 | anchor cannot be disabled and because the control must stay focusable --
 | taking focus off the element someone just activated drops them back to the
 | top of the document.
 */
.cfx-loadmore[aria-disabled='true'] {
    cursor: progress;
    color: var(--cfx-ink-soft);
}

.cfx-spinner {
    display: none;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: cfx-spin 0.7s linear infinite;
}

.cfx-loadmore.is-loading .cfx-spinner { display: inline-block; }

@keyframes cfx-spin { to { transform: rotate(360deg); } }

/* The end-of-rail sentence that replaces the button, and the live region. */
.cfx-feed-done,
.cfx-feed-status {
    margin: 0;
    color: var(--cfx-ink-soft);
    font-size: 0.925rem;
    text-align: center;
}

/*
 | The live region carries text only for as long as a screen reader needs to
 | announce it, and it is empty the rest of the time. :empty keeps it from
 | occupying a line when it has nothing to say.
 */
.cfx-feed-status:empty { display: none; }

/* ------------------------------- Skeletons ------------------------------- */

/*
 | Shaped like a real card so the grid does not reflow when the real ones
 | arrive. Heights here are on the placeholder's own bars, never on a
 | container that outlives the request.
 */
.cfx-skeleton {
    pointer-events: none;
    overflow: hidden;
    /* The shimmer below is absolutely positioned against this, not the page. */
    position: relative;
}

.cfx-skeleton__media {
    aspect-ratio: 400 / 250;
    background: hsl(var(--base) / 0.07);
}

.cfx-skeleton__body {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 1.25rem;
}

.cfx-skeleton__line,
.cfx-skeleton__bar {
    display: block;
    border-radius: 6px;
    background: hsl(var(--base) / 0.07);
}

.cfx-skeleton__line { height: 0.7rem; }
.cfx-skeleton__line--title { height: 1.05rem; width: 78%; }
.cfx-skeleton__line--short { width: 45%; }
.cfx-skeleton__bar { height: 0.45rem; border-radius: 999px; margin-top: 0.35rem; }

/* One shimmer across the whole card, rather than each bar pulsing alone. */
.cfx-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        hsl(var(--white) / 0.65),
        transparent
    );
    transform: translateX(-100%);
    animation: cfx-shimmer 1.35s ease-in-out infinite;
}

@keyframes cfx-shimmer { to { transform: translateX(100%); } }

/* Cards fade up as they land, so appended content reads as arriving. */
.cfx-card--entering {
    opacity: 0;
    transform: translateY(10px);
}

/*
 | Only appended cards get an opacity transition, and only they carry this
 | class. Adding opacity to the base .cfx-card rule instead would have been
 | shorter, but that rule already tunes the hover lift, and rewriting its
 | shorthand here would quietly restyle every server-rendered card on the page
 | to make an animation work on a handful of new ones. The other three
 | durations are repeated at their original values so hover feels identical
 | whether a card arrived with the page or after it.
 */
.cfx-card--appended {
    transition: opacity 0.32s ease, transform 0.2s ease,
                box-shadow 0.2s ease, border-color 0.2s ease;
}

/* -------------------------------- Toasts --------------------------------- */

/*
 | Fixed to the corner but created on first use, so a page that never fails
 | never has a toast container in its DOM at all.
 */
.cfx-toasts {
    position: fixed;
    z-index: 1080;
    right: clamp(0.75rem, 3vw, 1.5rem);
    bottom: clamp(0.75rem, 3vw, 1.5rem);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: min(24rem, calc(100vw - 1.5rem));
    pointer-events: none;
}

.cfx-toast {
    padding: 0.8rem 1.1rem;
    border: 1px solid var(--cfx-line);
    border-left-width: 4px;
    border-radius: var(--cfx-radius-sm);
    background: var(--cfx-surface);
    box-shadow: var(--cfx-shadow-lift);
    color: var(--cfx-ink);
    font-size: 0.925rem;
    line-height: 1.45;
    animation: cfx-toast-in 0.22s ease both;
}

.cfx-toast--error { border-left-color: hsl(var(--danger)); }
.cfx-toast--info  { border-left-color: hsl(var(--base)); }

.cfx-toast.is-leaving {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.24s ease, transform 0.24s ease;
}

@keyframes cfx-toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

/*
 | Toasts are appended to <body>, so they sit outside .cfx and the blanket
 | reduced-motion rule at the end of this file does not reach them. They get
 | their own.
 */
@media (prefers-reduced-motion: reduce) {
    .cfx-toast,
    .cfx-toast.is-leaving { animation: none; transition: none; }
}

/* ========================= Community & transparency ====================== */

/*
 | Leaderboard, feature campaigns, updates and the transparency panel.
 |
 | Every one of these sections hides itself in Blade when it has no rows, so
 | nothing here needs an empty state and nothing declares a height to hold a
 | space open. The same rule as the campaign page: if there is nothing to show,
 | the section is not on the page.
 */

/* ------------------------------ Leaderboard ------------------------------ */

.cfx-board {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cfx-board__row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.15rem;
    background: var(--cfx-surface);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius-sm);
}

.cfx-board__rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background: hsl(var(--base) / 0.08);
    color: hsl(var(--base-d-200));
    font-weight: 700;
    font-size: 0.875rem;
    /* Ranks line up as a column of digits. */
    font-variant-numeric: tabular-nums;
}

.cfx-board__rank--lead {
    background: hsl(var(--base));
    color: hsl(var(--white));
}

.cfx-board__who {
    font-weight: 600;
    color: var(--cfx-ink);
    /* A long username shortens rather than pushing the stats off the row. */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfx-board__stats {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--cfx-ink-soft);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

/*
 | The base class the --points modifier modifies. It was used in the markup
 | and defined nowhere, which the resolution check caught: a stat could wrap
 | between its number and its unit ("12 / campaigns" across two lines) because
 | nothing said otherwise.
 */
.cfx-board__stat { white-space: nowrap; }

.cfx-board__stat--points { color: hsl(var(--base-d-200)); font-weight: 600; }

/* On a narrow screen the stats drop under the name rather than squeezing. */
@media (max-width: 575px) {
    .cfx-board__row { grid-template-columns: auto 1fr; }
    .cfx-board__stats { grid-column: 2; gap: 0.75rem; }
}

/* --------------------------- Feature campaigns --------------------------- */

.cfx-features {
    display: grid;
    gap: var(--cfx-gap);
    grid-template-columns: 1fr;
}

@media (min-width: 768px)  { .cfx-features { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .cfx-features { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.cfx-feature {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.35rem;
    background: var(--cfx-surface);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.cfx-feature:hover,
.cfx-feature:focus-within {
    border-color: hsl(var(--base) / 0.45);
    box-shadow: var(--cfx-shadow);
}

.cfx-feature__link { text-decoration: none; }

.cfx-feature__title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.35;
    color: var(--cfx-ink);
    text-wrap: balance;
}

.cfx-feature__link:hover .cfx-feature__title { color: hsl(var(--base-d-200)); }

.cfx-feature__parent {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--cfx-ink-soft);
}

.cfx-feature__parent span { color: var(--cfx-ink); font-weight: 500; }

.cfx-feature__meter {
    height: 0.375rem;
    border-radius: 999px;
    background: hsl(var(--base) / 0.1);
    overflow: hidden;
    margin-top: 0.35rem;
}

.cfx-feature__meter > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: hsl(var(--base));
}

.cfx-feature__figures {
    margin: 0;
    font-size: 0.875rem;
    color: var(--cfx-ink-soft);
    font-variant-numeric: tabular-nums;
}

.cfx-feature__figures strong { color: var(--cfx-ink); }
.cfx-feature__pct { float: right; color: hsl(var(--base-d-200)); font-weight: 600; }

.cfx-feature__social {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin: 0.15rem 0 0;
    font-size: 0.8125rem;
    color: var(--cfx-ink-soft);
}

.cfx-feature__social i { color: hsl(var(--base)); }

/* -------------------------------- Updates -------------------------------- */

.cfx-updates {
    display: grid;
    gap: var(--cfx-gap);
    grid-template-columns: 1fr;
}

@media (min-width: 768px) { .cfx-updates { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.cfx-update {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.5rem;
    background: var(--cfx-surface);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
    /* A left rule, so an update reads as a quoted post rather than a card. */
    border-left: 3px solid hsl(var(--base) / 0.5);
}

.cfx-update__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.cfx-update__campaign {
    font-size: 0.8125rem;
    font-weight: 600;
    color: hsl(var(--base-d-200));
    text-decoration: none;
}

.cfx-update__campaign:hover { text-decoration: underline; }

.cfx-update__when { font-size: 0.75rem; color: var(--cfx-ink-soft); }

.cfx-update__title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.35;
    text-wrap: balance;
}

.cfx-update__title a { color: var(--cfx-ink); text-decoration: none; }
.cfx-update__title a:hover { color: hsl(var(--base-d-200)); }

.cfx-update__excerpt {
    margin: 0;
    color: var(--cfx-ink-soft);
    font-size: 0.925rem;
    line-height: 1.6;
}

/* ------------------------------ Transparency ----------------------------- */

.cfx-facts {
    display: grid;
    gap: var(--cfx-gap);
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    /*
     | auto-fit, so the grid adapts to however many facts survived the filter.
     | One true figure fills the row on its own rather than sitting in a third
     | of the width next to two empty columns.
     */
    .cfx-facts { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
}

.cfx-fact {
    padding: 1.65rem;
    background: var(--cfx-surface);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
}

.cfx-fact__figure {
    margin: 0 0 0.35rem;
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    font-weight: 700;
    line-height: 1.1;
    color: hsl(var(--base-d-200));
    font-variant-numeric: tabular-nums;
}

.cfx-fact__of {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--cfx-ink-soft);
}

.cfx-fact__label {
    margin: 0 0 0.35rem;
    font-weight: 600;
    color: var(--cfx-ink);
    line-height: 1.4;
}

.cfx-fact__help {
    margin: 0;
    font-size: 0.875rem;
    color: var(--cfx-ink-soft);
    line-height: 1.55;
}

/*
 | The risk note. Sized and coloured to be read, not to be dismissed -- it sits
 | with the reassuring figures on purpose.
 */
.cfx-facts__note {
    margin: var(--cfx-gap) 0 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid hsl(var(--base) / 0.4);
    background: hsl(var(--base) / 0.04);
    border-radius: var(--cfx-radius-sm);
    color: var(--cfx-ink-soft);
    font-size: 0.875rem;
    line-height: 1.65;
    max-width: 68ch;
}

/* ============================== Housekeeping ============================= */

/* Nothing on this page may push the document sideways. */
.cfx { overflow-x: clip; }

@media (prefers-reduced-motion: reduce) {
    .cfx *,
    .cfx *::before,
    .cfx *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    .cfx-card:hover { transform: none; }
    .cfx-btn:hover { transform: none; }
}
