/* --- CSS Reset & Variables --- */
:root {
    /* Color Palette */
    --bg-color: #0d0f17;
    /* Deep almost black-blue */
    --bg-surface: #1a1e2b;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;

    /* Accents */
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-winter: #475569;
    /* muted cold gray */

    /* Glows */
    --glow-primary: rgba(59, 130, 246, 0.4);
    --glow-secondary: rgba(139, 92, 246, 0.4);

    /* Layout */
    --container-max: 1200px;
    --line-width: 4px;
    --dot-size: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.05) 0%, transparent 25%);
}

.snap-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

h1,
h2,
h3,
h4,
.year {
    font-family: 'Outfit', sans-serif;
}

/* --- Typography Helpers --- */
.mb-2 {
    margin-bottom: 0.5rem;
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    padding: 2rem;
    overflow: hidden;

    scroll-snap-align: start;
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 800px;
}

/* Ambient glow orbs behind title */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background-color: var(--accent-blue);
    top: -50%;
    left: -20%;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background-color: var(--accent-purple);
    bottom: -30%;
    right: -10%;
}

.title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.subtitle {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 400;
    color: var(--accent-blue);
    margin-bottom: 2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.description {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.scroll-indicator {
    margin-top: 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-15px);
    }

    60% {
        transform: translateY(-7px);
    }
}

/* --- Timeline Container Structure --- */
.timeline-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 4rem 2rem;
}

/* Era Headers */
.timeline-era {
    margin-bottom: 8rem;
}

.era-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    padding-bottom: 2rem;

    /* Scroll Snapping */
    scroll-snap-align: start;
    scroll-margin-top: 50px;
    scroll-snap-stop: always;
    /* Force stop at the era title */
}

.era-header h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
}

.era-header p {
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Base Timeline Line */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--line-width);
    background: linear-gradient(to bottom, transparent, var(--bg-surface) 5%, var(--bg-surface) 95%, transparent);
    border-radius: 4px;
}

.timeline-item {
    position: relative;
    width: 50%;
    margin-bottom: 4rem;
    opacity: 0;
    /* Hidden for animation */

    scroll-snap-align: center;
    scroll-snap-stop: always;
}

/* Position left vs right */
.timeline-item.left {
    left: 0;
    padding-right: 3rem;
}

.timeline-item.right {
    left: 50%;
    padding-left: 3rem;
}

/* Center Dot */
.timeline-dot {
    position: absolute;
    width: var(--dot-size);
    height: var(--dot-size);
    border-radius: 50%;
    background-color: var(--bg-surface);
    border: 3px solid var(--text-muted);
    top: 24px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 2;
    transition: all 0.3s ease;
}

.timeline-item.left .timeline-dot {
    right: calc((var(--dot-size) / -2) - (var(--line-width) / 2));
}

.timeline-item.right .timeline-dot {
    left: calc((var(--dot-size) / -2) - (var(--line-width) / 2));
}


/* --- Glassmorphism Cards --- */
.card-glass {
    background: rgba(26, 30, 43, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.timeline-item:hover .card-glass {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.1);
}

.timeline-item:hover .timeline-dot {
    transform: scale(1.3);
    background-color: var(--text-main);
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

/* Card Content Typography */
.year {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.timeline-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 6px;
    margin: 1rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
}

.timeline-img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.winter-glass .timeline-img {
    filter: saturate(0.6) contrast(1.1) brightness(0.8);
    border-color: rgba(255, 255, 255, 0.05);
}

.winter-glass .timeline-img:hover {
    filter: saturate(0.8) contrast(1.1) brightness(0.9);
}

.event-title {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

.key-figures {
    font-size: 0.875rem;
    color: var(--accent-blue);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.event-description {
    color: #cbd5e1;
    font-size: 1rem;
}


/* --- Thematic Era Nuances --- */

/* Winter Era (Cold, muted) */
.winter-era .era-header h3 {
    color: #94a3b8;
}

.winter-line {
    background: linear-gradient(to bottom, var(--bg-surface), var(--bg-color), var(--bg-surface));
}

.winter-glass {
    background: rgba(15, 23, 42, 0.4);
    /* darker, colder blue */
    border-color: rgba(71, 85, 105, 0.2);
}

.winter-year {
    color: var(--accent-winter);
}

.winter-dot {
    border-color: var(--accent-winter);
}

/* Modern Era (Neon, vibrant, glowing) */
.modern-era .era-header h3 {
    background: linear-gradient(to right, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glowing-line {
    background: linear-gradient(to bottom, var(--bg-surface), var(--accent-purple) 20%, var(--accent-cyan) 80%, var(--bg-surface));
    box-shadow: 0 0 15px var(--glow-secondary);
}

.glowing-dot {
    border-color: var(--accent-cyan);
    background-color: #000;
}

.timeline-item:hover .glowing-dot {
    background-color: var(--accent-cyan);
    box-shadow: 0 0 20px var(--accent-cyan);
}

.neon-year {
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
}

.modern-era .key-figures {
    color: var(--accent-purple);
}

.active-border:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 10px 40px var(--glow-primary);
}

.special-glass {
    background: linear-gradient(135deg, rgba(88, 28, 135, 0.2), rgba(15, 23, 42, 0.4));
}

.glowing-text {
    color: var(--accent-cyan);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.ultimate-year {
    color: #fff;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
    box-shadow: 0 0 15px var(--glow-secondary);
    border: none;
}

.ultimate-glass {
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.pulsating-dot {
    border-color: var(--accent-purple);
    background-color: var(--accent-purple);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(139, 92, 246, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    }
}

/* --- Interactive Animation Classes (Triggered via JS) --- */

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s ease-out;
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Upon Interaction Observer intersection, we add the 'show' class */
.show {
    opacity: 1;
    transform: translate(0);
}


/* --- Footer --- */
.snap-footer {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    background-color: rgba(0, 0, 0, 0.2);
    /* Snapping */
    scroll-snap-align: end;
    scroll-snap-stop: always;
}

/* --- Interactive Source Links --- */
.source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--accent-cyan);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(6, 182, 212, 0.05);
    border: 1px solid rgba(6, 182, 212, 0.2);
    transition: all 0.3s ease;
    font-weight: 600;
}

.source-link svg {
    transition: transform 0.3s ease;
}

.source-link:hover {
    background: rgba(6, 182, 212, 0.15);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
    color: #fff;
}

.source-link:hover svg {
    transform: translateX(3px) translateY(-3px);
}

.winter-era .source-link {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.05);
    border-color: rgba(148, 163, 184, 0.2);
}

.winter-era .source-link:hover {
    color: #fff;
    background: rgba(148, 163, 184, 0.2);
    box-shadow: 0 0 10px rgba(148, 163, 184, 0.3);
}


/* --- Responsive Adjustments --- */
@media screen and (max-width: 900px) {
    .title {
        font-size: 3rem;
    }

    .subtitle {
        font-size: 1.25rem;
    }

    .timeline-line {
        left: 30px;
        /* Move line to left side */
        transform: none;
    }

    .timeline-item {
        width: 100%;
        left: 0 !important;
        /* Force all to left side essentially */
        padding-left: 80px !important;
        /* Make room for the line on the left */
        padding-right: 0 !important;
    }

    /* Fix dot positions to align with the new left-aligned line */
    .timeline-dot {
        left: 20px !important;
        right: auto !important;
        /* 30px (line pos) - 10px (half dot size) */
    }

    /* Make both left and right cards slide in from the correct direction now */
    .slide-in-right,
    .slide-in-left {
        transform: translateX(50px);
    }

    .slide-in-right.show,
    .slide-in-left.show {
        transform: translate(0);
    }
}

/* --- References section --- */
.references-section {
    scroll-snap-align: start;
    scroll-snap-stop: always;
}