/*
 * Event Card
 * Part: template-parts/event-card.php
 * Auto-enqueued by functions.php after css/theme.css.
 *
 * The tile used in every event listing (Events page, taxonomy archives,
 * related events, the events flexible content block). .events-grid is the
 * responsive grid the tiles sit in; .event-tag is the small event type pill,
 * also used above the title on single-event.php.
 */

.events-grid {
    display: grid;
    /* 22rem minimum caps the full-width container at three columns, matching the design. */
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: var(--space-md);
}

.event-tag {
    display: inline-block;
    padding: var(--space-2xs) var(--space-sm);
    font-family: var(--font-tag);
    font-size: var(--text--1);
    font-weight: var(--font-regular);
    line-height: 1.1;
    color: var(--color-primary);
    background-color: var(--color-contrast);
    border-radius: 100vmax;
}

.event-card {
    display: flex;
    flex-direction: column;
    background-color: var(--color-background);
    border-radius: .875rem;
    box-shadow: 0 0 20px 0 rgba(5, 26, 15, 0.05);
    overflow: hidden;
}

/*
 * Header band. --club-accent is set inline by the template from the club's
 * accent colour (default: the secondary green). The band is a light tint of
 * it; the motif, drawn through a mask so it can take any colour, is a deeper
 * shade of the same hue. Holds the club logo (when there is one), the event
 * type pills and the motif.
 */
.event-card__header {
    --club-accent: var(--color-secondary);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-xs);
    min-height: var(--space-4xl);
    padding: var(--space-sm) var(--space-md);
    background-color: color-mix(in srgb, var(--club-accent) 14%, white);
}

/* Motif in the top-right corner, coloured from the accent. */
.event-card__header::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 6.25rem;
    height: 6.25rem;
    background-color: color-mix(in srgb, var(--club-accent) 26%, white);
    -webkit-mask: url('../../assets/graphics/motif-sm.svg') top right / 6.25rem no-repeat;
    mask: url('../../assets/graphics/motif-sm.svg') top right / 6.25rem no-repeat;
    pointer-events: none;
}

/* Club logo (assets/graphics/clubs): a wide lock-up with text, so it is fitted, never cropped. */
.event-card__graphic {
    position: relative;
    z-index: 1;
    display: block;
    width: auto;
    max-width: calc(100% - 5rem);
    height: 4.25rem;
    object-fit: contain;
    object-position: left center;
}

/* Generic Vantage graphic (no club line): shorter, so its wordmark sits at the same size as the club logos'. */
.event-card__graphic--generic {
    height: 1.75rem;
}

.event-card__types {
    position: relative;
    z-index: 1;
    margin-top: auto; /* pills sit at the foot of the band whether or not there is a logo above */
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2xs);
}

/* On a tinted band the pill sits on white rather than the pale green. */
.event-card__header .event-tag {
    background-color: var(--color-background);
}

.event-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
}

.event-card__title {
    margin: 0;
    font-size: var(--text-2);
}

.event-card__title-link {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease-in-out;
}

.event-card__title-link:hover {
    color: var(--color-secondary);
}

.event-card__meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    /* Date and time range need more room than the location. */
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--space-sm);
}

.event-card__meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-2xs);
}

.event-card__meta-item + .event-card__meta-item {
    padding-left: var(--space-sm);
    border-left: 2px solid var(--color-contrast);
}

.event-card__meta-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.event-card__icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
}

.event-card__meta-title {
    font-size: var(--text-0);
    font-weight: var(--font-regular);
    color: var(--color-text);
    /* Keep "In-person" and the date on one line; the detail beneath can wrap. */
    white-space: nowrap;
}

.event-card__meta-detail {
    font-size: var(--text--1);
    font-weight: var(--font-light);
}

.event-card__excerpt {
    margin: 0;
    font-weight: var(--font-light);
}

.event-card__footer {
    margin-top: auto;
    padding-top: var(--space-md);
    border-top: 2px solid var(--color-contrast);
}

.event-card__button {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2xs);
    width: 100%;
}

@media screen and (max-width: 480px) {

    .event-card__meta {
        grid-template-columns: 1fr;
    }

    .event-card__meta-item + .event-card__meta-item {
        padding-left: 0;
        border-left: 0;
    }

}
