:root {
    --text-light: #e0e0e0; /* Body text, timeline highlight */
    --text-muted: #a1a1aa; /* Timeline date */
    --primary-orange: #ffa500; /* Timeline dot, year */
    --white-10: rgba(255, 255, 255, 0.1); /* Timeline card selected */
    --white-05: rgba(255, 255, 255, 0.05); /* Timeline card */
    --white-30: rgba(255, 255, 255, 0.3); /* Timeline card selected shadow */
    --orange-tint-20: rgba(255, 165, 0, 0.2); /* Hover shadow */
    --background-dark: #1a1a1a; /* Footer background */
    --border-dark: #333; /* Footer border */
    --transparent: transparent; /* Timeline container background */
}

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent; /* Transparent background for floating effect */
    border-top: none; /* Remove border */
    z-index: 10001; /* Below comic overlay (10002) so cover draws on top when overlay is open */
    overflow: visible; /* Allow thumbnails to float above */
    clip-path: none; /* Prevent clipping */
    contain: none; /* Prevent containment */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Hide footer when comic is open */
body.comic-is-open footer {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.timeline-container {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    white-space: nowrap;
    padding: 60px 0 16px 0; /* Increased top padding to accommodate thumbnails, reduced bottom padding */
    background: var(--transparent);
    border-radius: 0;
    width: 100%;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile */
    scroll-snap-type: x mandatory; /* Enable scroll snapping */
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none; /* Hide scrollbar for IE/Edge */
    overscroll-behavior-x: contain; /* Prevent overscroll bounce */
    touch-action: pan-x pan-y pinch-zoom; /* Enable all touch actions */
    clip-path: none; /* Prevent clipping */
    contain: none; /* Prevent containment that could clip */
}

.timeline-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
}

.timeline {
    display: flex;
    align-items: flex-start;
    padding: 0 16px;
    position: relative;
    width: max-content; /* Ensure timeline width matches content */
    overflow: visible; /* Allow thumbnails to float above */
    clip-path: none; /* Prevent clipping */
    contain: none; /* Prevent containment */
}

.timeline-line {
    position: absolute;
    top: 58px; /* Centered in the dots */
    left: 16px;
    height: 2px;
    min-width: 100px; /* Ensure line is visible even before JS sets width */
    background: var(--primary-orange);
    opacity: 0.85;
    z-index: 10;
}

.timeline-year-entry {
    display: inline-block;
    text-align: center;
    margin-right: 32px;
    width: 100px; /* Smaller width for year cards */
    position: relative;
}

.timeline-year-card {
    background: var(--background-dark); /* Dark card background */
    border: 1px solid var(--border-dark); /* Subtle border */
    border-radius: 8px; /* Increased from 4px */
    padding: 6px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Shadow for depth */
    margin-top: 12px; /* Space below dot */
    opacity: 0;
    animation: fadeIn 0.5s forwards;
    animation-delay: calc(var(--index) * 0.2s);
}

.timeline-year-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-orange);
}

.timeline-entry {
    display: inline-block;
    text-align: center;
    margin-right: 32px;
    cursor: pointer;
    transition: transform 0.3s ease;
    width: auto; /* Allow card to stretch based on content */
    min-width: 180px; /* Minimum width to prevent shrinking too much */
    position: relative;
    scroll-snap-align: center; /* Snap each entry to center */
    overflow: visible; /* Allow thumbnails to float above */
    clip-path: none; /* Prevent clipping */
    contain: none; /* Prevent containment */
}

.timeline-entry:hover .timeline-card {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--orange-tint-20);
}

.timeline-entry.selected .timeline-card {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--white-30);
}

.timeline-dot {
    position: absolute;
    top: -6px; /* Center vertically on 2px line: line center is at 1px, dot center is at 5px, so -6px positions dot center on line center */
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: var(--text-light);
    border-radius: 50%;
    transition: background 0.3s ease, transform 0.3s ease;
    opacity: 0.8;
    z-index: 11;
}

.timeline-entry:hover .timeline-dot,
.timeline-entry.selected .timeline-dot,
.timeline-year-entry .timeline-dot {
    background: var(--primary-orange);
    transform: translateX(-50%) scale(1.5); /* Enlarge for year and post dots */
}

.timeline-card {
    background: rgba(26, 26, 26, 0.8); /* Darker background for better visibility */
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
    animation-delay: calc(var(--index) * 0.2s);
    margin-top: 24px; /* Increased from 12px to move card lower */
    white-space: normal;
    position: relative;
    overflow: visible; /* Allow thumbnails to float above */
}

.full-moment-indicator {
    color: var(--primary-orange);
    font-size: 0.875rem;
    opacity: 0.9;
    transition: all 0.3s ease;
    position: absolute;
    top: -10px;
    right: -14px;
    z-index: 2;
    background: var(--background-dark);
    border: 1px solid var(--border-dark);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timeline-entry:hover .full-moment-indicator,
.timeline-entry.selected .full-moment-indicator {
    opacity: 1;
    transform: scale(1.1);
}

.comic-thumbnail-indicator {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    z-index: 20; /* Higher than timeline-line (10) and timeline-dot (11) */
    width: 60px;
    height: 80px;
    aspect-ratio: 3 / 4;
    border-radius: 6px;
    border: 1px solid var(--border-dark);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    object-fit: cover;
    opacity: 0.9;
    transition: all 0.3s ease;
    background: var(--background-dark);
    pointer-events: auto;
    clip-path: none; /* Ensure no clipping */
    contain: none; /* Prevent containment */
}

.timeline-entry:hover .comic-thumbnail-indicator,
.timeline-entry.selected .comic-thumbnail-indicator {
    opacity: 1;
    transform: translateX(-50%) translateY(-50%) scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.timeline-date-combined {
    font-size: 0.8125rem;
    color: var(--text-muted);
    opacity: 0.85;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
    margin-top: 4px; /* Add space from the title */
}

.timeline-duration {
    color: var(--text-muted);
    opacity: 0.75;
    text-align: center;
}

.timeline-highlight {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-light);
    opacity: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    text-align: center;
    width: 100%;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.full-post-indicator {
    color: var(--primary-orange);
    font-size: 0.75rem;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.timeline-entry:hover .full-post-indicator,
.timeline-entry.selected .full-post-indicator {
    opacity: 1;
}

@media (max-width: 640px) {
    /* Hide timeline when blog drawer is open on mobile */
    body.blog-drawer-open footer {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
    
    .timeline-container {
        padding: 60px 0 20px 0; /* Increased top padding to match desktop, reduced bottom padding */
        overflow-y: visible;
        touch-action: pan-x pan-y pinch-zoom; /* Enable all touch actions */
        -webkit-overflow-scrolling: touch; /* Ensure momentum scrolling */
        scroll-behavior: smooth; /* Smooth scrolling */
    }
    
    .timeline {
        padding: 0 8px; /* Reduce padding on mobile */
        touch-action: pan-x pan-y pinch-zoom; /* Enable all touch actions */
    }
    
    .timeline-entry {
        margin-right: 16px;
        width: auto;
        min-width: 140px;
        scroll-snap-align: center;
        touch-action: pan-x pan-y pinch-zoom; /* Enable all touch actions */
    }
    
    .timeline-year-entry {
        margin-right: 16px;
        width: 80px;
        scroll-snap-align: center;
    }
    .timeline-year-card {
        padding: 4px 8px;
    }
    .timeline-year-text {
        font-size: 0.875rem;
    }
    .timeline-date-combined {
        opacity: 0.8; /* Maintain visibility */
        margin-top: 2px; /* Smaller margin on mobile */
    }
    .timeline-highlight {
        padding: 4px 0px;
        font-weight: 700;
        font-size: 1.125rem;
        justify-content: center;
        margin-bottom: 4px;
    }
    .timeline-card {
        padding: 6px 10px;
        margin-top: 20px; /* Move card lower on mobile to accommodate thumbnails */
    }
    .timeline-line {
        top: 58px;
        left: 16px;
    }
    .timeline-dot {
        top: -5px; /* Center vertically on 2px line: line center is at 1px, dot center is at 4px (for 8px dot), so -5px positions dot center on line center */
        width: 8px;
        height: 8px;
    }
    .timeline-entry:hover .timeline-dot,
    .timeline-entry.selected .timeline-dot,
    .timeline-year-entry .timeline-dot {
        transform: translateX(-50%) scale(1.5);
    }
    .full-post-indicator {
        font-size: 0.625rem;
    }
    .full-moment-indicator {
        font-size: 0.75rem;
        width: 20px;
        height: 20px;
        top: -4px;
        right: -4px;
    }
    .comic-thumbnail-indicator {
        top: -15px; /* Position above the timeline entry on mobile */
        transform: translateX(-50%) translateY(-50%); /* Center on the dot position */
    }
}