/* ============================================
   COMPONENT STYLES
   ============================================ */

/* Hero Section */
.hero-section {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.hero-background {
    position: absolute;
    top: -10%;
    left: 0;
    width: 100%;
    height: 120%;
    z-index: 1;
    will-change: transform;
    transition: transform 0.3s ease-out;
}

.hero-background video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.4);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.hero-text {
    color: white;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.tech-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px);
    z-index: 2;
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-20px); }
    60% { transform: translateX(-50%) translateY(-10px); }
}

/* Ecosystem Gallery */
.ecosystem-gallery {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.ecosystem-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    z-index: 10;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

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

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #303384, #D2352D);
}

.timeline-item {
    position: relative;
    margin: 2rem 0;
    display: flex;
    align-items: center;
}

.timeline-item:nth-child(odd) {
    flex-direction: row-reverse;
}

.timeline-content {
    flex: 1;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.timeline-caption {
    opacity: 1 !important;
    visibility: visible !important;
}

.timeline-dot {
    width: 20px;
    height: 20px;
    background: #303384;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid white;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.5);
}

/* Cards */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.image-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    height: 250px;
    cursor: pointer;
    transition: transform 0.3s;
}

.image-card:hover {
    transform: scale(1.05);
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    color: white;
}

/* Tax Benefit Banner */
.tax-benefit-banner {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    padding: 1.5rem;
    border-radius: 16px;
    margin: 2rem 0;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

/* Section Transitions */
.section-transition {
    height: 100px;
    position: relative;
    overflow: hidden;
}

.section-transition svg {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100px;
}

/* Animation Classes */
.simple-fade {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.simple-fade-visible {
    opacity: 1;
}

.simple-slide {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.simple-slide-visible {
    opacity: 1;
    transform: translateY(0);
}

.simple-slide-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.8s ease;
}

.simple-slide-left-visible {
    opacity: 1;
    transform: translateX(0);
}

.simple-slide-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.8s ease;
}

.simple-slide-right-visible {
    opacity: 1;
    transform: translateX(0);
}

.simple-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s ease;
}

.simple-scale-visible {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   TIMELINE STYLES (extracted from inline)
   ============================================ */

/* Modern Three-Stage Timeline Animation */
.full-timeline-new {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #1a1b4b; /* Dark blue fallback */
}

.timeline-section {
    position: relative;
    width: 100%;
    height: 100vh; /* Full viewport height */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1b4b; /* Dark blue fallback to prevent gaps */
    margin: 0;
    padding: 0;
}

.timeline-image-container {
    position: sticky;
    top: 0; /* Full screen from top */
    width: 100vw; /* Full viewport width */
    height: 100vh; /* Full viewport height */
    overflow: hidden; /* Prevent clipping issues */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: auto; /* Let natural stacking order work */
    left: 0;
    right: 0;
    isolation: isolate; /* Create new stacking context */
    background: #1a1b4b; /* Dark blue fallback */
}

.timeline-image-fullwidth {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    will-change: opacity;
    transition: none; /* Instant updates for smoother scrolling */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1b4b; /* Dark blue fallback */
}

.timeline-image-fullwidth img {
    width: 100vw;
    height: 100vh;
    min-width: 100vw;
    min-height: 100vh;
    object-fit: cover;
    object-position: center;
    transform: none;
    will-change: opacity;
    transition: opacity 0.3s linear;
}

/* Dynamic sizing for different aspect ratios */
@media (min-aspect-ratio: 16/9) {
    /* Wide screens - use height to fill */
    .timeline-image-fullwidth img {
        width: auto;
        height: 100vh;
        min-width: 100vw;
        min-height: 100vh;
    }
}

@media (max-aspect-ratio: 9/16) {
    /* Tall screens/mobile portrait - use width to fill */
    .timeline-image-fullwidth img {
        width: 100vw;
        height: auto;
        min-width: 100vw;
        min-height: 100vh;
    }
}

@media (max-aspect-ratio: 3/4) and (min-aspect-ratio: 9/16) {
    /* Tablet portrait */
    .timeline-image-fullwidth img {
        width: 100vw;
        height: auto;
        min-width: 100vw;
        min-height: 100vh;
    }
}

.timeline-caption {
    position: absolute;
    bottom: 5%; /* Moved to lower bottom */
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 1 !important;
    visibility: visible !important;
    will-change: opacity, transform, visibility;
    transition: none; /* Instant updates */
    z-index: 10; /* Lower z-index for proper layering */
    max-width: 600px; /* Smaller max width */
    background: rgba(0, 0, 0, 0.6); /* Dark transparent background */
    padding: 1.5rem; /* Smaller padding */
    border-radius: 15px;
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    pointer-events: none; /* Prevent blocking interactions when hidden */
}

.timeline-caption.visible {
    pointer-events: auto; /* Enable interactions when visible */
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-20px);
    transition: none; /* Instant updates */
}

.timeline-year-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: linear-gradient(135deg, #303384, #4A4FA8);
    color: white;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem; /* Smaller font */
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 15px rgba(48, 51, 132, 0.3);
}

.timeline-caption h4 {
    color: #ffffff; /* White text for dark background */
    font-size: 1.75rem; /* Smaller heading */
    margin-bottom: 0.4rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.timeline-date {
    color: #FF6B6B; /* Lighter red for dark background */
    font-weight: 600;
    font-size: 0.9rem; /* Smaller date */
    margin-bottom: 0.75rem;
}

.timeline-description {
    color: #E5E5E5; /* Light gray for dark background */
    line-height: 1.6;
    font-size: 0.95rem; /* Smaller description */
    max-width: 500px;
    margin: 0 auto;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Full width images with crossfade transitions */
.timeline-image-container[data-stage="fullscreen"] .timeline-image-fullwidth {
    width: 100%;
    height: 100%;
    opacity: 1; /* Fully visible when entering viewport */
    border-radius: 0;
    box-shadow: none;
}

.timeline-image-container[data-stage="transition-to-freed"] .timeline-image-fullwidth {
    width: 100%;
    height: 100%;
    opacity: 0.95; /* Almost fully visible */
    border-radius: 0;
    box-shadow: none;
}

.timeline-image-container[data-stage="freed"] .timeline-image-fullwidth {
    width: 100%;
    height: 100%;
    opacity: 1; /* Fully visible */
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.timeline-image-container[data-stage="transition-to-shrink"] .timeline-image-fullwidth {
    width: 100%;
    height: 100%;
    opacity: 0.9; /* Still very visible - slow fade */
    border-radius: 0;
    box-shadow: none;
}

.timeline-image-container[data-stage="shrink"] .timeline-image-fullwidth {
    width: 100%;
    height: 100%;
    opacity: 0.3; /* Still partially visible even at end */
    border-radius: 0;
    overflow: hidden;
}

.timeline-image-container[data-stage="shrink"] .timeline-caption {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}

.timeline-image-container[data-stage="transition-to-shrink"] .timeline-caption {
    opacity: 0.3;
    transform: translateX(-50%) translateY(10px);
}

.timeline-image-container[data-stage="transition-to-freed"] .timeline-caption {
    opacity: 0.5;
    transform: translateX(-50%) translateY(-10px);
}

/* Parallax zoom effect on scroll */
.timeline-image-fullwidth[data-scroll-scale] img {
    transform: scale(var(--scale, 1.5));
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .timeline-section {
        height: 100vh; /* Keep full height on mobile */
        min-height: 100vh;
    }

    .timeline-image-fullwidth img {
        width: 100vw;
        height: 100vh;
        min-width: 100vw;
        min-height: 100vh;
        object-fit: cover;
    }

    .timeline-content-overlay {
        transform: translateX(0);
        margin: 0 1rem;
        padding: 2rem;
        max-width: 90%;
    }

    .timeline-content-overlay.align-right {
        transform: translateX(0);
    }

    .timeline-content-overlay h4 {
        font-size: 1.5rem;
    }

    .timeline-description {
        font-size: 1rem;
    }
}

.timeline-image-wrapper img {
    transform-origin: center center;
    transition: transform 0.3s ease-out;
    will-change: transform;
    display: block;
    width: 100%;
    height: auto;
}

/* Ensure timeline cards can handle expanding images */
.timeline-card {
    overflow: visible;
    z-index: 1;
    position: relative;
}

/* Higher z-index for expanded images */
.timeline-image-wrapper:hover {
    z-index: 10;
}

@supports (animation-timeline: scroll()) {
    .timeline-main-title {
        animation: titleParallax linear;
        animation-timeline: scroll();
        animation-range: 0% 30%;
    }

    @keyframes titleParallax {
        from {
            transform: translateY(0) scale(1);
            opacity: 1;
        }
        to {
            transform: translateY(-50px) scale(0.95);
            opacity: 0.3;
        }
    }

    /* Each timeline image expands when in center of viewport */
    /* Disabled to use JavaScript implementation instead
    .timeline-image-wrapper {
        animation: imageExpandShrink linear;
        animation-timeline: view();
        animation-range: entry 0% exit 100%;
    }
    */

    @keyframes imageExpandShrink {
        0% {
            transform: scale(0.3);
            opacity: 0.3;
            filter: blur(5px);
        }
        20% {
            transform: scale(0.6);
            opacity: 0.6;
            filter: blur(2px);
        }
        40% {
            transform: scale(0.9);
            opacity: 0.9;
            filter: blur(0px);
        }
        50% {
            /* Peak expansion when centered in viewport */
            transform: scale(1.2);
            opacity: 1;
            filter: blur(0px) brightness(1.1);
            box-shadow: 0 20px 40px rgba(0,0,0,0.3);
        }
        60% {
            transform: scale(0.9);
            opacity: 0.9;
            filter: blur(0px);
        }
        80% {
            transform: scale(0.6);
            opacity: 0.6;
            filter: blur(2px);
        }
        100% {
            transform: scale(0.3);
            opacity: 0.3;
            filter: blur(5px);
        }
    }

    /* Alternative smoother version for timeline containers */
    .timeline-container {
        animation: containerPulse linear;
        animation-timeline: view();
        animation-range: entry -20% exit 120%;
    }

    @keyframes containerPulse {
        0% {
            transform: scale(0.95);
            opacity: 0.7;
        }
        50% {
            transform: scale(1.05);
            opacity: 1;
        }
        100% {
            transform: scale(0.95);
            opacity: 0.7;
        }
    }

    .timeline-year {
        animation: yearPulse linear;
        animation-timeline: view();
        animation-range: entry 20% cover 50%;
    }

    @keyframes yearPulse {
        0% {
            transform: scale(0.5) rotate(-10deg);
            opacity: 0;
        }
        50% {
            transform: scale(1.1) rotate(5deg);
        }
        100% {
            transform: scale(1) rotate(0deg);
            opacity: 1;
        }
    }
}

/* Fallback animations for browsers without scroll-timeline support */
@supports not (animation-timeline: scroll()) {
    .timeline-container {
        opacity: 0;
        transform: translateY(30px);
        transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .timeline-container.animate-in {
        opacity: 1;
        transform: translateY(0);
    }

    .timeline-image-wrapper {
        opacity: 0;
        transform: scale(0.95);
        transition: all 0.6s ease 0.3s;
    }

    .timeline-container.animate-in .timeline-image-wrapper {
        opacity: 1;
        transform: scale(1);
    }

    .timeline-year {
        opacity: 0;
        transform: scale(0.8) rotate(-5deg);
        transition: all 0.5s ease;
    }

    .timeline-container.animate-in .timeline-year {
        opacity: 1;
        transform: scale(1) rotate(0);
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

.full-timeline {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    view-timeline-name: --timeline;
    view-timeline-axis: block;
}

.full-timeline::before {
    content: '';
    position: absolute;
    width: 10px;
    background: linear-gradient(to bottom,
        #ffffff 0%,
        #e0e0ff 15%,
        #c0c0ff 30%,
        #8080cc 45%,
        #5050aa 60%,
        #303384 75%,
        #1a1a4e 85%,
        #0f0f3a 100%);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -5px;
    z-index: 0;
    box-shadow: 0 0 20px rgba(255,255,255,0.3), 0 0 10px rgba(0,0,0,0.2);
    border-radius: 5px;
    transform-origin: top center;
}

/* Animated glow effect on timeline */
.full-timeline::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 100px;
    background: radial-gradient(ellipse at center, rgba(255,215,0,0.8) 0%, transparent 70%);
    left: 50%;
    margin-left: -10px;
    top: 0;
    z-index: 1;
    pointer-events: none;
    animation: glowMove 15s linear infinite;
}

@keyframes glowMove {
    from {
        top: -50px;
    }
    to {
        top: 100%;
    }
}

.timeline-container {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
}

.timeline-container::after {
    content: '';
    position: absolute;
    width: 35px;
    height: 35px;
    right: -22px;
    background-color: white;
    border: 6px solid;
    top: 20px;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Inverted border colors for circles based on position */
.timeline-container:nth-child(1)::after { border-color: #ffffff; }
.timeline-container:nth-child(2)::after { border-color: #e0e0ff; }
.timeline-container:nth-child(3)::after { border-color: #b0b0dd; }
.timeline-container:nth-child(4)::after { border-color: #8080cc; }
.timeline-container:nth-child(5)::after { border-color: #5050aa; }
.timeline-container:nth-child(6)::after { border-color: #303384; }
.timeline-container:nth-child(7)::after { border-color: #1a1a4e; }
.timeline-container:nth-child(8)::after { border-color: #0f0f3a; }

.left {
    left: 0;
}

.right {
    left: 50%;
}

.left::before {
    content: " ";
    height: 0;
    position: absolute;
    top: 22px;
    width: 0;
    z-index: 1;
    right: 30px;
    border: medium solid white;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent white;
}

.right::before {
    content: " ";
    height: 0;
    position: absolute;
    top: 22px;
    width: 0;
    z-index: 1;
    left: 30px;
    border: medium solid white;
    border-width: 10px 10px 10px 0;
    border-color: transparent white transparent transparent;
}

.right::after {
    left: -22px;
}

.timeline-card {
    padding: 20px 30px;
    background-color: white;
    position: relative;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.timeline-year {
    position: absolute;
    top: -15px;
    padding: 8px 20px;
    background: linear-gradient(135deg, #303384, #4A4FA8);
    color: white;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    z-index: 3;
}

@media screen and (max-width: 768px) {
    .simple-timeline::after {
        left: 31px;
    }

    .timeline-container {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }

    .timeline-container::before {
        left: 60px;
        border: medium solid white;
        border-width: 10px 10px 10px 0;
        border-color: transparent white transparent transparent;
    }

    .left::after, .right::after {
        left: 15px;
    }

    .right {
        left: 0%;
    }
}