/**
 * WebCreator - sponsoring (lists in a page and the page of a fiche; markup: src/sponsor.php, docs/sponsoring.md)
 *
 * Loaded only on pages that hold a sponsor list or on the page of a fiche. Colours, radius, shadow and fonts come from the theme
 * variables with fallbacks (like cards.css): --color-bg, --color-border, --wc-text / --color-text-muted, --wc-primary / --wc-on-primary,
 * --wc-radius, --wc-btn-radius, --wc-shadow, --wc-focus-ring.
 */
.wcsp-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* -- the cards ------------------------------------------------------------------------------------------------------- */
.wcsp-cards {
    --wcsp-cols: 3;
    --wcsp-gap: clamp(1rem, 2.5vw, 1.75rem);
    display: flex;
    flex-wrap: wrap;
    gap: var(--wcsp-gap);
    align-items: stretch;
    box-sizing: border-box;
    margin: 1.5rem 0;
}
.wcsp-cards[data-wcsp-columns="2"] { --wcsp-cols: 2; }
.wcsp-cards[data-wcsp-columns="3"] { --wcsp-cols: 3; }
.wcsp-cards[data-wcsp-columns="4"] { --wcsp-cols: 4; }
@media (max-width: 60rem) {
    .wcsp-cards[data-wcsp-columns="3"],
    .wcsp-cards[data-wcsp-columns="4"] { --wcsp-cols: 2; }
}
@media (max-width: 40rem) {
    .wcsp-cards[data-wcsp-columns] { --wcsp-cols: 1; }
}
.wcsp-card {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: calc((100% - (var(--wcsp-cols) - 1) * var(--wcsp-gap)) / var(--wcsp-cols));
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--wc-radius, 8px);
    background: var(--color-bg, #fff);
    color: var(--wc-text, var(--color-text, #111827));
    box-shadow: var(--wc-shadow, 0 1px 3px rgba(0, 0, 0, 0.12));
    text-align: left;
    line-height: 1.5;
}
.wcsp-card-media { display: block; }
.wcsp-cards .wcsp-card .wcsp-card-image { display: block; width: 100%; max-width: 100%; height: auto; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; aspect-ratio: 4 / 3; object-fit: cover; }
.wcsp-card-body { box-sizing: border-box; flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.5rem; padding: clamp(1rem, 2.5vw, 1.5rem); }
.wcsp-cards .wcsp-card .wcsp-card-body > * { margin: 0; padding-top: 0; padding-bottom: 0; }
.wcsp-cards .wcsp-card .wcsp-card-title {
    padding: 0;
    color: inherit;
    font-family: var(--font-family-heading, inherit);
    font-size: var(--font-size-xl, 1.25rem);
    font-weight: var(--wc-heading-weight, 700);
    line-height: 1.25;
    text-transform: none;
    letter-spacing: normal;
    overflow-wrap: anywhere;
}
.wcsp-card-title a, .wcsp-row-title a { color: inherit; text-decoration: none; }
.wcsp-card-title a:hover, .wcsp-row-title a:hover { text-decoration: underline; }
.wcsp-age, .wcsp-sponsors, .wcsp-amounts, .wcsp-percent { color: var(--color-text-muted, #4b5563); font-size: 0.95em; }
.wcsp-summary { overflow-wrap: anywhere; }

/* the button sits at the bottom of the card */
.wcsp-cards .wcsp-card .wcsp-button {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    box-sizing: border-box;
    min-height: 2.75rem;
    margin: auto 0 0;
    padding: 0.55rem 1.2rem;
    border: 0;
    border-radius: var(--wc-btn-radius, var(--radius-md, 6px));
    background: var(--wc-primary, var(--color-primary, #27ae60));
    color: var(--wc-on-primary, #111111);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
}
.wcsp-cards .wcsp-card .wcsp-button:hover { background: var(--wc-primary-hover, var(--color-primary-dark, var(--wc-primary, #1e8449))); color: var(--wc-on-primary-hover, var(--wc-on-primary, #111111)); }
/* a completed fiche: a quiet button (still a link to the page) */
.wcsp-card.is-completed .wcsp-card-image { filter: saturate(0.7); }
.wcsp-cards .wcsp-card .wcsp-button.is-done { background: transparent; color: inherit; border: 2px solid currentColor; }
.wcsp-cards .wcsp-card .wcsp-button.is-done:hover { background: transparent; color: inherit; text-decoration: underline; }
.wcsp-card-body a:focus-visible, .wcsp-copy:focus-visible, .wcsp-row-title a:focus-visible { outline: 3px solid var(--wc-focus-ring, currentColor); outline-offset: 2px; }

/* -- the progress bar ------------------------------------------------------------------------------------------------ */
.wcsp-progress { display: flex; flex-direction: column; gap: 0.25rem; }
.wcsp-bar { height: 0.75rem; overflow: hidden; border-radius: 999px; background: var(--color-border, #e5e7eb); }
.wcsp-bar-fill { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--wc-primary, var(--color-primary, #27ae60)); }
.is-completed .wcsp-bar-fill { background: var(--wc-primary, var(--color-primary, #27ae60)); }

/* -- the bars (a goal per row) ---------------------------------------------------------------------------------------- */
.wcsp-block.wcsp-bars { list-style: none; margin: 1.5rem 0; padding: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.wcsp-bars .wcsp-row { display: flex; flex-direction: column; gap: 0.35rem; margin: 0; padding: 0; color: var(--wc-text, var(--color-text, #111827)); }
.wcsp-row-title { font-weight: 600; font-family: var(--font-family-heading, inherit); }
.wcsp-row .wcsp-amounts { margin: 0; }
.wcsp-empty { margin: 1.5rem 0; color: var(--color-text-muted, #4b5563); }

/* -- the page of a fiche ---------------------------------------------------------------------------------------------- */
.wcsp-main { box-sizing: border-box; max-width: 62rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.wcsp-main > .breadcrumb { margin-bottom: 1rem; }
.wcsp-title { margin: 0 0 0.75rem; overflow-wrap: anywhere; }
.wcsp-facts { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0 1.5rem; }
.wcsp-facts > * { margin: 0; }
.wcsp-facts .wcsp-age, .wcsp-facts .wcsp-sponsors, .wcsp-facts .wcsp-amounts { font-size: 1.05em; }
.wcsp-facts .wcsp-progress { max-width: 28rem; }
.wcsp-photos { margin: 1rem 0 1.5rem; }
.wcsp-content { margin: 1.5rem 0; overflow-wrap: anywhere; }
.wcsp-content img { max-width: 100%; height: auto; }
.wcsp-untranslated-note { color: var(--color-text-muted, #4b5563); font-size: 0.9em; }

/* -- the payment box ------------------------------------------------------------------------------------------------- */
.wcsp-pay {
    box-sizing: border-box;
    margin: 2rem 0 0;
    padding: clamp(1rem, 2.5vw, 1.75rem);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--wc-radius, 8px);
    background: var(--color-bg, #fff);
    color: var(--wc-text, var(--color-text, #111827));
    box-shadow: var(--wc-shadow, 0 1px 3px rgba(0, 0, 0, 0.12));
}
.wcsp-pay h2 { margin: 0 0 0.75rem; font-size: var(--font-size-xl, 1.25rem); }
.wcsp-pay-text > :first-child { margin-top: 0; }
.wcsp-pay-details { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.25rem; margin: 1rem 0 0.5rem; }
.wcsp-pay-row { display: contents; }
.wcsp-pay-row dt { font-weight: 600; margin: 0; }
.wcsp-pay-row dd { margin: 0; overflow-wrap: anywhere; }
.wcsp-pay-value { user-select: all; font-variant-numeric: tabular-nums; }
.wcsp-pay-reference .wcsp-pay-value { font-weight: 600; }
.wcsp-pay-hint { margin: 0.5rem 0 0; color: var(--color-text-muted, #4b5563); font-size: 0.9em; }
.wcsp-pay .wcsp-copy {
    margin-left: 0.5rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    min-height: 2rem;
    padding: 0.2rem 0.75rem;
    border: 1px solid currentColor;
    border-radius: var(--wc-btn-radius, var(--radius-md, 6px));
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.9em;
    cursor: pointer;
}
.wcsp-copy:hover { background: var(--color-border, #e5e7eb); }
@media (max-width: 36rem) {
    .wcsp-pay-details { grid-template-columns: 1fr; gap: 0.1rem; }
    .wcsp-pay-row dd { margin-bottom: 0.6rem; }
}
