/* ===================================================================
   Schumann Resonance Live - Comprehensive UI/UX Fix v3.1
   2026-06-01
   Fixes: overflow, fixed-element stacking, font inconsistencies,
   acquisition card overlap, mobile layout collisions
   =================================================================== */

/* --- GLOBAL OVERFLOW LOCK --- */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

*, *::before, *::after {
    box-sizing: border-box !important;
}

/* --- DESKTOP: Push body content left, acq card lives in the margin --- */
@media (min-width: 981px) {
    body {
        padding-right: 0 !important; /* FIXED */
    }

    /* The nav must span full width including the padding area */
    nav.nav-glass,
    header,
    .nav-glass {
        width: 100vw !important;
        max-width: 100vw !important;
        margin-right: 0 !important; /* FIXED */
        padding-right: 0 !important; /* FIXED */
    }

    /* Acq card sits in the body right padding zone */
    #sr-acq-card {
        width: 310px !important;
        max-width: 310px !important;
        top: 50% !important;
        right: 14px !important;
        transform: translateY(-50%) !important;
    }

    #sr-acq-card .sr-acq-card-link {
        padding: 14px !important;
    }

    #sr-acq-card .sr-acq-title {
        font-size: 15px !important;
        max-width: 260px !important;
        line-height: 1.2 !important;
    }

    #sr-acq-card .sr-acq-copy {
        font-size: 11.5px !important;
        line-height: 1.38 !important;
        margin-bottom: 8px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 3 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    #sr-acq-card .sr-acq-proof {
        gap: 5px !important;
        margin-bottom: 8px !important;
    }

    #sr-acq-card .sr-acq-metric {
        min-height: 48px !important;
        padding: 5px !important;
    }

    #sr-acq-card .sr-acq-metric b {
        font-size: 9px !important;
    }

    #sr-acq-card .sr-acq-metric small {
        font-size: 9px !important;
    }

    #sr-acq-card .sr-acq-cta {
        min-height: 32px !important;
        font-size: 10.5px !important;
        padding: 7px 10px !important;
        margin-bottom: 5px !important;
    }

    #sr-acq-card .sr-acq-note {
        font-size: 9.5px !important;
    }

    /* Promo fab stays in the right margin area too */
    #sr-promo-fab {
        right: 14px !important;
        bottom: 16px !important;
        z-index: 9998 !important;
        max-width: 300px !important;
    }

    /* Back-to-top stays above promo fab */
    #back-to-top {
        right: 14px !important;
        bottom: 80px !important;
        z-index: 9997 !important;
    }
}

/* --- TABLET: narrower panel --- */
@media (min-width: 981px) and (max-width: 1280px) {
    body {
        padding-right: 0 !important; /* FIXED */
    }

    nav.nav-glass,
    header,
    .nav-glass {
        margin-right: 0 !important; /* FIXED */
        padding-right: 0 !important; /* FIXED */
    }

    #sr-acq-card {
        width: 250px !important;
        max-width: 250px !important;
    }

    #sr-acq-card .sr-acq-title {
        font-size: 13px !important;
    }

    #sr-acq-card .sr-acq-copy {
        font-size: 10.5px !important;
        -webkit-line-clamp: 2 !important;
    }

    #sr-acq-card .sr-acq-metric small {
        display: none !important;
    }
}

/* --- MOBILE: Compact bottom card with no overlap --- */
@media (max-width: 980px) {
    body {
        padding-right: 0 !important;
        padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)) !important;
    }

    #sr-acq-card {
        position: fixed !important;
        top: auto !important;
        left: 10px !important;
        right: 10px !important;
        bottom: max(10px, env(safe-area-inset-bottom, 0px)) !important;
        transform: none !important;
        width: auto !important;
        max-width: none !important;
        z-index: 2147483000 !important;
    }

    #sr-acq-card .sr-acq-card-link {
        padding: 10px 12px !important;
        max-height: 130px !important;
        overflow: hidden !important;
    }

    #sr-acq-card .sr-acq-title {
        font-size: 13px !important;
        margin-bottom: 4px !important;
    }

    #sr-acq-card .sr-acq-copy {
        font-size: 11px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        margin-bottom: 6px !important;
    }

    #sr-acq-card .sr-acq-proof {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 4px !important;
        margin-bottom: 6px !important;
    }

    #sr-acq-card .sr-acq-metric {
        min-height: 30px !important;
        padding: 4px !important;
        text-align: center !important;
    }

    #sr-acq-card .sr-acq-metric b {
        font-size: 8.5px !important;
        margin-bottom: 0 !important;
    }

    #sr-acq-card .sr-acq-metric small {
        display: none !important;
    }

    #sr-acq-card .sr-acq-cta {
        min-height: 28px !important;
        font-size: 9.5px !important;
        padding: 6px 8px !important;
        margin-bottom: 0 !important;
    }

    #sr-acq-card .sr-acq-note {
        display: none !important;
    }

    /* Promo fab - above the acq card */
    #sr-promo-fab {
        top: auto !important;
        right: 10px !important;
        bottom: calc(145px + env(safe-area-inset-bottom, 0px)) !important;
        width: min(9rem, calc(100vw - 4.5rem)) !important;
        max-width: min(9rem, calc(100vw - 4.5rem)) !important;
        min-width: 0 !important;
        transform: none !important;
        z-index: 9998 !important;
    }

    /* Back-to-top - left side above card */
    #back-to-top {
        left: 10px !important;
        right: auto !important;
        bottom: calc(145px + env(safe-area-inset-bottom, 0px)) !important;
        z-index: 9997 !important;
    }
}

/* --- SMALL MOBILE --- */
@media (max-width: 420px) {
    #sr-acq-card .sr-acq-card-link {
        max-height: 110px !important;
        padding: 8px 10px !important;
    }

    #sr-acq-card .sr-acq-proof {
        display: none !important;
    }

    body {
        padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    }

    #sr-promo-fab {
        bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
        width: 8rem !important;
        max-width: 8rem !important;
    }

    #back-to-top {
        bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* --- FONT CONSISTENCY --- */
body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
}

/* --- PREVENT DECORATIVE OVERFLOW --- */
#world-solar-bg,
.bg-anim-layer,
#globe-shell,
canvas#schumann-canvas,
body > canvas {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    pointer-events: none !important;
    z-index: 0 !important;
    overflow: hidden !important;
}

/* --- NAV Z-INDEX --- */
nav.nav-glass {
    z-index: 2147483100 !important;
    position: sticky !important;
    top: 0 !important;
}

/* --- FOOTER: fully visible --- */
.sr-footer-pro__matrix {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    gap: 1rem !important;
    width: 100% !important;
}

@media (max-width: 980px) {
    .sr-footer-pro__matrix {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 480px) {
    .sr-footer-pro__matrix {
        grid-template-columns: 1fr !important;
    }
}

/* --- TEXT OVERFLOW PREVENTION --- */
h1, h2, h3, h4, h5, h6, p, li {
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

/* --- IMAGES: prevent overflow --- */
img, video {
    max-width: 100% !important;
    height: auto !important;
}

/* Exception for fixed bg canvas */
canvas#schumann-canvas,
body > canvas {
    max-width: none !important;
    height: 100vh !important;
}

/* --- CHARTS --- */
.chart-container,
.live-chart-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

/* --- LIVE STRIP --- */
.nav-live-strip,
.sr-live-strip {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
}

.nav-live-strip::-webkit-scrollbar,
.sr-live-strip::-webkit-scrollbar {
    display: none !important;
}

/* --- SOLAR DATA CARDS --- */
.solar-data-container,
.sr-metrics-grid {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.solar-data-card,
.sr-metric-card {
    min-width: 0 !important;
    overflow: hidden !important;
}

/* --- PREVENT EMPTY HEADINGS --- */
h1:empty, h2:empty, h3:empty, h4:empty, h5:empty, h6:empty {
    display: none !important;
}

/* --- SCROLLBAR STABILITY --- */
html {
    scrollbar-gutter: stable !important;
}

/* --- PROMO FAB POLISH --- */
#sr-promo-fab {
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: 0 12px 32px rgba(0,0,0,0.4) !important;
}

/* --- LANGUAGE BAR --- */
.locale-bar,
.sr-lang-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: center !important;
}
