/* TIMELINE */
@keyframes orbFloat {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.55;
    }

    33% {
        transform: translate(3%, -4%) scale(1.08);
        opacity: 0.70;
    }

    66% {
        transform: translate(-3%, 3%) scale(0.94);
        opacity: 0.50;
    }

    100% {
        transform: translate(2%, 2%) scale(1.04);
        opacity: 0.60;
    }
}

@keyframes shimmerSweep {
    0% {
        transform: translateX(-120%) skewX(-12deg);
    }

    100% {
        transform: translateX(220%) skewX(-12deg);
    }
}

@keyframes dotPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.4);
        opacity: 0.6;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-60px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(60px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.timeline {
    padding: clamp(4rem, 12vw, 10rem) 0;
    background: #fef9f7;
    position: relative;
    overflow: hidden;
}

/* Background glows */
.timeline::before,
.timeline::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(clamp(60px, 10vw, 120px));
    z-index: 0;
}

/* Pink orb */
.timeline::before {
    width: clamp(220px, 38vw, 580px);
    height: clamp(220px, 38vw, 580px);
    top: -8%;
    right: -6%;
    background: radial-gradient(circle, rgba(244, 63, 94, 0.10) 0%, rgba(251, 146, 60, 0.06) 50%, transparent 70%);
    animation: orbFloat 22s ease-in-out infinite alternate;
}

/* Violet orb */
.timeline::after {
    width: clamp(180px, 30vw, 460px);
    height: clamp(180px, 30vw, 460px);
    bottom: -6%;
    left: -5%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.08) 0%, rgba(124, 58, 237, 0.05) 45%, transparent 70%);
    animation: orbFloat 28s ease-in-out infinite alternate-reverse;
}

/* Sweep overlay */
.timeline-shimmer {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.timeline-shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.40) 50%, transparent 80%);
    animation: shimmerSweep 12s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: 6s;
}

/* Noise overlay */
.timeline-noise {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 80% 30%, rgba(244, 63, 94, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 20% 70%, rgba(124, 58, 237, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 55% 55%, rgba(245, 158, 11, 0.03) 0%, transparent 45%);
}

.timeline .track {
    position: relative;
    width: 100%;
    padding-block: clamp(2rem, 6vw, 5rem) clamp(3rem, 8vw, 7rem);
    box-sizing: border-box;
    z-index: 1;
}

/* Spine effect */
.timeline .spine {
    position: absolute;
    top: 0;
    left: 50%;
    width: 5px;
    height: 0;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, #7c3aed 0%, #0d9488 50%, #f59e0b 100%);
    border-radius: 99px;
    box-shadow: 0 0 28px rgba(124, 58, 237, 0.22);
    transition: height 0.08s linear;
}

/* Entry item */
.timeline .entry {
    display: grid;
    /* [left-card] [spine-center-gap] [right-card] */
    grid-template-columns: 1fr clamp(56px, 5vw, 80px) 1fr;
    align-items: start;
    position: relative;
    padding-bottom: clamp(3rem, 8vw, 7rem);
}

/* Dot item */
.timeline .dot {
    position: absolute;
    left: 50%;
    top: clamp(2.5rem, 5vw, 4rem);
    transform: translate(-50%, -50%);
    z-index: 10;
    width: clamp(22px, 2.8vw, 38px);
    height: clamp(22px, 2.8vw, 38px);
    border-radius: 50%;
    background: #fff;
    border: 4px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.2, 1, 0.3, 1),
        box-shadow 0.4s ease;
    grid-column: 2;
    grid-row: 1;
}

.timeline .dot.violet {
    border-color: #7c3aed;
    box-shadow: 0 0 0 6px rgba(124, 58, 237, 0.12),
        0 0 0 12px rgba(124, 58, 237, 0.05);
}

.timeline .dot.teal {
    border-color: #0d9488;
    box-shadow: 0 0 0 6px rgba(13, 148, 136, 0.12),
        0 0 0 12px rgba(13, 148, 136, 0.05);
}

.timeline .dot.amber {
    border-color: #f59e0b;
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.12),
        0 0 0 12px rgba(245, 158, 11, 0.05);
}

.timeline .dot span {
    width: 42%;
    height: 42%;
    border-radius: 50%;
    animation: dotPulse 1.8s ease-in-out infinite;
}

.timeline .dot.violet span {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.timeline .dot.teal span {
    background: linear-gradient(135deg, #0d9488, #10b981);
}

.timeline .dot.amber span {
    background: linear-gradient(135deg, #f59e0b, #fb923c);
}

/* Dot grows */
.timeline .card:hover~.dot,
.timeline .entry:hover .dot {
    transform: translate(-50%, -50%) scale(1.25);
}

.timeline .dot.violet:hover,
.timeline .entry:hover .dot.violet {
    box-shadow: 0 0 0 8px rgba(124, 58, 237, 0.18),
        0 0 0 16px rgba(124, 58, 237, 0.07),
        0 0 30px rgba(124, 58, 237, 0.3);
}

.timeline .dot.teal:hover,
.timeline .entry:hover .dot.teal {
    box-shadow: 0 0 0 8px rgba(13, 148, 136, 0.18),
        0 0 0 16px rgba(13, 148, 136, 0.07),
        0 0 30px rgba(13, 148, 136, 0.3);
}

.timeline .dot.amber:hover,
.timeline .entry:hover .dot.amber {
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.18),
        0 0 0 16px rgba(245, 158, 11, 0.07),
        0 0 30px rgba(245, 158, 11, 0.3);
}

/* Connector line */
.timeline .connector {
    position: absolute;
    top: clamp(2.5rem, 5vw, 4rem);
    height: 2px;
    width: 5%;
    z-index: 5;
    border-radius: 99px;
    transform: translateY(-50%);
}

.timeline .connector.left {
    right: 46%;
}

.timeline .connector.right {
    left: 46%;
}

.timeline .connector.violet {
    background: linear-gradient(to left, rgba(124, 58, 237, 0.6), transparent);
}

.timeline .connector.teal {
    background: linear-gradient(to right, rgba(13, 148, 136, 0.6), transparent);
}

.timeline .connector.amber {
    background: linear-gradient(to left, rgba(245, 158, 11, 0.6), transparent);
}

.timeline .connector.right.teal {
    background: linear-gradient(to right, transparent, rgba(13, 148, 136, 0.6));
}

/* Card base */
.timeline .card {
    width: 100%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 28px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: transform 0.5s cubic-bezier(0.2, 1, 0.3, 1),
        box-shadow 0.5s ease,
        border-color 0.4s ease;
}

.timeline .card.left {
    animation: slideInLeft 0.7s cubic-bezier(0.2, 1, 0.3, 1) both;
}

.timeline .card.right {
    animation: slideInRight 0.7s cubic-bezier(0.2, 1, 0.3, 1) both;
}

/* Card header */
.timeline .card .card-head {
    padding: clamp(1.4rem, 3vw, 2.2rem) clamp(1.5rem, 3.5vw, 2.8rem);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.timeline .card.violet .card-head {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 60%, #c084fc 100%);
}

.timeline .card.teal .card-head {
    background: linear-gradient(135deg, #0d9488 0%, #10b981 60%, #34d399 100%);
}

.timeline .card.amber .card-head {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 60%, #fb923c 100%);
}

/* Sweep header */
.timeline .card .card-head::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.timeline .card:hover .card-head::after {
    transform: translateX(100%);
}

/* Head circle */
.timeline .card .card-head::before {
    content: '';
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    top: -40px;
    right: -40px;
    pointer-events: none;
}

.timeline .card .meta {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    position: relative;
    z-index: 1;
}

.timeline .card .chip {
    font-size: clamp(0.65rem, 1vw, 0.76rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    padding: 0.28em 0.9em;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(4px);
}

.timeline .card h3 {
    font-size: clamp(1.4rem, 3.5vw, 2.3rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: #fff;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

/* Card body */
.timeline .card .card-body {
    padding: clamp(1.2rem, 2.5vw, 2rem) clamp(1.5rem, 3.5vw, 2.8rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
}

/* Gradient mesh */
.timeline .card .card-body::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 0;
}

.timeline .card.violet .card-body::before {
    background: radial-gradient(ellipse at 0% 100%, rgba(124, 58, 237, 0.05) 0%, transparent 60%);
}

.timeline .card.teal .card-body::before {
    background: radial-gradient(ellipse at 0% 100%, rgba(13, 148, 136, 0.05) 0%, transparent 60%);
}

.timeline .card.amber .card-body::before {
    background: radial-gradient(ellipse at 0% 100%, rgba(245, 158, 11, 0.05) 0%, transparent 60%);
}

.timeline .card:hover .card-body::before {
    opacity: 1;
}

.timeline .card p {
    font-size: clamp(0.85rem, 1.4vw, 0.97rem);
    color: #64748b;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

/* card tags */
.timeline .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    padding-top: clamp(0.6rem, 1.5vw, 1rem);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 1;
}

.timeline .tags span {
    font-size: clamp(0.65rem, 1vw, 0.78rem);
    font-weight: 700;
    color: #94a3b8;
    font-family: 'Courier New', monospace;
    background: #f8fafc;
    padding: 0.2em 0.65em;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.timeline .card.violet:hover .tags span {
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.20);
    background: rgba(124, 58, 237, 0.06);
}

.timeline .card.teal:hover .tags span {
    color: #0d9488;
    border-color: rgba(13, 148, 136, 0.20);
    background: rgba(13, 148, 136, 0.06);
}

.timeline .card.amber:hover .tags span {
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.20);
    background: rgba(245, 158, 11, 0.06);
}

/* Arrow row */
.timeline .card .card-arrow-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 1, 0.3, 1);
    position: relative;
    z-index: 1;
}

.timeline .card.violet .card-arrow-row {
    color: #7c3aed;
}

.timeline .card.teal .card-arrow-row {
    color: #0d9488;
}

.timeline .card.amber .card-arrow-row {
    color: #f59e0b;
}

.timeline .card:hover .card-arrow-row {
    opacity: 1;
    transform: translateX(0);
}

/* Hover lift */
.timeline .card:hover {
    transform: translateY(-10px) scale(1.01);
    border-color: transparent;
}

.timeline .card.violet:hover {
    box-shadow: 0 30px 70px -16px rgba(124, 58, 237, 0.28), 0 0 0 1px rgba(124, 58, 237, 0.22);
}

.timeline .card.teal:hover {
    box-shadow: 0 30px 70px -16px rgba(13, 148, 136, 0.28), 0 0 0 1px rgba(13, 148, 136, 0.22);
}

.timeline .card.amber:hover {
    box-shadow: 0 30px 70px -16px rgba(245, 158, 11, 0.28), 0 0 0 1px rgba(245, 158, 11, 0.22);
}

/* Column positioning */
.timeline .left {
    grid-column: 1;
    margin: 0;
}

.timeline .right {
    grid-column: 3;
    margin: 0;
}

/* LARGE SCREENS */
@media (min-width: 1024px) {

    /* Track: remove inline padding — cards use absolute positioning instead */
    .timeline .track {
        padding-inline: 0;
    }

    /* Entry is a height-reserved block; cards hang absolutely inside */
    .timeline .entry {
        display: block;
        position: relative;
        min-height: clamp(220px, 28vw, 360px);
        padding-bottom: clamp(3.5rem, 8vw, 7rem);
    }

    /* Left card: from left page margin → just before spine */
    .timeline .left {
        position: absolute;
        top: 0;
        right: calc(50% + clamp(40px, 4vw, 60px));
        width: auto;
        margin: 0;
        grid-column: unset;
    }

    /* Right card: just after spine → right page margin */
    .timeline .right {
        position: absolute;
        top: 0;
        left: calc(50% + clamp(40px, 4vw, 60px));
        width: auto;
        margin: 0;
        grid-column: unset;
    }

    /* Dot stays on the spine, vertically centered with card header */
    .timeline .dot {
        position: absolute;
        left: 50%;
        top: clamp(2.5rem, 5vw, 4rem);
        transform: translate(-50%, -50%);
    }

    /* Branch connector: horizontal line between spine and card */
    .timeline .connector {
        position: absolute;
        top: clamp(2.5rem, 5vw, 4rem);
        transform: translateY(-50%);
        height: 2px;
        border-radius: 2px;
        z-index: 5;
        display: block;
    }

    /* Left branch: from spine's left face → right edge of left card */
    .timeline .connector.left {
        right: 50%;
        left: auto;
        width: clamp(40px, 4vw, 60px);
    }

    /* Right branch: from spine's right face → left edge of right card */
    .timeline .connector.right {
        left: 50%;
        right: auto;
        width: clamp(40px, 4vw, 60px);
    }

    /* Branch gradients — full at spine, fade toward card */
    .timeline .connector.left.violet {
        background: linear-gradient(to left, rgba(124, 58, 237, 0.3), rgba(124, 58, 237, 0.9));
    }

    .timeline .connector.left.teal {
        background: linear-gradient(to left, rgba(13, 148, 136, 0.3), rgba(13, 148, 136, 0.9));
    }

    .timeline .connector.left.amber {
        background: linear-gradient(to left, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.9));
    }

    .timeline .connector.right.teal {
        background: linear-gradient(to right, rgba(13, 148, 136, 0.9), rgba(13, 148, 136, 0.3));
    }

    .timeline .connector.right.violet {
        background: linear-gradient(to right, rgba(124, 58, 237, 0.9), rgba(124, 58, 237, 0.3));
    }

    .timeline .connector.right.amber {
        background: linear-gradient(to right, rgba(245, 158, 11, 0.9), rgba(245, 158, 11, 0.3));
    }
}

/* MEDIUM SCREENS */
@media (min-width: 768px) and (max-width: 1023px) {

    /* 3-column grid: 7fr  3fr  7fr
       ● Total = 17fr
       ● Col 2 (spine zone) center = (7 + 1.5) / 17 = 50% exactly ✓
       ● Left card spans col 1+2 → width = 10fr, 30% (3fr) crosses spine ✓
       ● Right card spans col 2+3 → width = 10fr, 30% (3fr) crosses spine ✓ */
    .timeline .entry {
        display: grid;
        grid-template-columns: 7fr 3fr 7fr;
        align-items: start;
        position: relative;
        padding-bottom: clamp(3rem, 8vw, 7rem);
    }

    .timeline .dot {
        position: absolute;
        grid-column: auto;
        grid-row: auto;
        left: 50%;
        top: clamp(-2.5rem, -5vw, -4rem);
        transform: translate(-50%, -50%);
        z-index: 10;
    }

    /* Cards get an explicit z-index so the dot's z-index:10 wins
       (CSS animations can create stacking contexts that otherwise hide the dot). */
    .timeline .card {
        z-index: 1;
    }

    /* Connectors hidden — the card overlap bridges the spine visually */
    .timeline .connector {
        display: none;
    }

    /* Left card: spans col 1 + col 2 (7fr + 3fr = 10fr)
       → 70% of card width in col 1 (left side), 30% in col 2 (spine zone) */
    .timeline .left {
        grid-column: 1 / 3;
        margin: 0;
    }

    /* Right card: spans col 2 + col 3 (3fr + 7fr = 10fr)
       → 30% of card width in col 2 (spine zone), 70% in col 3 (right side) */
    .timeline .right {
        grid-column: 2 / 4;
        margin: 0;
    }
}

/* SMALL SCREENS */
@media (max-width: 767px) {

    /* Spine stays centered */
    .timeline .spine {
        left: 50%;
        transform: translateX(-50%);
        z-index: 0;
    }

    /* Entry switches from grid to flex column */
    .timeline .entry {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding-left: 0;
        padding-bottom: clamp(2rem, 6vw, 3.5rem);
    }

    /* Dot: in-flow, kill the absolute translate so it never jumps */
    .timeline .dot {
        position: relative;
        left: auto;
        top: clamp(-1.75rem, -3vw, -1rem);
        transform: none !important;
        z-index: 2;
        flex-shrink: 0;
        margin-bottom: 0.75rem;
        transition: box-shadow 0.4s ease;
    }

    /* Inner pulse: opacity-only — no scale so there's no layout shift */
    .timeline .dot span {
        animation: none;
        opacity: 0.85;
    }

    /* Prevent hover state from re-introducing the translate */
    .timeline .entry:hover .dot {
        transform: none !important;
    }

    /* Hide connector lines */
    .timeline .connector {
        display: none;
    }

    /* Cards: match technology labs card width (full container width) */
    .timeline .card {
        width: 100%;
        margin: 0 !important;
        animation: none !important;
        z-index: 1;
    }

    /* Remove column offsets */
    .timeline .left,
    .timeline .right {
        margin: 0 !important;
    }

    .timeline .card h3 {
        font-size: clamp(1.2rem, 5vw, 1.55rem);
    }
}