/* ==========================================================================
   Match page (CPT syrian_match + API matches)
   Uses the variables of css/base/_variables.css
   ========================================================================== */

.match-page {
    padding-bottom: 40px;
}

/* ---------- Hero ---------- */
.match-hero {
    margin-block: 24px;
    background: #fff;
    border: 1px solid #E2E8DC;
    border-radius: 24px;
    overflow: hidden;
}

.match-hero__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    font-size: 14px;
    line-height: 20px;
    background: var(--Mapping-Surfaces-Specialty-Surfaces-surface-dark-footer-outer, #0E2212);
}

.match-hero__league {
    color: var(--Mapping-Text-Body-Text-text-body-brand, #CEDE47);
    font-weight: 600;
}

.match-hero__round {
    color: var(--Mapping-Text-Heading-text-heading-on-image, #D2E7D5);
    font-weight: 400;
}

.match-hero__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: start;
    gap: 16px;
    padding: 20px 24px 28px;
}

/* Team */
.match-hero__team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-align: center;
}

.match-hero__team-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

a.match-hero__team-link:hover .match-hero__name,
a.match-hero__team-link:focus-visible .match-hero__name {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.match-hero__logo {
    width: 88px;
    height: 88px;
    object-fit: contain;
}

.match-hero__name {
    color: var(--Mapping-Text-Heading-text-heading-secondary, #19421F);
    font-size: 24px;
    font-weight: 600;
    line-height: 40px;
    overflow-wrap: anywhere;
}

/* Scorers */
.match-hero__scorers {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
    line-height: 20px;
    color: var(--Mapping-Text-Body-Text-text-body-muted, #6B7A6F);
}
.match-hero__scorer {
    display: flex;
    gap: 8px;
}
.match-hero__scorer-name {
    color: #3D4A41;
}

.match-hero__minute {
    color: var(--Alias-Accent-Green-Dark, #126436);
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
    font-variant-numeric: tabular-nums;
}

.match-hero__goal-note {
    font-weight: 400;
    color: var(--Mapping-Text-Body-Text-text-body-muted, #6B7A6F);
}

/* Center: score / kick-off + status */
.match-hero__center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-top: 16px;
}

.match-hero__score,
.match-hero__kickoff {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #19421F;
    font-size: 56px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.match-hero__kickoff {
    font-size: 40px;
}

.match-hero__kickoff--empty {
    color: #B9C6BD;
}

.match-hero__score-sep {
    color: #B9C6BD;
    font-weight: 400;
}

.match-hero__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
}

.match-hero__status--live {
    background: #FDECEC;
    color: #B42318;
}

.match-hero__status--finished {
    background: #EEF1EC;
    color: #4B5A4F;
}

.match-hero__status--upcoming {
    background: #E6F4EA;
    color: #1E6B35;
}

.match-hero__status--other {
    background: #FFF4DB;
    color: #8A5A00;
}

.match-hero__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #D92D20;
    animation: match-hero-pulse 1.4s ease-in-out infinite;
}

@keyframes match-hero-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .match-hero__dot {
        animation: none;
    }
}

/* Footer: referee / stadium / date */
.match-hero__facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
    padding: 14px 24px;
    color: #fff;
    font-size: 13px;
    line-height: 20px;
    border-top: 1px solid #E4E4E4;
    background: linear-gradient(0deg, var(--Mapping-Surfaces-Specialty-Surfaces-surface-dark-footer-outer, #0E2212) 0%, var(--Mapping-Surfaces-Specialty-Surfaces-surface-dark-footer-outer, #0E2212) 100%), #FAFAFA;
}

.match-hero__fact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.match-hero__icon {
    flex: none;
    color: var(--Brand-Lemon-Lime-400, #CEDE47);
}

/* ---------- Mobile ---------- */
@media (max-width: 767.98px) {
    .match-hero {
        border-radius: 18px;
    }

    .match-hero__bar {
        padding: 14px 16px 0;
    }

    .match-hero__body {
        gap: 8px;
        padding: 16px 12px 20px;
    }

    .match-hero__logo {
        width: 56px;
        height: 56px;
    }

    .match-hero__name {
        font-size: 15px;
    }

    .match-hero__scorers {
        font-size: 12px;
    }

    .match-hero__score {
        gap: 8px;
        font-size: 36px;
    }

    .match-hero__kickoff {
        font-size: 28px;
    }

    .match-hero__center {
        gap: 10px;
        padding-top: 10px;
    }

    .match-hero__status {
        padding: 3px 10px;
        font-size: 12px;
    }

    .match-hero__facts {
        justify-content: center;
        padding: 12px 16px;
    }
}

/* ==========================================================================
   Sections under the hero
   ========================================================================== */

.match-tabs {
    margin-bottom: 8px;
}

.match-section {
    margin-top: 24px;
    scroll-margin-top: 140px;
}

.match-panel {
    background: #fff;
    border: 1px solid #E2E8DC;
    border-radius: 16px;
    padding: 16px;
}

.match-panel__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--Mapping-Text-Heading-text-heading-secondary, #19421F);
    font-size: 14px;
    font-weight: 600;
}

.match-panel__head img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* ---------- Lineups: the pitch ---------- */
.match-pitch {
    --pitch-line: rgba(255, 255, 255, 0.55);
    position: relative;
    direction: ltr; /* The pitch is a drawing: left / right must not flip with the page direction. */
    aspect-ratio: 1.75 / 1;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid #1F6E3A;
    background: repeating-linear-gradient(90deg, #2F8A4D 0 12.5%, #2B8048 12.5% 25%);
}

.match-pitch__mid {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--pitch-line);
    transform: translateX(-50%);
}

.match-pitch__circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16%;
    aspect-ratio: 1;
    border: 2px solid var(--pitch-line);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.match-pitch__box {
    position: absolute;
    border: 2px solid var(--pitch-line);
}

.match-pitch__box--big-away   { left: -2px;  top: 24%; width: 15%; height: 52%; }
.match-pitch__box--big-home   { right: -2px; top: 24%; width: 15%; height: 52%; }
.match-pitch__box--small-away { left: -2px;  top: 38%; width: 6%;  height: 24%; }
.match-pitch__box--small-home { right: -2px; top: 38%; width: 6%;  height: 24%; }

.match-pitch__player {
    position: absolute;
    left: var(--x);
    top: var(--y);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 92px;
    text-align: center;
    transform: translate(-50%, -50%);
}

.match-pitch__num {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--bd, #fff);
    background: var(--bg, #fff);
    color: var(--fg, #111);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    /* A thin light ring: a shirt color close to the green of the pitch must stay visible. */
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75), 0 2px 4px rgba(0, 0, 0, 0.25);
}

.match-pitch__pname {
    max-width: 100%;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
    overflow-wrap: anywhere;
}

.match-pitch__tag {
    position: absolute;
    bottom: 10px;
    padding: 4px 10px;
    border-radius: 8px;
    background: #fff;
    color: #19421F;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
}

.match-pitch__tag--home { right: 10px; }
.match-pitch__tag--away { left: 10px; }

.match-pitch__formation {
    margin-inline-start: 6px;
    font-variant-numeric: tabular-nums;
}

/* Lineup without a formation: two lists */
.match-lineup-lists {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.match-lineup-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}

.match-lineup-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #F1F4EF;
    border-radius: 10px;
}

.match-lineup-list__num {
    min-width: 22px;
    color: #2B7A3D;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ---------- Substitutions ---------- */
.match-subs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.match-subs__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.match-subs__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #F1F4EF;
    border-radius: 10px;
    font-size: 13px;
}

.match-subs__in,
.match-subs__out {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
}

.match-subs__name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.match-subs__num {
    display: inline-grid;
    place-items: center;
    flex: none;
    min-width: 22px;
    height: 22px;
    padding-inline: 4px;
    border-radius: 6px;
    border: 1px solid #DDE3DA;
    background: #fff;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.match-subs__arrow {
    flex: none;
}

.match-subs__arrow--in  { color: #1E9E4B; }
.match-subs__arrow--out { color: #D92D20; }

.match-subs__min {
    flex: none;
    margin-inline-start: auto;
    color: var(--Mapping-Text-Body-Text-text-body-muted, #6B7A6F);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ---------- Absences + staff ---------- */
.match-staff {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-staff__row {
    display: grid;
    grid-template-columns: 1.1fr 1.7fr 1fr 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    background: #F1F4EF;
    border-radius: 12px;
    font-size: 13px;
}

.match-staff--no-assistant .match-staff__row {
    grid-template-columns: 1.1fr 1.7fr 1fr;
}

.match-staff__row--head {
    background: #E6EDE4;
    color: #2B7A3D;
    font-size: 12px;
    font-weight: 600;
}

.match-staff__team {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.match-staff__team img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.match-staff__absent {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.match-staff__tag {
    display: inline-block;
    margin-inline-end: 8px;
    padding: 1px 8px;
    border-radius: 6px;
    background: #D6E0D7;
    color: #3D4A41;
    font-size: 11px;
    font-weight: 600;
}

.match-staff__none {
    color: #B9C6BD;
}

/* ---------- Statistics ---------- */
.match-stats__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.match-stats__head img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.match-stat + .match-stat {
    margin-top: 14px;
}

.match-stat__top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.match-stat__label {
    color: #3D4A41;
    font-weight: 600;
    text-align: center;
}

.match-stat__value {
    min-width: 40px;
    color: #19421F;
    font-weight: 700;
}

.match-stat__value:last-child {
    text-align: end;
}

.match-stat__bar {
    display: flex;
    gap: 4px;
    height: 8px;
    margin-top: 6px;
    background-color: #fff;
}

.match-stat__seg {
    height: 100%;
    border-radius: 3px;
}

.match-stat__seg--home { background: #4B7557; }
.match-stat__seg--away { background: #C9D2CB; }

/* ---------- Head to head ---------- */
.match-h2h__note {
    margin: 0 0 12px;
    color: #2B7A3D;
    font-size: 12px;
    font-weight: 600;
}

.match-h2h__summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px 16px;
    background: #F1F4EF;
    border-radius: 12px;
    text-align: center;
}

.match-h2h__side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    color: #3D4A41;
}

.match-h2h__side img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.match-h2h__side strong {
    color: #19421F;
    font-size: 22px;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.match-h2h__side--draw strong,
.match-h2h__side--draw {
    color: #8DA394;
}

.match-h2h__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.match-h2h__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #F1F4EF;
    border-radius: 10px;
}

.match-h2h__row img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.match-h2h__score {
    display: inline-flex;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 8px;
    background: #E3EBE1;
    color: #19421F;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.match-h2h__meta {
    display: flex;
    flex-direction: column;
    margin-inline-start: auto;
    font-size: 12px;
    line-height: 1.5;
}

.match-h2h__league {
    color: #3D4A41;
    font-weight: 600;
}

.match-h2h__date {
    color: #2B7A3D;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ---------- Sections on phones ---------- */
@media (max-width: 767.98px) {
    .match-section {
        scroll-margin-top: 110px;
    }

    .match-panel {
        padding: 12px;
    }

    .match-subs,
    .match-lineup-lists {
        grid-template-columns: 1fr;
    }

    /* The pitch becomes vertical: the home team at the bottom, the away team at the top. */
    .match-pitch {
        aspect-ratio: 3 / 4.3;
    }

    .match-pitch__mid {
        top: 50%;
        bottom: auto;
        left: 0;
        width: 100%;
        height: 2px;
        transform: translateY(-50%);
    }

    .match-pitch__circle {
        width: 30%;
    }

    .match-pitch__box--big-away   { left: 24%; right: auto; top: -2px; bottom: auto; width: 52%; height: 15%; }
    .match-pitch__box--big-home   { left: 24%; right: auto; top: auto; bottom: -2px; width: 52%; height: 15%; }
    .match-pitch__box--small-away { left: 38%; right: auto; top: -2px; bottom: auto; width: 24%; height: 6%; }
    .match-pitch__box--small-home { left: 38%; right: auto; top: auto; bottom: -2px; width: 24%; height: 6%; }

    .match-pitch__player {
        left: var(--vx);
        top: var(--vy);
        width: 64px;
    }

    .match-pitch__num {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }

    .match-pitch__pname {
        font-size: 10px;
    }

    .match-pitch__tag--away {
        top: 10px;
        bottom: auto;
    }

    /* Absences: every team becomes a small card, the column titles come from data-label. */
    .match-staff__row--head {
        display: none;
    }

    .match-staff__row,
    .match-staff--no-assistant .match-staff__row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .match-staff__cell::before {
        content: attr(data-label) ": ";
        color: #2B7A3D;
        font-weight: 600;
    }

    .match-staff__absent {
        display: inline-flex;
        vertical-align: top;
    }
}
