/* PROJECTS TIMELINE REDESIGN */

/* Core variables matching existing site */
:root {
    --timeline-blue: #1795d9;
    --timeline-blue-glow: rgba(23, 149, 217, 0.35);
    --timeline-blue-soft: rgba(23, 149, 217, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.30);
    --glass-blur: blur(18px);
    --card-hover-scale: 1.04;
    --dock-scale: 1.45;
    --transition-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Disable snap-scroll on projects page ---- */
html,
body {
    scroll-snap-type: none !important;
}

section#projects {
    height: auto !important;
    min-height: unset;
}

[data-theme="dark"] {
    --glass-bg: rgba(10, 20, 50, 0.45);
    --glass-border: rgba(255, 255, 255, 0.12);
}

/* ---- Page wrapper ---- */
#projects {
    min-height: 100vh;
    width: 100%;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* ---- Animated background particles ---- */
.bg-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(23, 149, 217, 0.07) 0%, transparent 70%);
    animation: floatParticle linear infinite;
}

@keyframes floatParticle {
    0% {
        transform: translateY(110vh) scale(0.8);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 0.6;
    }

    100% {
        transform: translateY(-20vh) scale(1.2);
        opacity: 0;
    }
}

/* ---- Page header section ---- */
.projects-header {
    text-align: center;
    padding: 10rem 2rem 3rem 2rem;
    position: relative;
    z-index: 2;
    width: 100%;
}

.projects-header .project-description {
    font-size: 1.55rem;
    color: var(--accent-color);
    margin: 0 auto 1.5rem auto;
    text-align: center;
    max-width: 800px;
}

/* ---- Tab filter ---- */
.project-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0;
    margin: 0.5rem auto 2rem auto;
    max-width: 860px;
    width: 100%;
    position: relative;
    z-index: 2;

    /* Liquid glass pill container */
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 999px;
    padding: 5px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 4px 20px rgba(0, 0, 0, 0.08);

    /* Horizontal scroll on small screens */
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
}

.project-tabs::-webkit-scrollbar {
    display: none;
}

/* Override global tab-button styles to match our glass pill */
.project-tabs .tab-button {
    flex-shrink: 0;
    position: relative;
    border: none !important;
    background: transparent !important;
    color: var(--navbar-color) !important;
    padding: 0.5rem 1.1rem !important;
    border-radius: 999px !important;
    font-family: 'Geist Mono', monospace !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em;
    cursor: pointer;
    white-space: nowrap;
    transition:
        background 0.22s ease,
        color 0.22s ease,
        transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.22s ease !important;
    transform: scale(1);
}

.project-tabs .tab-button:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    transform: scale(1.06) translateY(-1px) !important;
}

.project-tabs .tab-button.active {
    background: rgba(23, 149, 217, 0.28) !important;
    border: 1px solid rgba(23, 149, 217, 0.55) !important;
    color: #fff !important;
    box-shadow:
        0 2px 12px rgba(23, 149, 217, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    transform: scale(1.03) !important;
}

[data-theme="dark"] .project-tabs {
    background: rgba(10, 20, 50, 0.38);
    border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 860px) {
    .project-tabs {
        justify-content: flex-start;
        border-radius: 32px;
        padding: 4px;
        max-width: calc(100vw - 2rem);
    }
}

/* ---- Main timeline layout ---- */
.timeline-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 6rem 2rem;
    display: flex;
    gap: 3rem;
    position: relative;
    z-index: 2;
}

/* ---- Projects area (left) ---- */
.projects-area {
    flex: 1;
    min-width: 0;
}

/* ---- Year group ---- */
.year-group {
    margin-bottom: 4rem;
}

.year-label {
    font-family: 'Geist Mono', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--timeline-blue);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    padding: 0.4rem 1rem;
    background: var(--timeline-blue-soft);
    border: 1px solid rgba(23, 149, 217, 0.30);
    border-radius: 999px;
    display: inline-block;
    backdrop-filter: blur(8px);
}

/* ---- Dock-style project grid ---- */
.dock-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    align-items: flex-end;
    padding: 1rem 0.5rem 1.5rem 0.5rem;
}

/* ---- Individual project card (dock item) ---- */
.dock-card {
    position: relative;
    width: 220px;
    height: 220px;
    border-radius: 22px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;

    /* Liquid glass base */
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);

    /* Transition everything smoothly */
    transition:
        transform 400ms var(--transition-spring),
        box-shadow 400ms var(--transition-smooth),
        z-index 0ms;

    will-change: transform;
    z-index: 1;
}

/* Dock magnification: scale up hovered card + slightly scale neighbours */
.dock-grid:hover .dock-card {
    transform: scale(0.96);
}

.dock-card:hover {
    transform: scale(var(--dock-scale)) translateY(-16px) !important;
    box-shadow:
        0 20px 60px rgba(23, 149, 217, 0.35),
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 100;
}

.dock-card:hover+.dock-card,
.dock-card:has(+ .dock-card:hover) {
    transform: scale(1.15) translateY(-8px) !important;
    z-index: 50;
}

/* Card image */
.dock-card-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.35s ease, filter 0.35s ease;
}

/* Card glass overlay (always slightly visible) */
.dock-card-glass {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.08) 50%,
            rgba(0, 20, 60, 0.72) 100%);
    transition: background 0.35s ease;
}

/* Hover overlay - slides up */
.dock-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem;
    background: linear-gradient(0deg,
            rgba(5, 30, 80, 0.88) 0%,
            rgba(10, 40, 100, 0.60) 55%,
            rgba(0, 0, 0, 0) 100%);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    opacity: 0;
    transform: translateY(12px);
    transition:
        opacity 0.35s var(--transition-smooth),
        transform 0.35s var(--transition-smooth),
        backdrop-filter 0.35s ease;
}

.dock-card:hover .dock-card-overlay {
    opacity: 1;
    transform: translateY(0);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.dock-card:hover .dock-card-image {
    opacity: 0.75;
    filter: brightness(0.85) saturate(1.1);
}

/* Card tag badge */
.dock-card-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(23, 149, 217, 0.85);
    backdrop-filter: blur(8px);
    color: white;
    font-family: 'Geist Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    z-index: 3;
    letter-spacing: 0.05em;
    transition: transform 0.3s var(--transition-spring), background 0.3s ease;
}

.dock-card:hover .dock-card-tag {
    transform: scale(0.88);
}

/* Card content inside overlay */
.dock-card-title {
    font-family: 'Geist Mono', monospace;
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.35rem;
    line-height: 1.2;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

.dock-card-desc {
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    color: rgba(220, 235, 255, 0.88);
    line-height: 1.4;
    margin-bottom: 0.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dock-card-btn {
    display: inline-block;
    font-family: 'Geist Mono', monospace;
    font-size: 0.68rem;
    font-weight: 700;
    color: white;
    background: rgba(23, 149, 217, 0.75);
    border: 1px solid rgba(23, 149, 217, 0.8);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s var(--transition-spring);
    backdrop-filter: blur(6px);
    letter-spacing: 0.04em;
    align-self: flex-start;
}

.dock-card-btn:hover {
    background: rgba(23, 149, 217, 1);
    transform: translateY(-2px) scale(1.04);
}

/* Sneak peek card style */
.dock-card.sneak-peek {
    border: 1px solid rgba(23, 149, 217, 0.40);
}

.dock-card.sneak-peek .dock-card-image {
    opacity: 0.6;
    filter: blur(1.5px) grayscale(0.2);
}

.dock-card.sneak-peek:hover .dock-card-image {
    opacity: 0.5;
}

/* TIMELINE (right side) */

.timeline-sidebar {
    width: 180px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    height: fit-content;
    max-height: 85vh;
    overflow-y: auto;
    scrollbar-width: none;
}

.timeline-sidebar::-webkit-scrollbar {
    display: none;
}

.timeline-track {
    position: relative;
    padding-left: 24px;
}

/* Vertical blue line */
.timeline-track::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg,
            transparent 0%,
            var(--timeline-blue) 15%,
            var(--timeline-blue) 85%,
            transparent 100%);
    border-radius: 999px;
    box-shadow: 0 0 8px var(--timeline-blue-glow);
}

/* Timeline year markers */
.tl-year {
    position: relative;
    margin-bottom: 2.5rem;
}

.tl-year-dot {
    position: absolute;
    left: -22px;
    top: 5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--timeline-blue);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow:
        0 0 0 4px var(--timeline-blue-soft),
        0 0 14px var(--timeline-blue-glow);
    transition: transform 0.3s var(--transition-spring), box-shadow 0.3s ease;
}

.tl-year.active .tl-year-dot {
    transform: scale(1.3);
    box-shadow:
        0 0 0 6px var(--timeline-blue-soft),
        0 0 20px var(--timeline-blue-glow);
}

.tl-year-label {
    font-family: 'Geist Mono', monospace;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--timeline-blue);
    letter-spacing: 0.1em;
    margin-bottom: 0.6rem;
}

/* Timeline project dots */
.tl-project-item {
    position: relative;
    padding: 0.25rem 0 0.25rem 0;
    cursor: pointer;
    margin-bottom: 0.15rem;
}

.tl-project-item::before {
    content: '';
    position: absolute;
    left: -17px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--timeline-blue);
    opacity: 0.55;
    transition: opacity 0.2s ease, transform 0.2s var(--transition-spring);
}

.tl-project-item:hover::before {
    opacity: 1;
    transform: translateY(-50%) scale(1.4);
}

.tl-project-name {
    font-family: 'Geist Mono', monospace;
    font-size: 0.68rem;
    color: var(--title-and-text-color, #ccc);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.tl-project-item:hover .tl-project-name {
    opacity: 1;
    color: var(--timeline-blue);
}

/* ---- Glow pulse on timeline line ---- */
@keyframes timelineGlow {

    0%,
    100% {
        box-shadow: 0 0 6px var(--timeline-blue-glow);
    }

    50% {
        box-shadow: 0 0 18px rgba(23, 149, 217, 0.6);
    }
}

.timeline-track::before {
    animation: timelineGlow 3s ease-in-out infinite;
}

/* ---- Floating year chip that follows scroll ---- */
.floating-year-chip {
    position: fixed;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    background: rgba(23, 149, 217, 0.15);
    border: 1px solid rgba(23, 149, 217, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    padding: 0.5rem 0.9rem;
    font-family: 'Geist Mono', monospace;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--timeline-blue);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 200;
    letter-spacing: 0.05em;
    display: none;
    /* shown only in sidebar-less view */
}

/* ---- Ripple effect on card click ---- */
.dock-card .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(23, 149, 217, 0.3);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes rippleAnim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ---- Section title big ---- */
.headline-projects {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

/* ---- Scroll reveal ---- */
.year-group {
    opacity: 1;
}

@supports (animation-timeline: scroll()) {
    .year-group {
        opacity: 0;
        animation: revealGroup linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 60%;
    }

    @keyframes revealGroup {
        to {
            opacity: 1;
        }
    }

    .dock-card {
        opacity: 0;
        animation: revealCard linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 80%;
    }

    @keyframes revealCard {
        to {
            opacity: 1;
        }
    }
}

/* ---- Stagger dock cards with delay via JS ---- */
.dock-card[data-delay="1"] {
    animation-delay: 0.05s;
}

.dock-card[data-delay="2"] {
    animation-delay: 0.1s;
}

.dock-card[data-delay="3"] {
    animation-delay: 0.15s;
}

.dock-card[data-delay="4"] {
    animation-delay: 0.2s;
}

/* ---- Hidden cards (filtered out) ---- */
.dock-card.filtered-out {
    display: none;
}

/* ---- Category label for year ---- */
.year-group-empty {
    display: none;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
    .timeline-sidebar {
        display: none;
    }

    .floating-year-chip {
        display: block;
    }
}

@media (max-width: 768px) {
    .timeline-wrapper {
        padding: 0 1rem 4rem 1rem;
        gap: 0;
    }

    .dock-card {
        width: 160px;
        height: 160px;
        border-radius: 18px;
    }

    .dock-grid {
        gap: 0.8rem;
    }

    .dock-card:hover {
        transform: scale(1.15) translateY(-10px) !important;
    }
}

@media (max-width: 480px) {
    .dock-card {
        width: calc(50% - 0.5rem);
        height: 150px;
        border-radius: 16px;
    }

    .dock-grid {
        flex-wrap: wrap;
    }

    .dock-card:hover {
        transform: scale(1.05) translateY(-6px) !important;
    }

    .dock-card:hover+.dock-card,
    .dock-card:has(+ .dock-card:hover) {
        transform: none !important;
    }
}

/* DARK MODE ADJUSTMENTS */

[data-theme="dark"] .dock-card {
    background: rgba(8, 18, 45, 0.55);
    border-color: rgba(23, 149, 217, 0.18);
}

[data-theme="dark"] .dock-card:hover {
    box-shadow:
        0 20px 60px rgba(23, 149, 217, 0.45),
        0 4px 20px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .year-label {
    background: rgba(23, 149, 217, 0.12);
    border-color: rgba(23, 149, 217, 0.25);
}