body {
    font-family: sans-serif;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.6;
    background-color: black;
}

.main-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #f0f0f0;
    padding: 10px 0;
    text-align: center;
    z-index: 1000;
    border-bottom: 1px solid #ddd;
}

.main-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-menu li {
    display: inline-block;
    margin: 0 15px;
}

.main-menu a {
    text-decoration: none;
    color: #888;
    font-weight: bold;
    transition: color 0.3s ease;
}

.main-menu a.active {
    color: #333;
}

.slide {
    min-height: 100vh;
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start; /* Important for sticky */
    padding: 100px 50px;
    scroll-margin-top: 0;
    box-sizing: border-box;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* Prevents background zoom on long text */
    position: relative;
    color: #fff;
}

/* Fix for mobile background-attachment */
@media (max-width: 1024px) {
    .slide {
        background-attachment: scroll;
    }
}

.slide:nth-child(odd) {
    flex-direction: row-reverse;
}

.content {
    flex: 1;
    padding: 40px;
    background: rgba(0, 0, 0, 0.7); /* Professional semi-opaque box for readability */
    border-radius: 15px;
    margin: 20px;
    z-index: 2;
}

.content h2 {
    font-size: 2.5rem;
    margin-bottom: 25px;
}

.content p {
    margin-bottom: 20px;
    max-width: 75ch;
}

/* Initial state for text elements that will animate */
.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6,
.content p {
    opacity: 0;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.content h1.slide-in-left,
.content h2.slide-in-left,
.content h3.slide-in-left,
.content h4.slide-in-left,
.content h5.slide-in-left,
.content h6.slide-in-left,
.content p.slide-in-left {
    transform: translateX(-100px);
}

.content h1.slide-in-right,
.content h2.slide-in-right,
.content h3.slide-in-right,
.content h4.slide-in-right,
.content h5.slide-in-right,
.content h6.slide-in-right,
.content p.slide-in-right {
    transform: translateX(100px);
}

/* Final state when visible */
.content h1.is-visible,
.content h2.is-visible,
.content h3.is-visible,
.content h4.is-visible,
.content h5.is-visible,
.content h6.is-visible,
.content p.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.image-carousel {
    flex: 0 0 45%;
    height: 75vh;
    position: sticky;
    top: 120px;
    overflow: hidden;
    background-color: transparent;
    margin: 20px;
    border-radius: 15px;
    z-index: 2;
}

.carousel-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Container for each 'turn' in the carousel */
.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 1s ease-in-out, transform 1s ease-in-out;
    transform: translateX(100%);
}

.carousel-slide.active {
    opacity: 1;
    transform: translateX(0);
}

.carousel-slide.exiting {
    opacity: 0;
    transform: translateX(-100%);
}

.carousel-image {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    flex-shrink: 1;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}

/* Specific scaling for multiple images in a slide */
.carousel-slide[style*="--image-count: 2"] .carousel-image { max-height: 48%; }
.carousel-slide[style*="--image-count: 3"] .carousel-image { max-height: 31%; }

/* Background carousel specific styles for the first page */
.slide#bio-tangible {
    align-items: center;
    padding: 0;
    background-attachment: scroll;
}

.slide#bio-tangible .image-carousel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    flex: none;
    z-index: 1;
    background-color: #000;
}

.slide#bio-tangible .content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.title-overlay h2 {
    font-size: 4rem;
    margin-bottom: 30px;
}

.title-overlay p {
    max-width: 80ch;
    margin-left: auto;
    margin-right: auto;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .slide {
        flex-direction: column !important;
        padding: 80px 15px 40px;
        align-items: center;
        min-height: auto;
    }
    
    .image-carousel {
        position: relative;
        top: 0;
        width: 100%;
        height: 40vh;
        flex: none;
        margin: 0 0 20px 0;
    }
    
    .content {
        width: 100%;
        margin: 0;
        padding: 25px;
    }

    .title-overlay h2 {
        font-size: 2.2rem;
    }
    
    .content h2 {
        font-size: 1.8rem;
    }
}
