/**
 * Events & Webinars archive - Figma rework, phase 1 (hero, filters, tabs, card labels).
 *
 * The legacy styles still live in a <style> block inside Elementor template 61998, which prints
 * inline in the body and therefore outranks this file at equal specificity. Selectors here are
 * deliberately doubled (.ew-container .ew-item.ew-item) to win until that html widget is removed.
 */

.ew-filters,
.ew-tabs,
.ew-featured,
.ew-grid,
:is(.ew-container, .ew-grid) {
    --ew-yellow: #FEED1B;
    --ew-navy: #002840;
    --ew-blue: #039ACE;
    --ew-grey: #667E8C;
    --ew-ink: #252A2B;
    --ew-border: #E5E9EC;
    --ew-radius: 12px;
}

/* hero: featured event */

.ew-featured {
    display: grid;
    grid-template-columns: minmax(0, 540px) minmax(0, 1fr);
    gap: 48px;
    align-items: center;
    margin-top: 44px;
}

.ew-featured__media {
    border-radius: var(--ew-radius);
    overflow: hidden;
}

.ew-featured__media .ew-featured__img {
    display: block;
    width: 100%;
    aspect-ratio: 540 / 320;
    object-fit: cover;
}

.ew-featured__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 22px;
    margin-bottom: 18px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

.ew-featured .ew-featured__title {
    margin: 0 0 16px;
    color: #fff;
    font-size: 38px;
    line-height: 1.15;
    font-weight: 500;
}

.ew-featured__excerpt {
    margin: 0 0 26px;
    max-width: 540px;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.78);
}

.ew-featured__cta {
    display: inline-block;
    padding: 13px 30px;
    border-radius: 99px;
    background: var(--ew-blue);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease;
}

.ew-featured__cta:hover {
    background: #0288b6;
    color: #fff;
}

/* ------------------------------------------------------------------- filters */

.ew-filters {
    border: 1px solid var(--ew-border);
    border-radius: var(--ew-radius);
    padding: 22px 20px;
    background: #fff;
}

/* the trigger, panel header and footer are mobile-only */
.ew-filters__trigger,
.ew-filters__head,
.ew-filters__foot,
.ew-filters__clear--mobile {
    display: none;
}

.ew-filters__title {
    margin-bottom: 18px;
    font-size: 16px;
    font-weight: 500;
    color: var(--ew-navy);
}

.ew-filters__group + .ew-filters__group {
    margin-top: 22px;
}

.ew-filters__group-label {
    margin-bottom: 10px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ew-grey);
}

.ew-filters__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ew-filters__row + .ew-filters__row {
    margin-top: 19px;
}

.ew-filters__label {
    display: flex;
    text-decoration: none;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.3;
    color: var(--ew-navy);
}

.ew-filters__box {
    position: relative;
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border: 1px solid #C3CCD2;
    border-radius: 3px;
    background: #fff;
    transition: border-color 0.15s ease;
}

/* checked = an inset filled square, not a tick */
.ew-filters__box:after {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    bottom: 2px;
    left: 2px;
    border-radius: 2px;
    background: var(--ew-blue);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.ew-filters__box.is-checked {
    border-color: var(--ew-blue);
}

.ew-filters__box.is-checked:after {
    opacity: 1;
    transform: scale(1);
}

.ew-filters__label:focus-visible .ew-filters__box {
    outline: 2px solid var(--ew-blue);
    outline-offset: 2px;
}

.ew-filters__clear {
    display: block;
    margin-top: 22px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ew-blue);
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}


/*
 * The Elementor kit styles bare `button` (yellow pill, 99px radius, 32px padding, uppercase) at
 * 0-1-1, which outranks a single class. Every button below is therefore scoped tag+class inside a
 * parent, and resets the properties the kit sets - otherwise triggers render as yellow blobs.
 */
.ew-filters button.ew-filters__trigger,
.ew-filters button.ew-filters__back,
.ew-filters button.ew-filters__apply,
.ew-grid button.ew-load-more-button {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    background-color: transparent;
    background-image: none;
    box-shadow: none;
    text-transform: none;
    text-decoration: none;
    font-family: inherit;
    font-style: normal;
    letter-spacing: normal;
}

/* ---------------------------------------------------------------------- tabs */

.ew-tabs {
    box-sizing: border-box;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
    border-radius: 40px;
    background: var(--ew-yellow);
}

.ew-tabs .ew-tabs__tab {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 48px;
    text-decoration: none;
    padding: 10px 24px;
    border: 0;
    border-radius: 99px;
    background: transparent;
    color: #000;
    font-size: 16px;
    line-height: 26px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.ew-tabs .ew-tabs__tab:hover {
    background: rgba(255, 255, 255, 0.45);
}

.ew-tabs .ew-tabs__tab.is-active {
    background: #fff;
    color: #000;
    box-shadow: 0 2px 4px rgba(255, 208, 0, 0.8);
}

/* --------------------------------------------------------------------- cards */

:is(.ew-container, .ew-grid) .ew-items.ew-items {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px 40px;
}

:is(.ew-container, .ew-grid) .ew-item.ew-item {
    display: block;
    color: inherit;
    text-decoration: none;
}

:is(.ew-container, .ew-grid) .ew-image.ew-image {
    position: relative;
    border-radius: var(--ew-radius);
    overflow: hidden;
}

:is(.ew-container, .ew-grid) .ew-image.ew-image > img {
    display: block;
    width: 100%;
    aspect-ratio: 350 / 232;
    object-fit: cover;
    transition: transform 0.35s ease, opacity 0.3s ease;
}

/*
 * Image placeholder: with the script running, a card image stays transparent over a shimmering
 * tile until it has loaded, so lazy images arriving after a filter or Load More fade in rather than
 * popping in half-drawn.
 */
.ew-grid.ew-js .ew-image.ew-image {
    background: #eef1f4;
}

.ew-grid.ew-js .ew-image.ew-image:not(.is-loaded) > img {
    opacity: 0;
}

.ew-grid.ew-js .ew-image.ew-image:not(.is-loaded)::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%);
    transform: translateX(-100%);
    animation: ew-shimmer 1.2s ease-in-out infinite;
}

@keyframes ew-shimmer {
    to { transform: translateX(100%); }
}

:is(.ew-container, .ew-grid) a.ew-item:hover .ew-image > img {
    transform: scale(1.04);
}

:is(.ew-container, .ew-grid) .ew-item-body {
    padding-top: 14px;
}

/* type badge - sits under the image per the Figma, not overlaid on it */
.ew-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    padding: 4px 11px;
    border-radius: 99px;
    background: var(--ew-yellow);
    color: #000;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
}

.ew-badge i {
    font-size: 10px;
}

:is(.ew-container, .ew-grid) h4.ew-title.ew-title {
    margin: 0 0 10px;
    font-size: 19px;
    line-height: 1.28;
    font-weight: 500;
    color: #000;
}

:is(.ew-container, .ew-grid) .ew-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ew-ink);
}

:is(.ew-container, .ew-grid) .ew-meta--place {
    margin-top: 2px;
}

.ew-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ew-meta__item i {
    font-size: 11px;
    color: var(--ew-ink);
}

/*
 * Icons ship as theme SVGs in images/ with their stroke baked in as #252A2B, matching --ew-ink.
 * If the ink colour ever changes, the SVG files need the same edit - they cannot inherit it.
 */
.ew-meta__icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    display: block;
}

:is(.ew-container, .ew-grid) .ew-cta.ew-cta {
    display: inline-block;
    margin-top: 12px;
    color: var(--ew-blue);
    font-size: 13px;
    text-decoration: underline;
}

:is(.ew-container, .ew-grid) a.ew-item:hover .ew-cta {
    text-decoration: none;
}

:is(.ew-container, .ew-grid) .ew-load-more {
    margin-top: 40px;
    text-align: center;
}

/* ---------------------------------------------------- load more + entrance */

.ew-grid {
    position: relative;
}

/* Every card is in the page; filtering and Load More only toggle `hidden`. */
.ew-grid .ew-cell[hidden],
.ew-grid [data-ew-empty][hidden],
.ew-grid [data-ew-load-more][hidden] {
    display: none !important;
}

.ew-grid > .ew-items,
.ew-grid > .ew-no-results {
    transition: opacity 0.18s ease;
}

.ew-grid .ew-no-results {
    margin: 24px 0 0;
    text-align: center;
}

/* Filter change: the current cards dim under a spinner until the new set swaps in. */
.ew-grid.is-loading {
    min-height: 200px;
    pointer-events: none;
}

.ew-grid.is-loading > .ew-items,
.ew-grid.is-loading > .ew-no-results,
.ew-grid.is-loading > .ew-load-more {
    opacity: 0.35;
}

.ew-grid.is-loading::after {
    content: "";
    position: absolute;
    top: 90px;
    left: 50%;
    width: 34px;
    height: 34px;
    margin-left: -17px;
    border: 3px solid rgba(0, 40, 64, 0.18);
    border-top-color: var(--ew-blue);
    border-radius: 50%;
    animation: ew-spin 0.8s linear infinite;
}

/*
 * Cards fade and rise as they arrive. JS adds .is-entering to set the start state, then .is-in one
 * frame later with a per-card delay, so a Load More batch reads as a single movement rather than
 * twelve separate ones.
 */
.ew-cell.is-entering {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.32s ease, transform 0.32s ease;
    will-change: opacity, transform;
}

.ew-cell.is-entering.is-in {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .ew-cell.is-entering {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .ew-grid.ew-js .ew-image.ew-image:not(.is-loaded)::before {
        animation: none;
    }
}

.ew-load-more {
    margin-top: 44px;
    text-align: center;
}

.ew-grid button.ew-load-more-button {
    position: relative;
    padding: 12px 32px;
    border: 1px solid var(--ew-blue);
    border-radius: 99px;
    background: #fff;
    color: var(--ew-navy);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.ew-grid button.ew-load-more-button:hover {
    background: var(--ew-blue);
    color: #fff;
}

.ew-grid button.ew-load-more-button.loading {
    color: transparent;
    pointer-events: none;
}

.ew-grid button.ew-load-more-button.loading:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(0, 40, 64, 0.25);
    border-top-color: var(--ew-blue);
    border-radius: 50%;
    animation: ew-spin 0.8s linear infinite;
}

@keyframes ew-spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------- utility */

.ew-hidden,
.ew-filtered-out {
    display: none !important;
}


/* ------------------------------------------------- mobile: full-screen filter */

@media (max-width: 1024px) {
    /* the sidebar card collapses to just a trigger button */
    .ew-filters {
        border: 0;
        padding: 0;
        background: none;
    }

    .ew-filters button.ew-filters__trigger {
        display: block;
        width: 100%;
        padding: 15px 20px;
        border: 1px solid #1B2B33;
        border-radius: 99px;
        background: #fff;
        color: var(--ew-navy);
        font-size: 16px;
        font-weight: 500;
        line-height: 1.2;
        cursor: pointer;
    }

    .ew-filters__count {
        margin-left: 2px;
    }

    /*
     * Closed is display:none and open runs a keyframe animation. Transitioning opacity out of
     * visibility:hidden is unreliable across engines (and silently skips when the element is in a
     * throttled/offscreen context); an animation on display change always runs.
     */
    .ew-filters__panel {
        display: none;
    }

    body.ew-filters-open .ew-filters__panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        background: #fff;
        /*
         * `forwards`, not `both`: if the animation is ever throttled or blocked, the panel simply
         * appears without animating. With `both` it would be pinned at the from-state - invisible -
         * which is a far worse failure than a missing transition.
         */
        animation: ew-panel-in 0.26s ease forwards;
    }

    @keyframes ew-panel-in {
        from {
            opacity: 0;
            transform: translateY(18px);
        }
        to {
            opacity: 1;
            transform: none;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        body.ew-filters-open .ew-filters__panel {
            animation: none;
        }
    }

    .ew-filters__head {
        display: flex;
        align-items: center;
        gap: 14px;
        flex: 0 0 auto;
        padding: 20px 24px 16px;
    }

    .ew-filters button.ew-filters__back {
        width: 24px;
        height: 24px;
        padding: 0;
        border: 0;
        background: none;
        cursor: pointer;
    }

    /* chevron drawn in CSS so it needs no icon font */
    .ew-filters button.ew-filters__back:before {
        content: "";
        display: block;
        width: 11px;
        height: 11px;
        margin-left: 6px;
        border-left: 2px solid var(--ew-navy);
        border-bottom: 2px solid var(--ew-navy);
        transform: rotate(45deg);
    }

    .ew-filters__panel-title {
        font-size: 24px;
        font-weight: 500;
        color: #000;
    }

    .ew-filters__clear--mobile {
        display: inline-block;
        margin-left: auto;
        color: var(--ew-blue);
        font-size: 16px;
        text-decoration: underline;
    }

    .ew-filters__body {
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px 24px 24px;
    }

    /* the "Filter By" heading is the desktop affordance; the panel has its own title */
    .ew-filters__title,
    .ew-filters__clear--desktop {
        display: none;
    }

    .ew-filters__group + .ew-filters__group {
        margin-top: 30px;
    }

    .ew-filters__group-label {
        font-size: 13px;
        letter-spacing: 0.06em;
    }

    /* roomier touch targets */
    .ew-filters .ew-filters__row + .ew-filters__row {
        margin-top: 0;
    }

    .ew-filters__label {
        gap: 14px;
        padding: 13px 0;
        font-size: 18px;
    }

    .ew-filters__box {
        width: 20px;
        height: 20px;
        border-radius: 4px;
    }

    .ew-filters__box:after {
        top: 3px;
        right: 3px;
        bottom: 3px;
        left: 3px;
        border-radius: 2px;
    }

    .ew-filters__foot {
        display: block;
        flex: 0 0 auto;
        padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--ew-border);
    }

    .ew-filters button.ew-filters__apply {
        display: block;
        width: 100%;
        padding: 16px 24px;
        border: 0;
        border-radius: 99px;
        background: var(--ew-blue);
        color: #fff;
        font-size: 17px;
        font-weight: 500;
        cursor: pointer;
    }

    /* tab bar goes full width and scrolls as one yellow strip */
    /* The wrapper scrolls, so the yellow strip travels with the pills instead of staying pinned
       at viewport width. min-width keeps it edge to edge when the tabs are narrower than the screen. */
    .ew-tabs-scroll {
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        /* Inset the strip from both edges. Padding on a horizontal scroller is what keeps the
           16px at the far end too - a margin on the bar collapses once you scroll past it. */
        padding-left: 16px;
        padding-right: 16px;
    }

    .ew-tabs-scroll::-webkit-scrollbar {
        display: none;
    }

    .ew-tabs {
        display: inline-flex;
        /* must beat the base rule's flex-wrap: wrap, or the strip stacks instead of scrolling */
        flex-wrap: nowrap;
        width: max-content;
        min-width: 100%;
        /* box-sizing keeps min-width:100% from overflowing the scroller's padding box */
        box-sizing: border-box;
    }

    .ew-tabs .ew-tabs__tab {
        flex: 0 0 auto;
        font-size: 16px;
        white-space: nowrap;
    }
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1200px) {
    :is(.ew-container, .ew-grid) .ew-items.ew-items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .ew-featured {
        grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
        gap: 32px;
    }
}

@media (max-width: 1024px) {
    .ew-featured {
        grid-template-columns: 1fr;
    }
    .ew-featured .ew-featured__title {
        font-size: 28px;
    }
}

@media (max-width: 767px) {
    :is(.ew-container, .ew-grid) .ew-items.ew-items {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}
