/* style.css */

/* 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;
}

body {
    background-color: #f0f0f0;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: #1e73be; /* Blue 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;
}

/* 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-pills */
.lead {
    width: 100%;
    max-width: 640px;
    margin: 0 auto 1.75rem;
    text-align: center;
}

.lead-text {
    font-size: 1.15rem;
    font-weight: bold;
    color: #16314d;
    line-height: 1.4;
}

/* Sized so all three pills fit on one row at 360px (the narrowest common
   phone width), with a little to spare */
.lead-points {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.lead-points li {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.65rem;
    border: 1px solid #cfdcea;
    border-radius: 999px;
    background-color: #fff;
    font-size: 0.8rem;
    color: #444;
    white-space: nowrap;
}

.lead-points li::before {
    content: "\2713";
    color: #1e73be;
    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: #1e73be;
    text-align: center;
    margin-bottom: 0.4rem;
}

.about-lead {
    max-width: 640px;
    margin: 0 auto 1.25rem;
    text-align: center;
    font-size: 1rem;
    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: #16314d;
    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;
    }
}

/* Styled Match Selection Text */
.match-selection h2 {
    font-size: 1.8rem;
    font-weight: bold;
    color: #1e73be;
    border-bottom: 2px solid #1e73be;
    padding-bottom: 0.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* 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:hover,
.match-box:focus,
.match-box.active {
    transform: scale(1.05);
    box-shadow: 0px 4px 12px rgba(30, 115, 190, 0.3);
    border-color: #1e73be;
    background-color: rgba(30, 115, 190, 0.1);
}

.match-box:focus-visible {
    outline: 3px solid #1e73be;
    outline-offset: 2px;
}

.match-box h2 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 0.3rem;
    text-decoration: none;
}

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

.watch-live {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    color: white;
    background-color: #bd5909; /* Orange, 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: #9e4a07;
}

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

/* 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 {
        width: calc(50% - 1rem);
        max-width: none;
    }
}

/* Footer Styling */
footer {
    background-color: #1e73be;
    color: white;
    text-align: center;
    padding: 1rem 0;
    width: 100%;
    flex-shrink: 0;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 1.25rem;
    margin-bottom: 0.5rem;
}

.footer-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
}

.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: #fff4e8;
    border-left: 4px solid #bd5909;
    border-radius: 8px;
    color: #333;
}

/* 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.3rem;
    color: #1e73be;
    margin-bottom: 0.35rem;
}

.device-links p {
    color: #555;
    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 #1e73be;
    border-radius: 999px;
    color: #185fa0;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.device-link:hover,
.device-link:focus {
    background-color: #1e73be;
    color: #fff;
}

/* Dark mode: follows the phone's setting. The blue header/footer and the
   orange buttons are brand colours and stay as they are. */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121417;
        color: #e6e6e6;
    }

    .match-selection h2 {
        color: #5ea3e6;
        border-bottom-color: #5ea3e6;
    }

    .lead-text,
    .about-item h3 {
        color: #e6e6e6;
    }

    .lead-points li {
        background-color: #1c2128;
        border-color: #2c333d;
        color: #cfd5dc;
    }

    .lead-points li::before {
        color: #5ea3e6;
    }

    .about h2 {
        color: #5ea3e6;
    }

    .about-lead,
    .about-item p {
        color: #cfd5dc;
    }

    .about-item {
        background-color: #1c2128;
        border-color: #2c333d;
    }

    .match-box {
        background-color: #1c2128;
        border-color: #2c333d;
    }

    .match-box h2 {
        color: #e6e6e6;
    }

    .match-channel {
        color: #a0a8b3;
    }

    .match-box:focus-visible {
        outline-color: #5ea3e6;
    }

    .match-box:hover,
    .match-box:focus,
    .match-box.active {
        background-color: #22303f;
        border-color: #5ea3e6;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }

    .no-matches {
        color: #a0a8b3;
    }

    .not-found {
        background-color: #2b2118;
        border-left-color: #e08a3c;
        color: #e6e6e6;
    }

    .device-links h2 {
        color: #5ea3e6;
    }

    .device-links p {
        color: #a0a8b3;
    }

    .device-link {
        border-color: #5ea3e6;
        color: #5ea3e6;
    }

    .device-link:hover,
    .device-link:focus {
        background-color: #5ea3e6;
        color: #121417;
    }
}

/* 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,
    .match-box.active {
        transform: none;
    }
}
