/**
 * WebCreator - card grid (markup: docs/page-editor-blocks.md)
 *
 * Loaded only on pages that contain a card grid (div.wc-cards, see wc_block_assets()). No script.
 * Colours, radius, shadow and fonts come from the theme variables (docs/themes.md, 4 and 7), with fallbacks:
 *   card surface   --color-bg (the page colour; every ring colour of the contract holds on it) + --color-border
 *   text           --wc-text, quiet text --color-text-muted      button  --wc-primary / --wc-on-primary (like .btn-primary)
 *   ring           --wc-focus-ring        shape  --wc-radius, --wc-btn-radius, --wc-shadow
 * Layout: flex, not grid, so that an incomplete last row can be centred (data-wc-center="on"). Cards in a row are
 * equally high (the default; data-wc-equal="off" lets each card keep its own height). 1 column on a phone, at most 2 on a tablet.
 */
.wc-cards {
    --wcc-cols: 3;
    --wcc-gap: clamp(1rem, 2.5vw, 1.75rem);
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: stretch;
    gap: var(--wcc-gap);
    box-sizing: border-box;
    margin: 1.5rem 0;
    padding: 0;
}
.wc-cards[data-wc-columns="2"] { --wcc-cols: 2; }
.wc-cards[data-wc-columns="3"] { --wcc-cols: 3; }
.wc-cards[data-wc-columns="4"] { --wcc-cols: 4; }
.wc-cards[data-wc-center="on"] { justify-content: center; }
.wc-cards[data-wc-equal="off"] { align-items: flex-start; }
@media (max-width: 60rem) {
    .wc-cards[data-wc-columns="3"],
    .wc-cards[data-wc-columns="4"] { --wcc-cols: 2; }
}
@media (max-width: 40rem) {
    .wc-cards,
    .wc-cards[data-wc-columns] { --wcc-cols: 1; }
}

.wc-cards > .wc-card {
    position: relative;   /* the link of a clickable card stretches over it */
    box-sizing: border-box;
    flex: 0 0 auto;
    width: calc((100% - (var(--wcc-cols) - 1) * var(--wcc-gap)) / var(--wcc-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;
}

/* image: a fixed ratio, so the cards have their final size before the pictures are loaded */
.wc-cards .wc-card > img.wc-card-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
.wc-cards[data-wc-ratio="4-3"] .wc-card > img.wc-card-image { aspect-ratio: 4 / 3; }
.wc-cards[data-wc-ratio="1-1"] .wc-card > img.wc-card-image { aspect-ratio: 1 / 1; }
.wc-cards[data-wc-ratio="natural"] .wc-card > img.wc-card-image { aspect-ratio: auto; }

.wc-cards .wc-card > .wc-card-body {
    box-sizing: border-box;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: clamp(1rem, 2.5vw, 1.5rem);
}
.wc-cards .wc-card .wc-card-title {
    margin: 0 0 0.5rem;
    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;
}
.wc-cards .wc-card .wc-card-text {
    margin: 0 0 1rem;
    color: inherit;
    font-size: var(--font-size-base, 1rem);
    line-height: 1.55;
}
.wc-cards .wc-card .wc-card-text:last-child { margin-bottom: 0; }

/* the button sits at the bottom of the card, whatever the length of the text */
.wc-cards .wc-card .wc-card-body a.wc-card-button {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    box-sizing: border-box;
    min-height: 2.75rem;
    margin-top: auto;
    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;
    transition: background-color var(--transition-fast, 0.15s ease), color var(--transition-fast, 0.15s ease);
}
.wc-cards .wc-card .wc-card-body a.wc-card-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));
}

/* the whole card is one link: the title link, stretched over the card (one link, no nested links) */
.wc-cards .wc-card .wc-card-title a.wc-card-link {
    color: inherit;
    text-decoration: none;
}
.wc-cards .wc-card[data-wc-link="card"] .wc-card-title a.wc-card-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}
.wc-cards .wc-card[data-wc-link="card"] .wc-card-title a.wc-card-link:hover { text-decoration: underline; }
@media (hover: hover) {
    .wc-cards .wc-card[data-wc-link="card"] { transition: box-shadow var(--transition-normal, 0.2s ease), transform var(--transition-normal, 0.2s ease); }
    .wc-cards .wc-card[data-wc-link="card"]:hover { box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.16)); transform: translateY(-2px); }
}

/* focus: the ring of the page colour (--wc-focus-ring) around the link or button; a clickable card also gets a ring-coloured border */
.wc-cards .wc-card a:focus-visible {
    outline: 3px solid var(--wc-focus-ring, var(--color-primary, #27ae60));
    outline-offset: 3px;
}
.wc-cards .wc-card[data-wc-link="card"]:has(a.wc-card-link:focus-visible) { border-color: var(--wc-focus-ring, var(--color-primary, #27ae60)); }
@media (prefers-reduced-motion: reduce) {
    .wc-cards .wc-card,
    .wc-cards .wc-card .wc-card-body a.wc-card-button { transition: none; transform: none; }
}
