/* live.css */

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

body, html {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    color: #333;
    line-height: 1.6;
    width: 100%;
    height: 100%;
}

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

.header {
    width: 100%;
    background-color: #1e73be;
    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;
}

/* 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: #333;
    text-align: center;
    margin-bottom: 0.4rem;
    border-bottom: 2px solid #1e73be;
    padding-bottom: 0.5rem;
}

/* "Live cricket streaming · Channel 3" under the match name */
.channel-sub {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    margin-bottom: 1rem;
}

/* Video Container for Responsive Player */
.video-container {
    width: 100%;
    position: relative;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    margin-bottom: 20px;
}

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

/* Button Bar Styles */
.button-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 20px 0;
    gap: 15px;
}

.btn {
    background-color: #bd5909;
    color: #fff;
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.btn:hover,
.btn:focus {
    background-color: #9e4a07;
}

.btn:focus-visible {
    outline: 3px solid #1e73be;
    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: #16314d;
    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;
}

/* Footer Styling */
.footer {
    width: 100%;
    background-color: #1e73be;
    color: white;
    padding: 10px 20px;
    text-align: center;
}

/* 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 22px;
    border-radius: 5px;
    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 #1e73be;
    outline-offset: 2px;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 20px;
    margin-bottom: 6px;
}

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

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

/* 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: #16314d;
    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: #1e73be;
    font-weight: bold;
    text-decoration: none;
    transition: border-color 0.2s ease;
}

.also-live-link:hover,
.also-live-link:focus {
    border-color: #1e73be;
}

.also-live-link:focus-visible {
    outline: 3px solid #1e73be;
    outline-offset: 2px;
}

/* Dark mode: follows the phone's setting. Brand blue and the buttons stay. */
@media (prefers-color-scheme: dark) {
    body, html {
        background-color: #121417;
        color: #e6e6e6;
    }

    .channel-title {
        color: #e6e6e6;
        border-bottom-color: #5ea3e6;
    }

    .channel-sub {
        color: #9aa3ad;
    }

    .match-about h2,
    .also-live h2 {
        color: #e6e6e6;
    }

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

    .match-about-card p {
        color: #cfd5dc;
    }

    .also-live-link {
        background-color: #1c2128;
        border-color: #2c333d;
        color: #5ea3e6;
    }

    .also-live-link:hover,
    .also-live-link:focus {
        border-color: #5ea3e6;
    }

    .also-live-link:focus-visible {
        outline-color: #5ea3e6;
    }
}

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

}

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