/* 
    ========================================
    DESIGN SYSTEM & VARIABLES
    ========================================
*/
:root {
    /* Colors (Defaults) */
    --color-primary: #032858;
    --color-accent: #f9d783;
    --color-text: #ffffff;
    --color-dark-text: #1a1c1e;

    /* UI Specific Colors (Divorced from Theme) */
    --color-ui-accent: #f9d783;
    --color-ui-brand: #032858;
    --color-ui-text: #ffffff;
    --color-ui-text-dim: rgba(255, 255, 255, 0.7);
    --color-ui-bg-panel: rgba(13, 17, 23, 0.95);

    /* Theme Intensity (Controlled by JS) */
    --frame-intensity: 0.1;

    /* Theme Assets (Injected by JS) */
    --img-border: url('assets/images/flower_border_transparent.svg');
    --img-sway-1: url('assets/images/pink-blooms-1.png');
    --img-sway-2: url('assets/images/pink-blooms-with-stem.png');
    --img-sway-3: url('assets/images/leafy-stem.png');
    --img-sway-4: url('assets/images/pink-blooms.png');
    --img-sway-side: url('assets/images/pink-blooms-2.png');

    /* Fonts */
    --font-primary: 'Montserrat', system-ui, sans-serif;
    --font-display: 'Cinzel Decorative', Georgia, serif;
    --font-heading: 'Cinzel', Georgia, serif;
    --font-ui: 'Inter', system-ui, sans-serif;

    /* Responsive Base Multipliers for Host Scaling */
    --host-scale-base: 1;
    --host-width-base: 1;

    /* Stacking Order (Z-Index) */
    --z-bg: 0;
    --z-particles-back: 10;
    --z-particles-mid: 20;
    --z-content: 30;
    --z-particles-front: 40;
    --z-logo: 100;
    --z-hosts: 110;
    --z-footer: 120;
    --z-debug: 1000;
}

@media (max-width: 1900px) {
    :root {
        --host-scale-base: 0.95;
        --host-width-base: 0.95;
    }
}

@media (max-width: 1400px) {
    :root {
        --host-scale-base: 0.85;
        --host-width-base: 0.88;
    }
}

@media (min-width: 2500px) {
    :root {
        --host-scale-base: 1.125;
        --host-width-base: 1.04;
    }
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: -webkit-fill-available;
    overflow: hidden;
    background-color: #032858; /* Fallback for initial load */
    background-color: var(--color-primary);
    font-family: var(--font-primary);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-backface-visibility: hidden; /* Safari edge rendering fix */
}

body {
    /* Bleed the background color out to cover sub-pixel rounding gaps */
    box-shadow: 0 0 0 100vmax var(--color-primary);
}

/* Fullscreen & Backdrop Normalization */
:fullscreen, 
::backdrop,
:-webkit-full-screen {
    background-color: var(--color-primary) !important;
}

@media (min-width: 1900px) {
    body {
        /* zoom: 109%; removed to prevent flickering */
    }
}

/* Global Oversized Backdrop Reinforcement 
   This ensures that any sub-pixel gaps (common with zoom and Safari fullscreen) 
   show the theme color instead of the white browser canvas. */
html::before {
    content: '';
    position: fixed;
    top: -5vh; 
    left: -5vw;
    width: 110vw; 
    height: 110vh;
    background-color: var(--color-primary);
    z-index: -10000;
    pointer-events: none;
}

/* Typography Utilities */
.ff-cin-dec {
    font-family: var(--font-display);
}

.ff-cin {
    font-family: var(--font-heading);
}

.ff-mont {
    font-family: var(--font-primary);
}

/* 
========================================
PARTICLE SYSTEMS
========================================
*/
.particle-layer {
    position: absolute;
    top: 0;
    left: -10%;
    width: 120%;
    height: 100%;
    pointer-events: none;
    contain: layout style;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    overflow: hidden; /* Prevent 1px leaks at the viewport edges */
}

body:not(.is-loading) .particle-layer {
    opacity: 1;
}

#particles-back {
    z-index: var(--z-particles-back);
}

#particles-front {
    z-index: var(--z-particles-front);
}

#particles-mid {
    z-index: var(--z-particles-mid);
}

.petal {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    opacity: 0.85;
    will-change: transform;
}

.petal.is-blurred {
    filter: blur(2px);
    opacity: 0.6;
}

/* 
========================================
CONTENT WRAPPER & COMPONENTS
========================================
*/
.content-wrapper {
    position: relative;
    z-index: var(--z-content);
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: var(--inset-v) var(--inset-h);
    /* Controlled by JS sliders */
    box-sizing: border-box;
    background: transparent;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    overflow: hidden;
}

body:not(.is-loading) .content-wrapper {
    opacity: 1;
}

/* Global Vignette Overlay — Moved inside content-wrapper */
#vignette-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at center, var(--overlay-dark), var(--overlay-mid) 39.92%, var(--overlay-clear) 77.73%);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

body:not(.is-loading) #vignette-overlay {
    opacity: 1;
}

/* Theme Frame - HUD / Border Logic */
.theme-frame {
    position: absolute;
    top: 25px;
    left: 25px;
    right: 25px;
    bottom: 25px;
    pointer-events: none;
    z-index: 50; /* Bring it in front of the background */
    transition: all 1s ease-in-out;
    opacity: 0;
}

body:not(.is-loading) .theme-frame {
    opacity: 1;
}

body:not(.is-loading) .theme-frame {
    opacity: 1;
}

.theme-frame-inner,
.theme-texture {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Base states for the frame elements (Theme files will override these) */
body:not(.is-loading) .content-wrapper {
    opacity: 1;
}

body:not(.is-sliding) .content-wrapper {
    transition: opacity 1s ease-in-out, padding 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Performance: Disable expensive transitions on poster content ONLY while sliding. */
body.is-sliding .content-wrapper,
body.is-sliding .content-wrapper * {
    transition: none !important;
}

.main-content {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Spacers will handle the centering */
    width: 100%;
    max-width: 1400px;
    top: 0;
    z-index: 10;
}

body:not(.is-sliding) .main-content {
    transition: padding-top 0.8s ease, top 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Biased Spring System for dynamic vertical placement */
.main-content::before {
    content: '';
    flex: 1;
    /* Top spring */
}

.main-content::after {
    content: '';
    flex: 4;
    /* Bottom spring is stronger, pushing content UP */
}

body:not(.is-sliding) .main-content::before,
body:not(.is-sliding) .main-content::after {
    transition: flex 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}



/* Hide primary UI elements while preserving overlays like QR codes */
.ui-hidden .logo-banner,
.ui-hidden .event-footer,
.ui-hidden .hosts-container {
    opacity: 0;
    pointer-events: none;
}

/* Banner Styling (Layout Only) */
.logo-banner {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    min-height: 100px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-banner img {
    width: 85%;
    max-height: 70px;
    object-fit: contain;
}

/* Hosts List */
.hosts-container {
    --host-text-size: 1.0;
    --host-max-width: 1400px;
    --dynamic-scale: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

@media (min-width: 1400px) and (max-width: 1900px) {
    .logo-banner {
        transform: translateY(2.3rem);
    }

    .hosts-container {
        transform: translateY(2.3rem);
    }
}

@media (min-width: 1900px) {
    .hosts-container {
        transform: translateY(55px);
    }
}

@media (min-width: 1400px) and (max-width: 1900px) {
    .title-hidden .hosts-container {
        transform: translateY(25px);
    }
}

@media (min-width: 1900px) {
    .title-hidden .hosts-container {
        transform: translateY(45px);
    }
}



.hosts-title {
    position: relative;
    z-index: var(--z-hosts);
    color: var(--color-accent);
    font-size: calc(2.2rem * var(--host-text-size) * var(--host-scale-base) * var(--dynamic-scale));
    letter-spacing: 4px;
    margin-top: 0;
    margin-bottom: calc(20px * var(--dynamic-scale));
    text-transform: uppercase;
    font-weight: 600;
    font-family: var(--font-heading);
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.is-light-bg .hosts-title {
    color: var(--color-dark-text);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.hosts-empty-hint {
    position: relative;
    z-index: var(--z-hosts);
    font-size: calc(1.4rem * var(--host-text-size) * var(--host-scale-base) * var(--dynamic-scale));
    color: var(--color-text);
    font-style: italic;
    opacity: 0.9;
    margin-top: 40px;
    transition: opacity 0.8s ease, transform 0.8s ease;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
    font-weight: 500;
    text-align: center;
}

.hosts-empty-hint.is-hidden {
    display: block !important;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.hosts-list {
    position: relative;
    z-index: var(--z-hosts);
    max-width: calc(var(--host-max-width) * var(--host-width-base));
    margin-bottom: 0;
    /* Handled by spacers now */
    padding: 0 40px;
    pointer-events: none;
    transition: all 0.5s ease;
}

/* Centered (Default) */
.hosts-list.layout-centered {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: calc(20px * var(--dynamic-scale)) calc(60px * var(--dynamic-scale));
}

/* Justify */
.hosts-list.layout-justify {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: calc(20px * var(--dynamic-scale)) calc(20px * var(--dynamic-scale));
    width: 100%;
    max-width: calc(var(--host-max-width) * 0.73 * var(--host-width-base));
}

/* Columns */
.hosts-list.layout-columns {
    display: block;
    column-count: 2;
    column-gap: calc(40px * var(--dynamic-scale));
    text-align: center;
    width: 100%;
    max-width: calc(var(--host-max-width) * 0.643 * var(--host-width-base));
}

.hosts-list.layout-columns span {
    display: inline-block;
    width: 100%;
    margin-bottom: calc(12px * var(--dynamic-scale));
    break-inside: avoid;
    font-size: calc(1.45rem * var(--host-text-size) * var(--host-scale-base) * var(--dynamic-scale));
}

.hosts-list span {
    font-size: calc(1.6rem * var(--host-text-size) * var(--host-scale-base) * var(--dynamic-scale));
    font-weight: 600;
    font-family: var(--font-primary);
    white-space: nowrap;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.93);
    pointer-events: auto;
    transition: transform 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
}



.is-light-bg .hosts-list span {
    color: var(--color-dark-text);
    text-shadow: none;
}

/* Footer Info */
.event-footer {
    position: relative;
    z-index: 10;
    text-align: center;
    width: 100%;
    flex-shrink: 0;
    pointer-events: none;
    top: 0;
}


.event-top-label {
    font-size: 1.6rem;
    letter-spacing: 6px;
    font-family: var(--font-display);
    margin-bottom: -5px;
    opacity: 0.95;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.event-title {
    font-size: 5.5rem;
    color: var(--color-accent);
    font-family: var(--font-display);
    line-height: 1;
    margin: 5px 0 0;
    text-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

.is-light-bg .event-title {
    color: var(--color-dark-text);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

.event-subtitle {
    font-size: 1.8rem;
    letter-spacing: 8px;
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
    margin-top: -8px;
    opacity: 0.95;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

.event-date {
    font-size: 1.3rem;
    letter-spacing: 3px;
    font-family: var(--font-heading);
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    /* Define base for transition */
    max-height: 100px;
    margin-top: 5px;
    opacity: 1;
}

.event-top-label,
.event-title,
.event-subtitle {
    max-height: 150px;
    opacity: 1;
}

.is-light-bg .event-subtitle,
.is-light-bg .event-top-label,
.is-light-bg .event-date {
    color: var(--color-dark-text);
    text-shadow: none;
    opacity: 1;
}

/* 
========================================
TRANSITIONS & DYNAMIC STATES
========================================
*/
.logo-banner,
.event-footer {
    opacity: 1;
    /* base state */
}

body:not(.is-sliding) .logo-banner,
body:not(.is-sliding) .event-footer {
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        margin 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        top 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* will-change scoped to container-level only — not each individual span */
.hosts-container,
.hosts-list {
    will-change: transform;
}

body:not(.is-sliding) .hosts-container,
body:not(.is-sliding) .hosts-title,
body:not(.is-sliding) .hosts-list,
body:not(.is-sliding) .hosts-list span {
    transition: margin 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.event-top-label,
.event-title,
.event-subtitle,
.event-date {
    will-change: transform, opacity;
}

body:not(.is-sliding) .event-top-label,
body:not(.is-sliding) .event-title,
body:not(.is-sliding) .event-subtitle,
body:not(.is-sliding) .event-date {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        margin 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hide Date State */
.date-hidden .event-date {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    max-height: 0;
    margin: 0;
    pointer-events: none;
    overflow: hidden;
}

.date-hidden .event-subtitle {
    margin-bottom: 60px;
}

.date-hidden .logo-banner {
    transform: translateY(1vh) scale(1.06);
}

.date-hidden .hosts-title {

}

.date-hidden .hosts-container {
    transform: translateY(6.5vh);
}

.date-hidden .hosts-list {
    transform: scale(1.05);
}

.date-hidden .event-footer {
    transform: translateY(6vh) scale(1.1);
}

/* Hide Title State */
.title-hidden .event-top-label,
.title-hidden .event-title,
.title-hidden .event-subtitle {
    opacity: 0;
    transform: scale(1);
    max-height: 0;
    margin: 0;
    pointer-events: none;
    overflow: hidden;
}

.title-hidden .logo-banner {
    transform: scale(1.1);
}

.title-hidden .hosts-container {
    transform: translateY(8vh) scale(1.05);
    transform-origin: center center;
}

.title-hidden .hosts-list {
    transform: translateY(0);
    margin-top: 0;
}

.title-hidden .hosts-list span {
    opacity: 1;
}

/* Hide Logo State */
.logo-hidden .logo-banner {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
    margin-bottom: 0;
    padding: 0;
    pointer-events: none;
    overflow: hidden;
}

.logo-hidden .hosts-container {
    transform: scale(1.1);
    transform-origin: bottom center;
}

@media (min-width: 1400px) and (max-width: 1900px) {
    .logo-hidden .hosts-container {
        transform: translateY(2.3rem) scale(1.1);
    }
}

@media (min-width: 1900px) {
    .logo-hidden .hosts-container {
        transform: translateY(10px) scale(1.05);
    }
}

.logo-hidden .main-content {
    padding-top: 0;
}

/* Hide Host State */
.host-hidden .hosts-container {
    opacity: 0;
    transform: scale(0.8);
    max-height: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
    overflow: hidden;
}

.host-hidden .event-footer {
    transform: translateY(-7rem) scale(1.45)
}

.host-hidden .logo-banner {
    transform: translateY(7rem) scale(1.7);
}

/* Combined States */
.host-hidden.date-hidden .event-footer {
    transform: translateY(-6rem) scale(1.7);
}

.host-hidden.date-hidden .logo-banner {
    transform: translateY(9rem) scale(2);
}

.host-hidden.date-hidden.title-hidden .main-content::before,
.host-hidden.date-hidden.title-hidden .main-content::after {
    flex: 1;
}

.host-hidden.date-hidden.title-hidden .logo-banner {
    transform: scale(2);
}

.logo-hidden.host-hidden .event-footer {
    transform: translateY(-33vh) scale(2.1);
}

.logo-hidden.host-hidden.date-hidden .event-footer {
    transform: translateY(-20vh) scale(2.2);
}

.date-hidden.title-hidden .logo-banner {
    transform: scale(1.3);
}

.date-hidden.title-hidden .hosts-container {
    transform: translateY(7em);
}

.logo-hidden.date-hidden .event-subtitle {
    margin-bottom: 70px;
}

.logo-hidden.date-hidden.title-hidden .hosts-container {
    transform: translateY(7.5rem) scale(1.1);
}

/* 
   ========================================
   FULLSCREEN VS VIEWPORT NUDGES
   ========================================
   When not in fullscreen, the browser toolbars reduce the available height.
   We nudge the main content up and footer down to prevent overlap.
*/
body:not(.is-fullscreen) .main-content {
    top: -2rem;
}

body:not(.is-fullscreen) .event-footer {

}

@media (min-width: 2500px) {
    body:not(.is-fullscreen) .main-content {
        top: 4rem;
        scale: 1.3;
    }

    /* Specifically override the nudge when on this resolution */
    body:not(.is-fullscreen) .event-footer {
        top: 0;
    }

    .event-footer {
        scale: 1.3;
    }
}

/* QR Codes */
.qr-code-container {
    position: absolute;
    bottom: 40px;
    width: 180px;
    height: 180px;
    background: white;
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    z-index: var(--z-content);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-left {
    left: 40px;
}

.qr-right {
    right: 40px;
}

.qr-hidden {
    opacity: 0;
    transform: translateY(40px) scale(0.8);
    pointer-events: none;
}

/* Adjustments when QR codes are visible on small screens */
@media (max-width: 1400px) {
    .qr-code-container {
        width: 140px;
        height: 140px;
        bottom: 20px;
    }

    .qr-left {
        left: 20px;
    }

    .qr-right {
        right: 20px;
    }
}











/* Pause States */
.paused,
.paused *,
.paused::before,
.paused::after,
.paused *::before,
.paused *::after {
    animation-play-state: paused !important;
    transition: none !important;
}

/* Theme-specific animations moved to theme-*.css files */

/* 
           ========================================
           RESPONSIVE BREAKPOINTS
           ========================================
        */
@media (max-width: 1200px) {
    .hosts-list span {
        font-size: calc(1.3rem * var(--host-text-size) * var(--host-scale-base));
    }

    .event-title {
        font-size: 4.5rem;
    }
}

@media (max-width: 900px) {
    .hosts-list span {
        font-size: calc(1.1rem * var(--host-text-size) * var(--host-scale-base));
    }

    .event-title {
        font-size: 3.2rem;
    }

    .hosts-title {
        font-size: calc(1.6rem * var(--host-text-size) * var(--host-scale-base));
    }

    .logo-banner {
        max-width: 320px;
        min-height: 65px;
        height: auto;
        padding: 8px 35px;
    }

    .hosts-list {
        gap: 12px 25px;
        padding: 0 20px;
    }

    .event-top-label {
        font-size: 1.2rem;
    }

    .event-subtitle {
        font-size: 1.4rem;
        letter-spacing: 4px;
    }
}


/* Logo banner: text mode */
.logo-text-custom {
    font-size: 1.7rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--color-primary);
    letter-spacing: 2px;

    text-align: center;
    padding: 0;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    white-space: pre-line;
    text-wrap: balance;
}
