/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    font-size: 16px;
}

body {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Lato, Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #202122;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* Header - Full width, fixed height feel */
header {
    background-color: #ffffff;
    border-bottom: 1px solid #a2a9b1;
    padding: 10px 20px;
    flex-shrink: 0;
}

.header-container {
    max-width: 1920px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 400;
    color: #202122;
}

.burger-menu {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #202122;
    padding: 5px 10px;
}

/* Main Layout Container - Flex column for header + middle + footer */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Middle Section - Flex row for sidebar + main, fills remaining space */
.content-wrapper {
    flex: 1;
    display: flex;
    max-width: 1920px;
    margin: 0 auto;
    width: 100%;
}

/* Sidebar - Fixed width left column */
.sidebar {
    flex: 0 0 280px;
    padding: 20px;
    background-color: #f8f9fa;
    border-right: 1px solid #a2a9b1;
    overflow-y: auto;
}

.nav-section h2 {
    font-size: 0.875rem;
    font-weight: bold;
    color: #54595d;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #a2a9b1;
}

.nav-section ul {
    list-style: none;
}

.nav-section li {
    margin-bottom: 8px;
}

.nav-section a {
    color: #0645ad;
    text-decoration: none;
    font-size: 0.9375rem;
}

.nav-section a:hover,
.nav-section a:focus {
    color: #0b0080;
    text-decoration: underline;
}

.nav-section a.active {
    font-weight: bold;
    color: #202122;
}

/* Main Content + Footer Wrapper - Column for main + footer */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

/* Main Content - No top padding to eliminate gap */
.main-content {
    flex: 1;
    padding: 0 20px 20px 20px;
    overflow-y: auto;
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 20px;
}

.content h1 {
    font-size: 2.2rem;
    font-weight: normal;
    border-bottom: 1px solid #a2a9b1;
    padding-bottom: 12px;
    margin-bottom: 24px;
    color: #202122;
}

.content h2 {
    font-size: 1.6rem;
    font-weight: normal;
    margin: 24px 0 12px;
    color: #202122;
}

.content p {
    margin-bottom: 16px;
    font-size: 1rem;
    line-height: 1.8;
}

/* Image Box Styling - Float right with caption under image, text wraps around */
.content figure.image-box {
    float: right;
    clear: right;
    margin: 8px 0 20px 20px;
    text-align: center;
    max-width: 520px;
    /* Increased slightly for better breathing room */
    background-color: #ffffff;
    border: 1px solid #c8ccd1;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

.content figure.image-box img {
    display: block;
    margin: 0 auto 10px auto;
    width: 100%;
    /* Key fix: force image to fill available width */
    max-width: 100%;
    /* But never exceed container */
    height: auto;
    /* Preserve aspect ratio */
    object-fit: contain;
    /* Ensures full image is visible without cropping */
    border-radius: 4px;
}

.content figure.image-box figcaption {
    font-size: 0.8125rem;
    color: #54595d;
    font-style: italic;
    line-height: 1.5;
}

/* Specific image max-widths are now handled by width:100% + max-width:100% above */
/* We keep them only for finer control if needed, but they are secondary */
#imgHuguenotPersecution1,
#imgHuguenotPersecution2,
#imgSimonVanDerStel {
    max-width: 480px;
}

#imgCapeDutchFarm,
#imgHuguenotShips,
#imgHuguenotVineyards {
    max-width: 480px;
}

#imgHuguenotMonument {
    max-width: 480px;
}

/* Legacy specific sizes (for other pages) */
#imgJanVanRiebeeck,
#imgContactUsTelegram {
    max-width: 280px;
}

#imgJanVanRiebeeckArrivalToCapeOfGoodHope {
    max-width: 420px;
}

#TrekboersExpansion,
#TrekboersMakingCamp {
    max-width: 480px;
}

/* Timeline Table */
.timeline-table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

.timeline-table th,
.timeline-table td {
    border: 1px solid #a2a9b1;
    padding: 20px;
    text-align: left;
    vertical-align: top;
    font-size: 0.9375rem;
}

.timeline-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.timeline-table tr:nth-child(even) td {
    background-color: #f8f9fa;
}

/* License */
.license {
    font-size: 0.75rem;
    color: #54595d;
    text-align: center;
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #a2a9b1;
}

.license a {
    color: #0645ad;
    text-decoration: none;
}

.license a:hover {
    color: #0b0080;
    text-decoration: underline;
}

/* Footer - Full width at bottom */
.footer {
    flex-shrink: 0;
    background-color: #f8f9fa;
    padding: 20px;
    text-align: center;
    border-top: 1px solid #a2a9b1;
}

/* Responsive Design */
@media (min-width: 1441px) {
    .sidebar {
        flex-basis: 300px;
    }

    .content {
        max-width: 1400px;
    }
}

@media (max-width: 768px) {
    .burger-menu {
        display: block;
    }

    .content-wrapper {
        flex-direction: column;
    }

    .sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        background-color: #f8f9fa;
        border-right: 1px solid #a2a9b1;
        z-index: 1000;
        overflow-y: auto;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
        padding: 60px 20px 20px 20px;
    }

    .sidebar.active {
        display: block;
    }

    /* On mobile: stack images full-width, no float */
    .content figure.image-box {
        float: none;
        clear: both;
        margin: 20px auto;
        max-width: 100%;
        padding: 12px;
    }

    .content figure.image-box img {
        width: 100%;
        max-width: 100%;
        height: auto;
        object-fit: contain;
    }

    .content p {
        font-size: 0.9375rem;
    }

    .content h1 {
        font-size: 1.8rem;
    }
}