/*
 * Events Archive
 * Templates: template-events.php, taxonomy.php
 * Parts:     template-parts/events-filter.php, events-listing.php (hero: page-hero.css)
 * Auto-enqueued by functions.php after css/theme.css.
 *
 * Tiles and the grid live in event-card.css; .card is defined in
 * single-event.css and reused here for the filter panel and empty state.
 */

/* --- Page shell ---------------------------------------------------------- */

.events-archive {
    --section-pad: var(--space-2xl);
    background-color: var(--color-muted);
}

.events-archive__layout {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

/* --- Filter panel -------------------------------------------------------- */

.events-filter__heading {
    margin: 0 0 var(--space-xs);
    font-size: var(--text-3);
}

.events-filter__intro {
    margin: 0 0 var(--space-md);
    font-weight: var(--font-light);
}

.events-filter__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr) auto;
    gap: var(--space-md);
    align-items: end;
}

.events-filter__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xs);
}

.events-filter__label {
    font-family: var(--font-heading);
    font-size: var(--text-1);
    color: var(--color-text);
}

/* Inputs: the theme border and radius, with the UX icon inset on the left. */
.events-filter__select,
.events-filter__input {
    /* Chevron for the selects (no asset for it, so drawn inline in the text colour like the features tick). */
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23051A0F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    width: 100%;
    padding: var(--space-sm) var(--space-sm) var(--space-sm) calc(var(--space-sm) + var(--space-md) + var(--space-xs));
    font-family: var(--font-body);
    font-size: var(--text-0);
    font-weight: var(--font-regular);
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-background);
    background-repeat: no-repeat;
    background-position: var(--space-sm) center;
    background-size: var(--space-md);
    /* Secondary green clears the 3:1 contrast guideline for controls on the white background. */
    border: 2px solid var(--color-secondary);
    border-radius: .5rem;
    appearance: none;
    transition: border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.events-filter__select:focus-visible,
.events-filter__input:focus-visible {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 var(--space-3xs) var(--color-contrast);
}

/* Selects: field icon on the left, chevron on the right. */
.events-filter__select {
    padding-right: calc(var(--space-sm) + var(--space-md) + var(--space-xs));
    background-position: var(--space-sm) center, right var(--space-sm) center;
    background-size: var(--space-md), var(--space-md);
    cursor: pointer;
}

.events-filter__select--club {
    background-image: url('../../assets/graphics/search-ux-club.svg'), var(--chevron);
}

.events-filter__select--type {
    background-image: url('../../assets/graphics/search-ux-label.svg'), var(--chevron);
}

.events-filter__input {
    background-image: url('../../assets/graphics/search-ux-search.svg');
}

.events-filter__input::placeholder {
    color: var(--color-text);
    opacity: 0.6;
}

.events-filter__input::-webkit-search-decoration,
.events-filter__input::-webkit-search-cancel-button {
    appearance: none;
}

.events-filter__submit {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2xs);
    width: 100%;
    cursor: pointer;
}

.events-filter__status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-md) 0 0;
}

.events-filter__clear {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    color: var(--color-secondary);
    text-decoration: none;
    transition: color 0.3s ease-in-out;
}

.events-filter__clear::before {
    content: "";
    width: var(--space-sm);
    height: var(--space-sm);
    background: url('../../assets/graphics/search-ux-clear.svg') center / contain no-repeat;
}

.events-filter__clear:hover {
    color: var(--color-primary);
}

.events-filter__count {
    font-weight: var(--font-light);
}

.events-filter__count strong {
    font-weight: var(--font-heavy);
    color: var(--color-secondary);
}

/* --- Empty state --------------------------------------------------------- */

.events-empty {
    text-align: center;
}

.events-empty__heading {
    margin: 0 0 var(--space-xs);
    font-size: var(--text-2);
}

.events-empty__text {
    margin: 0;
    font-weight: var(--font-light);
}

/* --- Pagination ---------------------------------------------------------- */

.events-pagination .page-numbers {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2xs);
}

.events-pagination a.page-numbers,
.events-pagination span.page-numbers {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: var(--space-xl);
    padding: var(--space-xs) var(--space-sm);
    color: var(--color-primary);
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: .5rem;
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

.events-pagination a.page-numbers:hover {
    background-color: var(--color-contrast);
}

.events-pagination .page-numbers.current {
    color: var(--color-contrast);
    background-color: var(--color-primary);
}

.events-pagination .page-numbers.dots {
    color: var(--color-text);
}

/* --- Responsive ---------------------------------------------------------- */

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

    .events-filter__form {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .events-filter__field--keyword,
    .events-filter__field--submit {
        grid-column: 1 / -1;
    }

}

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

    .events-filter__form {
        grid-template-columns: 1fr;
    }

}
