/**
 * Interactive Timeline Styles
 * An elegant, animated timeline showing key milestones in Freya's development
 */

.timeline-container {
    position: relative;
    width: 100%;
    margin: 3rem 0;
    padding: 2rem 0;
    overflow: hidden;
}

/* The actual timeline (the vertical ruler) */
.timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* The actual timeline (the vertical ruler) */
.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background: linear-gradient(to bottom, rgba(107, 99, 255, 0.2), rgba(147, 112, 219, 0.8), rgba(107, 99, 255, 0.2));
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px;
    box-shadow: 0 0 10px rgba(107, 99, 255, 0.4);
    border-radius: 2px;
}

/* Container around content */
.timeline-item {
    position: relative;
    background-color: inherit;
    width: 40%; /* Reduced from 50% */
    margin: 2rem 0; /* Reduced from 3rem */
    perspective: 1000px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    box-sizing: border-box; /* Ensure padding doesn't increase size */
    max-width: 40%; /* Prevent oversizing */
    min-width: 300px; /* Minimum width for proper display */
    flex-basis: 40%; /* For more consistent sizing */
}

/* Animate timeline items when in viewport */
.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Place the container to the left */
.timeline-left {
    left: 0;
    padding-right: 40px;
}

/* Place the container to the right */
.timeline-right {
    left: 50%;
    padding-left: 40px;
}

/* Add arrows to the left container (pointing right) */
.timeline-left::before {
    content: " ";
    position: absolute;
    width: 0;
    height: 0;
    top: 22px;
    right: 30px;
    z-index: 1;
    border: medium solid transparent;
    border-right: 0;
    border-left: 10px solid rgba(107, 99, 255, 0.8);
}

/* Add arrows to the right container (pointing left) */
.timeline-right::before {
    content: " ";
    position: absolute;
    width: 0;
    height: 0;
    top: 22px;
    left: 30px;
    z-index: 1;
    border: medium solid transparent;
    border-left: 0;
    border-right: 10px solid rgba(107, 99, 255, 0.8);
}

/* The actual content */
.timeline-content {
    position: relative;
    padding: 1rem; /* Reduced from 1.5rem */
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(107, 99, 255, 0.25);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    transform: rotateY(0deg);
    backface-visibility: hidden;
    box-sizing: border-box; /* Ensure padding doesn't increase size */
    width: 100%; /* Enforce consistent width */
    overflow: hidden; /* Prevent content overflow */
}

.timeline-content:hover {
    box-shadow: 0 0 15px rgba(107, 99, 255, 0.5);
    border-color: rgba(107, 99, 255, 0.5);
    /* Remove translateY transform that causes size perception change */
}

/* Custom animation for milestone cards - adding animation-fill-mode to prevent flashing */
.timeline-item:nth-child(odd) .timeline-content {
    animation: fadeInLeft 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation-fill-mode: both;
}

.timeline-item:nth-child(even) .timeline-content {
    animation: fadeInRight 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation-fill-mode: both;
}

/* Timeline milestone marker */
.timeline-marker {
    position: absolute;
    background: linear-gradient(45deg, #6B63FF, #9370DB);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    top: 20px;
    z-index: 2;
    box-shadow: 0 0 10px rgba(147, 112, 219, 0.8);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-left .timeline-marker {
    right: -10px;
}

.timeline-right .timeline-marker {
    left: -10px;
}

.timeline-item:hover .timeline-marker {
    transform: scale(1.5);
    box-shadow: 0 0 20px rgba(147, 112, 219, 1);
}

/* Timeline content styling */
.timeline-date {
    color: #9370DB;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    font-family: 'Cinzel', serif;
    letter-spacing: 1px;
    text-transform: none;
}

.timeline-title {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    font-family: 'Cinzel Decorative', serif;
    background: linear-gradient(45deg, #ffffff, #e0e0e0);
    -webkit-background-clip: text;
    background-clip: text;
    text-transform: uppercase;
}

.timeline-description {
    color: #d0d0d0;
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    text-transform: none;
}

.timeline-image {
    width: 100%;
    max-height: 150px; /* Reduced from 200px */
    border-radius: 5px;
    object-fit: cover;
    margin-top: 0.75rem; /* Reduced from 1rem */
    border: 1px solid rgba(107, 99, 255, 0.15);
    transition: all 0.3s ease;
}

.timeline-image:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Animation keyframes */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
        max-width: 40%; /* Maintain consistent width during animation */
    }
    to {
        opacity: 1;
        transform: translateX(0);
        max-width: 40%; /* Maintain consistent width during animation */
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
        max-width: 40%; /* Maintain consistent width during animation */
    }
    to {
        opacity: 1;
        transform: translateX(0);
        max-width: 40%; /* Maintain consistent width during animation */
    }
}

/* Responsive adjustments */
@media screen and (max-width: 992px) {
    .timeline {
        padding: 0 1.5rem;
    }
    
    .timeline-content {
        padding: 1.25rem;
    }
}

@media screen and (max-width: 768px) {
    /* Timeline becomes vertical on smaller screens */
    .timeline::after {
        left: 31px;
    }
    
    /* Full width containers */
    .timeline-item {
        width: 100%;
        max-width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }
    
    /* Make both containers behave like the right container */
    .timeline-right, .timeline-left {
        left: 0;
        padding-left: 70px;
        padding-right: 25px;
    }
    
    /* Make all arrows point leftwards */
    .timeline-right::before, .timeline-left::before {
        left: 60px;
        border: medium solid transparent;
        border-left: 0;
        border-right: 10px solid rgba(107, 99, 255, 0.8);
    }

    /* Place all markers at left */
    .timeline-right .timeline-marker, .timeline-left .timeline-marker {
        left: 15px;
    }
    
    .timeline-title {
        font-size: 1.2rem;
    }
}
