/* Matches - flex layout `matches`
   Live .block-matches: navy band, Teko throughout, next-match card (500px column)
   + scrolling rail of upcoming cards with a right-edge fade, sky standings bar.
   Fallback (no fixtures): "Latest News" 3-up cards on navy. */
.matches {
    width: 100%;
    max-width: 100%;
    background: var(--primary);
    color: var(--white);
    font-family: var(--font-display);

    & .matches_inner {
        display: flex;
        max-width: 1700px;
        margin: 0 auto;
        color: var(--white);

        @media (max-width: 992px) {
            flex-direction: column;
        }
    }

    & .matches_heading {
        margin: 0 0 32px;
        color: var(--white);
        font-size: 27px;
        font-weight: 500;
        text-transform: uppercase;

        @media (max-width: 576px) {
            margin-bottom: 24px;
            font-size: 20px;
        }
    }

    /* Next match column ------------------------------------------------ */
    & .matches_next {
        padding: 32px;
        border-right: 1px solid rgba(255, 255, 255, .2);

        @media (min-width: 993px) {
            min-width: 500px;
            max-width: 500px;
        }

        @media (max-width: 992px) {
            padding: 24px;
            border-right: 0;
            border-bottom: 1px solid rgba(255, 255, 255, .2);
        }

        @media (max-width: 576px) {
            padding: 16px;
        }
    }

    /* Fixture card (shared) --------------------------------------------- */
    & .match_card {
        position: relative;
        flex: none;
        min-width: 430px;
        max-width: 430px;
        min-height: 300px;
        max-height: 300px;
        padding: 32px;
        border-radius: 8px;
        background: var(--primary-card);

        @media (max-width: 992px) {
            width: 100%;
            min-width: 0;
            max-width: 100%;
        }

        @media (max-width: 768px) {
            padding: 24px;
        }

        @media (max-width: 400px) {
            min-height: 150px;
            max-height: none;
        }
    }

    & .match_card_date {
        margin-bottom: 32px;
        text-align: center;

        & span {
            color: var(--white);
            font-family: var(--font-display);
            font-size: 22px;
            text-transform: uppercase;
        }
    }

    & .match_card_teams {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 32px;

        @media (max-width: 400px) {
            gap: 16px;
        }
    }

    & .match_team {
        text-align: center;

        & img {
            display: block;
            width: 80px;
            height: 80px;
            margin: 0 auto 16px;
            object-fit: contain;
            object-position: center;

            @media (max-width: 400px) {
                width: 60px;
                height: 60px;
                margin-bottom: 8px;
            }
        }

        & p {
            max-width: 100px;
            margin: 0;
            color: var(--white);
            font-family: var(--font-display);
            font-size: 21px;
            line-height: 1.1;
            text-transform: uppercase;

            @media (max-width: 400px) {
                max-width: 80px;
                font-size: 19px;
            }
        }
    }

    & .match_meta {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;

        & span {
            font-family: var(--font-display);
            color: var(--white);
        }

        & .match_time {
            margin-bottom: 8px;
            font-size: 40px;
            line-height: 1;

            @media (max-width: 400px) {
                font-size: 29px;
            }
        }

        & .match_location {
            color: var(--secondary);
            font-size: 22px;
            text-transform: uppercase;

            @media (max-width: 400px) {
                font-size: 16px;
            }
        }
    }

    /* Upcoming rail ------------------------------------------------------ */
    & .matches_upcoming {
        position: relative;
        width: 70%;
        padding: 32px;
        overflow: hidden;

        /* right-edge fade into the navy band */
        &::after {
            content: "";
            position: absolute;
            top: 0;
            right: 0;
            width: 150px;
            height: 100%;
            background: linear-gradient(to right, rgba(8, 35, 60, 0) 0%, rgb(8, 35, 60) 100%);
            pointer-events: none;
            z-index: 1;

            @media (max-width: 768px) { width: 100px; }
            @media (max-width: 400px) { display: none; }
        }

        @media (max-width: 992px) {
            width: 100%;
            padding: 24px;
        }

        @media (max-width: 576px) {
            padding: 16px;
        }
    }

    & .matches_upcoming_head {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    & .matches_view_all {
        position: relative;
        z-index: 10;
        margin-bottom: 30px;
        color: var(--secondary);
        font-family: var(--font-display);
        font-size: 24px;
        text-transform: uppercase;
        text-decoration: none;
        transition: color .3s var(--ease);

        &:hover,
        &:focus-visible {
            color: var(--secondary-hover);
        }

        @media (max-width: 576px) {
            font-size: 14px;
        }
    }

    & .matches_upcoming_list {
        display: flex;
        gap: 32px;
        padding-right: 150px;
        overflow-x: auto;
        scrollbar-width: none;

        &::-webkit-scrollbar {
            display: none;
        }

        @media (max-width: 992px) {
            width: 100%;
            padding-right: 0;
        }

        @media (max-width: 768px) {
            gap: 16px;
        }

        @media (max-width: 400px) {
            flex-direction: column;
            gap: 16px;
        }
    }

    /* Fallback: latest news --------------------------------------------- */
    & .matches_news {
        width: 100%;
        max-width: 1400px;
        margin: 0 auto;
        padding: 64px 32px;
    }

    & .matches_news_head {
        margin-bottom: 48px;
    }

    & .matches_news_heading {
        margin: 0;
        color: var(--white);
        font-size: 48px;
        font-weight: 700;
        letter-spacing: 1px;
        text-align: center;
        text-transform: uppercase;
    }

    & .matches_news_list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 32px;
        width: 100%;
        justify-items: center;

        @media (max-width: 768px) {
            grid-template-columns: 1fr;
        }
    }

    & .matches_news_item {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-width: 300px;
        max-width: 400px;
        padding: 32px;
        border-radius: var(--radius-lg);
        background: var(--primary-card);
        transition: transform .3s var(--ease);

        @media (max-width: 768px) {
            max-width: none;
        }

        & h3 {
            margin: 0 0 16px;
            color: var(--white);
            font-size: 22px;
            font-weight: 600;
            line-height: 1.3;

            & a {
                color: var(--white);
                font-family: inherit;
                font-size: inherit;
                font-weight: inherit;
                text-decoration: none;
            }
        }

        & .btn_primary {
            align-self: flex-start;
        }
    }

    & .matches_news_item_image {
        width: 100%;
        height: 100%;
        margin-top: 16px;
        overflow: hidden;
        border-radius: var(--radius-lg);

        & img {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: var(--radius-lg);
            transition: transform .5s var(--ease);
        }
    }

    & .matches_news_item:hover .matches_news_item_image img {
        transform: scale(1.03);
    }

    /* Standings bar -------------------------------------------------------- */
    & .matches_standings {
        width: 100%;
    }

    & .matches_standings_link {
        display: block;
        width: 100%;
        padding: 21.6px 24px;
        background: var(--secondary);
        color: var(--white);
        font-family: var(--font-display);
        font-size: 28px;
        line-height: 1.2;
        letter-spacing: .02em;
        text-align: center;
        text-transform: uppercase;
        text-decoration: none;
        transition: background-color .3s var(--ease);

        &:hover,
        &:focus {
            background: var(--link-hover);
            color: var(--white);
        }

        &:focus-visible {
            outline: 3px solid var(--white);
            outline-offset: -6px;
        }

        @media (max-width: 768px) {
            padding: 17.6px 20px;
            font-size: 22px;
        }

        @media (max-width: 576px) {
            padding: 16px;
            font-size: 19px;
        }
    }
}
