body {
    background-color: #260107;
    margin: 0;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
}

header {
    background-color: rgb(251, 240, 223);
    border-width: 2px 0;
    border-style: solid;
    border-color: rgb(243, 233, 217);
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12pt;
}

.header-link {
    height: 30px;
    align-content: center;
    margin: 0 5px 0 5px;
    color: #000000;
    text-align: center;
    text-decoration: none;
}

.header-link:hover {
    color: #57000e;
}

#header-link-current {
    align-content: flex-start;
    pointer-events: none;
    height: 24px;
    padding-top: 8px;
    border-bottom-style: solid;
    border-bottom-width: 2px;
    border-bottom-color: #57000e;
    color: #57000e;
}



/* --------------------------------------------*/



main {
    max-width: 640px;
    padding: 20px;
    margin: 35px auto 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    flex: 1;
    width: 100%;
}



/* Timeline Container */
.timeline {
    position: relative;
    width: 100%;
    margin: 40px 0 0;
    padding-top: 40px;
}

/* Central Vertical Line */
.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, #f3e9d9, #f3e9d9 80%, transparent);    
    transform: translateX(-50%);
}

/* Top node */
.top-node {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-96%);
    z-index: 10;
}

/* Timeline Entry Container - now flows for dynamic stacking */
.timeline-entry {
    position: relative;
    width: 100%;
    margin-bottom: 60px; /* Space between entries */
    min-height: 20px;
    margin-top: 2px;
}

/* Timeline Node (ring) - positioned relative to entry */
.timeline-entry .timeline-node {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    z-index: 10;
}

.node-ring {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid #f3e9d9; /* off-white ring */
    background-color: #260107; /* maroon fill to hide line underneath */
    box-sizing: border-box;
}

/* Top node ring (no content) */
.node-ring-top {
    width: 9px;
    height: 9px;
}

/* Branch Lines */
.branch-line {
    position: absolute;
    top: 8.5px; /* center vertically with node */
    width: 60px;
    height: 3px;
    background-color: #f3e9d9; /* off-white */
}

.branch-left {
    right: 50%;
    margin-right: 9px; /* connect to edge of node */
}

.branch-right {
    left: 50%;
    margin-left: 9px; /* connect to edge of node */
}



/* Media query for smaller screens - shift timeline to left */

@media (max-width: 1540px) {
    /* Move timeline line to left side */
    .timeline-line {
        /* left: 20px; */
        left: 0px;
        transform: none;
    }

    /* Move top node to left */
    .top-node {
        /* left: 21.5px; */
        left: 1.5px;
    }

    /* Move all entry nodes to left */
    .timeline-entry .timeline-node {
        /* left: 21.5px; */
        left: 1.5px;
        transform: translateX(-50%);
    }

    /* All branches go to the right */
    .branch-line {
        /* left: 20px; */
        left: 0px;
        margin-left: 9px;
        right: auto;
        margin-right: 0;
    }

    .branch-left {
        /* left: 20px; */
        left: 0px;
        margin-left: 9px;
        right: auto;
        margin-right: 0;
    }

    .branch-right {
        /* left: 20px; */
        left: 0px;
        margin-left: 9px;
    }
}



/* Timeline Cards */
.timeline-card {
    position: relative;
    width: 700px;
    background-color: rgb(251, 240, 223);
    border: 4px solid rgb(243, 233, 217);
    padding: 15px;
    box-sizing: border-box;
    border-radius: 4px;
    margin-top: -20px; /* Offset to align with node */
}

.card-left {
    margin-right: calc(50% + 69px); /* Push to left side */
    margin-left: 0;
    right: 469px;
}

.card-right {
    margin-left: calc(50% + 69px); /* Push to right side */
    margin-right: 0;
}

.card-date {
    font-size: 12pt;
    color: #57000e;
    font-weight: bold;
    margin-bottom: 5px;
}

.card-title {
    font-size: 14pt;
    color: #000000;
    margin: 5px 0;
    font-weight: bold;
}

.card-description {
    font-size: 12pt;
    color: #000000;
    line-height: 1.4;
    margin: 8px 0 12px 0;
}

/* Media Row Container */
.card-media-row {
    display: flex;
    flex-wrap: wrap;
}

/* Card Images - in horizontal row */
.card-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 1px solid rgb(243, 233, 217);
    border-radius: 3px;
}

/* Card Embedded Media - in horizontal row */
.card-embed {
    flex: 1;
    margin: 10px 0;
}

.card-embed iframe {
    width: 95%;
    height: 200px;
    border-radius: 3px;
}

/* Media query for smaller screens - all cards to right side */

@media (max-width: 1540px) {
    .timeline-card {
        left: -20px;
        width: 510px;
    }

    /* Move all cards to right side */
    .card-left {
        margin-left: calc(20px + 69px);
        margin-right: auto;
        right: 0;
    }

    .card-right {
        margin-left: calc(20px + 69px);
    }
}



/* Responsive card adjustments for mobile */
@media (max-width: 640px) {
    .timeline-card {
        width: 320px;
    }

    .card-left {
        margin-left: 49px; /* Adjust for shorter branch */
        right: 0;
    }

    .card-right {
        margin-left: 49px;
    }

    .card-media-row {
        flex-direction: column;
    }

    .card-image {
        width: 100%;
        height: auto;
    }

    .card-embed {
        min-width: 100%;
    }

    .card-embed iframe {
        width: 100%;
        height: 150px;
    }
}



/* --------------------------------------------*/



footer {
    width: 100%;
    margin: 12px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    font-size: 11pt;
    color: #A57476;
}

/* Responsive adjustments */
@media (max-width: 500px) {
    .branch-line {
        width: 40px;
    }
}