/*
 * Global styles for the Fidelity FM-inspired website.
 * The design takes cues from the official station page: a bold red backdrop,
 * a crisp white content area, and simple, modern typography.  Flexbox and
 * responsive units help the layout adapt gracefully to phones, tablets and
 * desktops.  Comments throughout this file explain the intention behind
 * each rule.
 */

/* Set up a clean slate */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Global CSS variables control the size of the play and mute buttons.  By using
 * variables, we can easily scale the controls for different viewport widths and
 * ensure the control area is always tall enough to accommodate them. */
:root {
    --play-size: 64px;
    --mute-size: 44px;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #e52c2d; /* primary red used on the original site */
    color: #333;
    line-height: 1.5;
}

/* Decorative heading above the player */
.live-heading {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #e52c2d;
    text-align: center;
    margin-bottom: 20px;
}

/* The central white panel that holds all content */
.container {
    background-color: #fff;
    max-width: 1000px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Header styling */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 4px solid #f2f2f2;
}

header .logo img {
    height: 80px;
    width: auto;
}

header nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* The navigation no longer uses image sprites for buttons; styles for images inside nav are removed */

/* Podcast button styling */
.podcast-btn {
    display: inline-flex;
    align-items: center;
    background-color: #e52c2d;
    color: #fff;
    padding: 10px 18px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.2s ease;
}

.podcast-btn:hover {
    transform: scale(1.05);
}

.podcast-btn .podcast-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    filter: brightness(0) saturate(100%) invert(100%);
}

/* Player section with subtle shadow and rounded corners */
.player-section {
    margin: 30px 0;
    background-color: #f7f7f7;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 20px;
}

/* Custom audio player layout */
.custom-player {
    display: flex;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
}

.custom-player .player-left {
    flex: 0 0 35%;
    background-color: #e52c2d;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.custom-player .player-left img {
    max-width: 100%;
    height: auto;
    /* no filter needed: the logo asset is already white */
    filter: none;
}

.custom-player .player-right {
    flex: 1;
    background-color: #1c1c1c;
    display: flex;
    flex-direction: column;
    /* Display as a column so we can push the status bar to the bottom via auto margin */
    justify-content: flex-start;
    height: 100%;
    padding: 20px;
    /* remove bottom padding so the status bar sits flush with the bottom edge */
    padding-bottom: 0;
    color: #fff;
    position: relative;
    overflow: hidden;

    /* Guarantee enough vertical space for the controls and status bar even on very
     * wide screens.  On mobile the min-height is adjusted via media query below. */
    min-height: 120px;
}

/* Container for play/mute controls and equalizer.  Make it relatively positioned so the
 * equalizer background spans only this area and does not overlay the status text.  We
 * also hide overflow to prevent bars from escaping into the status section. */
.controls-container {
    position: relative;
    width: 148%;
    /* Allow the play button to extend outside the container if necessary */
    overflow: visible;
    /* Let the height be determined by its contents so that the bars adapt naturally
     * and the play button isn’t cut off.  A minimum height ensures adequate space for
     * the controls. */
    /* Ensure the control area always has enough height for the play button and a bit
     * of breathing room above/below.  The 24px extra accounts for vertical spacing,
     * preventing the play button from being clipped on smaller screens. */
    min-height: calc(var(--play-size) + 24px);
}

/* Align play button and volume slider horizontally */
.control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    /* remove bottom margin so controls occupy the full height of their container */
    margin-bottom: 0;

    /* Ensure controls appear above the equalizer overlay */
    position: relative;
    z-index: 1;
}

.play-btn {
    width: var(--play-size);
    height: var(--play-size);
    border-radius: 50%;
    /* subtle gradient for depth */
    background: linear-gradient(135deg, #ff7a7a, #e52c2d);
    /* add a gentle border for a more polished appearance */
    border: 2px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* Remove bottom margin so controls align neatly in a single row */
    margin-bottom: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

/* Mute/volume button on the right side of the controls */
.mute-btn {
    width: var(--mute-size);
    height: var(--mute-size);
    border-radius: 50%;
    /* Dark grey circle similar to the reference player */
    background: #2f2f2f;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mute-btn:hover {
    background: #444;
}

.mute-btn img {
    width: 20px;
    height: 20px;
    /* make the black SVG white */
    filter: brightness(0) invert(1);
}

/* Volume slider / progress bar styling */
.progress-bar {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    /* dark track similar to reference player */
    background: #444;
    cursor: pointer;
    outline: none;
}

/* WebKit thumb */
/* WebKit thumb */
.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    /* white knob like the sample player */
    background: #ffffff;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Mozilla thumb */
/* Mozilla thumb */
.progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.status-text {
    font-size: 0.9rem;
    /* The status appears on a coloured bar.  It sits at the bottom of the
     * player-right panel and stretches to the edges by offsetting the
     * panel's horizontal padding.  Horizontal padding on the text itself
     * ensures it doesn’t hug the edges. */
    background-color: #0d6efd; /* initial blue for paused/stopped */
    color: #fff;
    padding: 6px 20px;
    border-radius: 0;
    display: block;
    /* static positioning so the status sits directly beneath the controls. */
    position: static;
    margin-top: 0;
    /* stretch the coloured bar into the panel padding by using negative margins.  The
     * width accounts for the horizontal padding (20px each side). */
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
    /* Push the status to the bottom of the flex column */
    margin-top: auto;

    /* Round the bottom-right corner to align with the custom-player’s border radius
     * so that the coloured bar fills the curved corner instead of leaving a dark gap */
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
}

/* Equalizer overlay covers the entire controls area.  Bars animate when playing. */
.eq-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-end;
    pointer-events: none;
    z-index: 0;
    /* hidden until playing */
    opacity: 0;
}

.eq-bg .eq-bar {
    flex: 1;
    margin: 0 1px;
    height: 100%;
    /* red translucent bars for a more cohesive look with the brand colour */
    background: linear-gradient(180deg, rgba(229, 44, 45, 0.7), rgba(229, 44, 45, 0.3));
    transform-origin: bottom;
    animation: equalize 1s ease-in-out infinite;
    animation-play-state: paused;
}

/* Apply repeating delays for the animated segments */
.eq-bg .eq-bar:nth-child(5n+1) { animation-delay: 0s; }
.eq-bg .eq-bar:nth-child(5n+2) { animation-delay: 0.2s; }
.eq-bg .eq-bar:nth-child(5n+3) { animation-delay: 0.4s; }
.eq-bg .eq-bar:nth-child(5n+4) { animation-delay: 0.6s; }
.eq-bg .eq-bar:nth-child(5n)   { animation-delay: 0.8s; }

/* Trigger the animation only when playing */
.eq-bg.playing .eq-bar {
    animation-play-state: running;
}

/* When playing, reveal the overlay */
.eq-bg.playing {
    opacity: 0.6;
}

@keyframes equalize {
    0%, 100% {
        transform: scaleY(0.3);
    }
    50% {
        transform: scaleY(1);
    }
}

@media (max-width: 768px) {
    .custom-player .player-left {
        flex: 0 0 100%;
        padding: 30px;
    }
    .custom-player .player-right {
        flex: 0 0 100%;
        /* reduce padding on mobile so the dark area appears narrower */
        padding: 10px;
        /* remove bottom padding on mobile as well */
        padding-bottom: 0;
    }

    /* When the right panel padding shrinks, adjust the negative margins and horizontal
     * padding of the status bar accordingly so that it still stretches edge to edge
     * with equal spacing inside. */
    .status-text {
        width: calc(100% + 20px);
        margin-left: -10px;
        margin-right: -10px;
        padding-left: 10px;
        padding-right: 10px;
        margin-top: auto;
    }

    /* On small screens tighten spacing between controls and status */
    .control-row {
        margin-bottom: 6px;
    }
}

/* Banner styling */
.banner {
    margin-bottom: 30px;
    text-align: center;
}

.banner img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

/* Footer styles */
footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 4px solid #f2f2f2;
    text-align: center;
    color: #777;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.social-icons a img {
    width: 32px;
    height: 32px;
    transition: transform 0.2s ease;
    /*
     * Colour the icons to the same vibrant red as the page accents.  The icons
     * themselves are pure black SVGs, so by setting brightness(0) and then
     * applying a series of filters we can approximate our brand colour
     * (#e52c2d).  This avoids having to modify the SVG source directly.
     */
    filter: brightness(0) saturate(100%) invert(19%) sepia(97%) saturate(7418%) hue-rotate(-6deg) brightness(93%) contrast(99%);
}

.social-icons a:hover img {
    transform: scale(1.1);
}

footer p {
    font-size: 0.9rem;
}

/* Responsive design tweaks */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    header .logo img {
        height: 60px;
    }
    header nav {
        align-self: center;
    }

    .podcast-btn {
        margin-top: 10px;
    }
    /* The custom player adjusts naturally on small screens */
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    .social-icons a img {
        width: 28px;
        height: 28px;
    }
    footer p {
        font-size: 0.8rem;
    }

    /* Reduce the global control sizes on very small screens via CSS variables.  This
     * automatically updates both the buttons and the minimum height of the control
     * container defined above. */
    :root {
        --play-size: 52px;
        --mute-size: 36px;
    }

    /* Adjust the play button icon size to remain proportionate when scaled down */
    .play-btn {
        font-size: 24px;
    }

    /* Reduce the minimum height of the player-right panel on small screens so it
     * remains proportionate while still accommodating the controls and status. */
    .custom-player .player-right {
        min-height: 100px;
    }
}