/* Base styles */
body {
    font-family: Arial, sans-serif;
    background-color: #111;
    color: #fff;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Infinite scrolling background effect */
.space-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/space-background.jpg');
    background-size: cover;
    background-position: center top;
    animation: scroll-bg 600s linear infinite;
    z-index: -2;
}

/* Gradient overlay for seamless looping */
.space-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(17, 17, 17, 0.7) 0%,
        transparent 15%,
        transparent 85%,
        rgba(17, 17, 17, 0.7) 100%
    );
    z-index: -1;
    pointer-events: none;
}

@keyframes scroll-bg {
    from { background-position-y: 0; }
    to { background-position-y: -10000px; }
}

/* Header and Navigation Styles */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease-in-out;
}

.site-logo {
    width: 250px;
    height: auto;
    margin: 15px 0 5px;
}

.main-nav {
    width: 100%;
    text-align: center;
}

.nav-list {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-size: 1.2em;
    font-weight: bold;
    padding: 10px 15px;
    transition: color 0.3s ease;
    white-space: nowrap;
    position: relative;
    cursor: pointer;
}

.nav-link:hover {
    color: #003B46;
}

.nav-item:not(:first-child) .nav-link:before {
    content: '|';
    color: #fff;
    font-size: 1.5em;
    margin-right: 15px;
    line-height: 1;
}

/* Dropdown Menu Styles */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    z-index: 1;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid #003B46;
}

.dropdown-content a {
    color: #fff;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background-color: rgba(0, 59, 70, 0.2);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Burger Menu Icon Styles */
.burger-menu {
    display: none;
    flex-direction: column;
    cursor: pointer;
    margin-right: 20px;
}

.burger-menu .line {
    width: 30px;
    height: 3px;
    background-color: #fff;
    margin: 4px 0;
    transition: 0.4s;
}

/* Main Content Styles (for doctor selection page) */
.main-content {
    padding-top: 200px;
}
.doctor-selection-container {
    text-align: center;
}
.doctor-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

/* Doctor item is now a link */
.doctor-item {
    position: relative;
    width: 250px;
    height: 470px;
    cursor: pointer;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.5s ease;
    text-decoration: none;
    color: #fff;
}

/* Reset base transformation to stand straight */
.image-container {
    position: relative;
    width: 250px;
    height: 400px;
}
.tardis-image, .doctor-image {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform-origin: bottom center;
    transition: opacity 0.7s ease, transform 0.7s ease;
    pointer-events: none;
    transform: translateX(-50%);
}

.tardis-image {
    width: 200px;
    z-index: 1;
}

.doctor-image {
    width: 150px;
    height: 320px;
    object-fit: contain;
    z-index: 2;
}

/* Hover effect: Apply the tilt and lift only on hover */
.doctor-item:hover .tardis-image {
    transform: translateX(-50%) rotate(3deg) translateY(-15px);
}

.doctor-item:nth-child(even):hover .tardis-image {
    transform: translateX(-50%) rotate(-3deg) translateY(-15px);
}

.doctor-name {
    margin-top: auto;
    width: 100%;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    z-index: 3;
    pointer-events: none;
}

/* Timeline specific styles */
.transparent-background {
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 20px;
    min-height: 100vh;
    padding-top: 100px;
}

/* New: 3-column layout for tablets and desktops */
@media (min-width: 769px) {
    .timeline-layout {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        max-width: 1200px; /* Adjust max width as needed */
        margin: 0 auto;
        padding-top: 100px;
    }
    
    .timeline-left-column,
    .timeline-right-column {
        width: 25%;
        padding: 20px;
        position: sticky; /* Keep content visible as user scrolls */
        top: 120px; /* Adjust based on header height */
        align-self: flex-start;
        text-align: center;
        margin-top: 20px;
        display: block !important; /* Explicitly show on desktop */
    }

    .timeline-middle-column {
        width: 50%;
    }
}

/* Removed these image display containers as images are now placed directly in story-details */
/* .image-display-container {
    padding: 10px;
    min-height: 300px;
} */

.timeline-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
}

/* New: Styling for the main story image to control its size */
.main-story-image-container {
    padding: 10px;
    margin-bottom: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    /* Removed text-align: center; as it affects other elements too */
    overflow: hidden; /* Hide overflowing parts if image is too large */
}

.main-story-card-image {
    max-height: 175px; /* Set a maximum height, adjust as needed */
    width: auto; /* Allow width to adjust proportionally */
    display: block;
    margin: 0; /* Changed from 0 auto to 0 for left alignment */
    object-fit: contain; /* Ensure the entire image is visible, scale down if needed */
}


.timeline-item {
    position: relative;
    padding: 20px;
    margin-bottom: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-left: 5px solid #003B46;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.timeline-header h3 {
    margin: 0;
    flex-grow: 1;
}

.story-details {
    display: none;
    padding-top: 10px;
}

.story-details.show {
    display: block;
}

.dropdown-arrow {
    font-size: 2em;
    transition: transform 0.3s ease;
}

.dropdown-arrow.rotate {
    transform: rotate(180deg);
}

.story-details p {
    margin: 5px 0;
}

.story-id {
    font-weight: bold;
    margin-right: 15px;
    font-size: 0.9em;
    color: #003B46;
}

/* Footer */
footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .doctor-grid {
        flex-direction: column;
        align-items: center;
    }
    .main-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
    }

    .site-logo {
        margin: 0;
        width: 150px;
    }

    .main-nav {
        display: none;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: rgba(0, 0, 0, 0.9);
        box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    }

    .main-nav.menu-open {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        width: 100%;
        padding: 15px 20px;
    }

    .nav-item:not(:first-child) .nav-link:before {
        display: none;
    }

    .dropdown-content {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
    }

    .burger-menu {
        display: flex;
    }
    
    /* HIDE THE SIDE COLUMNS ON MOBILE */
    .timeline-left-column,
    .timeline-right-column {
        display: none !important; /* Use !important to force the rule on mobile */
    }
}
