/* ========================================
   RIDER TIMELINE
   ======================================== */

.xio-rider-achievements:not(:has(.xio-rider-timeline)) {
    display: none !important;
}

.xio-rider-timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

/* ----------------------------------------
   CENTRAL LINE (drawn per item segment)
   ---------------------------------------- */

/* ----------------------------------------
   YEAR HEADER
   ---------------------------------------- */

.xio-rider-timeline__year {
    position: relative;
    z-index: 2;
    width: 100%;
    text-align: center;
    margin: 3rem 0 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.xio-rider-timeline__year:first-child {
    margin-top: 0;
}

.xio-rider-timeline__year.xio-rider-timeline--visible {
    opacity: 1;
    transform: translateY(0);
}

.xio-rider-timeline__year-title {
    display: inline-block;
    font-family: var(--font-primary, 'Bebas Neue', sans-serif);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 400;
    color: #ffffff;
    margin: 0;
    letter-spacing: 0.05em;
}

/* ----------------------------------------
   TIMELINE ITEM
   ---------------------------------------- */

.xio-rider-timeline__item {
    position: relative;
    display: flex;
    width: 100%;
    margin: 1.5rem 0;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.xio-rider-timeline__item:nth-child(odd) {
    justify-content: flex-end;
    padding-right: calc(50% + 40px);
    transform: translateX(-50px);
}

.xio-rider-timeline__item:nth-child(even) {
    justify-content: flex-start;
    padding-left: calc(50% + 40px);
    transform: translateX(50px);
}

.xio-rider-timeline__item.xio-rider-timeline--visible {
    opacity: 1;
    transform: translateX(0);
}

/* ----------------------------------------
   ITEMS GROUP (contains items per year)
   ---------------------------------------- */

.xio-rider-timeline__group {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ----------------------------------------
   VERTICAL LINE (continuous within group)
   ---------------------------------------- */

.xio-rider-timeline__line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%);
    z-index: 1;
}

/* ----------------------------------------
   CONNECTION DOT
   ---------------------------------------- */

.xio-rider-timeline__item::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 3;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s;
}

.xio-rider-timeline__item.xio-rider-timeline--visible::before {
    transform: translate(-50%, -50%) scale(1);
}

/* ----------------------------------------
   CONNECTION LINE (HORIZONTAL)
   ---------------------------------------- */

.xio-rider-timeline__item::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}

.xio-rider-timeline__item.xio-rider-timeline--visible::after {
    width: 40px;
}

.xio-rider-timeline__item:nth-child(odd)::after {
    right: calc(50% + 6px);
    left: auto;
}

.xio-rider-timeline__item:nth-child(even)::after {
    left: calc(50% + 6px);
    right: auto;
}

/* ----------------------------------------
   CARD
   ---------------------------------------- */

.xio-rider-timeline__card {
    position: relative;
    max-width: 400px;
    padding: 1.25rem 1.5rem;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 8px;
    border: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.4s ease,
                background 0.3s ease;
}

.xio-rider-timeline__card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: none;
    background: transparent;
}

.xio-rider-timeline__item:nth-child(odd) .xio-rider-timeline__card {
    text-align: right;
}

.xio-rider-timeline__item:nth-child(even) .xio-rider-timeline__card {
    text-align: left;
}

/* ----------------------------------------
   DATE
   ---------------------------------------- */

.xio-rider-timeline__date {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

/* ----------------------------------------
   RACE LINK & NAME
   ---------------------------------------- */

.xio-rider-timeline__race-link {
    text-decoration: none;
    display: block;
}

.xio-rider-timeline__race-name {
    font-family: var(--font-secondary, 'Inter', sans-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.xio-rider-timeline__race-link:hover .xio-rider-timeline__race-name {
    color: rgba(255, 255, 255, 0.8);
}

/* ----------------------------------------
   DETAILS ROW
   ---------------------------------------- */

.xio-rider-timeline__details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.xio-rider-timeline__item:nth-child(odd) .xio-rider-timeline__details {
    justify-content: flex-end;
}

.xio-rider-timeline__item:nth-child(even) .xio-rider-timeline__details {
    justify-content: flex-start;
}

.xio-rider-timeline__flag {
    font-size: 1.1rem;
    line-height: 1;
}

.xio-rider-timeline__route {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
}

.xio-rider-timeline__separator {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
}

/* ----------------------------------------
   RACE TYPE BADGE
   ---------------------------------------- */

.xio-rider-timeline__type {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ----------------------------------------
   POSITION
   ---------------------------------------- */

.xio-rider-timeline__position {
    font-family: var(--font-primary, 'Bebas Neue', sans-serif);
    font-size: 1.2rem;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: 0.02em;
}

.xio-rider-timeline__position--podium {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .xio-rider-timeline {
        padding: 2rem 1rem;
    }
    
    .xio-rider-timeline__line {
        left: 20px;
        transform: none;
    }
    
    .xio-rider-timeline__item {
        padding-left: 50px !important;
        padding-right: 0 !important;
        justify-content: flex-start !important;
        transform: translateX(30px);
    }
    
    .xio-rider-timeline__item:nth-child(odd),
    .xio-rider-timeline__item:nth-child(even) {
        transform: translateX(30px);
    }
    
    .xio-rider-timeline__item.xio-rider-timeline--visible {
        transform: translateX(0);
    }
    
    .xio-rider-timeline__item::before {
        left: 20px;
    }
    
    .xio-rider-timeline__item::after {
        left: 26px !important;
        right: auto !important;
    }
    
    .xio-rider-timeline__item.xio-rider-timeline--visible::after {
        width: 24px;
    }
    
    .xio-rider-timeline__card {
        max-width: 100%;
        text-align: left !important;
    }
    
    .xio-rider-timeline__item:nth-child(odd) .xio-rider-timeline__details,
    .xio-rider-timeline__item:nth-child(even) .xio-rider-timeline__details {
        justify-content: flex-start;
    }
    
    .xio-rider-timeline__year-title {
        font-size: clamp(3.5rem, 14vw, 5rem);
    }
    
    .xio-rider-timeline__year {
        text-align: left;
        padding-left: 50px;
        transform: translateX(30px);
    }
    
    .xio-rider-timeline__year.xio-rider-timeline--visible {
        transform: translateX(0);
    }
    
    .xio-rider-timeline__details {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .xio-rider-timeline__separator {
        display: none;
    }
    
    .xio-rider-timeline__race-name {
        font-size: 1.1rem;
    }
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .xio-rider-timeline__year,
    .xio-rider-timeline__item,
    .xio-rider-timeline__item::before,
    .xio-rider-timeline__item::after,
    .xio-rider-timeline__card {
        transition: none;
    }
    
    .xio-rider-timeline__year,
    .xio-rider-timeline__item {
        opacity: 1;
        transform: none;
    }
    
    .xio-rider-timeline__item::before {
        transform: translate(-50%, -50%) scale(1);
    }
    
    .xio-rider-timeline__item::after {
        width: 40px;
    }
}
