/* --- CSS VARIABLES FOR THEME --- */
:root {
    /* Backgrounds */
    --bg-main: #f5f5f5;
    --bg-live-broadcast: #E53935;
    --bg-programs-header: #2c6fb1;
    --bg-card-podcasts: #E53935;
    --bg-card-blue: #2c6fb1;
    --bg-card-black: #000;
    --bg-card-schedule: #f7c029;
    --bg-nav-button: #f8c22c;
    --bg-play-button: #f8f5ea;

    /* Text */
    --text-primary: #000;
    --text-secondary: #fff;
    --text-live-broadcast-p: rgba(255, 255, 255, 0.9);
    --text-nav-button: #000;

    /* Borders & Accents */
    --border-main: #000;
    --grid-line-color: black;
    --logo-circle-inner: #000;
    --logo-circle-main: #E53935;

    /* Visualizer Bars */
    --bar-black: #000;
    --bar-red: #E53935;
    --bar-yellow: #FFD600;
    --bar-blue: #2c6fb1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    /* font name to use in your CSS */
    font-family: 'Outfit';
    src: url('../fonts/outfit/Outfit-VariableFont_wght.ttf') format('truetype-variations');
    /* Define font weight range support */
    font-weight: 100 900;
    /* Helps the browser load the font smoothly without layout shifts */
    font-display: swap;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5em;
    transition: background-color 0.3s ease;
    /* Smooth transition */
}

body {
    background-image:
        linear-gradient(to right, var(--grid-line-color) 0.25em, transparent 2px),
        linear-gradient(to bottom, var(--grid-line-color) 0.25em, transparent 2px);
    background-size: 8.4em 8.4em;
    background-position: -1em -1em;
}

.grid-container {
    position: relative;
    width: 100%;
    max-width: 59.1em;
    border: 3px solid var(--border-main);
    position: relative;
    background-size: 4.5em 4.5em;
    padding: 1.6em;
}

/* This block only applies when the .debug-overlay class is present */
.grid-container.debug-overlay::after {
    /* Required for pseudo-elements to show up */
    content: "";

    /* The background image is our design mockup */
    background-image: url('image.png');
    background-repeat: no-repeat;

    /* Position it absolutely relative to .grid-container */
    position: absolute;
    top: -0.23em;
    left: -0.23em;
    right: 0;
    bottom: 0;

    /* The 50% transparency */
    opacity: 0.5;

    /* VERY IMPORTANT: Let mouse events pass through */
    pointer-events: none;
}

/* Header */
.header {
    padding: 1.25em 0 3.3em 0;
    display: flex;
    align-items: center;
}

.logo-dark {
    display: none;
}

/* Equalizer */
.visualizer {
    display: flex;
    align-items: flex-end;
    gap: 0.78em;
    padding: 1.45em 0;
    border-radius: 0.75em;
}

.column {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.35em;
}

.bar {
    width: 2.8em;
    height: 1.4em;
    border-radius: 0.15em;
    flex-shrink: 0;
}

.bar-black { background: var(--bar-black); }
.bar-red { background: var(--bar-red); }
.bar-yellow { background: var(--bar-yellow); }
.bar-blue { background: var(--bar-blue); }

/* Main Content */
.main-content {
    display: grid;
    /* grid-template-columns: 1fr 1.2fr; */
    gap: 1em;
    grid-template-columns: 1fr 1.1fr;
    padding: 2.6em 0 2.2em;
}

/* Live Broadcast */
.live-broadcast {
    background: var(--bg-live-broadcast);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.play-button {
    width: 7em;
    height: 7em;
    background: var(--bg-play-button);
    border: 3px solid var(--bg-play-button);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    margin-bottom: 1.5em;
}

.play-button:hover {
    transform: scale(1.1);
}

.play-button svg {
    width: 7em;
    height: 7em;
    fill: black;
}

.play-button.small {
    width: 3em;
    height: 3em;
    background: transparent;
    margin-bottom: 0.7em;
}

.play-button.small svg {
    fill: #f5f5f5;
}

.live-broadcast h2 {
    color: var(--text-primary);
    font-size: 1.8em;
    margin-bottom: 0.35em;
    font-weight: 700;
}

.live-broadcast p {
    color: var(--text-live-broadcast-p);
    font-size: 1.3em;
}

.programs-header {
    background: var(--bg-programs-header);
    padding: 2em;
    margin: 0 0 1.5em;
}

.programs-header h2 {
    color: var(--text-secondary);
    font-size: 2em;
    font-weight: 700;
}

.programs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1em;
    /* padding: 0 0 2em; */
}

.program-card {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    font-weight: 600;
    font-size: 1.1em;
    text-align: center;
}

.program-card img {
    max-width: 1.9em;
    max-height: 1.9em;
}

.program-card:hover {
    transform: scale(0.95);
}

.program-icon {
    font-size: 1.38em;
    margin-bottom: 5px;
}

.program-card.podcasts {
    background: var(--bg-card-podcasts);
    color: var(--text-secondary);
}

.program-card.blue {
    background: var(--bg-card-blue);
    color: var(--text-secondary);
}

.program-card.black {
    background: var(--bg-card-black);
    color: var(--text-secondary);
}

.program-card img {
    filter: invert(1);
}

.program-card.yellow img {
    filter: none;
}

.program-card.yellow {
    background: var(--bg-card-schedule);
    color: var(--text-secondary);
}

/* Navigation Bar */
.nav-bar {
    display: flex;
}

.nav-button {
    color: var(--text-nav-button);
    flex: 1;
    background: var(--bg-nav-button);
    border: none;
    font-weight: 700;
    padding: 0.90em;
    font-size: 1.75em;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-button:hover,
.nav-button.active {
    text-decoration: #FFC400;
}

/* ========== */
/* DARK THEME */

@media (prefers-color-scheme: dark) {
    :root {
        /* Re-define variables for dark mode */
        --bg-main: #1a1a1a;

        /* Text */
        --text-primary: #f0f0f0;
        --text-secondary: #f0f0f0;
        --text-live-broadcast-p: rgba(255, 255, 255, 0.85);
        --text-nav-button: #000;

        /* Borders & Accents */
        --border-main: rgba(255, 255, 255, 0.2);
        --grid-line-color: rgba(255, 255, 255, 0.2);
        --logo-circle-inner: #f0f0f0;

        /* Visualizer Bars */
        --bar-black: #f0f0f0;

        /* Program Cards */
        --bg-card-music: #f0f0f0;
        --bg-card-black: #f0f0f0;
    }

    /* Specific overrides for dark mode */

    .logo-light {
        display: none;
    }
    .logo-dark {
        display: block;
    }

    .program-card.black {
        color: #1a1a1a;
    }

    .live-broadcast h2 {
        color: var(--text-secondary);
    }

    .program-card.blue {
        color: var(--text-secondary);
    }

    .program-card img {
        filter: none;
    }
}

/* ====================== */
/* SMALL SCREENS (MOBILE) */

@media (max-width: 59.1em) {
    body {
        /* This is the core of the scaling. 
       It creates a dynamic "root em" (rem) unit that is 
       proportional to the viewport width. We divide by 59.1 
       because that's the design's max-width in 'em'. */
        font-size: calc(100vw / 59.1);

        /* Remove padding to allow the container to fill the screen */
        padding: 0;
    }

    .grid-container {
        /* Make the container fill the entire viewport */
        width: 100vw;
        height: 100vh;

        /* Remove constraints that would interfere with scaling */
        max-width: none;
        border: none;
        padding: calc(1.6 * (100vw / 59.1));
    }

    .logo-light,
    .logo-dark {
        max-width: 100%;
        height: auto;
    }

    .program-card img {
        width: 31%;
        height: auto;
        max-width: none;
        max-height: none;
    }
}