/* Premium Vertical Timeline for Experience Section */

/* Structure and Spacing */
#work .work_exp4,
#work .work_exp1 {
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 3rem;
}

/* Remove bottom margin from the last item */
#work .work_exp1:last-child {
    margin-bottom: 0;
}

/* 1. Animated Timeline Line */
#work .work_exp4::after,
#work .work_exp1::after {
    content: '';
    position: absolute;
    top: 20px; /* Start slightly below the dot */
    left: 5px; /* Center the 2px line (dot is 12px, so 5px + 2px + 5px = 12px) */
    width: 2px;
    height: calc(100% + 3rem - 20px); /* Stretch down to next dot, including margin */
    background: rgba(255, 255, 255, 0.1);
    transform-origin: top;
    transform: scaleY(0);
    transition: background 0.4s ease;
    z-index: 1;
}

/* Hide line after the last experience */
#work .work_exp1:last-child::after {
    display: none;
}

/* Highlight line for the current/first role */
#work h2.major + .work_exp4::after {
    background: linear-gradient(to bottom, rgba(0, 255, 255, 0.5), rgba(255, 255, 255, 0.1));
}

/* 2. Timeline Dots */
#work .work_exp4::before,
#work .work_exp1::before {
    content: '';
    position: absolute;
    top: 6px; /* Align vertically with the h3 icon/text */
    left: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(20, 22, 26, 1); /* Dark base */
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 2;
    transform: scale(0);
}

/* Current company dot highlighted */
#work h2.major + .work_exp4::before {
    border-color: #00FFFF;
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
}

/* 3. Hover Reveals Company Accent */
#work .work_exp4:hover::after,
#work .work_exp1:hover::after {
    background: linear-gradient(to bottom, rgba(0, 255, 255, 0.4), rgba(0, 255, 255, 0.1));
}

#work .work_exp4:hover::before,
#work .work_exp1:hover::before {
    border-color: #00FFFF;
    background: #00FFFF;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
    transform: scale(1.3) !important;
}

/* Subtle content lift on hover for elegance */
#work .work_exp4 > *,
#work .work_exp1 > * {
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#work .work_exp4:hover > *,
#work .work_exp1:hover > * {
    transform: translateX(4px);
}

/* 4. Entrance Animations (Dots pop, Line draws) */
#work.active .work_exp4::after,
#work.active .work_exp1::after {
    animation: drawTimelineLine 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

#work.active .work_exp4::before,
#work.active .work_exp1::before {
    animation: popTimelineDot 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Stagger animations for sequential reveal */
#work.active .work_exp4:nth-of-type(1)::before { animation-delay: 0.3s; }
#work.active .work_exp4:nth-of-type(1)::after { animation-delay: 0.4s; }

#work.active .work_exp4:nth-of-type(2)::before { animation-delay: 0.5s; }
#work.active .work_exp4:nth-of-type(2)::after { animation-delay: 0.6s; }

#work.active .work_exp4:nth-of-type(3)::before { animation-delay: 0.7s; }
#work.active .work_exp4:nth-of-type(3)::after { animation-delay: 0.8s; }

#work.active .work_exp1:nth-of-type(4)::before { animation-delay: 0.9s; }
/* No line after the 4th item */

@keyframes drawTimelineLine {
    to { transform: scaleY(1); }
}

@keyframes popTimelineDot {
    to { transform: scale(1); }
}

/* Ensure they remain visible after animation finishes (respecting premium-animations.js) */
#work.has-revealed .work_exp4::before,
#work.has-revealed .work_exp1::before {
    transform: scale(1);
    animation: none;
}

#work.has-revealed .work_exp4::after,
#work.has-revealed .work_exp1::after {
    transform: scaleY(1);
    animation: none;
}

/* Responsive adjustments */
@media screen and (max-width: 480px) {
    #work .work_exp4,
    #work .work_exp1 {
        padding-left: 1.5rem;
    }
}
