/* Site header for non-briefing single chart pages (header-single-chart.php) */
.site-header {
    overflow: visible;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 150px;
    background-color: var(--title-color, #2c3e50);  /* Use CSS variable for title color */
    color: white;
    transition: top 0.1s linear;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    will-change: height;
    -webkit-backface-visibility: hidden;
}

/* On briefing pages, hide any non-briefing header elements that Astra injects */
body.briefing-page .site-header:not(.briefing-header),
body.briefing-page header:not(.briefing-header):not(#masthead),
body.briefing-page .ast-main-header-wrap,
body.briefing-page #ast-desktop-header,
body.briefing-page #ast-mobile-header,
body.briefing-page .main-header-bar,
body.briefing-page .ast-primary-header-bar,
body.briefing-page .ast-hfb-header {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
}



.location-display {
    position: absolute;
    right: 75px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease, font-size 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
    font-size: 45pt;
    line-height: 1.2;
    text-align: right;
    z-index: 1001;
}

.header-scrolled .location-display {
    opacity: 1;
}



/*Header Map xxxx*/
.header-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    z-index: 1;
    overflow: hidden;
    will-change: opacity;
    -webkit-transform: translateZ(0);
}

.map-color-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(to right, 
            rgba(44, 62, 80, 1) 0%, 
            rgba(44, 62, 80, 0.8) 20%,
            rgba(44, 62, 80, 0.2) 50%, 
            rgba(44, 62, 80, 0.1) 80%,                 
            rgba(44, 62, 80, 0) 100%),
        linear-gradient(to top right, 
            rgba(44, 62, 80, 1) 0%, 
            rgba(44, 62, 80, 0.85) 20%, 
            rgba(44, 62, 80, 0.6) 40%, 
            rgba(44, 62, 80, 0.3) 60%, 
            rgba(44, 62, 80, 0.05) 80%, 
            rgba(44, 62, 80, 0) 100%),
        radial-gradient(circle at bottom left, 
            rgba(44, 62, 80, 1) 0%, 
            rgba(44, 62, 80, 0.8) 50%, 
            rgba(44, 62, 80, 0.2) 60%, 
            rgba(44, 62, 80, 0.05) 80%, 
            rgba(44, 62, 80, 0) 100%);
    background-blend-mode: normal;
    z-index: 1000;
}

.map-color-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: height;
    -webkit-transform: translateZ(0);
    overflow: hidden;
}





body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    padding-top: 104px; /* 60px header + 44px breadcrumb (both fixed) */
}

/* Ensure briefing header renders at the very top on single chart pages */
body.briefing-page .briefing-header {
    position: fixed !important;
    top: 0 !important;
    z-index: 1001 !important;
}

#chart-layout {
    display: flex;
    margin: 0;
    padding: 0;
}

#chart-layout.no-sidebar {
    display: block;
}

#sidebar {
    width: 200px;
    padding: 20px;
    background-color: #f0f0f0;
    overflow-y: auto;
    height: calc(100vh - 80px); /* Subtract header height */
}

#main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.no-sidebar #main-content {
    width: 100%;
}

#chart-container {
    height: max(600px, 55vh);
    overflow: hidden;
}

.cct-chart {
    width: 100% !important;
    height: 100% !important;
}

.cct-chart > div {
    width: 100% !important;
    height: 100% !important;
}





/* Light divider below chart */
.cct-chart-divider {
    border: none;
    border-top: 1px solid var(--color-border, #e5e7eb);
    margin: 24px 0 0;
}

/* Hide location from header on single chart pages — chart may not match user's location */
.single-citizen_chart .briefing-nav-location {
    display: none !important;
}

/* Hide Dashboard/Explore nav links on single chart pages — redundant with
   logo (→ dashboard), breadcrumb category (→ explore), and browser back.
   Keeps header to one row so it doesn't overlap the breadcrumb on mobile. */
.single-citizen_chart .briefing-nav-dashboard,
.single-citizen_chart .briefing-nav-explore {
    display: none !important;
}

/* Override Astra theme spacing on single chart pages */
#content, #primary, .site-main, .entry-content,
.ast-container, .site-content, .ast-article-single,
#page, .hfeed, .site {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    height: auto;
}


/* Share button styles */
.cct-chart {
    position: relative;
}

.cct-share-button {
    position: absolute;
    bottom: 8px;
    right: 16px;
    z-index: 1000;
}

.cct-share-toggle {
    background-color: rgba(255, 255, 255, 0.4);
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 48px !important; 
    height: 36px !important; 
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    color: #2c3e50;
    transition: all 0.3s ease;
    padding: 0 !important;
    font-size: 24px !important;
    line-height: 1 !important;
}

.cct-share-toggle:hover {
    background-color: #2c3e50;
    color: white;
}

.cct-share-dropup {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background-color: #34495e;
    border: 1px solid #2c3e50;
    border-radius: 4px;
    padding: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 150px;
    margin-bottom: 5px;
    z-index: 8001;
}

.cct-share-dropup.active {
    display: block;
}

.cct-share-dropup button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 5px;
    background-color: transparent;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    color: white;
    transition: background-color 0.3s ease;
}

.cct-share-dropup button:last-child {
    margin-bottom: 0;
}

.cct-share-dropup button:hover {
    background-color: #2c3e50;
}

#chart-container,
.cct-chart {
    position: relative;
}

.cct-chart .cct-share-button {
    position: absolute !important;
    bottom: 8px !important;
    right: 16px !important;
    z-index: 1000 !important;
}

.cct-share-dropup button.copied {
    background-color: #4CAF50;
    color: white;
}

.chart-title {
    font-size: 36px;
    margin-left: auto;
    margin-right: auto;
    color: white;
}



/*Scope Display*/
.scope-display {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%) translateX(100%);
    font-size: 30px;
    font-weight: bold;
    color: white;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.header-scrolled .scope-display {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
}


/*Sources*/
.sources-list {
    list-style-type: none;
    padding-left: 0;
}

.sources-list li {
    margin-bottom: 10px;
}

/* Responsive adjustments */
@media screen and (max-width: 1200px) {
    #chart-container {
        height: max(500px, 50vh);
    }

    .chart-title {
        font-size: 32px;
    }

    .scope-display {
        font-size: 26px;
    }
}

@media screen and (max-width: 900px) {
    #chart-container {
        height: max(400px, 45vh);
    }

    .chart-title {
        font-size: 28px;
    }

    .scope-display {
        font-size: 22px;
    }

    .cct-share-toggle {
        border-radius: 4px;
        width: 40px !important;
        height: 30px !important;
        font-size: 18px !important;
    }
}

@media screen and (max-width: 600px) {
    #chart-container {
        height: max(300px, 42vh);
    }

    /* Allow visualization charts more breathing room on tall phones */
    #chart-container:only-child {
        min-height: 42vh;
    }

    .chart-title {
        font-size: 24px;
    }

    .scope-display {
        font-size: 18px;
    }
}

@media screen and (max-width: 480px) {

    .chart-title {
        opacity: 0;
    }

    .cct-share-toggle {
        border-radius: 3px;
        width: 32px !important;
        height: 24px !important;
        font-size: 14px !important;
    }

}

/* ==========================================
   Landscape mobile: hide header on single chart view
   Tap breadcrumb to toggle. Breadcrumb stays as primary nav.
   ========================================== */

/* Chevron indicator on breadcrumb bar — only visible in landscape mode */
body.landscape-mode .cct-breadcrumb-bar::after {
    content: '\25BC'; /* down triangle */
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--color-text-tertiary, #8E8EA0);
    transition: transform 0.3s ease;
    pointer-events: none;
}

body.landscape-mode .cct-breadcrumb-bar.landscape-menu-open::after {
    content: '\25B2'; /* up triangle */
}

body.landscape-mode .cct-breadcrumb-bar {
    cursor: pointer;
}


@media screen and (max-height: 500px) and (orientation: landscape) {
    body.single-citizen_chart,
    body.single-citizen_chart.briefing-page {
        padding-top: 44px !important; /* breadcrumb only */
        margin-top: 0 !important;
    }

    body.single-citizen_chart.landscape-header-visible,
    body.single-citizen_chart.landscape-header-visible.briefing-page {
        padding-top: 104px !important; /* header + breadcrumb */
    }

    body.single-citizen_chart .briefing-header,
    .single-citizen_chart #masthead.briefing-header {
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }

    body.single-citizen_chart.landscape-header-visible .briefing-header,
    .single-citizen_chart.landscape-header-visible #masthead.briefing-header {
        transform: translateY(0);
    }

    body.single-citizen_chart .cct-breadcrumb-bar {
        top: 0 !important;
        transition: top 0.3s ease;
    }

    body.single-citizen_chart.landscape-header-visible .cct-breadcrumb-bar {
        top: 60px !important;
    }

    /* Kill any extra spacing on content wrappers */
    body.single-citizen_chart #content,
    body.single-citizen_chart #chart-layout,
    body.single-citizen_chart #main-content {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}