/*
 * The module's own components, wearing this theme.
 *
 * ─────────────────────────────────────────────────────────────────────────
 * Why a stylesheet instead of thirteen rewritten templates
 *
 * The remaining crowdfunding pages — the eleven "My Crowdfunding" screens,
 * the community page, campaign updates, the product library — are built from
 * one small vocabulary: cf-card, cf-tile, cf-chip, cf-notice, cf-muted and a
 * handful more. Rewriting each view would mean re-authoring thirteen forms and
 * tables, and every one of those rewrites is a chance to drop a field name, a
 * CSRF token or a guard. This restyles the vocabulary instead: no markup
 * changes, so no contract can break, and every page that uses it moves at once.
 *
 * Loaded only by this theme, after the module stylesheet it overrides, so the
 * five HYIPLAB skins are untouched and still get the module's own look.
 *
 * A second thing this fixes: several classes the module views use are defined
 * nowhere at all — cf-empty, cf-note, cf-filter, cf-prose, cf-status,
 * cf-search, the cf-refund-* set. Those elements render unstyled on every skin
 * today. They are given rules here.
 * ─────────────────────────────────────────────────────────────────────────
 *
 * No min-height, no fixed heights. Anything that would hold space open when
 * empty collapses instead.
 */

/* ------------------------------- Surfaces -------------------------------- */

.cf-card,
.cf-panel {
    background: var(--cfx-surface);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
    box-shadow: none;
}

.cf-card__media { overflow: hidden; }

.cf-card__media img {
    width: 100%;
    height: auto;
    aspect-ratio: 400 / 220;
    object-fit: cover;
}

.cf-card__title {
    color: var(--cfx-ink);
    line-height: 1.35;
    text-wrap: balance;
}

.cf-card__title a { color: inherit; text-decoration: none; }
.cf-card__title a:hover { color: hsl(var(--base-d-200)); }

.cf-card__foot {
    border-top: 1px solid var(--cfx-line);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.cf-panel__title {
    color: var(--cfx-ink);
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

/* --------------------------------- Tiles --------------------------------- */

.cf-tile {
    height: 100%;
    padding: 1.25rem;
    background: var(--cfx-surface);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
}

.cf-tile__label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--cfx-ink-soft);
    margin-bottom: 0.35rem;
}

.cf-tile__label i { color: hsl(var(--base)); }

.cf-tile__value {
    font-size: clamp(1.2rem, 2.4vw, 1.5rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--cfx-ink);
    font-variant-numeric: tabular-nums;
    /* A long amount wraps inside its tile rather than widening the row. */
    overflow-wrap: anywhere;
}

.cf-stats { gap: var(--cfx-gap); }

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

.cf-muted { color: var(--cfx-ink-soft); }
.cf-accent { color: hsl(var(--base-d-200)); }

a.cf-accent { text-decoration: none; font-weight: 600; }
a.cf-accent:hover { text-decoration: underline; }

/* Undefined in the module stylesheet: a short explanatory line. */
.cf-note {
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--cfx-ink-soft);
}

/* Undefined in the module stylesheet: author-written HTML. */
.cf-prose {
    color: var(--cfx-ink-soft);
    line-height: 1.7;
    max-width: 70ch;
}

.cf-prose :is(h2, h3, h4, h5) { color: var(--cfx-ink); margin-top: 1.5rem; }
.cf-prose img { max-width: 100%; height: auto; border-radius: var(--cfx-radius-sm); }

/* Author content can carry a wide table; it scrolls, the page does not. */
.cf-prose :is(table, pre) { display: block; max-width: 100%; overflow-x: auto; }

.cf-section__title {
    font-family: var(--heading-font);
    color: var(--cfx-ink);
    line-height: 1.2;
    text-wrap: balance;
}

.cf-section__text { color: var(--cfx-ink-soft); }

/* ---------------------------- Chips and badges --------------------------- */

.cf-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid hsl(var(--base));
    background: hsl(var(--base));
    color: hsl(var(--white));
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.cf-chip--plain {
    background: var(--cfx-surface);
    border-color: var(--cfx-line);
    color: var(--cfx-ink-soft);
}

.cf-chip--plain:hover {
    border-color: hsl(var(--base));
    color: hsl(var(--base-d-200));
}

.cf-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: hsl(var(--base) / 0.1);
    color: hsl(var(--base-d-200));
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Undefined in the module stylesheet: an update's type, a row's state. */
.cf-type,
.cf-status {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: hsl(var(--base) / 0.08);
    color: hsl(var(--base-d-200));
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* --------------------------------- States -------------------------------- */

/*
 | Undefined in the module stylesheet, and the most visible of the gaps: an
 | empty state was rendering as a bare line of text with no framing at all.
 */
.cf-empty {
    padding: clamp(2rem, 5vw, 3rem) 1.5rem;
    border: 1px dashed var(--cfx-line);
    border-radius: var(--cfx-radius);
    text-align: center;
    color: var(--cfx-ink-soft);
}

.cf-notice {
    display: block;
    padding: 0.9rem 1.15rem;
    border-left: 3px solid hsl(var(--base) / 0.55);
    border-radius: var(--cfx-radius-sm);
    background: hsl(var(--base) / 0.05);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--cfx-ink-soft);
}

.cf-notice strong { color: var(--cfx-ink); }

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

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

.cf-meter__fill {
    height: 100%;
    border-radius: inherit;
    background: hsl(var(--base));
}

.cf-meter__fill--done { background: hsl(var(--base-d-200)); }

/* ------------------------------- Community ------------------------------- */

.cf-comment {
    padding: 1.15rem;
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius-sm);
    background: var(--cfx-surface);
    margin-bottom: 0.85rem;
}

.cf-comment__replies {
    margin-top: 0.85rem;
    padding-left: 1.15rem;
    border-left: 2px solid hsl(var(--base) / 0.2);
}

.cf-vote {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.cf-vote__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    aspect-ratio: 1;
    padding: 0;
    border: 1px solid var(--cfx-line);
    border-radius: 50%;
    background: var(--cfx-surface);
    color: var(--cfx-ink-soft);
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.cf-vote__btn:hover {
    border-color: hsl(var(--base));
    color: hsl(var(--base-d-200));
}

/*
 | The cast-vote state. Undefined in the module stylesheet, which meant a
 | visitor could not tell which way they had already voted.
 */
.cf-vote-up.is-active,
.cf-vote__btn.cf-vote-up:hover {
    border-color: hsl(var(--base));
    background: hsl(var(--base));
    color: hsl(var(--white));
}

.cf-vote-down.is-active,
.cf-vote__btn.cf-vote-down:hover {
    border-color: hsl(var(--danger));
    background: hsl(var(--danger));
    color: hsl(var(--white));
}

.cf-vote__count {
    font-weight: 700;
    color: var(--cfx-ink);
    font-variant-numeric: tabular-nums;
}

/* -------------------------------- Rewards -------------------------------- */

.cf-reward {
    padding: 1rem 1.15rem;
    margin-bottom: 0.7rem;
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius-sm);
    cursor: pointer;
}

.cf-reward.is-selected {
    border-color: hsl(var(--base));
    background: hsl(var(--base) / 0.05);
    box-shadow: 0 0 0 1px hsl(var(--base));
}

.cf-reward.is-soldout { cursor: not-allowed; background: hsl(var(--base) / 0.02); }

.cf-reward__price {
    font-weight: 700;
    color: hsl(var(--base-d-200));
    font-variant-numeric: tabular-nums;
}

.cf-reward__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
}

/* -------------------------------- Timeline ------------------------------- */

.cf-timeline {
    position: relative;
    padding-left: 1.5rem;
}

.cf-timeline::before {
    content: "";
    position: absolute;
    left: 0.3rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    background: hsl(var(--base) / 0.18);
}

.cf-timeline__item { position: relative; padding-bottom: 1.25rem; }

.cf-timeline__item::before {
    content: "";
    position: absolute;
    left: -1.5rem;
    top: 0.4rem;
    width: 0.7rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background: hsl(var(--base));
    box-shadow: 0 0 0 3px hsl(var(--base) / 0.15);
}

/* --------------------------------- Ranks --------------------------------- */

.cf-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;
    font-variant-numeric: tabular-nums;
}

.cf-rank--1,
.cf-rank--2,
.cf-rank--3 { background: hsl(var(--base)); color: hsl(var(--white)); }

.cf-rank--2 { background: hsl(var(--base) / 0.75); }
.cf-rank--3 { background: hsl(var(--base) / 0.55); }

/* ------------------------------ Badge tiles ------------------------------ */

.cf-badge-tile {
    padding: 1.35rem 1rem;
    text-align: center;
    background: var(--cfx-surface);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
}

/* -------------------------- Filters and searching ------------------------ */

/*
 | Undefined in the module stylesheet: these forms were laying out as raw
 | stacked controls.
 */
.cf-filter,
.cf-search {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.85rem;
    padding: 1.15rem;
    background: var(--cfx-surface);
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
}

.cf-filter > :is(input, select),
.cf-search > :is(input, select) { flex: 1 1 12rem; min-width: 0; }

.cf-filter > button,
.cf-search > button { flex: 0 0 auto; }

/* -------------------------------- Refunds -------------------------------- */

/* All three undefined in the module stylesheet. */
.cf-refund-summary {
    padding: 1.15rem;
    border: 1px solid var(--cfx-line);
    border-radius: var(--cfx-radius);
    background: var(--cfx-surface);
    margin-bottom: var(--cfx-gap);
}

.cf-refund-reason {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--cfx-ink-soft);
}

.cf-refund-btn { white-space: nowrap; }

/* -------------------------------- Gallery -------------------------------- */

.cf-gallery {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
}

.cf-gallery img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--cfx-radius-sm);
}

/* ------------------------------- Chart box ------------------------------- */

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

/* ----------------------------- Housekeeping ------------------------------ */

@media (prefers-reduced-motion: reduce) {
    .cf-vote__btn { transition: none; }
}
