/**
 * Events Grid Block Frontend Styles
 *
 * @package Town_Hall
 */

.events-grid {
    margin-bottom: 200px;
}

.events-grid__filters-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 0;
    border-bottom: 1px solid rgb(13 13 13 / 12%);
    margin-bottom: 100px;
}

.events-grid__toggler {
    display: flex;
    justify-content: center;
    align-items: center;
}

.events-grid__toggler-button {
    border: none;
    background-color: transparent;
    outline: none;
    cursor: pointer;
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 15px;
    line-height: 100%;
    text-transform: uppercase;
    color: #f2eee6;
    background-color: #354200;
    padding: 6px 14px;
    border: 2px solid #354200;
}

.events-grid__toggler-button.active {
    color: #354200;
    background-color: #f2eee6;
}

.events-grid__categories {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.events-grid__category-button {
    border: none;
    background-color: transparent;
    outline: none;
    cursor: pointer;
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 15px;
    line-height: 100%;
    text-transform: uppercase;
    color: #0d0d0d80;
    transition: color 0.3s ease;
    padding: 0;
}

.events-grid__category-button:hover,
.events-grid__category-button.active {
    color: #0d0d0d;
    text-decoration: underline;
}

.events-grid__count {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 15px;
    line-height: 100%;
    color: #0d0d0d;
}

.events-grid__items-title {
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 32px;
    line-height: 90%;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 100px;
    color: #0d0d0d;
}

.events-grid__item {
    position: relative;
    width: 100%;
}

.events-grid__item-inner {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.events-grid__item-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    margin-bottom: 20px;
    border-radius: 2px;
    min-height: 412px;
}

.events-grid__item-card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transition: 0.6s;
    --parallax-y: 0%;
    transform: translateY(var(--parallax-y)) scale(1);
}

.events-grid__item:hover img {
    transform: translateY(var(--parallax-y)) scale(1.13);
}

.events-grid__item-overline {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 15px;
    line-height: 100%;
    text-align: center;
    text-transform: uppercase;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-dark);
    position: relative;
    z-index: 2;
}

.events-grid__item-overline span:first-child {
    padding: 4px 12px;
    background-color: #f2eee6;
}

.events-grid__item-overline span:last-child {
    mask: url("data:image/svg+xml,%3Csvg width='114' height='20' viewBox='0 0 114 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M56.75 0V20H102.394C102.838 20 103.198 19.6419 103.198 19.2V10C103.198 4.47716 107.698 0 113.25 0H56.75Z' fill='%23F2EEE6'/%3E%3Cpath d='M57.25 0V20H11.6062C11.162 20 10.802 19.6419 10.802 19.2V10C10.802 4.47716 6.3017 0 0.75 0H57.25Z' fill='%23F2EEE6'/%3E%3C/svg%3E")
        no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg width='114' height='20' viewBox='0 0 114 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M56.75 0V20H102.394C102.838 20 103.198 19.6419 103.198 19.2V10C103.198 4.47716 107.698 0 113.25 0H56.75Z' fill='%23F2EEE6'/%3E%3Cpath d='M57.25 0V20H11.6062C11.162 20 10.802 19.6419 10.802 19.2V10C10.802 4.47716 6.3017 0 0.75 0H57.25Z' fill='%23F2EEE6'/%3E%3C/svg%3E")
        no-repeat center;
    mask-size: contain;
    -webkit-mask-size: contain;
    min-width: 114px;
    min-height: 20px;
    background-color: #f2eee6;
}

.event-grid__item-bottom {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
    padding: 20px;
}

.event-grid__item-sponsors {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 15px;
    line-height: 140%;
    color: #f2eee6;
}

.events-grid__item-links.desktop {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    align-items: flex-end;
    margin-left: auto;
    flex-shrink: 0;
}

.events-grid__item-links.mobile {
    display: none;
}

.events-grid__item-link {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 15px;
    line-height: 140%;
    text-transform: uppercase;
    color: #f2eee6;
    border-bottom: 1px solid #f2eee6;
    border-bottom-color: currentColor;
    transition: 0.3s;
}

.events-grid__item-link:hover {
    color: #f2eee6;
    border-bottom-color: transparent;
}

.events-grid__item-link svg {
    vertical-align: super;
}

.events-grid__item-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    position: relative;
    z-index: 2;
    transition: 0.4s;
}

.events-grid__item-title {
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 32px;
    line-height: 90%;
    text-align: left;
    text-transform: uppercase;
    color: #0d0d0d;
    margin: 0;
}

.events-grid__item-guests {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: 15px;
    line-height: 140%;
    text-align: left;
    text-transform: uppercase;
    color: #0d0d0d;
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: 8px;
}

.events-grid__item-guests .more {
    font-size: 11px;
    opacity: .5;
}

/* ====== 12-col grid (gutter 20px) with nth-child placement ====== */
.events-grid__items {
    max-width: 1440px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    column-gap: 20px;
    row-gap: 99px;
}

/* Center the very last single card if it's Pattern C */
@media (min-width: 1025px) {
    .events-grid__items {
        grid-template-columns: repeat(12, minmax(0, 1fr));
        row-gap: 160px;
    }

    /* Pattern A: items #1 and #2 of each group of 5
    [empty 1] [item 5] [empty 1] [item 5] */
    .events-grid__items > .events-grid__item:nth-child(5n + 1) {
        grid-column: 2 / span 5; /* cols 2–6 */
    }
    .events-grid__items > .events-grid__item:nth-child(5n + 2) {
        grid-column: 8 / span 5; /* cols 8–12 */
    }

    /* Pattern B: items #3 and #4 of each group of 5
    [item 5] [item 6] [empty 1] */
    .events-grid__items > .events-grid__item:nth-child(5n + 3) {
        grid-column: 1 / span 5; /* cols 1–5 */
    }
    .events-grid__items > .events-grid__item:nth-child(5n + 4) {
        grid-column: 6 / span 6; /* cols 6–11 */
    }

    /* Pattern C: item #5 of each group of 5
    [empty 4] [item 8] */
    .events-grid__items > .events-grid__item:nth-child(5n + 5) {
        grid-column: 5 / span 8; /* cols 5–12 */
        justify-self: stretch;
    }

    /* ----- Pattern-specific min-heights (desktop) ----- */
    .events-grid__items > .events-grid__item:nth-child(5n + 1) .events-grid__item-card,
    .events-grid__items > .events-grid__item:nth-child(5n + 2) .events-grid__item-card {
        min-height: 660px;
    }

    .events-grid__items > .events-grid__item:nth-child(5n + 3) .events-grid__item-card {
        min-height: 560px;
    }

    .events-grid__items > .events-grid__item:nth-child(5n + 4) .events-grid__item-card {
        min-height: 660px;
    }

    .events-grid__items > .events-grid__item:nth-child(5n + 5) .events-grid__item-card {
        min-height: 660px;
    }
}

/* ====== Mobile stack ====== */
@media (max-width: 1024px) {
    .events-grid {
        margin-bottom: 139px;
    }

    .events-grid__filters-wrapper {
        display: flex;
        flex-direction: column;
        gap: 30px;
        border-bottom: none;
        margin-bottom: 80px;
        padding: 20px 0 0;
    }

    .events-grid__categories {
        display: none;
    }

    .events-grid__items-title {
        font-size: 28px;
        margin-bottom: 80px;
    }

    .events-grid__item-links.desktop {
        display: none;
    }

    .events-grid__item-links.mobile {
        display: flex;
        gap: 15px;
        align-items: center;
        justify-content: flex-start;
    }

    .events-grid__item-link {
        color: #0d0d0d;
        border-bottom: 1px solid #0d0d0d;
    }

    .events-grid__item-link:hover {
        color: #0d0d0d;
        border-bottom-color: transparent;
    }

    .events-grid__item-text {
        gap: 20px;
        flex-direction: column-reverse;
        padding-bottom: 30px;
        border-bottom: 1px solid #0d0d0d1a;
        margin-bottom: 20px;
    }
}
