/* ═══════════════════════════════════════════════════════════════
   GIT TIMELINE - Horizontal Career Visualization
   Clean git-style graph with branches, commits, and merges
   ═══════════════════════════════════════════════════════════════ */

/* ─── CSS Variables ─── */
:root {
    --git-work-color: #33ff00;
    --git-project-color: #ff6b6b;
    --git-education-color: #4ecdc4;
    --git-trunk-color: rgba(255, 255, 255, 0.3);
    --git-bg: rgba(0, 0, 0, 0.6);
    --git-bg-solid: rgba(10, 10, 10, 0.95);
    --git-overlay-bg: rgba(10,10,10,0.5);
    --git-border: rgba(255, 255, 255, 0.15);
    --git-text: #ffffff;
    --git-text-secondary: rgba(255, 255, 255, 0.7);
    --git-text-muted: rgba(255, 255, 255, 0.5);
    --git-hash-color: #ffb000;
}

/* ─── Section Container ─── */
.git-timeline-section {
    position: relative;
    padding: 4rem 0 2rem 0;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Section header with padding (like other sections) */
.git-timeline-section .section-header {
    padding: 0 var(--spacing-xl, 2rem);
    margin-bottom: 2rem;
}

.git-timeline-section .section-label {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.git-timeline-section .section-title {
    /* Match other sections styling */
    font-family: var(--font-sans, system-ui);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.git-timeline-section .section-divider {
    display: none; /* Hide divider for cleaner look */
}

.git-timeline-intro {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 2rem;
}

.git-timeline-intro .section-title {
    margin-bottom: 0.5rem;
}

.git-timeline-subtitle {
    font-size: 1.1rem;
    opacity: 0.7;
}

/* ─── Viewport & Scroll ─── */
.git-timeline-viewport {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.git-timeline-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--git-trunk-color) transparent;
    margin: 0;
    padding: 0;
}

.git-timeline-scroll::-webkit-scrollbar {
    height: 8px;
}

.git-timeline-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.git-timeline-scroll::-webkit-scrollbar-thumb {
    background: var(--git-trunk-color);
    border-radius: 4px;
}

.git-timeline-content {
    position: relative;
    min-height: 300px;
    padding-top: 15px;
    /* Flexbox to put axis at the bottom */
    display: flex;
    flex-direction: column;
}

/* ─── Year Axis (now at the bottom) ─── */
#git-timeline-axis {
    position: relative;
    height: 50px;
    margin-top: 0;
    order: 2; /* Place after lanes in flex layout */
}

.git-timeline-axis {
    position: relative;
    height: 100%;
}

.git-year-marker {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
}

.git-year-label {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--git-text-secondary);
    margin-top: 8px; /* Changed from margin-bottom since tick is now above */
}

.git-year-tick {
    width: 2px;
    height: 16px;
    background: var(--git-trunk-color);
}

.git-year-marker.current .git-year-label {
    color: var(--git-hash-color);
    font-size: 1.05rem;
}

.git-year-marker.current .git-year-tick {
    background: var(--git-hash-color);
    width: 3px;
}

.git-year-marker.future {
    opacity: 0.4;
}

/* NOW Marker (positioned above the axis, which is now at the bottom) */
.git-now-marker {
    position: absolute;
    top: -25px; /* Above the tick */
    transform: translateX(-50%);
    z-index: 10;
}

.git-now-marker span {
    display: inline-block;
    padding: 4px 12px;
    background: #ff3333;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(255, 51, 51, 0.4);
}

/* ─── SVG Graph (above axis) ─── */
#git-timeline-lanes {
    position: relative;
    order: 1; /* Place before axis in flex layout */
    width: 100%;
}

.git-timeline-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Trunk line */
.git-trunk {
    stroke: var(--git-trunk-color);
    stroke-linecap: round;
}

/* Branch paths */
.git-branch {
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: stroke-width 0.2s ease, opacity 0.2s ease;
}

.git-branch-work { stroke: var(--git-work-color); }
.git-branch-project { stroke: var(--git-project-color); }
.git-branch-education { stroke: var(--git-education-color); }

/* Nodes */
.git-node {
    transition: r 0.2s ease;
}

.git-node-work { fill: var(--git-work-color); }
.git-node-project { fill: var(--git-project-color); }
.git-node-education { fill: var(--git-education-color); }

/* Ongoing node pulse */
.git-node-ongoing {
    animation: pulse-node 2s ease-in-out infinite;
}

@keyframes pulse-node {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ─── Commit Markers (Compact) ─── */
.git-commit-marker {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--git-bg-solid, rgba(30, 30, 30, 0.95));
    border: 1px solid var(--git-border);
    border-left: 3px solid var(--branch-color, var(--git-work-color));
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    z-index: 5;
}

.git-commit-marker:hover {
    background: var(--git-bg-solid, rgba(20, 20, 20, 0.98));
    border-color: var(--branch-color, var(--git-work-color));
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 20;
}

/* Click indicator for desktop markers */
.git-commit-marker::after {
    content: '›';
    margin-left: 6px;
    font-size: 1rem;
    font-weight: 400;
    color: var(--git-text-muted, rgba(255, 255, 255, 0.4));
    transition: transform 0.2s ease, color 0.2s ease;
}

.git-commit-marker:hover::after {
    color: var(--branch-color, var(--git-work-color));
    transform: translateX(2px);
}

/* Type-specific left border colors */
.git-commit-work {
    border-left-color: var(--git-work-color);
}

.git-commit-project {
    border-left-color: var(--git-project-color);
}

.git-commit-education {
    border-left-color: var(--git-education-color);
}

.marker-hash {
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-mono, monospace);
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
}

.marker-title {
    color: var(--git-text, #ffffff);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.marker-badge {
    width: 6px;
    height: 6px;
    background: var(--branch-color, var(--git-work-color));
    border-radius: 50%;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Type-specific marker hover effects */
.git-commit-work:hover {
    border-color: var(--git-work-color);
    box-shadow: 0 4px 16px rgba(51, 255, 0, 0.15);
}

.git-commit-project:hover {
    border-color: var(--git-project-color);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.15);
}

.git-commit-education:hover {
    border-color: var(--git-education-color);
    box-shadow: 0 4px 16px rgba(78, 205, 196, 0.15);
}


/* ─── CDK-Style Overlay (positioned below section header) ─── */
.git-timeline-overlay {
    position: absolute;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.git-timeline-overlay.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Position below section header within timeline section */
.git-timeline-overlay.fixed-corner {
    position: absolute;
    /* Position just below the section header (4rem padding + ~2rem header + 2rem margin) */
    top: 7rem;
    left: 20px;
    right: auto;
    bottom: auto;
}

.overlay-content {
    width: 320px;
    max-width: 90vw;
    padding: 1rem;
    background: var(--git-overlay-bg);
    border: 2px solid var(--git-border);
    border-radius: 8px;
    box-shadow: var(--git-overlay-shadow, 0 10px 40px rgba(0, 0, 0, 0.6));
    backdrop-filter: blur(15px);
}

/* Overlay type-specific borders */
.git-overlay-work .overlay-content {
    border-color: var(--git-work-color);
}

.git-overlay-project .overlay-content {
    border-color: var(--git-project-color);
}

.git-overlay-education .overlay-content {
    border-color: var(--git-education-color);
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--git-border);
}

.overlay-hash {
    color: var(--git-hash-color);
    font-family: var(--font-mono, monospace);
    font-size: 0.7rem;
    font-weight: 700;
}

.overlay-date {
    color: var(--git-text-muted);
    font-size: 0.75rem;
}

.overlay-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--git-text);
    margin: 0 0 0.5rem 0;
}

.overlay-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.overlay-company {
    color: var(--git-text-secondary);
    font-weight: 500;
}

.overlay-location {
    color: var(--git-text-muted);
    font-size: 0.85rem;
}

.overlay-description {
    color: var(--git-text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0 0 0.75rem 0;
    white-space: normal;
}

.overlay-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.overlay-tag {
    padding: 3px 8px;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--git-border);
    border-radius: 4px;
    color: var(--git-text-secondary);
}

/* ─── Scroll Hint (hidden when timeline fits viewport) ─── */
.git-timeline-scroll-hint {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: none; /* Hidden by default since timeline fits viewport */
    align-items: center;
    gap: 0.5rem;
    color: var(--git-text-muted);
    font-size: 0.85rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.git-timeline-scroll-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.scroll-hint-arrow {
    animation: bounce-right 1.5s ease-in-out infinite;
}

@keyframes bounce-right {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
}

/* ─── Responsive - Tablet/Mobile Vertical Timeline ─── */
@media (max-width: 1024px) {
    .git-timeline-section {
        padding: 1.5rem 0;
    }

    .git-timeline-intro {
        padding: 0 1rem;
        margin-bottom: 1rem;
    }

    /* Hide horizontal timeline on mobile */
    .git-timeline-viewport {
        display: none;
    }

    /* Show vertical timeline on mobile */
    .git-timeline-mobile {
        display: block;
        padding: 0 1rem;
    }

    .mobile-timeline {
        position: relative;
        padding-left: 20px;
    }

    /* Vertical line */
    .mobile-timeline::before {
        content: '';
        position: absolute;
        left: 6px;
        top: 0;
        bottom: 0;
        width: 2px;
        background: var(--git-trunk-color, rgba(0, 0, 0, 0.2));
    }

    .mobile-commit {
        position: relative;
        margin-bottom: 1rem;
        padding-left: 20px;
    }

    /* Node on the line */
    .mobile-commit::before {
        content: '';
        position: absolute;
        left: -17px;
        top: 12px;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: var(--branch-color, var(--git-work-color));
        border: 2px solid var(--git-bg-solid, #fff);
        z-index: 2;
    }

    /* Branch line to node */
    .mobile-commit::after {
        content: '';
        position: absolute;
        left: -7px;
        top: 16px;
        width: 27px;
        height: 2px;
        background: var(--branch-color, var(--git-work-color));
    }

    .mobile-commit-card {
        background: var(--git-bg-solid, rgba(30, 30, 30, 0.95));
        border: 1px solid var(--git-border, rgba(0, 0, 0, 0.1));
        border-left: 3px solid var(--branch-color, var(--git-work-color));
        border-radius: 8px;
        padding: 12px 14px;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-commit-card:active {
        transform: scale(0.98);
    }

    .mobile-commit-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .mobile-commit-title {
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--git-text, #fff);
        flex: 1;
    }

    .mobile-commit-date {
        font-size: 0.7rem;
        color: var(--git-text-muted, rgba(255, 255, 255, 0.5));
        white-space: nowrap;
    }

    /* Click indicator chevron for mobile */
    .mobile-commit-chevron {
        font-size: 1rem;
        color: var(--git-text-muted, rgba(255, 255, 255, 0.4));
        transition: transform 0.2s ease;
        margin-left: 4px;
    }

    .mobile-commit.expanded .mobile-commit-chevron {
        transform: rotate(90deg);
        color: var(--branch-color, var(--git-work-color));
    }

    .mobile-commit-badge {
        width: 8px;
        height: 8px;
        background: var(--branch-color, var(--git-work-color));
        border-radius: 50%;
        animation: pulse-badge 2s ease-in-out infinite;
    }

    /* Expanded details */
    .mobile-commit-details {
        display: none;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--git-border, rgba(255, 255, 255, 0.1));
    }

    .mobile-commit.expanded .mobile-commit-details {
        display: block;
        animation: slideDown 0.2s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .mobile-commit-company {
        font-size: 0.85rem;
        color: var(--branch-color, var(--git-work-color));
        font-weight: 500;
        margin-bottom: 4px;
    }

    .mobile-commit-location {
        font-size: 0.75rem;
        color: var(--git-text-muted, rgba(255, 255, 255, 0.5));
        margin-bottom: 8px;
    }

    .mobile-commit-description {
        font-size: 0.8rem;
        color: var(--git-text-secondary, rgba(255, 255, 255, 0.7));
        line-height: 1.5;
        margin-bottom: 10px;
    }

    .mobile-commit-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .mobile-commit-tag {
        padding: 3px 8px;
        font-size: 0.65rem;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid var(--git-border, rgba(255, 255, 255, 0.15));
        border-radius: 4px;
        color: var(--git-text-secondary, rgba(255, 255, 255, 0.7));
    }

    /* Type-specific colors */
    .mobile-commit-work {
        --branch-color: var(--git-work-color);
    }

    .mobile-commit-project {
        --branch-color: var(--git-project-color);
    }

    .mobile-commit-education {
        --branch-color: var(--git-education-color);
    }

    /* Hide overlay on mobile */
    .git-timeline-overlay {
        display: none !important;
    }

    /* Hide scroll hint on mobile */
    .git-timeline-scroll-hint {
        display: none;
    }
}

/* Desktop: hide mobile timeline */
@media (min-width: 1025px) {
    .git-timeline-mobile {
        display: none;
    }
}
