/**
 * VINTAGE RADIO THEME
 * 
 * Layout Philosophy: The radio cabinet is a rigid physical object.
 * All elements occupy fixed positions. Hiding an element fades it
 * to invisible without collapsing or repositioning anything.
 *
 * !important Usage: Restricted to Section 5 (Hidden State Neutralizer)
 * where we must override base stylesheet combinatorial hidden-state
 * rules that collapse and reposition elements.
 */


/* ============================================
   1. WOOD CABINET & FRAME
   ============================================ */

/* Theme-specific body background: A deep, moody take on the chosen glow color */
body.theme-vintage-radio {
    background-color: #050202;
    background-image: radial-gradient(circle at center, rgba(var(--color-primary-rgb), 0.45) 0%, #050202 100%);
    --z-particles-back: 25;
    --z-particles-mid: 35;
    --z-particles-front: 55;
}

/* Main Frame: Wood Cabinet */
body.theme-vintage-radio .theme-frame {
    opacity: 1;
    transition: none;
    border: 20px solid #3b1d12;
    background-color: #5c301c;
    background-image:
        linear-gradient(45deg, rgba(0,0,0,0.6) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.6) 100%),
        repeating-linear-gradient(90deg, transparent, transparent 100px, rgba(0,0,0,0.05) 100px, rgba(0,0,0,0.05) 102px);
    border-radius: 40px;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.9), 0 20px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    /* Create a low-level stacking context for cabinet parts (z:10) 
       so particles (z:25+) can reliably stay in front of the whole unit. */
    z-index: 10;
}

/* Noise Texture Overlay */
body.theme-vintage-radio .theme-texture {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.25;
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 0;
}

/* Inner Speaker Grille */
body.theme-vintage-radio .theme-frame-inner {
    position: absolute;
    top: 10%;
    bottom: 25%;
    left: 8%;
    right: 8%;
    background-color: #3b2818;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,0.4) 3px, rgba(0,0,0,0.4) 6px),
        repeating-linear-gradient(90deg, #d3b58d, #d3b58d 3px, #a3825a 3px, #a3825a 6px);
    box-shadow: inset 0 0 40px rgba(0,0,0,0.9), inset 0 5px 15px rgba(0,0,0,0.7), 0 2px 2px rgba(255,255,255,0.1);
    border: 8px solid #2a150c;
    border-radius: 12px;
    /* Sits on top of the wood cabinet background (z:10) */
    z-index: 20;
}

/* Radio Knobs — Shared Base */
body.theme-vintage-radio .theme-frame-inner::before,
body.theme-vintage-radio .theme-frame-inner::after {
    content: '';
    position: absolute;
    width: 86px;
    height: 86px;
    bottom: -15vh;
    border-radius: 50%;
    z-index: 20;
    /* 3D Chrome Bezel and Shadow */
    box-shadow:
        0 18px 30px rgba(0,0,0,0.8),             /* Cast shadow */
        0 8px 15px rgba(0,0,0,0.6),              /* Inner cast shadow */
        inset 0 0 0 6px rgba(10,10,10,0.9),      /* Dark inner gap / grip edge */
        inset 0 3px 5px rgba(255,255,255,0.6),   /* Outer rim top highlight */
        inset 0 -3px 6px rgba(0,0,0,0.8);        /* Outer rim bottom shadow */
    border: 2px solid #050505;
}

/* Knob Left (Volume) */
body.theme-vintage-radio .theme-frame-inner::before {
    left: 5%;
    background:
        /* Engraved Indicator Notch (Shadow + Highlight) */
        linear-gradient(50deg, transparent 47%, rgba(0,0,0,0.9) 47%, rgba(0,0,0,0.9) 49.5%, rgba(255,255,255,0.7) 49.5%, rgba(255,255,255,0.7) 51%, transparent 51%),
        /* Inner shadow rim */
        radial-gradient(circle at 50% 50%, transparent 58%, rgba(0,0,0,0.7) 63%, #111 68%),
        /* Polished Chrome Conical Reflection */
        conic-gradient(from 30deg, 
            #ffffff 0%, #666666 12%, #f0f0f0 25%, #333333 37%, 
            #ffffff 50%, #666666 62%, #f0f0f0 75%, #333333 87%, #ffffff 100%);
}

/* Knob Right (Tuning) */
body.theme-vintage-radio .theme-frame-inner::after {
    right: 5%;
    background:
        /* Engraved Indicator Notch (Shadow + Highlight) */
        linear-gradient(-35deg, transparent 47%, rgba(0,0,0,0.9) 47%, rgba(0,0,0,0.9) 49.5%, rgba(255,255,255,0.7) 49.5%, rgba(255,255,255,0.7) 51%, transparent 51%),
        /* Inner shadow rim */
        radial-gradient(circle at 50% 50%, transparent 58%, rgba(0,0,0,0.7) 63%, #111 68%),
        /* Polished Chrome Conical Reflection (Different Angle) */
        conic-gradient(from 145deg, 
            #ffffff 0%, #666666 12%, #f0f0f0 25%, #333333 37%, 
            #ffffff 50%, #666666 62%, #f0f0f0 75%, #333333 87%, #ffffff 100%);
}

/* Hide Frame Toggle */
body.border-hidden.theme-vintage-radio .theme-frame,
body.border-hidden.theme-vintage-radio .theme-texture {
    opacity: 0;
    pointer-events: none;
}


/* ============================================
   2. TYPOGRAPHY
   ============================================ */

body.theme-vintage-radio .hosts-title {
    font-family: 'Special Elite', 'Courier New', monospace;
    color: #fff8e7;
    font-size: calc(2.4rem * var(--host-text-size) * var(--host-scale-base) * var(--dynamic-scale));
    text-shadow: 0 2px 5px rgba(0,0,0,1), 0 0 15px rgba(0,0,0,1);
    letter-spacing: 2px;
}

body.theme-vintage-radio .hosts-list span {
    font-family: 'Courier New', Courier, monospace;
    color: #fff8e7;
    font-size: calc(1.8rem * var(--host-text-size) * var(--host-scale-base) * var(--dynamic-scale));
    text-shadow: 0 2px 5px rgba(0,0,0,1), 0 0 15px rgba(0,0,0,1);
    font-weight: 700;
}

body.theme-vintage-radio .event-title {
    font-family: var(--font-display);
    color: var(--color-primary);
    text-transform: uppercase;
    font-size: 3.2rem;
    letter-spacing: 4px;
    margin-top: 0;
    animation: radioPulse calc(4s - 2s * var(--frame-intensity)) infinite alternate;
}

@keyframes radioPulse {
    0% {
        text-shadow: 0 0 calc(5px + 5px * var(--frame-intensity)) rgba(var(--color-primary-rgb), 0.4),
                     0 0 calc(10px + 10px * var(--frame-intensity)) rgba(var(--color-primary-rgb), 0.2);
    }
    100% {
        text-shadow: 0 0 calc(15px + 15px * var(--frame-intensity)) rgba(var(--color-primary-rgb), 0.9),
                     0 0 calc(30px + 20px * var(--frame-intensity)) rgba(var(--color-primary-rgb), 0.6);
    }
}

body.theme-vintage-radio .event-top-label,
body.theme-vintage-radio .event-subtitle {
    font-family: var(--font-heading);
    font-weight: 400;
    color: var(--color-primary);
    font-size: 1.4rem;
    letter-spacing: 5px;
    text-shadow: 0 0 5px rgba(var(--color-primary-rgb), 0.5);
    background: none;
    padding: 0;
    text-transform: uppercase;
}

body.theme-vintage-radio .event-top-label {
    margin-bottom: -5px;
}

body.theme-vintage-radio .event-date {
    font-family: var(--font-heading);
    color: var(--color-primary);
    font-size: 1.3rem;
    letter-spacing: 3px;
    text-shadow: 0 0 5px rgba(var(--color-primary-rgb), 0.5);
    background-color: transparent;
    padding: 8px 24px;
    border: none;
    display: inline-block;
    margin-top: -5px;
    text-transform: uppercase;
}

body.theme-vintage-radio .logo-text-custom {
    color: var(--color-dark-text, #332200);
    font-family: var(--font-display);
    font-size: 3.5rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: -1px -1px 0px rgba(255,255,255,0.4), 1px 1px 0px rgba(0,0,0,0.3);
    background-color: var(--color-primary);
    background-image: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, var(--color-primary) 50%, rgba(0,0,0,0.2) 100%);
    padding: 4px 20px;
    border: 2px solid rgba(0,0,0,0.3);
    border-radius: 8px;
    box-shadow: 0 8px 15px rgba(0,0,0,0.6), inset 0 2px 4px rgba(255,255,255,0.6);
    display: inline-block;
    white-space: nowrap;
    box-sizing: border-box;
    pointer-events: auto;
}


/* ============================================
   3. LAYOUT
   ============================================
   Single authoritative block per element.
   No !important needed — body.theme-vintage-radio prefix
   outranks all base selectors. */

body.theme-vintage-radio .content-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: var(--inset-v) var(--inset-h);
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
    background: none;
}

body.theme-vintage-radio .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    position: relative;
    top: -1rem;
    margin: 0;
    padding-top: 0;
    /* Elevate above speaker grill (z:25) and theme frame */
    z-index: 60;
}

body.theme-vintage-radio.is-fullscreen .main-content {
    top: 0;
}

/* Flex spacers: pin banner to top, hosts to center */
body.theme-vintage-radio .main-content::before {
    content: '';
    flex: 1;
    order: 2;
}

body.theme-vintage-radio .main-content::after {
    content: '';
    flex: 1.2;
    order: 4;
}

/* Banner — Top of Main Content */
body.theme-vintage-radio .logo-banner {
    position: relative;
    order: 1;
    margin: 0;
    max-width: 80vw;
    display: flex;
    justify-content: center;
    width: 100%;
    height: 100px;
    min-height: 100px;
    max-height: 100px;
    pointer-events: none;
    z-index: 100;
    transform: scale(0.8);
    box-sizing: border-box;
}

/* Hosts — Center of Main Content
   will-change: auto neutralizes the base stylesheet's will-change: transform
   which silently creates a stacking context and traps children inside it. */
body.theme-vintage-radio .hosts-container {
    position: relative;
    order: 3;
    transform: none;
    margin: 1.8rem auto 0 auto;
    z-index: auto;
    will-change: auto;
    width: fit-content;
    max-width: var(--host-max-width, 850px);
    padding: 1.5rem 3rem;
}

/* Ensure host text renders ABOVE the speaker grill (z:25) */
body.theme-vintage-radio .hosts-title {
    position: relative;
    z-index: 60;
}

body.theme-vintage-radio .hosts-list {
    position: relative;
    z-index: 60;
    will-change: auto;
    margin: 10px 0 0 0;
}

/* Host name backdrop — radial gradient tied to slider variables.
   Sits IN FRONT of the speaker grill (z:25) to darken the text area,
   but behind the host text (z:60). */
body.theme-vintage-radio .hosts-container::before {
    content: '';
    position: absolute;
    inset: 0.5rem 1rem;
    background: radial-gradient(ellipse at center,
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0.8) 60%,
        transparent 100%
    );
    opacity: var(--backdrop-opacity, 1);
    border-radius: 20px;
    /* Sits in front of back/mid particles (z:25, 35) but behind host text */
    z-index: 40;
    pointer-events: none;
    filter: blur(12px);
    transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Footer — Tuning Window Display */
body.theme-vintage-radio .event-footer {
    position: relative;
    margin: 0 auto;
    max-width: 920px;
    /* height: 160px; */
    min-height: 160px;
    max-height: 50rem;
    padding: 10px 40px;
    z-index: 60;
    text-align: center;
    box-sizing: border-box;
    background-color: #0a0505;
    /* Chrome Frame Style */
    border: 6px solid #9ea0a3;
    border-color: #bebfc1 #9ea0a3 #7e8082 #9ea0a3;
    border-radius: 12px;
    box-shadow:
        /* Inner Accent Tint */
        inset 0 0 50px rgba(var(--color-primary-rgb), 0.45),
        /* Depth and Chrome Highlights */
        inset 0 0 20px rgba(0,0,0,0.9),
        inset 0 2px 0 rgba(255,255,255,0.6),
        inset 0 -1px 0 rgba(0,0,0,0.4),
        /* Outer Shadow */
        0 15px 35px rgba(0,0,0,0.8),
        0 0 0 1px #444;
    overflow: hidden;
    scale: 1.1;
}

body.theme-vintage-radio .event-top-label {
    margin: -0.2rem 0 0 0;
}

body.theme-vintage-radio .event-title {
    margin: 0.1rem 0 0.1rem 0;
    font-size: 3.6rem;
}

body.theme-vintage-radio .event-subtitle {
    margin: 0 0 0.2rem 0;
}

body.theme-vintage-radio .event-date {
    margin: -2px 0 0 0;
}

body.theme-vintage-radio:not(.is-fullscreen) .event-footer {
    top: -3rem;
}


/* ============================================
   4. EFFECTS & PERFORMANCE
   ============================================ */

/* Animated Tuning Needle */
body.theme-vintage-radio .event-footer::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background-color: rgba(var(--color-accent-rgb), 0.7);
    box-shadow: 0 0 15px rgba(var(--color-accent-rgb), 0.9);
    transform: translateX(-50%);
    z-index: -1;
    opacity: 0.5;
    animation: tuneScan 30s ease-in-out infinite;
}

@keyframes tuneScan {
    0%, 10% { margin-left: 0; opacity: 0.5; }
    20% { margin-left: calc(-40% * var(--frame-intensity)); opacity: 1; }
    25% { margin-left: calc(-35% * var(--frame-intensity)); opacity: 1; }
    30% { margin-left: calc(-45% * var(--frame-intensity)); opacity: 1; }
    50% { margin-left: calc(40% * var(--frame-intensity)); opacity: 1; }
    55% { margin-left: calc(35% * var(--frame-intensity)); opacity: 1; }
    60% { margin-left: calc(45% * var(--frame-intensity)); opacity: 1; }
    75% { margin-left: 0; opacity: 0.5; }
    100% { margin-left: 0; opacity: 0.5; }
}

/* Dust particles */
body.theme-vintage-radio .petal {
    opacity: 0.6;
    mix-blend-mode: multiply;
}

body.theme-vintage-radio .petal.is-white {
    mix-blend-mode: screen;
    opacity: 0.4;
}

/* Performance: kill blur during slider interaction */
body.is-sliding.theme-vintage-radio .hosts-container::before {
    filter: none;
    transition: none;
}


/* ============================================
   5. HIDDEN STATE NEUTRALIZER
   ============================================
   The base stylesheet collapses hidden elements (max-height: 0,
   overflow: hidden) and repositions siblings (transforms, margins).
   This theme needs a rigid layout, so we neutralize ALL of that.

   !important is used here because the base uses combinatorial
   selectors (e.g. .host-hidden.date-hidden.title-hidden .logo-banner)
   that can outrank single-state theme selectors. */

/* 5a. Hidden elements: fade only, preserve space */
body.theme-vintage-radio.logo-hidden .logo-banner,
body.theme-vintage-radio.date-hidden .event-date,
body.theme-vintage-radio.title-hidden .event-top-label,
body.theme-vintage-radio.title-hidden .event-title,
body.theme-vintage-radio.title-hidden .event-subtitle,
body.theme-vintage-radio.host-hidden .hosts-container {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    /* Prevent base collapse */
    max-height: none !important;
    overflow: visible !important;
    transition: opacity 0.4s ease !important;
}

/* 5b. Lock the logo-banner scale across ALL hidden states */
body.theme-vintage-radio:is(.logo-hidden, .date-hidden, .title-hidden, .host-hidden) .logo-banner {
    transform: scale(0.8) !important;
}

/* 5c. Prevent ALL sibling repositioning across ALL hidden states */
body.theme-vintage-radio:is(.logo-hidden, .date-hidden, .title-hidden, .host-hidden) :is(.hosts-container, .hosts-title, .hosts-list, .event-footer, .main-content) {
    transform: none !important;
}

/* 5d. Neutralize base sibling margin/padding shifts */
body.theme-vintage-radio:is(.logo-hidden, .date-hidden, .title-hidden, .host-hidden) .main-content {
    padding-top: 0 !important;
}

body.theme-vintage-radio:is(.date-hidden, .title-hidden) .event-subtitle {
    margin: 0 0 0.2rem 0 !important;
}

body.theme-vintage-radio:is(.title-hidden) .hosts-list {
    margin: 10px 0 0 0 !important;
}

/* 5e. Lock flex spacers so triple-combo states can't redistribute them */
body.theme-vintage-radio:is(.logo-hidden, .date-hidden, .title-hidden, .host-hidden) .main-content::before {
    flex: 1 !important;
}

body.theme-vintage-radio:is(.logo-hidden, .date-hidden, .title-hidden, .host-hidden) .main-content::after {
    flex: 1.2 !important;
}


@media (max-width: 1600px) {
    body.theme-vintage-radio .content-wrapper {
        padding: 30px 40px !important;
    }
    body.theme-vintage-radio .logo-banner {
        height: 80px; min-height: 80px; max-height: 80px;
        scale: 0.7 !important;
        margin-top: 1.5rem;
    }
    body.theme-vintage-radio .hosts-title {
        font-size: calc(2rem * var(--host-text-size) * var(--host-scale-base) * var(--dynamic-scale));
        margin-bottom: 0.5rem;
    }
    body.theme-vintage-radio .hosts-list span {
        font-size: calc(1.6rem * var(--host-text-size) * var(--host-scale-base) * var(--dynamic-scale));
    }
    body.theme-vintage-radio .hosts-container {
        max-width: 1100px !important;
        padding: 0.8rem 1.5rem;
    }
    /* Soften the backdrop intensity for smaller screens */
    body.theme-vintage-radio .hosts-container::before {
        background: radial-gradient(ellipse at center,
            rgba(0, 0, 0, 0.85) 0%,
            rgba(0, 0, 0, 0.7) 60%,
            transparent 100%
        ) !important;
        opacity: calc(var(--backdrop-opacity, 1) * 0.85) !important;
    }
    body.theme-vintage-radio .event-footer {
        /* height: 140px;  */
        /* min-height: 140px;  */
        max-height: 50rem;
        scale: 1;
        max-width: 50rem;
        padding: 5px 30px;
    }
    /* Pull footer higher up */
    body.theme-vintage-radio .event-footer {
        top: -3.5rem
    }
    body.theme-vintage-radio .event-title {
        font-size: 2.6rem;
    }
    body.theme-vintage-radio .event-top-label,
    body.theme-vintage-radio .event-subtitle {
        font-size: 1.2rem;
    }
    body.theme-vintage-radio .event-date {
        font-size: 1.1rem;
    }
}

@media (min-width: 1601px) {
    body.theme-vintage-radio .event-top-label {
        margin-top: -0.5rem;
    }
    body.theme-vintage-radio .event-title {
        margin-top: 0.3rem;
    }
}

@media (min-width: 2500px) {
    body.theme-vintage-radio .main-content {
        scale: 1;
        top: 0;
    }
}
