/**
 * Articles & Events Grid — [events_articles_grid]
 *
 * Filter bar, three-column card grid, numbered pagination. Colours come from
 * the theme's palette presets, each with a literal fallback so the section
 * still renders if this loads before global styles.
 */

.eag {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* =============================================================================
 * Filter bar
 * ========================================================================== */

.eag-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.eag-filters__field {
    display: block;
    min-width: 0;
}

/*
 * A native select, restyled. The platform picker stays intact — keyboard
 * operable, correctly announced, and using the OS control on touch — while the
 * chevron is drawn as a background image because `appearance: none` removes the
 * browser's own.
 */
.eag-filters select {
    box-sizing: border-box;
    width: 100%;
    min-width: 150px;
    height: 48px;
    padding: 0 44px 0 18px;
    border: 1px solid var(--wp--preset--color--hang-neutral-lighter, #e0e0e0);
    border-radius: 6px;
    background-color: var(--wp--preset--color--hang-white, #ffffff);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%231f2222' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    -webkit-appearance: none;
    appearance: none;
    font-family: var(--wp--preset--font-family--roboto, Roboto, sans-serif);
    font-size: 15px;
    line-height: 1.4;
    color: var(--wp--preset--color--hang-neutral-darker, #1f2222);
    cursor: pointer;
}

.eag-filters select:focus-visible {
    outline: 2px solid var(--wp--preset--color--hang-neptune, #83c1c0);
    outline-offset: 2px;
}

.eag-filters__submit {
    flex-shrink: 0;
    height: 48px;
    padding: 0 32px;
    border: 0;
    border-radius: 999px;
    background: var(--wp--preset--color--hang-neptune, #83c1c0);
    font-family: var(--wp--preset--font-family--roboto, Roboto, sans-serif);
    font-size: 15px;
    line-height: 1.4;
    color: var(--wp--preset--color--hang-neutral-darkest, #16191a);
    cursor: pointer;
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.eag-filters__submit:hover,
.eag-filters__submit:focus-visible {
    background: var(--wp--preset--color--hang-neptune-dark, #538988);
}

/* Only rendered while a filter is active. */
.eag-filters__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: transparent;
    color: var(--wp--preset--color--hang-neutral-dark, #5a5a5a);
    text-decoration: none;
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.eag-filters__clear:hover,
.eag-filters__clear:focus-visible {
    background: var(--wp--preset--color--hang-neutral-lightest, #f2f2f2);
    color: var(--wp--preset--color--hang-wine-berry, #551c25);
}

/* =============================================================================
 * Grid
 * ========================================================================== */

.eag-grid {
    display: grid;
    grid-template-columns: repeat(var(--eag-columns, 3), minmax(0, 1fr));
    gap: 32px;
}

/*
 * `align-items: flex-start` on the badge keeps it shrink-wrapped; as a column
 * flex child it would otherwise stretch the full card width. The Learn More
 * link takes `margin-top: auto` so it sits on a common baseline across a row,
 * however many lines the title or excerpt runs to.
 */
.eag-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    background: var(--wp--preset--color--hang-white, #ffffff);
    box-shadow: 0px 4px 20px rgba(195, 195, 195, 0.25);
}

.eag-card__badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 4px;
    background: var(--wp--preset--color--hang-wine-berry, #551c25);
    font-family: var(--wp--preset--font-family--roboto, Roboto, sans-serif);
    font-size: 14px;
    line-height: 1.4;
    color: var(--wp--preset--color--hang-white, #ffffff);
}

.eag-card__title {
    margin: 0;
    font-family: var(--wp--preset--font-family--roboto, Roboto, sans-serif);
    font-size: 20px;
    font-weight: 400;
    line-height: 1.35;
}

/*
 * Family and weight are repeated on the anchor: theme.json styles links
 * directly, so the <a> takes both from that rule rather than inheriting the
 * h3's — without this the title falls back to the body serif.
 */
.eag-card__title a {
    font-family: var(--wp--preset--font-family--roboto, Roboto, sans-serif);
    font-weight: 400;
    color: var(--wp--preset--color--hang-wine-berry, #551c25);
    text-decoration: none;
    transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.eag-card__title a:hover,
.eag-card__title a:focus-visible {
    color: var(--wp--preset--color--hang-neptune, #83c1c0);
}

.eag-card__excerpt {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--wp--preset--color--hang-neutral-darker, #1f2222);
}

/* Mirrors the Link button variation (`is-style-link`). */
.eag-card__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    font-family: var(--wp--preset--font-family--roboto, Roboto, sans-serif);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: #538988;
    text-decoration: none;
    transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.eag-card__more:hover,
.eag-card__more:focus-visible {
    color: var(--wp--preset--color--hang-wine-berry, #551c25);
}

.eag-card__more .hli-event__more-icon {
    flex-shrink: 0;
}

.eag-empty {
    margin: 0;
    text-align: center;
    color: var(--wp--preset--color--hang-neutral, #838484);
}

/* =============================================================================
 * Pagination
 * ========================================================================== */

.eag-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.eag-pagination__numbers {
    display: flex;
    align-items: center;
    gap: 8px;
}

/*
 * `paginate_links` emits `.page-numbers` anchors, a `.current` span and a
 * `.dots` span, so all three are styled from that one class.
 */
.eag-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--wp--preset--color--hang-neutral-lighter, #e0e0e0);
    border-radius: 6px;
    background: var(--wp--preset--color--hang-white, #ffffff);
    font-family: var(--wp--preset--font-family--roboto, Roboto, sans-serif);
    font-size: 15px;
    line-height: 1;
    color: var(--wp--preset--color--hang-neutral-darker, #1f2222);
    text-decoration: none;
    transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.eag-pagination a.page-numbers:hover,
.eag-pagination a.page-numbers:focus-visible {
    border-color: var(--wp--preset--color--hang-wine-berry, #551c25);
    color: var(--wp--preset--color--hang-wine-berry, #551c25);
}

.eag-pagination .page-numbers.current {
    border-color: var(--wp--preset--color--hang-wine-berry, #551c25);
    color: var(--wp--preset--color--hang-wine-berry, #551c25);
}

/* The ellipsis is a label, not a control — no box around it. */
.eag-pagination .page-numbers.dots {
    border-color: transparent;
    background: transparent;
}

.eag-pagination__step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--wp--preset--color--hang-neutral-lightest, #f2f2f2);
    color: var(--wp--preset--color--hang-neutral-dark, #5a5a5a);
    text-decoration: none;
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.eag-pagination__step:hover,
.eag-pagination__step:focus-visible {
    background: var(--wp--preset--color--hang-neutral-lighter, #e0e0e0);
    color: var(--wp--preset--color--hang-wine-berry, #551c25);
}

.eag-pagination__step.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* =============================================================================
 * Responsive
 * ========================================================================== */

@media (max-width: 1024px) {
    .eag-grid {
        grid-template-columns: repeat(min(var(--eag-columns, 3), 2), minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .eag-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Stacked, full-width controls beat a cramped row of half-width selects. */
    .eag-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .eag-filters__submit {
        width: 100%;
    }

    .eag-filters__clear {
        align-self: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .eag-card__title a,
    .eag-card__more,
    .eag-filters__submit,
    .eag-pagination .page-numbers,
    .eag-pagination__step {
        transition: none;
    }
}
