/* Timeline Header */
.timeline-header {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.biography-timeline {
    position: relative;
    padding: 50px 0;
    width: 100%;
}

/* Vertical line */
.biography-timeline .timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--bs-border-color);
    transform: translateX(-50%);
    overflow: hidden;
    border-radius: 2px;
}

.biography-timeline .timeline-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: var(--primary-color);
    transition: height 0.25s ease-out;
}

.biography-timeline .timeline-items {
    display: flex;
    flex-direction: column;
}

.biography-timeline .timeline-item {
    position: relative;
    width: 50%;
    padding: 20px;
}

/* Left side */
.biography-timeline .timeline-item.left {
    left: 0;
    text-align: right;
}

/* Right side */
.biography-timeline .timeline-item.right {
    left: 50%;
    text-align: left;
}

/* Dot on the line */
.biography-timeline .timeline-dot {
    position: absolute;
    top: 20px;
    width: 18px;
    height: 18px;
    background: var(--backdrop-background, #fff);
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    z-index: 2;
}

body.dark-mode .biography-timeline .timeline-dot {
    background-color: var(--backdrop-background, #fff);
}

.biography-timeline .timeline-item.left .timeline-dot {
    right: -9px;
}

.biography-timeline .timeline-item.right .timeline-dot {
    left: -9px;
}

/* Content box */
.biography-timeline .timeline-content {
    background: var(--backdrop-background, #fff);
    backdrop-filter: blur(7px) saturate(180%);
    /* Keep blur effect */
    padding: 15px 20px;
    border-radius: var(--b-radius, 8px);
    display: inline-block;
    max-width: 90%;
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.biography-timeline .timeline-content:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}


body.dark-mode .biography-timeline .timeline-content {
    background-color: rgba(27, 27, 27, 0.8);
    backdrop-filter: blur(5px) saturate(180%);
}

.biography-timeline .timeline-year {
    /* font-weight: bold; Removed */
    color: var(--primary-color);
    /* Use theme primary color */
    display: block;
    margin-bottom: 5px;
    z-index: 1;
    position: relative;
}

.biography-timeline .timeline-title {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    z-index: 1;
    position: relative;
}

.biography-timeline .timeline-description {
    margin: 5px 0 0;
    font-size: 14px;
    z-index: 1;
    position: relative;
}

/* Image Hover Effect */
.biography-timeline .timeline-content {
    /* existing styles */
    overflow: hidden;
    /* Ensure image doesn't break out */
    position: relative;
    /* For positioning child elements */
    z-index: 1;
    /* Ensure content is above the image/overlay */
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
    /* Add background-color transition */
}

.post-type-archive .biography-timeline .timeline-content::before {
    /* This will be the new overlay */
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    /* Darker overlay for better contrast */
    opacity: 0;
    /* Hidden by default */
    transition: opacity 0.3s ease;
    z-index: 0;
    /* Below the text content */
    border-radius: var(--border-radius, 8px);
    /* Match parent radius */
}

.biography-timeline .timeline-content-image {
    /* Only responsible for the image now */
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    /* HIDDEN BY DEFAULT */
    transition: opacity 0.3s ease, transform 0.3s ease;
    /* Keep transitions */
    transform: scale(1.1);
    /* Zoomed out initially */
    z-index: -1;
    /* Behind the content and overlay */
    border-radius: var(--border-radius, 8px);
    /* Match parent radius */
}

.biography-timeline .timeline-content:hover .timeline-content-image {
    opacity: 1;
    /* Image becomes fully visible (behind overlay) */
    transform: scale(1);
    /* Zoom in to normal size */
}

.biography-timeline .timeline-content:hover::before {
    /* Overlay appears on hover */
    opacity: 1;
}

/* Adjust text color on hover for readability against the image and overlay */
.post-type-archive .biography-timeline .timeline-content:hover .timeline-year,
.post-type-archive .biography-timeline .timeline-content:hover .timeline-title,
.post-type-archive .biography-timeline .timeline-content:hover .timeline-description,
.post-type-archive .biography-timeline .timeline-content:hover .timeline-title a {
    color: #fff;
    /* White text on dark overlay */
    transition: color 0.3s ease;
    /* Smooth text color transition */
}

/* Responsive */
@media(max-width: 768px) {
    .biography-timeline .timeline-item {
        width: 100%;
        text-align: left !important;
        left: 0 !important;
        padding-left: 40px;
    }

    .biography-timeline .timeline-dot {
        left: 12px !important;
        right: auto !important;
    }

    .biography-timeline .timeline-line {
        left: 20px;
        transform: none;
    }
}