/*
 * Clubee Matches. The accent colours come from Settings > Clubee Matches; other variables can be
 * overridden in the theme (Appearance > Customize > Additional CSS), e.g. .clubee-matches { --clubee-radius: 4px; }
 */
.clubee-matches {
    --clubee-accent: #0070bb;
    --clubee-accent-text: #fff;
    --clubee-dialog-bg: #fff;
    --clubee-dialog-text: #1e1e1e;
    --clubee-text: inherit;
    --clubee-muted: color-mix(in srgb, currentColor 60%, transparent);
    --clubee-border: color-mix(in srgb, currentColor 14%, transparent);
    --clubee-card: color-mix(in srgb, currentColor 3%, transparent);
    --clubee-radius: 10px;

    color: var(--clubee-text);
    margin: 1.5em 0;
    font-variant-numeric: tabular-nums;
}

.clubee-matches *,
.clubee-matches *::before,
.clubee-matches *::after {
    box-sizing: border-box;
}

.clubee-matches__title {
    margin: 0 0 .5em;
}

.clubee-matches__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75em;
    padding: .6em 0;
    margin-bottom: .5em;
    border-bottom: 2px solid var(--clubee-accent);
}

.clubee-matches__range {
    flex: 1;
    text-align: center;
    font-weight: 700;
}

.clubee-matches__today {
    margin-left: .5em;
    font-size: .8em;
    font-weight: 400;
}

.clubee-matches a.clubee-matches__nav {
    flex: none;
    padding: .35em .8em;
    border: 1px solid var(--clubee-border);
    border-radius: 999px;
    font-size: .875em;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.clubee-matches a.clubee-matches__nav:hover,
.clubee-matches a.clubee-matches__nav:focus-visible {
    border-color: var(--clubee-accent);
    color: var(--clubee-accent);
}

.clubee-matches__empty {
    padding: 1.5em 0;
    text-align: center;
    color: var(--clubee-muted);
}

.clubee-matches__day {
    margin: 1.25em 0;
}

.clubee-matches h3.clubee-matches__date {
    margin: 0 0 .5em;
    font-size: .8em;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--clubee-muted);
}

.clubee-matches ul.clubee-matches__list {
    display: grid;
    gap: .5em;
    margin: 0;
    padding: 0;
    list-style: none;
}

.clubee-game {
    display: grid;
    grid-template-columns: 4.25em minmax(0, 1fr) auto;
    grid-template-areas:
        "time teams badge"
        ".    meta  meta";
    align-items: center;
    column-gap: .9em;
    row-gap: .4em;
    margin: 0;
    padding: .75em 1em;
    border: 1px solid var(--clubee-border);
    border-left: 4px solid var(--clubee-border);
    border-radius: var(--clubee-radius);
    background: var(--clubee-card);
}

.clubee-game--home {
    border-left-color: var(--clubee-accent);
}

.clubee-game--clickable {
    position: relative;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

/* Hover: shadow plus a slightly stronger border on all sides, the left (home) marker keeps its colour. */
.clubee-game--clickable:hover,
.clubee-game--clickable:focus-within {
    border-top-color: color-mix(in srgb, currentColor 28%, transparent);
    border-right-color: color-mix(in srgb, currentColor 28%, transparent);
    border-bottom-color: color-mix(in srgb, currentColor 28%, transparent);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
}

.clubee-game--clickable:not(.clubee-game--home):hover,
.clubee-game--clickable:not(.clubee-game--home):focus-within {
    border-left-color: color-mix(in srgb, currentColor 28%, transparent);
}

/* Home match outside the usual hall. */
.clubee-game--other-venue {
    --clubee-warning: #b45309;
}

.clubee-game__other-venue {
    display: inline-flex;
    align-items: center;
    gap: .3em;
    padding: .15em .6em;
    border-radius: 999px;
    background: color-mix(in srgb, var(--clubee-warning) 12%, transparent);
    color: var(--clubee-warning);
    font-weight: 600;
}

.clubee-game__other-venue .clubee-game__pin {
    color: inherit;
}

.clubee-game__time {
    grid-area: time;
    align-self: start;
    padding-top: .2em;
    font-size: 1.05em;
    font-weight: 700;
}

.clubee-game__tba {
    display: block;
    font-size: .75em;
    font-weight: 600;
    line-height: 1.2;
    color: var(--clubee-muted);
}

.clubee-team__crest--none {
    visibility: hidden;
}

.clubee-game__end {
    display: block;
    font-size: .75em;
    font-weight: 400;
    color: var(--clubee-muted);
}

.clubee-game__name {
    align-self: center;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.clubee-game__teams {
    grid-area: teams;
    display: grid;
    gap: .35em;
    min-width: 0;
}

.clubee-team {
    display: flex;
    align-items: center;
    gap: .6em;
    min-width: 0;
}

.clubee-team__crest {
    flex: none;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.clubee-team__crest--empty {
    border-radius: 50%;
    background: var(--clubee-border);
}

.clubee-team__name {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.clubee-team--club .clubee-team__name {
    font-weight: 700;
}

.clubee-team__score {
    flex: none;
    min-width: 2ch;
    text-align: right;
    font-weight: 700;
    color: var(--clubee-muted);
}

.clubee-team--winner .clubee-team__score {
    color: inherit;
}

.clubee-game__badge {
    grid-area: badge;
    align-self: start;
}

.clubee-game__badge span {
    display: inline-block;
    padding: .2em .65em;
    border: 1px solid var(--clubee-border);
    border-radius: 999px;
    font-size: .75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--clubee-muted);
}

.clubee-game--home .clubee-game__badge span {
    border-color: var(--clubee-accent);
    background: var(--clubee-accent);
    color: var(--clubee-accent-text);
}

.clubee-game__meta {
    grid-area: meta;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25em .5em;
    font-size: .85em;
    color: var(--clubee-muted);
}

.clubee-game__venue {
    display: inline-flex;
    align-items: center;
    gap: .25em;
}

/* Invisible link over the whole card, so clicking anywhere on the game opens the popup. */
.clubee-matches a.clubee-game__open {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: var(--clubee-radius);
}

.clubee-matches a.clubee-game__open:focus {
    outline: none;
}

.clubee-matches a.clubee-game__open:focus-visible {
    outline: 2px solid var(--clubee-accent);
    outline-offset: 2px;
}

.clubee-game__pin {
    flex: none;
    color: var(--clubee-accent);
}

/* Venue popup */
.clubee-dialog {
    width: min(560px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: var(--clubee-dialog-bg);
    color: var(--clubee-dialog-text);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .3);
    overflow: auto;
}

/* Clicking inside the dialog focuses the dialog itself; no focus ring for that. */
.clubee-dialog:focus,
.clubee-dialog:focus-visible,
.clubee-dialog__inner:focus {
    outline: none;
}

.clubee-dialog p.clubee-dialog__warning {
    margin: 0 0 .6em;
    padding: .5em .75em;
    border-left: 3px solid #b45309;
    border-radius: 6px;
    background: rgba(180, 83, 9, .1);
    color: #92400e;
    font-size: .9em;
    font-weight: 600;
}

.clubee-dialog::backdrop {
    background: rgba(0, 0, 0, .55);
}

.clubee-dialog__inner {
    position: relative;
    padding: 1.4em 1.4em 1.25em;
    border-top: 4px solid var(--clubee-accent);
}

.clubee-dialog .clubee-dialog__close {
    position: absolute;
    top: .5em;
    right: .5em;
    width: 2.25em;
    height: 2.25em;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 1.25em;
    line-height: 1;
    cursor: pointer;
}

.clubee-dialog .clubee-dialog__close:hover,
.clubee-dialog .clubee-dialog__close:focus-visible {
    background: rgba(0, 0, 0, .07);
}

/* The dialog focuses the close button when it opens; only show a ring for keyboard users. */
.clubee-dialog .clubee-dialog__close:focus {
    outline: none;
    box-shadow: none;
}

.clubee-dialog .clubee-dialog__close:focus-visible {
    outline: 2px solid var(--clubee-accent);
    outline-offset: 0;
}

.clubee-dialog p.clubee-dialog__when {
    margin: 0 2.5em .25em 0;
    font-size: .8em;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--clubee-accent);
}

.clubee-dialog h2.clubee-dialog__title {
    margin: 0 2em .2em 0;
    font-size: 1.3em;
    line-height: 1.25;
}

.clubee-dialog p.clubee-dialog__league {
    margin: 0;
    font-size: .9em;
    opacity: .7;
}

.clubee-dialog p.clubee-dialog__note {
    margin: .75em 0 0;
    white-space: pre-line;
}

.clubee-dialog dl.clubee-dialog__officials {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .2em 1em;
    margin: 1em 0 0;
    padding: .75em 1em;
    border-radius: 10px;
    background: rgba(0, 0, 0, .04);
    font-size: .9em;
}

.clubee-dialog__officials dt {
    margin: 0;
    font-weight: 700;
}

.clubee-dialog__officials dd {
    margin: 0;
}

.clubee-dialog__officials dd.is-empty,
.clubee-dialog__officials dd.is-loading {
    opacity: .6;
}

.clubee-dialog__officials dd.is-loading {
    grid-column: 1 / -1;
}

.clubee-dialog dl.clubee-dialog__officials[hidden],
.clubee-dialog__venue[hidden],
.clubee-dialog__actions[hidden] {
    display: none;
}

.clubee-dialog__venue {
    margin-top: 1.1em;
}

.clubee-dialog__venue h3 {
    margin: 0;
    font-size: 1.05em;
}

.clubee-dialog__venue address {
    margin: .15em 0 0;
    font-style: normal;
    opacity: .8;
}

.clubee-dialog__map {
    aspect-ratio: 16 / 10;
    margin: 1em 0;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(0, 0, 0, .06);
}

.clubee-dialog__map[hidden] {
    display: none;
}

.clubee-dialog__map iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.clubee-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5em;
    margin-top: 1em;
}

.clubee-dialog a.clubee-dialog__button {
    flex: 1 1 8em;
    padding: .65em 1em;
    border: 2px solid var(--clubee-accent);
    border-radius: 999px;
    background: var(--clubee-accent);
    color: var(--clubee-accent-text);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.clubee-dialog a.clubee-dialog__button:not(:first-child) {
    background: transparent;
    color: var(--clubee-accent);
}

.clubee-dialog a.clubee-dialog__button:hover,
.clubee-dialog a.clubee-dialog__button:focus-visible {
    filter: brightness(.92);
}

.clubee-dialog a.clubee-dialog__button[hidden] {
    display: none;
}

.clubee-game--cancelled .clubee-game__time,
.clubee-game--cancelled .clubee-team__name {
    text-decoration: line-through;
    opacity: .6;
}

.clubee-game--live .clubee-game__badge span {
    border-color: var(--clubee-live, #d62828);
    background: var(--clubee-live, #d62828);
    color: #fff;
}

.clubee-game--live .clubee-game__badge span::before {
    content: "";
    display: inline-block;
    width: .5em;
    height: .5em;
    margin-right: .4em;
    border-radius: 50%;
    background: currentColor;
    vertical-align: .05em;
    animation: clubee-live-pulse 1.4s ease-in-out infinite;
}

@keyframes clubee-live-pulse {
    50% { opacity: .25; }
}

@media (prefers-reduced-motion: reduce) {
    .clubee-game--live .clubee-game__badge span::before {
        animation: none;
    }
}

.clubee-game--cancelled .clubee-game__badge span {
    border-color: currentColor;
    background: none;
    color: var(--clubee-accent);
}

@media (max-width: 480px) {
    .clubee-game {
        grid-template-columns: 3.4em minmax(0, 1fr);
        grid-template-areas:
            "time teams"
            ".    meta"
            ".    badge";
        padding: .7em .75em;
        column-gap: .6em;
    }

    .clubee-game__badge:empty,
    .clubee-game__sep {
        display: none;
    }

    .clubee-game__meta {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Bottom sheet on phones. */
    .clubee-dialog {
        width: 100%;
        max-height: 92dvh;
        margin: auto 0 0;
        border-radius: 16px 16px 0 0;
    }

    .clubee-dialog__inner {
        padding-bottom: calc(1.25em + env(safe-area-inset-bottom));
    }

    /* Arrow only on phones, label stays available to screen readers. */
    .clubee-matches__nav-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}
