.timeline-wrapper {
    position: relative;
    width: 100%;
    overflow: visible;
    padding: 150px 75px;
    margin: 20px 0;
    background: transparent; /* Ensure transparent background */
}

.timeline-container {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 100%;
    padding: 0 120px;
    transition: transform 0.3s ease;
}

/* Add transparent fade zones for content exiting the screen */
.timeline-wrapper::before,
.timeline-wrapper::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 120px;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Left fade zone - fade to transparent */
.timeline-wrapper::before {
    left: 0;
    background: linear-gradient(
        to right,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.4) 40%,
        rgba(0, 0, 0, 0.1) 70%,
        transparent 100%
    );
    -webkit-mask: linear-gradient(to right, black 0%, transparent 100%);
    mask: linear-gradient(to right, black 0%, transparent 100%);
}

/* Right fade zone - fade to transparent */
.timeline-wrapper::after {
    right: 0;
    background: linear-gradient(
        to left,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.4) 40%,
        rgba(0, 0, 0, 0.1) 70%,
        transparent 100%
    );
    -webkit-mask: linear-gradient(to left, black 0%, transparent 100%);
    mask: linear-gradient(to left, black 0%, transparent 100%);
}

/* Better approach: Use CSS mask on the container itself */
.timeline-wrapper.has-navigation .timeline-container {
    -webkit-mask: linear-gradient(
        to right,
        transparent 0px,
        black 120px,
        black calc(100% - 120px),
        transparent 100%
    );
    mask: linear-gradient(
        to right,
        transparent 0px,
        black 120px,
        black calc(100% - 120px),
        transparent 100%
    );
}

/* Remove the continuous line */
.timeline-line {
    display: none;
}

/* Base line styling - will be adjusted per combination */
.timeline-item:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    height: 9px;
    background: currentColor; /* Use current text color instead of white */
    transform: translateY(-50%);
    z-index: 1;
}

/* Major to Major connection */
.timeline-item.major:not(:last-child)::after {
    right: -80%;
    width: 100%;
}

/* Major to Minor connection */
.timeline-item.major:not(:last-child):has(+ .timeline-item.minor)::after {
    right: -80%;
    width: 100%;
}

/* Minor to Major connection */
.timeline-item.minor:not(:last-child):has(+ .timeline-item.major)::after {
    right: -80%;
    width: 100%;
}

/* Minor to Minor connection */
.timeline-item.minor:not(:last-child)::after {
    right: -80%;
    width: 100%;
}

/* Fallback for browsers that don't support :has() */
@supports not selector(:has(*)) {
    .timeline-item:not(:last-child)::after {
        right: -80%;
        width: 100%;
    }
}

.timeline-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 225px;
    z-index: 2;
    color: inherit; /* Inherit color from parent */
}

/* Adjust item spacing for the segmented lines */
.timeline-item:not(:last-child) {
    margin-right: 150px;
}

/* Major event styling */
.timeline-item.major .timeline-dot {
    width: 86px;
    height: 86px;
    border: 10px solid currentColor;
    background: transparent;
    border-radius: 50%;
    position: relative;
    z-index: 3;
}

.timeline-item.major .timeline-content {
    position: absolute;
    top: -36px;
    left: 154px;
    transform: rotate(-45deg);
    transform-origin: left;
    white-space: normal;
    color: inherit;
    text-align: left;
    min-width: 160px;
    line-height: 1.2;
}

.timeline-item .timeline-date {
    font-weight: bolder;
}

/* Minor event styling */
.timeline-item.minor .timeline-dot {
    width: 42px;
    height: 42px;
    background: currentColor;
    border-radius: 50%;
    position: relative;
    z-index: 3;
}

.timeline-item.minor .timeline-content {
    position: absolute;
    top: 120px;
    left: -15px;
    transform: rotate(-45deg);
    transform-origin: left top;
    white-space: normal;
    color: inherit;
    text-align: left;
    min-width: 160px;
    line-height: 1.2;
}

.timeline-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
    word-wrap: break-word;
    hyphens: auto;
}

.timeline-theme-cnc .timeline-booth {
  color: #C42430
}

.timeline-theme-hydro .timeline-booth {
  color: #1D9E4F
}

.timeline-date {
    font-size: 14px;
    font-weight: 700;
    opacity: 0.8;
}

/* Navigation buttons - with transparent background and border */
.timeline-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9); /* Semi-transparent white */
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 75px;
    height: 75px;
    cursor: pointer;
    z-index: 6;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    font-weight: lighter;
    color: #333;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px); /* Add blur effect */
    -webkit-backdrop-filter: blur(10px);
}

.timeline-nav.show {
    display: flex;
}

.timeline-nav:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.timeline-nav:disabled {
    opacity: 0.05;
    cursor: not-allowed;
}

.timeline-nav.prev {
    left: 15px;
}

.timeline-nav.next {
    right: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .timeline-item:not(:last-child) {
        margin-right: 40px;
    }

    /* Adjust fade zones for mobile */
    .timeline-wrapper.has-navigation .timeline-container {
        -webkit-mask: linear-gradient(
            to right,
            transparent 0px,
            black 90px,
            black calc(100% - 90px),
            transparent 100%
        );
        mask: linear-gradient(
            to right,
            transparent 0px,
            black 90px,
            black calc(100% - 90px),
            transparent 100%
        );
    }

    .timeline-item.major:not(:last-child)::after {
        right: -50px;
        width: 100px;
        height: 6px;
    }

    .timeline-item.major:not(:last-child):has(+ .timeline-item.minor)::after {
        right: -50%;
        width: 80%;
    }

    .timeline-item.minor:not(:last-child):has(+ .timeline-item.major)::after {
        right: -40%;
        width: 70%;
        height: 6px;
    }

    .timeline-item.minor:not(:last-child)::after {
        right: -36.5px;
        width: 67px;
        height: 6px;
    }

    @supports not selector(:has(*)) {
        .timeline-item:not(:last-child)::after {
            right: -45px;
            width: 90px;
            height: 6px;
        }
    }

    .timeline-item.major .timeline-dot {
        width: 60px;
        height: 60px;
        border: 4px solid currentColor;
    }

    .timeline-item.minor .timeline-dot {
        width: 33px;
        height: 33px;
    }

    .timeline-item.major .timeline-content {
        max-width: 150px;
        top: -70px;
        left: 15px;
        left: initial;
        transform: none;
        text-align: center;
    }

    .timeline-item.minor .timeline-content {
        max-width: 140px;
        top: 50px;
        left: initial;
        transform: none;
        text-align: center;
    }

    .timeline-title {
        font-size: 14px;
    }

    .timeline-date {
        font-size: 12px;
    }

    .timeline-nav {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .timeline-container {
        padding: 0 10px;
    }
}
