/* style.css — the homepage and the 404 page. The dark look is style-dark.css,
   linked after this file with a media condition (see theme_mode_head() in
   system/lib.php), so a rule there wins over the same rule here. */

/* General reset for consistent styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

/* Reserve the scrollbar's width on every page so content doesn't shift
   horizontally when moving between a short page and a tall one. */
html {
    scrollbar-gutter: stable;
    color-scheme: light;
}

body {
    background-color: #f0f0f0;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-text-size-adjust: 100%;
}

/* Embedded frames (the ads) keep their own colours whatever the page's look */
iframe {
    color-scheme: normal;
}

header {
    position: relative;
    background-color: var(--brand); /* Brand colour background */
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    /* Installed web app on iPhone: keep the title clear of the status bar */
    padding-top: max(1.5rem, env(safe-area-inset-top));
    width: 100%;
    flex-shrink: 0;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1rem;
}

/* Phones: a shorter bar, so the page starts higher. live.css and
   install-guide.css carry the same numbers. */
@media (max-width: 699px) {
    header {
        padding: 14px 0;
        padding-top: max(14px, env(safe-area-inset-top));
    }

    header h1 {
        font-size: 1.6rem;
        margin-bottom: 3px;
    }

    header p {
        font-size: 0.875rem;
    }
}

/* Light/dark button at the right of the header (theme_toggle_button()).
   The moon shows in the light look; style-dark.css swaps in the sun. */
.theme-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    background-color: rgba(255, 255, 255, 0.15);
}

.theme-toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.theme-toggle .icon-sun {
    display: none;
}

/* Main content wrapper */
.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Start below the header rather than centring in the leftover viewport
       height, which left a large gap above the match list on tall screens */
    justify-content: flex-start;
    width: 100%;
    /* Matches .content in live.css so the homepage and player page align */
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Lead strip under the header: one line plus three check items */
.lead {
    width: 100%;
    max-width: 640px;
    margin: 0 auto 1.75rem;
    text-align: center;
}

.lead-text {
    font-size: 1.15rem;
    font-weight: bold;
    color: var(--heading);
    line-height: 1.4;
}

/* Plain text with a check mark; all three fit on one row from 320px up */
.lead-points {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1rem;
    margin-top: 0.75rem;
}

.lead-points li {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.875rem;
    color: #555;
    white-space: nowrap;
}

.lead-points li::before {
    content: "\2713";
    color: var(--brand);
    font-weight: bold;
}

/* "About" at the foot of the homepage: a lead sentence and three cards */
.about {
    width: 100%;
    margin-top: 2.5rem;
}

.about h2 {
    font-size: 1.25rem;
    color: var(--heading);
    text-align: center;
    margin-bottom: 0.4rem;
}

.about-lead {
    max-width: 640px;
    margin: 0 auto 1.25rem;
    text-align: center;
    font-size: 1rem;
    line-height: 1.5;
    color: #444;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.about-item {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem 1.1rem;
    text-align: left;
}

.about-item h3 {
    font-size: 1rem;
    color: var(--heading);
    margin-bottom: 0.35rem;
}

.about-item p {
    font-size: 0.93rem;
    line-height: 1.55;
    color: #555;
}

@media (min-width: 760px) {
    .about-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

/* Heading above the match list: a plain section label, like the headings
   on the match page */
.match-selection h2 {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--heading);
    text-align: center;
    margin-bottom: 0.9rem;
}

/* Matches Section */
.matches {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    width: 100%;
}

/* Match Box Styling */
.match-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Pins the button to the card bottom so it stays aligned across a row
       even when a longer match name wraps to two lines */
    justify-content: space-between;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 100%;
    max-width: 350px;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}

.match-box:focus-visible,
.match-box.active {
    transform: scale(1.05);
    box-shadow: 0px 4px 12px rgba(var(--brand-rgb), 0.3);
    border-color: var(--brand);
    background-color: rgba(var(--brand-rgb), 0.1);
}

/* Hover only where there is a real pointer. On a touch screen :hover and
   :focus stay on the tapped card, so it was still enlarged after Back. */
@media (hover: hover) {
    .match-box:hover {
        transform: scale(1.05);
        box-shadow: 0px 4px 12px rgba(var(--brand-rgb), 0.3);
        border-color: var(--brand);
        background-color: rgba(var(--brand-rgb), 0.1);
    }
}

.match-box:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
}

.match-box h3 {
    font-size: 1.2rem;
    color: var(--heading);
    margin-bottom: 0.3rem;
    text-decoration: none;
}

/* "Channel 3" — what the site can honestly say about a listed match */
.match-channel {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 1rem;
}

.watch-live {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    color: white;
    background-color: var(--accent); /* Accent colour; it has to be dark enough for white text (4.5:1) */
    border-radius: 4px;
    font-size: 1rem;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.watch-live:hover,
.watch-live:focus {
    background-color: var(--accent-hover);
}

/* Empty state when no matches are listed */
.no-matches {
    font-size: 1.1rem;
    color: #555;
    text-align: center;
    padding: 2rem 1rem;
}

/* Phones: each match is one row, name and channel on the left, Watch on the
   right, so the whole list fits on one screen. The row is still one link. */
@media (max-width: 699px) {
    .matches {
        gap: 0.6rem;
    }

    .match-box {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "title watch"
            "channel watch";
        align-items: center;
        column-gap: 0.5rem;
        max-width: none;
        padding: 0.8rem 0.9rem 0.8rem 1rem;
        text-align: left;
    }

    .match-box h3 {
        grid-area: title;
        font-size: 1rem;
        margin-bottom: 0.15rem;
    }

    .match-channel {
        grid-area: channel;
        margin-bottom: 0;
    }

    .watch-live {
        grid-area: watch;
        padding: 0.5rem 0.9rem;
    }
}

/* Responsive Design — two columns above 700px. Deliberately not three: at the
   960px container width a third column leaves too little room for longer match
   names, which then wrap to two lines. */
@media (min-width: 700px) {
    .match-box {
        /* Two cards plus the 1rem gap are exactly the row, so the grid lines up
           with the About cards and with the video on the match page */
        width: calc(50% - 0.5rem);
        max-width: none;
    }
}

/* Footer (system/partials/site-footer.php); live.css and install-guide.css
   carry the same rules */
.footer {
    background-color: var(--brand);
    color: white;
    text-align: center;
    padding: 6px 8px 12px;
    width: 100%;
    flex-shrink: 0;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-nav a {
    display: inline-block;
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.25;
    padding: 10px 8px;
}

.footer-nav a:hover,
.footer-nav a:focus {
    text-decoration: underline;
}

/* Shown when the catch-all route serves a URL that does not exist */
.not-found {
    width: 100%;
    max-width: 640px;
    margin: 0 auto 1.25rem;
    padding: 0.9rem 1rem;
    background-color: var(--notice-tint);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    color: #333;
    line-height: 1.45;
}

/* Links to the install guides, under the match list */
.device-links {
    width: 100%;
    margin-top: 2.5rem;
    text-align: center;
}

.device-links h2 {
    font-size: 1.25rem;
    color: var(--heading);
    margin-bottom: 0.35rem;
}

.device-links p {
    color: #555;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.device-links-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.device-link {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    border: 2px solid var(--brand);
    border-radius: 999px;
    color: var(--brand-text);
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.device-link:hover,
.device-link:focus {
    background-color: var(--brand);
    color: #fff;
}

/* Respect the OS "reduce motion" setting */
@media (prefers-reduced-motion: reduce) {
    .match-box,
    .watch-live,
    .device-link {
        transition: none;
    }

    .match-box:hover,
    .match-box:focus-visible,
    .match-box.active {
        transform: none;
    }
}
