/* Color palette */
:root {
    --wheat-gold: #D4A574;
    --prairie-brown: #8B7355;
    --soil-dark: #5C4742;
    --sage-green: #8B9D83;
    --sky-blue: #4A6C8F;

    --boom-gold: #DAA520;
    --bust-gray: #6B6B6B;
    --transition-tan: #C19A6B;

    --cream: #F5F1E8;
    --off-white: #FEFDF9;
    --light-tan: #E8DCC8;

    --text-dark: #2C2416;
    --text-medium: #4A4238;
    --text-light: #7A6F5D;

    --chart-text: #4A4238;
    --chart-grid: rgba(139, 115, 85, 0.15);
    --chart-tooltip-bg: rgba(92, 71, 66, 0.92);
    --chart-tooltip-text: #F5F1E8;
    --chart-tooltip-border: #D4A574;
}

/* Basic reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.7;
    color: var(--text-dark);
    background-color: var(--off-white);
    font-size: 16px;
}

/* Headings */
h1, h2, h3, h4 {
    font-family: 'Helvetica Neue', 'Arial', sans-serif;
    font-weight: 600;
    line-height: 1.3;
    color: var(--soil-dark);
}

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

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    border-bottom: 3px solid var(--wheat-gold);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--prairie-brown);
}

p {
    margin-bottom: 1rem;
    color: var(--text-medium);
}

a {
    color: var(--sky-blue);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-bottom 0.3s ease;
}

a:hover {
    border-bottom: 1px solid var(--sky-blue);
}

/* Header */
header {
    position: relative;
    color: var(--off-white);
    padding: 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header-banner {
    width: 100%;
    overflow: hidden;
    max-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--soil-dark);
}

.banner-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    max-height: 400px;
    filter: brightness(0.6);
}

.header-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    z-index: 10;
    padding: 2rem;
    background: rgba(20, 16, 10, 0.38);
    border-radius: 12px;
    backdrop-filter: blur(2px);
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.85);
}

header h1 {
    color: var(--off-white);
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.byline {
    color: var(--cream);
    text-shadow: 1px 1px 6px rgba(0, 0, 0, 0.7);
    font-style: italic;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #ffd986;
    text-shadow: 1px 1px 6px rgba(0, 0, 0, 0.8);
    font-size: 1.2rem;
    font-weight: 500;
    margin-top: 1rem;
}

/* Sticky Navigation */
.nav-bar {
    position: sticky;
    top: 0;
    background-color: var(--soil-dark);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    flex: 1;
}

.nav-controls {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    align-items: center;
}

.nav-link {
    color: var(--light-tan);
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    font-family: 'Helvetica Neue', sans-serif;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: var(--wheat-gold);
    border-bottom: 2px solid var(--wheat-gold);
}

/* Hamburger menu - now visible on all screens */
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}


.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--light-tan);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Settings dropdown */
.settings-dropdown {
    position: absolute;
    top: 100%;
    right: 1rem;
    background-color: var(--soil-dark);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: none;
    z-index: 1001;
    min-width: 180px;
}

.settings-dropdown.active {
    display: block;
}

/* Theme toggle button */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    color: var(--light-tan);
    cursor: pointer;
    padding: 0.5rem 0;
    width: 100%;
    font-family: 'Helvetica Neue', sans-serif;
    font-size: 0.95rem;
}

.theme-label {
    font-weight: 500;
}

.theme-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: var(--prairie-brown);
    border-radius: 12px;
    transition: background-color 0.3s ease;
}

.theme-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: var(--off-white);
    border-radius: 50%;
    transition: transform 0.3s ease;
}

body.dark-mode .theme-switch {
    background-color: var(--wheat-gold);
}

body.dark-mode .theme-slider {
    transform: translateX(20px);
}

/* Main content area */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    margin-bottom: 4rem;
    background-color: var(--cream);
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(92, 71, 66, 0.1);
}

#introduction p {
    font-size: 1.1rem;
    text-align: justify;
}

/* Historical context with colored bullets */
.context-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.context-item-list {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--off-white);
    border-radius: 6px;
}

.bullet {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.5rem;
}

.context-item-list.founded .bullet {
    background-color: var(--sage-green);
}

.context-item-list.namesake .bullet {
    background-color: var(--prairie-brown);
}

.context-item-list.economic .bullet {
    background-color: var(--boom-gold);
}

.context-item-list.decline .bullet {
    background-color: var(--bust-gray);
}

.context-content {
    flex: 1;
    color: var(--text-medium);
    line-height: 1.6;
}

/* Population section */
.population-section {
    margin-bottom: 3rem;
}

.population-section h3 {
    text-align: center;
    margin-bottom: 1rem;
}

.chart-note {
    text-align: center;
    font-style: italic;
    color: var(--text-light);
    margin-top: 1rem;
}

/* Dual charts */
.dual-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.chart-half {
    background-color: var(--off-white);
    padding: 1.5rem;
    border-radius: 6px;
}

.chart-half h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.chart-container {
    position: relative;
    height: 400px;
    background-color: white;
    padding: 1rem;
    border-radius: 6px;
}

.chart-container-small {
    position: relative;
    height: 300px;
    background-color: white;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.chart-caption {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-light);
    text-align: center;
    margin-top: 0.5rem;
}

/* Timeline filters */
.timeline-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    border: 2px solid var(--prairie-brown);
    background-color: var(--off-white);
    color: var(--prairie-brown);
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Helvetica Neue', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: var(--light-tan);
}

.filter-btn.active {
    background-color: var(--prairie-brown);
    color: var(--off-white);
}

/* Timeline zigzag layout */
#timeline-container {
    position: relative;
    padding: 2rem 0;
}

#timeline-container::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--wheat-gold) 0%, var(--prairie-brown) 100%);
    transform: translateX(-50%);
}

.timeline-event {
    position: relative;
    width: 45%;
    padding: 1.5rem;
    margin-bottom: 2rem;
    background-color: var(--off-white);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.timeline-event::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: var(--wheat-gold);
    border: 3px solid var(--soil-dark);
    border-radius: 50%;
    top: 30px;
    z-index: 1;
}

.timeline-event:nth-child(odd) {
    margin-left: 0;
    margin-right: auto;
}

.timeline-event:nth-child(odd)::after {
    right: -55px;
}

.timeline-event:nth-child(even) {
    margin-left: auto;
    margin-right: 0;
}

.timeline-event:nth-child(even)::after {
    left: -55px;
}

.timeline-event:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.timeline-event.infrastructure {
    border-left: 5px solid var(--sky-blue);
}

.timeline-event.industry {
    border-left: 5px solid var(--boom-gold);
}

.timeline-event.disaster {
    border-left: 5px solid var(--bust-gray);
}

.timeline-event.demographics {
    border-left: 5px solid var(--sage-green);
}

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

.timeline-date {
    font-weight: bold;
    color: var(--soil-dark);
    font-size: 1.1rem;
    font-family: 'Helvetica Neue', sans-serif;
    margin-bottom: 0.5rem;
}

.timeline-category {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    margin-left: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
}

.timeline-category.infrastructure {
    background-color: var(--sky-blue);
    color: white;
}

.timeline-category.industry {
    background-color: var(--boom-gold);
    color: white;
}

.timeline-category.disaster {
    background-color: var(--bust-gray);
    color: white;
}

.timeline-category.demographics {
    background-color: var(--sage-green);
    color: white;
}

.timeline-title {
    font-size: 1.2rem;
    margin: 0.75rem 0 0.5rem 0;
    color: var(--prairie-brown);
}

.timeline-description {
    color: var(--text-medium);
    font-size: 0.95rem;
    line-height: 1.5;
}

.timeline-impact {
    color: var(--text-medium);
    font-size: 0.9rem;
    display: none;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--light-tan);
    line-height: 1.6;
}

.timeline-event.active .timeline-impact {
    display: block;
}

.timeline-image {
    margin-bottom: 1rem;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    background-color: var(--light-tan);
}

.timeline-image img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 340px;
    object-fit: contain;
}

.image-caption {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-light);
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: var(--light-tan);
    border-radius: 4px;
}

.timeline-note {
    text-align: center;
    font-style: italic;
    color: var(--text-light);
    margin-top: 2rem;
}

/* Phase cards */
.phase-card {
    background-color: var(--off-white);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 6px;
    border-left: 6px solid var(--wheat-gold);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.phase-card.boom {
    border-left-color: var(--boom-gold);
}

.phase-card.transition {
    border-left-color: var(--transition-tan);
}

.phase-card.bust {
    border-left-color: var(--bust-gray);
}

.phase-card h3 {
    margin-bottom: 1rem;
}

/* Insight box */
.insight-box {
    background-color: var(--soil-dark);
    color: var(--off-white);
    padding: 2.5rem;
    border-radius: 8px;
    margin-top: 3rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.insight-box h3 {
    color: var(--wheat-gold);
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
}

.insight-box p {
    color: var(--cream);
    line-height: 1.8;
    font-size: 1.05rem;
}

/* Sources */
.sources-list {
    list-style-position: inside;
    padding-left: 0;
}

.sources-list li {
    margin-bottom: 0.75rem;
    color: var(--text-medium);
    line-height: 1.6;
}

.sources-list a {
    color: var(--sky-blue);
}

.wiki-link {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-left: 4px solid var(--wheat-gold);
    background-color: var(--off-white);
    border-radius: 6px;
    font-family: 'Helvetica Neue', sans-serif;
    color: var(--text-medium);
}

.wiki-link a {
    color: var(--sky-blue);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.wiki-link a:hover {
    border-bottom: 1px solid var(--sky-blue);
}

/* Footer */
footer {
    background-color: var(--soil-dark);
    color: var(--light-tan);
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

footer p {
    color: var(--light-tan);
    margin-bottom: 0.5rem;
}

.footer-note {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--cream);
    margin-top: 1rem;
}

/* Mobile */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.75rem;
    }

    .byline {
        font-size: 1rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .nav-container {
        justify-content: flex-start;
        overflow-x: auto;
    }

    .nav-link {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }

    main {
        padding: 1rem;
    }

    section {
        padding: 1.5rem;
    }

    h2 {
        font-size: 1.6rem;
    }

    .dual-charts {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 300px;
    }

    .chart-container-small {
        height: 250px;
    }

    #timeline-container::before {
        left: 20px;
        transform: none;
    }

    .timeline-event {
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 50px;
    }

    .timeline-event::after {
        left: 12px !important;
        right: auto !important;
    }

    .timeline-filters {
        justify-content: flex-start;
    }

    .insight-box {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    section {
        padding: 1rem;
    }

    .chart-container {
        height: 250px;
    }

    .chart-container-small {
        height: 200px;
    }
}

/* Gallery page styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 3rem;
    margin-top: 2rem;
}

.gallery-item {
    background-color: var(--off-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(92, 71, 66, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(92, 71, 66, 0.2);
}

.gallery-image {
    width: 100%;
    height: auto;
    display: block;
}

.gallery-caption {
    padding: 1.5rem;
}

.gallery-caption h3 {
    color: var(--prairie-brown);
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}

.gallery-caption p {
    color: var(--text-medium);
    line-height: 1.6;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .header-banner {
        height: 50vh;
        min-height: 260px;
        max-height: 320px;
    }

    .banner-image {
        height: 100%;
        max-height: 320px;
        object-position: center 35%;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .header-content {
        padding: 1.25rem;
        width: 94%;
    }

    .timeline-image img {
        max-height: 260px;
    }

    .nav-bar {
        flex-direction: row;
        align-items: center;
    }

    .nav-container {
        order: initial;
        width: auto;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }

    .nav-link {
        flex: none;
        text-align: left;
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .nav-controls {
        order: initial;
        width: auto;
        justify-content: center;
        padding: 0.75rem 1rem;
    }
}

/* Dark mode styles - improved readability */
body.dark-mode {
    --wheat-gold: #F4C542;
    --prairie-brown: #C9A66B;
    --soil-dark: #4A4238;
    --sage-green: #B8CCA8;
    --sky-blue: #7A9FBF;

    --boom-gold: #F4C542;
    --bust-gray: #A8A8A8;
    --transition-tan: #E0C49A;

    --cream: #2E2A22;
    --off-white: #232019;
    --light-tan: #E8DCC8;

    --text-dark: #F5F1E8;
    --text-medium: #E8DCC8;
    --text-light: #D4C4B0;

    --chart-text: #F5F1E8;
    --chart-grid: rgba(232, 220, 200, 0.18);
    --chart-tooltip-bg: rgba(20, 18, 14, 0.9);
    --chart-tooltip-text: #F5F1E8;
    --chart-tooltip-border: #F4C542;

    background-color: #1C1915;
    color: #F5F1E8;
}

body.dark-mode section {
    background-color: #2E2A22;
}

body.dark-mode .phase-card,
body.dark-mode .context-item-list,
body.dark-mode .chart-half,
body.dark-mode .timeline-event,
body.dark-mode .gallery-item {
    background-color: #232019;
}

body.dark-mode .insight-box {
    background-color: #4A4238;
    color: #F5F1E8;
}

body.dark-mode .insight-box h3 {
    color: #F4C542;
}

body.dark-mode .insight-box p {
    color: #E8DCC8;
}

body.dark-mode .chart-container,
body.dark-mode .chart-container-small {
    background-color: #2E2A22;
}

body.dark-mode .filter-btn {
    background-color: #232019;
    color: #C9A66B;
    border-color: #C9A66B;
}

body.dark-mode .filter-btn.active {
    background-color: #C9A66B;
    color: #232019;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
    color: #F5F1E8;
}

body.dark-mode .timeline-title,
body.dark-mode .gallery-caption h3 {
    color: #E0C49A;
}

body.dark-mode .settings-dropdown {
    background-color: #2E2A22;
    border: 1px solid #4A4238;
}

body.dark-mode .timeline-date {
    color: #F5F1E8;
}

body.dark-mode .chart-note,
body.dark-mode .chart-caption {
    color: #D4C4B0;
}

body.dark-mode .phase-card h3 {
    color: #F4C542;
}

body.dark-mode .phase-card p,
body.dark-mode .context-content {
    color: #E8DCC8;
}

body.dark-mode .image-caption {
    background-color: #4A4238;
    color: #D4C4B0;
}

body.dark-mode .byline {
    color: #F8F3E2;
    text-shadow: 1px 1px 8px rgba(0, 0, 0, 0.85);
}
