/* Scrolling
================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.intro {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.intro2, .conclusion {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0 0 2rem 0;
}

.intro h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.intro p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.scrolly {
    position: relative;
    display: flex;
    min-height: 60vh;
/*    min-height: 100vh;*/
}

.scrolly-overlay {
    position: sticky;
    top: 0;
    width: 60%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
/*    background: #f8f9fa;*/
}

.chart-container {
    width: 90%;
    height: 70vh;
    background: white;
/*    border-radius: 8px;*/
/*    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);*/
/*    padding: 20px;*/
}

.scrolly-content {
    width: 40%;
    padding: 0 2rem;
}

.step {
    margin: 50vh 0;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.step.is-active {
    opacity: 1;
}

.step h2 {
    font-size: 1.5rem;
    margin-bottom: .5rem;
    color: #2c3e50;
}

.step p {
    font-size: 1.15rem;
    line-height: 1.6;
    color: #111;
}

.conclusion {
/*    height: 100vh;*/
    display: flex;
/*    align-items: center;*/
/*    justify-content: center;*/
/*    text-align: center;*/
/*    background: #2c3e50;*/
/*    color: white;*/
}

.conclusion h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* Chart styling */
.bar {
    transition: all 0.5s ease;
}

.bar:hover {
    opacity: 0.8;
}

.axis text {
    font-size: 12px;
    fill: #666;
}

.axis path,
.axis line {
    fill: none;
    stroke: #ccc;
    shape-rendering: crispEdges;
}

.axistitle {
    fill: #333 !important;
    font-size: 14px !important;
}

.intro2 .sidebar-entry {
    background: none;
    padding: 0;
}



/* Desktop styles - sidebar on the right */
@media (min-width: 769px) {
    .intro2, .conclusion {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .intro2 .entry, .conclusion .entry {
        flex: 2;
        margin-right: 20px;
        margin: 1rem 2rem 2rem 2rem;
    }
    
    .sidebar-entry {
        flex: 1;
        min-width: 250px;
        margin: 1rem 2rem 2rem 0;
        padding: 16px;
        background-color: #e8e8e8;
        border-radius: 4px;
/*        border: 1px solid #ccc;*/
    }
    
}


@media (max-width: 768px) {
/*    .intro,
    .conclusion {
        position: relative;
        z-index: 3;
    }*/
    
    .intro2, .conclusion {
        flex-direction: column;
        height: auto;
        margin: 1rem 0;
    }
    
    .intro2 .entry, .conclusion .entry {
        order: 1;
        flex: none;
        margin: 1rem;
    }
    
    .conclusion .sidebar-entry {
        order: 2;
        flex: none;
/*        margin: 1rem;*/
        padding: 20px 16px;
        background-color: #e8e8e8;
        border-radius: 3px;
        border: 1px solid #ccc;
    }
    
    
    
    .scrolly {
        flex-direction: column;
        position: relative;
    }
    
    .scrolly-overlay {
            /* Use sticky positioning like desktop instead of fixed */
            position: sticky;
            top: calc(50vh - 30vh);
            width: 100%;
            height: 50vh; /* Reduced height for mobile */
            z-index: 1;
            margin-bottom: 2rem;
            /* Remove opacity transitions */
            opacity: 1;
            transition: none;
            /* Center the chart */
            display: flex;
            align-items: center;
            justify-content: center;
        }
    
/*    .scrolly-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 1;
        opacity: 0;
        transition: opacity 0.3s ease;
    }*/
    
    .scrolly-overlay.show {
        opacity: 1;
    }

/*    .chart-container {
            width: 95%;
            height: 100%;
            padding: 15px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }*/
    
    .chart-container {
        width: 95%;
        height: 80vh;
        padding: 15px;
    }
    
    .scrolly-content {
        width: 100%;
        padding: 0;
        position: relative;
        z-index: 2;
    }
    
/*    .step {
        margin: 30vh 0;
        margin-left: 1rem;
        margin-right: 1rem;
        padding: 1.0rem;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(3px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }*/
    
    .step {
            /* Reduce margins to prevent excessive scrolling */
            margin: 20vh 0;
            margin-left: 1rem;
            margin-right: 1rem;
            padding: 1.0rem;
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(3px);
            border: 1px solid rgba(200, 200, 200, 0.3);
            /* Ensure steps appear above the sticky chart */
            position: relative;
            z-index: 2;
        }
    
        /* First and last step adjustments */
        .step:first-child {
            margin-top: 10vh;
        }
        
    
    .step h2 {
        font-size: 1.5rem;
        margin-bottom: .4rem;
    }
    
    .step p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .intro h1 {
        font-size: 2.5rem;
    }
    
    .intro p {
        font-size: 1.1rem;
        padding: 0 1rem;
    }
    
    .conclusion h2 {
        font-size: 2rem;
        padding: 0 1rem;
    }
}

/* Smaller mobile devices */
@media (max-width: 480px) {
    .scrolly-overlay {
            height: 53vh; /* Even smaller for small screens */
            /* Center vertically: 50vh - (half of container height) */
            top: calc(50vh - 40vh); /* Centers a 40vh container */
        }
    
    .step {
        margin: 60vh 0;
        margin-left: 0.5rem;
        margin-right: 0.5rem;
        padding: 1rem;
    }
    
    .entry.header {
        margin: 1.25rem 0.5rem 0 .5rem;
    }
    
    .intro2 {
        flex-direction: column;
        margin: 0.5rem 0;
        margin-bottom: 40vh;
    }
    
    .intro2 .sidebar-entry {
        order: 1;
        margin: 0.5rem;
    }
    .intro2 .entry {
        order: 2;
        margin: 0.5rem;
    }
    
    .conclusion .entry {
        order: 1;
        margin: 0.5rem;
    }
    
    .conclusion .sidebar-entry {
        order: 2;
        margin: 0.5rem;
        padding: 16px;
    }
    
    #newsletter, .footnotes .entry {
        margin: 0.5rem;
    }
    
    #intro-image {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }
    
    .step h2 {
        font-size: 1.3rem;
    }
    
    .step p {
        font-size: 0.9rem;
    }
    
    .chart-container {
        padding: 10px;
    }
    
    .intro h1 {
        font-size: 2rem;
    }
    
    .conclusion h2 {
        font-size: 1.8rem;
    }
}