/* --- SECTION 4: CLIMATE LAB (Analysis) --- */
.lab-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 3rem;
    align-items: start;
    min-height: 600px;
    font-family: var(--font-body);
}

/* --- Left: Viz Area --- */
.lab-viz-area {
    position: relative;
    height: 500px;
    display: flex;
    flex-direction: column;
}

.lab-chart-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 1.5rem;
    text-align: left;
}

.lab-chart-title span {
    font-weight: 800;
}

#cl-viz-target {
    width: 100%;
    height: 100%;
}

.climate-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Axis Styles */
.axis text {
    fill: #666;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.axis line {
    stroke: #eee;
    stroke-dasharray: 2 2;
}

.axis path.domain {
    display: none;
}

/* Line Styles */
.line {
    fill: none;
    stroke-width: 3px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.line-main {
    fill: none;
}

.line-fut {
    stroke-dasharray: 4 4;
}

.hover-line {
    stroke: #333;
    /* Darker for better visibility */
    stroke-width: 1px;
    stroke-dasharray: 3 3;
}

.overlay {
    fill: none;
    pointer-events: all;
}

/* --- Legend --- */
.chart-legend {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid #eee;
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #999;
}

.legend-line-dashed {
    width: 15px;
    height: 2px;
    border-bottom: 2px dashed #999;
}


/* --- Right: Story/Controls (Sidebar) --- */
.lab-sidebar {
    position: sticky;
    top: 2rem;
    padding-left: 2rem;
    border-left: 1px solid #eee;
}

.story-card {
    background: transparent;
}

.story-step-indicator {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.story-title {
    font-family: var(--font-heading);
    /* Serif */
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: #111;
}

.story-text {
    font-family: var(--font-heading);
    /* Serif for reading text */
    font-size: 1.1rem;
    line-height: 1.7;
    color: #333;
    margin-bottom: 2rem;
}

.story-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

/* Minimal Buttons */
.nav-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: sans-serif;
    font-size: 0.9rem;
}

.nav-btn:hover:not(:disabled) {
    border-color: #333;
    background: #f9f9f9;
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #eee;
}

.nav-btn.primary {
    background: #111;
    color: #fff;
    border-color: #111;
}

.nav-btn.primary:hover {
    background: #333;
}


/* --- Explorer Controls (Unlocked) --- */
.mech-explorer {
    display: none;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    animation: fadeIn 0.5s ease;
}

.mech-explorer.active {
    display: flex;
}

.explorer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.col-left,
.col-right {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.explorer-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #999;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.mech-btn-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.mech-btn-small {
    padding: 0.4rem;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: left;
}

.mech-btn-small:hover {
    background: #f5f5f5;
    color: #111;
}

/* Active States */
.mech-btn-small.active {
    background: #fff;
    font-weight: 700;
    /* Border and shadow set dynamically by JS */
}

/* Future Toggle */
.future-toggle-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    padding: 0.8rem;
    background: #f9f9f9;
    border-radius: 6px;
    justify-content: space-between;
}

.toggle-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #444;
}

/* Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #111;
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* --- Tooltip (Global) --- */
/* Note: Since we append to body, we don't need relative positioning logic from container */
.chart-tooltip-global {
    position: absolute;
    background: #fff;
    border: 1px solid #111;
    padding: 12px 16px;
    border-radius: 6px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    /* Softer, modern shadow */
    font-family: var(--font-body), sans-serif;
    font-size: 0.85rem;
    z-index: 9999;
    /* Highest priority */
    min-width: 175px;
    transition: opacity 0.1s;
    line-height: 1.4;
}

.tt-title {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
    margin-bottom: 6px;
    color: #111;
    letter-spacing: 0.5px;
}

.tt-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-weight: 500;
}

.tt-fut {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-left: 5px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .lab-container {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 2rem;
    }

    .lab-sidebar {
        position: relative;
        top: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid #eee;
        padding-top: 2rem;
        order: 2;
        /* Put controls below chart on mobile */
    }

    .lab-viz-area {
        order: 1;
        height: 400px;
    }
}