:root {
    --mtg-bg: #f4f6f8;
    --mtg-card: #ffffff;
    --mtg-border: #dfe5ec;
    --mtg-text: #14304a;
    --mtg-soft: #6b7f94;
    --mtg-accent: #cc6f44;
    --mtg-accent-soft: #f7ece7;
    --mtg-shadow: 0 10px 28px rgba(13, 34, 56, 0.12);
    --mtg-radius: 20px;
    --mtg-pill: 999px;
}

.mtg-wrap,
.mtg-event-filter,
.mtg-event-filter *,
.mtg-masonry,
.mtg-pagination,
.mtg-home-grid {
    font-family: "Unbounded", Sans-serif;
}

.mtg-wrap {
    border-radius: var(--mtg-radius);
}

.mtg-title {
    margin: 0 0 18px;
    color: var(--mtg-text);
    font-size: clamp(24px, 2.6vw, 34px);
    line-height: 1.1;
}

.mtg-event-filter {
    display: inline-flex;
    margin-bottom: 18px;
}

.mtg-event-filter-control {
    position: relative;
}

.mtg-event-trigger {
    min-width: 250px;
    border: 1.5px solid #b9c9d8;
    border-radius: var(--mtg-pill);
    background: #ffffff;
    color: #274664;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    padding: 10px 42px 10px 16px;
    cursor: pointer;
    text-align: left;
}

.mtg-event-trigger:hover,
.mtg-event-trigger:focus {
    outline: none;
    background: var(--mtg-accent-soft);
    border-color: #d59674;
}

.mtg-event-filter-control::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid #2a4a66;
    border-bottom: 2px solid #2a4a66;
    transform: translateY(-60%) rotate(45deg);
    pointer-events: none;
    transition: transform 0.18s ease;
}

.mtg-event-filter-control.is-open::after {
    transform: translateY(-30%) rotate(-135deg);
}

.mtg-event-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    min-width: 250px;
    margin: 0;
    padding: 8px;
    list-style: none;
    border: 1px solid #d7e0ea;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: var(--mtg-shadow);
    z-index: 40;
    max-height: 280px;
    overflow: auto;
}

.mtg-event-option {
    width: 100%;
    border: 0;
    background: transparent;
    color: #2a4a66;
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.mtg-event-option:hover,
.mtg-event-option.is-active {
    background: var(--mtg-accent-soft);
    color: var(--mtg-accent);
}

.mtg-masonry {
    column-count: 3;
    column-gap: 14px;
    transition: opacity 0.18s ease;
}

.mtg-masonry.is-loading {
    opacity: 0.45;
    pointer-events: none;
}

.mtg-item {
    break-inside: avoid;
    margin: 0 0 14px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--mtg-card);
    box-shadow: var(--mtg-shadow);
}

.mtg-item-link {
    position: relative;
    display: block;
    color: inherit;
    text-decoration: none;
}

.mtg-item-img {
    display: block;
    width: 100%;
    height: auto;
}

.mtg-item-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px;
    background: linear-gradient(to top, rgba(11, 27, 44, 0.86), rgba(11, 27, 44, 0));
    color: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 1;
    transform: translateY(0px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.mtg-item:hover .mtg-item-overlay {
    opacity: 1;
    transform: translateY(0);
}

.mtg-item-event {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fbcfb4;
}

.mtg-item-title {
    font-size: 14px;
    font-weight: 700;
}

.mtg-item-caption {
    font-size: 12px;
    color: #f4f4f4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mtg-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.mtg-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid #c4d1de;
    color: #274664;
    font-weight: 700;
    font-size: 13px;
    background: #ffffff;
}

.mtg-page:hover,
.mtg-page.is-active {
    border-color: #d59674;
    background: var(--mtg-accent-soft);
    color: var(--mtg-accent);
}

.mtg-home-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.mtg-home-item {
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--mtg-shadow);
}

.mtg-home-item:nth-child(3) {
    grid-column: span 2;
}

.mtg-home-link {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
}

.mtg-home-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mtg-home-grid .mtg-home-item:nth-child(1) .mtg-home-img,
.mtg-home-grid .mtg-home-item:nth-child(2) .mtg-home-img {
    height: 300px !important;
}

.mtg-home-grid .mtg-home-item:nth-child(3) .mtg-home-img {
    height: 250px !important;
}

.mtg-home-grid .mtg-home-item:nth-child(1),
.mtg-home-grid .mtg-home-item:nth-child(2) {
    height: 300px;
}

.mtg-home-grid .mtg-home-item:nth-child(3) {
    height: 250px;
}

.mtg-home-title {
    display: none;
}

.mtg-empty {
    margin: 10px 0 0;
    color: var(--mtg-soft);
    font-size: 14px;
}

@media (max-width: 1024px) {
    .mtg-masonry {
        column-count: 2;
    }
}

@media (max-width: 767px) {
    .mtg-wrap {
        padding: 18px;
    }

    .mtg-event-trigger {
        min-width: 100%;
        width: 100%;
    }

    .mtg-event-filter {
        display: flex;
        width: 100%;
    }

    .mtg-event-filter-control {
        width: 100%;
    }

    .mtg-event-menu {
        min-width: 100%;
    }

    .mtg-masonry {
        column-count: 1;
    }

    .mtg-home-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mtg-home-item:nth-child(3) {
        grid-column: span 2;
    }

    .mtg-home-grid .mtg-home-item:nth-child(1) .mtg-home-img,
    .mtg-home-grid .mtg-home-item:nth-child(2) .mtg-home-img {
        height: 300px !important;
    }

    .mtg-home-grid .mtg-home-item:nth-child(3) .mtg-home-img {
        height: 250px !important;
    }

    .mtg-home-grid .mtg-home-item:nth-child(1),
    .mtg-home-grid .mtg-home-item:nth-child(2) {
        height: 300px;
    }

    .mtg-home-grid .mtg-home-item:nth-child(3) {
        height: 250px;
    }
}
