/* live.css — the match pages. The dark look is live-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 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 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, html {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    color: #333;
    line-height: 1.6;
    width: 100%;
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

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

/* Wrapper and Header */
.wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    position: relative;
    width: 100%;
    background-color: var(--brand);
    color: white;
    padding: 24px 20px;
    /* Installed web app on iPhone: keep the title clear of the status bar */
    padding-top: max(24px, env(safe-area-inset-top));
    text-align: center;
    /* Opt out of the 1.6 body line-height so this matches the homepage header */
    line-height: normal;
}

.header-title {
    color: white;
    text-decoration: none;
    font-size: 2rem;
    font-weight: bold;
}

.header p {
    margin-top: 8px;
    font-size: 1rem;
}

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

    .header-title {
        font-size: 1.6rem;
    }

    .header p {
        margin-top: 3px;
        font-size: 0.875rem;
    }
}

/* Light/dark button at the right of the header (theme_toggle_button()).
   The moon shows in the light look; live-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;
}

/* Content and Channel Title */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    /* 1.5rem matches .content-wrapper in style.css, so the video lines up with
       the homepage match cards instead of sitting 8px wider */
    padding: 1.5rem;
}

.channel-title {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--heading);
    text-align: center;
    margin-bottom: 0.4rem;
    border-bottom: 2px solid var(--brand);
    padding-bottom: 0.5rem;
}

/* The subheading under the match name */
.channel-sub {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    margin-bottom: 1rem;
}

/* Video Container for Responsive Player. Black from the first paint, like the
   app and TV players, so the visitor sees where the video will be. */
.video-container {
    width: 100%;
    position: relative;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    margin-bottom: 20px;
    background-color: #000;
}

.video-container iframe, .video-container script {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Wide screens: never let the player be taller than the window, so its
   controls stay above the fold on a laptop. 255 = header (111) + content
   padding (24) + title and sub-line (96) + 24px gap; the phone header block
   above does not apply here. Landscape phones are kept out by min-height. */
@media (min-width: 700px) and (min-height: 501px) {
    @supports (aspect-ratio: 16 / 9) {
        .video-container {
            padding-top: 0;
            aspect-ratio: 16 / 9;
            width: min(100%, calc((100vh - 255px) * 16 / 9));
        }
    }
}

/* Install links: quiet outlines, like the device links on the homepage, so
   the player and the match list lead */
.button-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 4px 0 14px;
    gap: 10px;
}

.btn {
    background-color: transparent;
    color: var(--brand-text);
    border: 1.5px solid var(--brand);
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: background-color 0.2s ease, color 0.2s ease;
}

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

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

/* Match description: a card under the "Other matches" chips, styled like the
   About cards on the homepage so the two pages read as one site */
.match-about {
    width: 100%;
    margin: 4px 0 20px;
}

.match-about h2 {
    font-size: 1.1rem;
    color: var(--heading);
    text-align: center;
    margin-bottom: 10px;
}

.match-about-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px 18px;
}

.match-about-card p {
    font-size: 1rem;
    line-height: 1.6;
    text-align: left;
    color: #333;
}

/* Share row under the install buttons */
.share-bar {
    margin: 0 0 20px;
    text-align: center;
}

.share-btn {
    display: inline-block;
    background-color: #0f7f72;   /* WhatsApp's dark green, 4.9:1 with white */
    color: #fff;
    font-weight: bold;
    padding: 12px 20px;
    /* Same height and corners as the install links above */
    border: 1.5px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.share-btn:hover,
.share-btn:focus {
    background-color: #0b6a5f;
}

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

/* Other current matches, under the install and share buttons */
.also-live {
    width: 100%;
    margin: 4px 0 20px;
}

.also-live h2 {
    font-size: 1.1rem;
    color: var(--heading);
    text-align: center;
    margin-bottom: 10px;
}

.also-live-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.also-live-link {
    display: inline-block;
    padding: 10px 16px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: var(--brand);
    font-weight: bold;
    text-decoration: none;
    transition: border-color 0.2s ease;
}

.also-live-link:hover,
.also-live-link:focus {
    border-color: var(--brand);
}

.also-live-link:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
}

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

.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;
}

/* Responsive Design Adjustments */
@media (max-width: 600px) {
    .btn,
    .share-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    /* More matches: a list of full-width rows instead of centred boxes */
    .also-live h2,
    .match-about h2 {
        text-align: left;
    }

    .also-live-row {
        flex-direction: column;
        gap: 8px;
    }

    .also-live-link {
        display: block;
        padding: 12px 16px;
    }
}

/* Phone turned sideways: the video alone, as large as the screen allows,
   like the app player's theatre mode. Everything else returns on rotate. */
@media (orientation: landscape) and (max-height: 500px) {
    body, html {
        background-color: #000;
    }

    .wrapper {
        min-height: 100vh;
        justify-content: center;
    }

    .header,
    .channel-title,
    .channel-sub,
    .button-bar,
    .share-bar,
    .also-live,
    .match-about,
    .footer {
        display: none;
    }

    .content {
        flex: 0 0 auto;
        padding: 0;
    }

    .video-container {
        width: min(100vw, calc(100vh * 16 / 9));
        height: min(100vh, calc(100vw * 9 / 16));
        /* Browsers that know svh fit the video under the URL bar too */
        width: min(100vw, calc(100svh * 16 / 9));
        height: min(100svh, calc(100vw * 9 / 16));
        padding-top: 0;
        margin: 0 auto;
    }
}
