/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    color: #333;
    background-color: #fafafa;
    line-height: 1.6;
}

/* Header */
header {
    text-align: center;
    padding: 3rem 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* Main layout */
main {
    position: relative;
    display: flex;
}

/* Sticky map container */
#map-container {
    position: sticky;
    top: 0;
    width: 60%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fafafa;
    padding: 2rem;
}

#us-map {
    width: 100%;
    height: 100%;
    max-width: 900px;
    max-height: 600px;
}

/* Scrollable article */
#scrolly {
    width: 40%;
    position: relative;
    z-index: 10;
}

.step {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 2rem;
}

.step.final-section {
    min-height: 60vh;
}

.content-box {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 500px;
}

.content-box h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.content-box p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #555;
}

/* Category stats */
.category-stats {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e0e0e0;
}

.stat-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background-color: #f5f5f5;
    border-radius: 6px;
}

.stat-item:hover {
    background-color: rgba(255, 152, 0, 0.1);
    transform: translateX(5px);
    transition: all 0.2s ease;
}

.stat-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

.stat-text {
    font-size: 0.95rem;
    color: #555;
}

/* Attribution */
.attribution {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e0e0e0;
    font-size: 0.9rem;
    color: #777;
}

.attribution p {
    margin-bottom: 0.5rem;
}

/* Map states */
.state {
    fill: #e0e0e0;
    stroke: #fff;
    stroke-width: 1.5;
    transition: all 0.5s ease;
    cursor: default;
}

.state.clickable {
    cursor: pointer;
}

.state.clickable:hover {
    stroke: #333;
    stroke-width: 2;
    filter: brightness(0.95);
}

.state.neutral {
    fill: #e0e0e0;
    opacity: 1;
}

.state.approved {
    fill: #66bb6a;
    opacity: 1;
}

.state.implemented {
    fill: #1e88e5;
    opacity: 1;
}

.state.faded {
    opacity: 0.1;
}

/* Legend */
.legend {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
}

.legend.hidden {
    display: none;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    margin-right: 0.5rem;
}

/* Timeline visualization */
.timeline-viz {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 600px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.timeline-viz.hidden {
    display: none;
}

.timeline-header {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #555;
}

.timeline-bar {
    height: 40px;
    background: linear-gradient(to right, #1e88e5, #90caf9);
    border-radius: 4px;
    position: relative;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #777;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s ease;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.close-button:hover {
    color: #333;
}

.modal-content h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #667eea;
    padding-right: 2rem;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.timeline-item,
.restriction-item,
.notes-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #f5f5f5;
    border-radius: 6px;
}

.timeline-item strong,
.restriction-item strong,
.notes-item strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #667eea;
}

#modal-notes-container.hidden {
    display: none;
}

.state-link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.state-link:hover {
    background-color: #5568d3;
}

/* Responsive design */
@media (max-width: 1024px) {
    main {
        display: block;
    }

    #map-container {
        position: sticky;
        top: 0;
        width: 100%;
        height: 50vh;
        padding: 1rem;
        z-index: 20;
        display: flex;
        flex-direction: column;
    }

    #us-map {
        flex: 1;
        min-height: 0;
        width: 100%;
    }

    #scrolly {
        position: relative;
        width: 100%;
        z-index: auto;
    }

    .step {
        min-height: 80vh;
        padding: 1.5rem;
    }

    .content-box {
        max-width: 100%;
    }

    .legend,
    .timeline-viz {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        transform: none;
        width: 100%;
        margin-top: 0.5rem;
        flex-shrink: 0;
    }

    .legend {
        display: flex;
        flex-wrap: wrap;
        gap: 0 1rem;
        padding: 0.25rem 1rem;
        font-size: 0.8rem;
    }

    .legend .legend-item {
        margin-bottom: 0;
    }

    .legend .legend-color {
        width: 12px;
        height: 12px;
    }

    .timeline-viz {
        padding: 0.25rem 1rem;
    }

    .timeline-viz .timeline-header {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }

    .timeline-viz .timeline-bar {
        height: 18px;
    }

    .timeline-viz .timeline-labels {
        margin-top: 0.2rem;
        font-size: 0.7rem;
    }

    header h1 {
        font-size: 2rem;
    }

    header .subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 640px) {
    #map-container {
        height: 40vh;
    }

    .legend,
    .timeline-viz {
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    header {
        padding: 2rem 1rem 1.5rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .content-box {
        padding: 1.5rem;
    }

    .content-box h2 {
        font-size: 1.5rem;
    }

    .content-box p {
        font-size: 1rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-content h3 {
        font-size: 1.5rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Tooltip (optional enhancement) */
.tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 100;
}

.tooltip.visible {
    opacity: 1;
}
