/* ============================================
   HISTÓRIA - SCROLLYTELLING TIMELINE
   ============================================ */

/* Base Styles */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Hero Section */
.timeline-hero {
    /* Adjusted to appear below fixed header (50px top-header + 100px navbar) */
    margin-top: 150px;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1f2b3b 0%, #2c3e50 100%);
    position: relative;
    overflow: hidden;
}

.timeline-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
            radial-gradient(circle at 20% 50%, rgba(239, 54, 45, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 80% 80%, rgba(249, 79, 27, 0.1) 0%, transparent 50%);
    animation: pulseBackground 15s ease-in-out infinite;
}

@keyframes pulseBackground {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.hero-content {
    text-align: center;
    z-index: 1;
    color: #f4f3f0;
    padding: 0 20px;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--pomegranate), color-mix(in srgb, var(--pomegranate) 85%, #000 15%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 300;
    margin-bottom: 60px;
    opacity: 0.9;
}

.scroll-indicator {
    font-size: 2rem;
    color: var(--pomegranate);
    cursor: pointer;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(15px); }
}

.hero-logo {
    margin-top: 40px;
    opacity: 0.95;
}

.hero-logo img {
    max-width: 300px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.hero-logo img:hover {
    transform: scale(1.05);
}

/* Timeline Container */
#timeline-wrapper {
    position: relative;
    width: 100%;
    background: #f4f3f0;
}

#timeline-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 100px 20px;
    min-height: 400vh;
    isolation: isolate; /* Create stacking context */
}

/* SVG Timeline Path */
#timeline-path {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    overflow: visible;
    opacity: 1 !important;
    /* Will be positioned by JavaScript to match milestones */
}

#background-path {
    stroke-width: 3;
    opacity: 1;
}

#main-path {
    stroke-width: 3;
    filter: drop-shadow(0 0 8px rgba(239, 54, 45, 0.4));
    opacity: 1;
}

/* Milestone Sections */
.milestone {
    position: relative;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
    padding: 80px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Layout for LEFT side (year on left, content on right) */
.milestone[data-side="left"] {
    grid-template-areas: "year content";
}

.milestone[data-side="left"] .milestone-year {
    grid-area: year;
    justify-self: end;
    text-align: right;
    padding-right: 40px;
}

.milestone[data-side="left"] .milestone-content {
    grid-area: content;
    justify-self: start;
    padding-left: 40px;
}

/* Layout for RIGHT side (content on left, year on right) */
.milestone[data-side="right"] {
    grid-template-areas: "content year";
}

.milestone[data-side="right"] .milestone-year {
    grid-area: year;
    justify-self: start;
    text-align: left;
    padding-left: 40px;
}

.milestone[data-side="right"] .milestone-content {
    grid-area: content;
    justify-self: end;
    padding-right: 40px;
}

/* Milestone Year Styling */
.milestone-year {
    display: flex;
    align-items: center;
}

.year-number {
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -2px;
    transition: all 0.3s ease;
    position: relative;
    background: linear-gradient(180deg, currentColor 0%, currentColor 70%, transparent 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: var(--pomegranate); /* base cor dinâmica para transição */
}

/* Different colors for each year with fade effect */
.year-number[data-year="1985"] {
    color: var(--pomegranate); /* tom base */
}

.year-number[data-year="1990"] {
    color: color-mix(in srgb, var(--pomegranate) 85%, white 15%); /* ligeiramente mais claro */
}

.year-number[data-year="1995"] {
    color: color-mix(in srgb, var(--pomegranate) 65%, white 35%); /* pastel */
}

.year-number[data-year="2000"] {
    color: color-mix(in srgb, var(--pomegranate) 75%, white 25%); /* tom médio claro */
}

.year-number[data-year="2005"] {
    color: color-mix(in srgb, var(--pomegranate) 70%, white 30%); /* quente claro */
}

.year-number[data-year="2010"] {
    color: color-mix(in srgb, var(--pomegranate) 90%, white 10%); /* quase original */
}

.year-number[data-year="2015"] {
    color: color-mix(in srgb, var(--pomegranate) 80%, black 20%); /* ligeiramente mais escuro */
}

.year-number[data-year="2020"] {
    color: color-mix(in srgb, var(--pomegranate) 55%, white 45%); /* bem claro */
}

.year-number[data-year="2024"] {
    color: color-mix(in srgb, var(--pomegranate) 88%, black 12%); /* subtilmente profundo */
}

/* Content Styling */
.milestone-content {
    width: 100%;
    max-width: 600px;
    position: relative;
}

.milestone-content:hover .milestone-title {
    color: var(--pomegranate);
}

/* Milestone Title */
.milestone-title {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 700;
    color: #1f2b3b;
    margin-bottom: 20px;
    line-height: 1.3;
    transition: color 0.3s ease;
}

/* Milestone Description */
.milestone-description {
    font-size: 1rem;
    line-height: 1.7;
    color: #5d656f;
    margin-bottom: 30px;
}

/* Milestone Images */
.milestone-image {
    width: 100%;
    margin-top: 30px;
    border-radius: 15px;
    overflow: hidden;
}

.milestone-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.milestone-content:hover .milestone-image img {
    transform: scale(1.05);
}

/* Statistics */
.milestone-stats {
    display: flex;
    gap: 30px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.stat-item {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #1f2b3b 0%, #2c3e50 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(31, 43, 59, 0.2);
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--pomegranate);
    margin-bottom: 5px;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #f4f3f0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Highlights/Badges */
.milestone-highlights {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 25px;
}

.highlight-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--pomegranate), color-mix(in srgb, var(--pomegranate) 85%, #000 15%));
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(239, 54, 45, 0.3);
    transition: all 0.3s ease;
}

.highlight-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 54, 45, 0.4);
}

/* Icons */
.milestone-icons {
    display: flex;
    gap: 25px;
    margin-top: 30px;
    justify-content: center;
}

.milestone-icons i {
    font-size: 3rem;
    color: var(--pomegranate);
    transition: transform 0.3s ease;
}

.milestone-icons i:hover {
    transform: scale(1.2) rotate(5deg);
}

/* Timeline End Section */
.timeline-end {
    text-align: center;
    padding: 100px 20px;
    background: linear-gradient(135deg, #1f2b3b 0%, #2c3e50 100%);
    border-radius: 20px;
    margin-top: 100px;
    color: #f4f3f0;
}

.timeline-end h2 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 20px;
}

.timeline-end p {
    font-size: 1.3rem;
    margin-bottom: 40px;
    opacity: 0.9;
}

.cta-button {
    display: inline-block;
    background: linear-gradient(135deg, var(--pomegranate), color-mix(in srgb, var(--pomegranate) 85%, #000 15%));
    color: white;
    padding: 18px 45px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 25px rgba(239, 54, 45, 0.4);
    transition: all 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px color-mix(in srgb, var(--pomegranate) 60%, transparent);
}

/* Responsive Design */
@media (max-width: 1200px) {
    #timeline-container {
        padding: 80px 40px;
    }

    .milestone {
        gap: 60px;
        padding: 60px 30px;
    }

    .milestone[data-side="left"] .milestone-year,
    .milestone[data-side="right"] .milestone-year {
        padding-left: 30px;
        padding-right: 30px;
    }

    .milestone[data-side="left"] .milestone-content,
    .milestone[data-side="right"] .milestone-content {
        padding-left: 30px;
        padding-right: 30px;
    }

    .milestone-content {
        max-width: 500px;
    }

    .year-number {
        font-size: clamp(3.5rem, 8vw, 6rem);
    }
}

@media (max-width: 768px) {
    #timeline-path {
        width: 60px;
    }

    #timeline-container {
        padding: 60px 20px;
    }

    .milestone {
        min-height: auto;
        padding: 60px 20px;
        grid-template-columns: 1fr;
        gap: 30px;
    }

    /* Stack year above content on mobile */
    .milestone[data-side="left"],
    .milestone[data-side="right"] {
        grid-template-areas:
            "year"
            "content";
    }

    .milestone[data-side="left"] .milestone-year,
    .milestone[data-side="right"] .milestone-year {
        justify-self: center;
        text-align: center;
        padding: 0;
    }

    .milestone[data-side="left"] .milestone-content,
    .milestone[data-side="right"] .milestone-content {
        justify-self: center;
        padding: 0;
        max-width: 100%;
    }

    .year-number {
        font-size: clamp(3rem, 12vw, 5rem);
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .milestone-title {
        font-size: 1.8rem;
    }

    .milestone-description {
        font-size: 1rem;
    }

    .milestone-stats {
        gap: 15px;
    }

    .stat-item {
        min-width: 100px;
        padding: 15px;
    }

    .stat-number {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .milestone-icons i {
        font-size: 2.5rem;
    }

    .timeline-end {
        padding: 60px 20px;
        margin-top: 60px;
    }
}

@media (max-width: 480px) {
    .milestone {
        padding: 40px 15px;
        gap: 20px;
    }

    .year-number {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }

    .milestone-title {
        font-size: 1.5rem;
    }

    .milestone-description {
        font-size: 0.95rem;
    }

    .milestone-stats {
        flex-direction: column;
    }

    .stat-item {
        width: 100%;
    }

    .milestone-icons {
        gap: 20px;
    }

    .milestone-icons i {
        font-size: 2rem;
    }

    .highlight-badge {
        font-size: 0.8rem;
        padding: 8px 16px;
    }
}

/* Responsive video wrapper to preserve aspect ratio and avoid fixed pixel height */
.video-wrapper {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    overflow: hidden; /* prevent visual overflow and ensure spacer controls height */
}

/* Fallback container spacer for browsers that don't support aspect-ratio */
.video-wrapper::before {
    content: "";
    display: block;
    padding-top: 56.25%; /* 16:9 */
}

/* Default: fill the spacer using absolute positioning (fallback) */
.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    background: transparent !important;
}

/* Prefer browsers that support aspect-ratio: let iframe be in normal flow and use aspect-ratio */
@supports (aspect-ratio: 16/9) {
    .video-wrapper::before { display: none; }
    .video-wrapper iframe {
        position: static !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16/9 !important;
    }
}

/* Extra high-specificity fallback to make sure the iframe stays 16:9 inside the hero */
.timeline-hero.has-video .video-wrapper iframe,
.timeline-hero .video-wrapper iframe {
    -webkit-box-sizing: border-box !important;
    box-sizing: border-box !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16/9 !important;
    max-height: none !important;
    background: transparent !important;
}

/* When a hero section contains a video, let it size to content rather than fixed 100vh minus header.
   This prevents the footer overlapping or cutting the iframe on some viewports. */
.timeline-hero:has(.video-wrapper),
.timeline-hero.has-video {
    height: auto;
    min-height: 60vh;
    padding: 60px 0 120px; /* extra bottom padding so footer doesn't overlap */
}

/* Adjustments for smaller screens */
@media (max-width: 768px) {
    /* no fixed padding here; aspect-ratio or fallback spacer covers sizing */

    .timeline-hero:has(.video-wrapper),
    .timeline-hero.has-video {
        padding-bottom: 80px;
    }
}

/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .scroll-indicator {
        animation: none;
    }
}

/* Print Styles */
@media print {
    #timeline-path {
        display: none;
    }

    .milestone-content {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .timeline-hero,
    .scroll-indicator {
        display: none;
    }
}
