:root {
    --broadcast-midnight: #1A1832;
    --studio-indigo: #2A2347;
    --cream-phosphor: #FFF8E7;
    --warm-parchment: #F5E6C8;
    --blush-rose: #E8A0A0;
    --soft-lavender: #B8A9D4;
    --butter-gold: #F2D479;
    --lavender-gray: #C8BFD6;
    --deep-plum: #3D3250;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    background-color: var(--broadcast-midnight);
    color: var(--lavender-gray);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════
   STAR FIELD
   ═══════════════════════════════════════════ */

.star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    border-radius: 50%;
    animation: twinkle var(--twinkle-duration, 5s) ease-in-out infinite alternate;
    animation-delay: var(--twinkle-delay, 0s);
}

@keyframes twinkle {
    0% { opacity: var(--star-opacity-min, 0.3); }
    100% { opacity: var(--star-opacity-max, 0.9); }
}

/* ═══════════════════════════════════════════
   CONSTELLATION CANVAS
   ═══════════════════════════════════════════ */

.constellation-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.constellation-canvas svg {
    width: 100%;
    height: 100%;
}

.constellation-line {
    fill: none;
    stroke: var(--soft-lavender);
    stroke-width: 1;
    stroke-opacity: 0.3;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 0.5s ease-out;
}

/* ═══════════════════════════════════════════
   CHANNEL INDICATOR (Fixed Top-Right)
   ═══════════════════════════════════════════ */

.channel-indicator {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    background: var(--deep-plum);
    border: 2px solid var(--butter-gold);
    border-radius: 8px;
    padding: 0.4rem 0.7rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.channel-indicator.visible {
    opacity: 1;
}

.channel-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.55rem;
    color: var(--butter-gold);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.channel-number {
    font-family: 'Righteous', cursive;
    font-size: 1.6rem;
    color: var(--butter-gold);
    line-height: 1;
    letter-spacing: 0.05em;
    transition: opacity 0.15s ease;
}

.channel-number.flipping {
    opacity: 0.2;
}

/* ═══════════════════════════════════════════
   OPENING SEQUENCE
   ═══════════════════════════════════════════ */

.opening-sequence {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    overflow: hidden;
}

.frequency-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--butter-gold) 20%,
        var(--butter-gold) 80%,
        transparent 100%
    );
    opacity: 0;
    transform: scaleX(0);
    animation: freqLineReveal 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s forwards;
    z-index: -1;
}

@keyframes freqLineReveal {
    0% { opacity: 0; transform: scaleX(0); }
    50% { opacity: 0.5; transform: scaleX(0.6); }
    100% { opacity: 0.15; transform: scaleX(1); }
}

.site-title {
    font-family: 'Bungee Shade', cursive;
    font-size: clamp(2.5rem, 7vw + 1rem, 8rem);
    color: var(--cream-phosphor);
    text-shadow: 2px 3px 0 rgba(199, 134, 134, 0.4);
    letter-spacing: 0.04em;
    display: flex;
    gap: 0;
}

.title-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
}

.title-char.revealed {
    animation: charReveal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes charReveal {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.site-tagline {
    font-family: 'Righteous', cursive;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.4vw, 1.1rem);
    color: var(--lavender-gray);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 1.5rem;
    opacity: 0;
    animation: fadeSlideUp 0.8s ease 2s forwards;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.frequency-wave {
    margin-top: 3rem;
    width: clamp(200px, 60vw, 600px);
    opacity: 0;
    animation: fadeSlideUp 1s ease 2.2s forwards;
}

.frequency-wave svg {
    width: 100%;
    height: 40px;
    overflow: visible;
}

.wave-path {
    fill: none;
    stroke: var(--butter-gold);
    stroke-width: 1.5;
    stroke-opacity: 0.4;
    stroke-linecap: round;
    animation: waveShift 8s ease-in-out infinite;
}

@keyframes waveShift {
    0% { transform: translateX(0); }
    50% { transform: translateX(-30px); }
    100% { transform: translateX(0); }
}

.scroll-chevron {
    margin-top: 3rem;
    opacity: 0;
    animation: fadeSlideUp 0.6s ease 2.8s forwards;
}

.scroll-chevron svg {
    animation: chevronBounce 2s ease-in-out infinite;
}

@keyframes chevronBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ═══════════════════════════════════════════
   FREQUENCY BAR DIVIDER
   ═══════════════════════════════════════════ */

.frequency-bar-divider {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1rem clamp(1.5rem, 5vw, 6rem);
}

.freq-bar-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--butter-gold), transparent);
    opacity: 0.25;
}

.freq-ticks {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 2rem;
}

.freq-tick {
    width: 1px;
    height: 6px;
    background: var(--butter-gold);
    opacity: 0.3;
}

.freq-tick--long {
    height: 12px;
    opacity: 0.5;
}

/* ═══════════════════════════════════════════
   BROADCAST GRID SECTION
   ═══════════════════════════════════════════ */

.broadcast-grid {
    position: relative;
    z-index: 1;
    padding: 4rem clamp(1.5rem, 5vw, 6rem);
    max-width: 1200px;
    margin: 0 auto;
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(200, 191, 214, 0.15);
}

.section-label {
    font-family: 'Righteous', cursive;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    color: var(--warm-parchment);
    letter-spacing: 0.02em;
}

.broadcast-time {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--lavender-gray);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
}

/* ═══════════════════════════════════════════
   CARD GRID
   ═══════════════════════════════════════════ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.4rem;
}

/* ═══════════════════════════════════════════
   CRT CARD BASE
   ═══════════════════════════════════════════ */

.crt-card {
    background: var(--studio-indigo);
    border: 3px solid var(--warm-parchment);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.3s ease,
                box-shadow 0.4s ease;
    position: relative;
}

.crt-card:hover {
    transform: translateY(-4px);
    border-color: var(--butter-gold);
    box-shadow: 0 12px 40px rgba(26, 24, 50, 0.6),
                0 0 20px rgba(242, 212, 121, 0.08);
}

.crt-card--wide {
    grid-column: span 2;
}

.crt-card--tall {
    grid-row: span 2;
}

/* Card Type: Live */
.crt-card--live .crt-screen {
    background: var(--cream-phosphor);
}

.crt-card--live .card-title {
    color: var(--deep-plum);
}

.crt-card--live .card-text {
    color: var(--deep-plum);
}

/* Card Type: Archive */
.crt-card--archive .crt-screen {
    background: var(--studio-indigo);
}

.crt-card--archive .card-title {
    color: var(--warm-parchment);
}

.crt-card--archive .card-text {
    color: var(--lavender-gray);
}

.archive-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(242, 212, 121, 0.04) 0%, rgba(232, 160, 160, 0.03) 100%);
    pointer-events: none;
    z-index: 1;
}

.crt-card--archive .scanline-overlay {
    opacity: 0.08;
}

/* Card Type: Static */
.crt-card--static .crt-screen {
    background: var(--broadcast-midnight);
}

.crt-card--static .card-title {
    color: var(--lavender-gray);
}

.crt-card--static .card-text {
    color: var(--soft-lavender);
    opacity: 0.8;
}

.static-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image:
        radial-gradient(circle at 20% 30%, var(--cream-phosphor) 0.5px, transparent 0.5px),
        radial-gradient(circle at 60% 70%, var(--soft-lavender) 0.3px, transparent 0.3px),
        radial-gradient(circle at 80% 20%, var(--cream-phosphor) 0.4px, transparent 0.4px),
        radial-gradient(circle at 40% 80%, var(--soft-lavender) 0.5px, transparent 0.5px),
        radial-gradient(circle at 10% 60%, var(--cream-phosphor) 0.3px, transparent 0.3px),
        radial-gradient(circle at 90% 50%, var(--soft-lavender) 0.4px, transparent 0.4px);
    background-size: 8px 8px, 12px 12px, 6px 10px, 10px 6px, 14px 14px, 7px 9px;
    opacity: 0.15;
    animation: staticFlicker 0.3s steps(3) infinite;
}

.static-overlay--heavy {
    opacity: 0.3;
}

@keyframes staticFlicker {
    0% { background-position: 0 0, 2px 3px, 4px 1px, 1px 5px, 3px 2px, 5px 4px; }
    33% { background-position: 3px 2px, 0 1px, 2px 4px, 5px 0, 1px 3px, 4px 2px; }
    66% { background-position: 1px 4px, 4px 0, 0 3px, 3px 2px, 5px 1px, 2px 5px; }
    100% { background-position: 0 0, 2px 3px, 4px 1px, 1px 5px, 3px 2px, 5px 4px; }
}

/* ═══════════════════════════════════════════
   CRT BEZEL
   ═══════════════════════════════════════════ */

.crt-bezel {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    background: var(--deep-plum);
    border-bottom: 1px solid rgba(200, 191, 214, 0.1);
}

.crt-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--soft-lavender);
    flex-shrink: 0;
}

.crt-indicator--live {
    background: var(--blush-rose);
    animation: indicatorPulse 1.5s ease-in-out infinite;
}

.crt-indicator--amber {
    background: var(--butter-gold);
    opacity: 0.6;
}

.crt-indicator--rose {
    background: var(--blush-rose);
    opacity: 0.5;
}

@keyframes indicatorPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--blush-rose); }
    50% { opacity: 0.4; box-shadow: 0 0 1px var(--blush-rose); }
}

.crt-channel {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.6rem;
    color: var(--lavender-gray);
    letter-spacing: 0.15em;
}

.crt-status {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.55rem;
    color: var(--soft-lavender);
    letter-spacing: 0.1em;
    margin-left: auto;
    opacity: 0.6;
}

/* ═══════════════════════════════════════════
   CRT SCREEN
   ═══════════════════════════════════════════ */

.crt-screen {
    padding: 1.8rem;
    position: relative;
    min-height: 180px;
    border-radius: 0 0 8px 8px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.15);
}

.scanline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(255, 248, 231, 0.03) 3px,
        rgba(255, 248, 231, 0.03) 4px
    );
    opacity: 0.5;
    border-radius: 0 0 8px 8px;
}

.crt-card:hover .scanline-overlay {
    opacity: 0.8;
}

.card-title {
    font-family: 'Righteous', cursive;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: 0.02em;
    margin-bottom: 0.8rem;
    position: relative;
    z-index: 3;
}

.card-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    position: relative;
    z-index: 3;
}

.card-meta {
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--soft-lavender);
    letter-spacing: 0.1em;
    margin-top: 1.2rem;
    opacity: 0.5;
    position: relative;
    z-index: 3;
}

/* ═══════════════════════════════════════════
   REVEAL ANIMATIONS
   ═══════════════════════════════════════════ */

.reveal {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.crt-card.reveal:nth-child(1) { transition-delay: 0s; }
.crt-card.reveal:nth-child(2) { transition-delay: 0.1s; }
.crt-card.reveal:nth-child(3) { transition-delay: 0.2s; }
.crt-card.reveal:nth-child(4) { transition-delay: 0.3s; }
.crt-card.reveal:nth-child(5) { transition-delay: 0.4s; }
.crt-card.reveal:nth-child(6) { transition-delay: 0.5s; }
.crt-card.reveal:nth-child(7) { transition-delay: 0.1s; }
.crt-card.reveal:nth-child(8) { transition-delay: 0.2s; }
.crt-card.reveal:nth-child(9) { transition-delay: 0.3s; }
.crt-card.reveal:nth-child(10) { transition-delay: 0.4s; }
.crt-card.reveal:nth-child(11) { transition-delay: 0.1s; }
.crt-card.reveal:nth-child(12) { transition-delay: 0.2s; }

/* Scanline delayed appearance */
.crt-card.reveal .scanline-overlay {
    opacity: 0;
    transition: opacity 0.5s ease 0.2s;
}

.crt-card.reveal.visible .scanline-overlay {
    opacity: 0.5;
}

/* ═══════════════════════════════════════════
   SIGNAL FADE / ENDING
   ═══════════════════════════════════════════ */

.signal-fade {
    position: relative;
    z-index: 1;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 4rem;
}

.fade-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, var(--broadcast-midnight) 0%, #0a0812 60%, #000000 100%);
    z-index: 0;
}

.broadcast-ended {
    position: relative;
    z-index: 1;
    text-align: center;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.broadcast-ended.visible {
    opacity: 1;
    transform: translateY(0);
}

.ended-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--lavender-gray);
    letter-spacing: 0.25em;
    display: inline;
}

.ended-cursor {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--lavender-gray);
    animation: cursorBlink 1s steps(1) infinite;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.ended-timestamp {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--soft-lavender);
    letter-spacing: 0.12em;
    margin-top: 1rem;
    opacity: 0.4;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 900px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .crt-card--wide {
        grid-column: span 2;
    }
}

@media (max-width: 680px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .crt-card--wide {
        grid-column: span 1;
    }

    .crt-card--tall {
        grid-row: span 1;
    }

    .broadcast-grid {
        padding: 3rem 1.2rem;
    }

    .grid-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .channel-indicator {
        top: 1rem;
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .broadcast-grid {
        padding: 2rem 1rem;
    }

    .crt-screen {
        padding: 1.2rem;
    }

    .card-grid {
        gap: 1.5rem;
    }
}
