/* ==========================================================================
   Timeline — Trajetória Latitud (Sobre)
   ========================================================================== */

.timeline {
    background-color: #181D27;
    padding: 96px 0 64px;
    /* Cultura agora termina reta (sem clip-path) — timeline começa logo abaixo sem overlap */
    /* Evita scroll horizontal em telas médias quando a foto da direita transborda o container */
    overflow-x: clip;
}

.timeline__inner {
    position: relative;
}

/* ===== Content (texto + imagem) ===== */

.timeline__content {
    display: flex;
    align-items: flex-start;
    gap: 64px;
    margin-bottom: 64px;
}

/* Texto */

.timeline__text {
    flex: 1;
    min-width: 0;
    max-width: 590px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.timeline__text--exiting {
    opacity: 0;
    transform: translateY(10px);
}

.timeline__text--entering {
    opacity: 0;
    transform: translateY(20px);
}

/* Label do ano (estilo cultura) */
.timeline__label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-text);
    font-weight: 400;
    font-size: var(--fs-label);
    line-height: 1.7;
    letter-spacing: -0.01em;
    color: #FAFAFA;
}

.timeline__line {
    display: inline-block;
    width: 71px;
    height: 0;
    border-top: 1px solid var(--color-primary);
    flex-shrink: 0;
}

.timeline__title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: var(--fs-section-lg);
    line-height: 1.19;
    color: #FFFFFF;
}

.timeline__description {
    font-family: var(--font-text);
    font-weight: 400;
    font-size: var(--fs-body-lg);
    line-height: 1.7;
    letter-spacing: -0.01em;
    color: #FFFFFF;
}

/* Imagem */

.timeline__images {
    flex: 0 0 auto;
    position: relative;
    width: clamp(340px, 40vw, 460px);
    aspect-ratio: 540.564 / 547.127;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.timeline__images--exiting {
    opacity: 0;
    transform: translateX(10px);
}

.timeline__images--entering {
    opacity: 0;
    transform: translateX(20px);
}

/* Cada foto = uma caixa posicionada. A moldura (::before) e a imagem usam a
   MESMA caixa/proporção, então o corte diagonal da moldura bate exatamente com
   o da foto. A moldura fica levemente maior (inset negativo) para "espiar". */
.timeline__photo {
    position: absolute;
}

.timeline__photo::before {
    content: '';
    position: absolute;
    inset: -4%;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    pointer-events: none;
    z-index: 0;
}

.timeline__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    z-index: 1;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* Principal (esquerda) — chanfro superior esquerdo, atrás */
.timeline__photo--main {
    left: 5.5%;
    top: 5.54%;
    width: 72.05%;
    height: 77.87%;
    z-index: 1;
}

.timeline__photo--main::before {
    background-image: url('../images/timeline/timeline-frame-left.svg');
}

.timeline__img--main {
    -webkit-mask-image: url('../images/timeline/timeline-mask-left.svg');
    mask-image: url('../images/timeline/timeline-mask-left.svg');
}

/* Secundária (direita) — chanfro inferior direito, à frente */
.timeline__photo--sec {
    left: 56.96%;
    top: 22.75%;
    width: 58.07%;
    height: 72.31%;
    z-index: 2;
}

.timeline__photo--sec::before {
    background-image: url('../images/timeline/timeline-frame-right.svg');
}

.timeline__img--sec {
    -webkit-mask-image: url('../images/timeline/timeline-mask-right.svg');
    mask-image: url('../images/timeline/timeline-mask-right.svg');
}

/* ===== Nav — Blocos ===== */

.timeline__nav {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.timeline__blocks {
    display: flex;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

/* Container dos botões prev/next — oculto por padrão (só aparece no mobile) */
.timeline__nav-controls {
    display: none;
    gap: 20px;
    align-items: center;
    justify-content: center;
}

/* Dots de paginação entre prev/next (mobile) — ativo branco 12px, inativo branco 40% 10px */
.timeline__dots {
    display: flex;
    align-items: center;
    gap: 11px;
}

.timeline__dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition-fast), width 0.2s ease, height 0.2s ease;
}

.timeline__dot--active {
    width: 12px;
    height: 12px;
    background: #FFFFFF;
}

/* Botões prev/next — pill com cores dinâmicas baseadas no estado */
.timeline__nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 96px;          /* Pill total */
    backdrop-filter: blur(2.937px);
    -webkit-backdrop-filter: blur(2.937px);
    cursor: pointer;
    flex-shrink: 0;
    /* Estado padrão: pode navegar pra essa direção (azul escuro) */
    background: #1F3A5F;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform 0.15s ease-out;
}

/* Feedback de clique — scale 0.9 no :active, volta suavemente pra 1 */
.timeline__nav-btn:active {
    transform: scale(0.9);
}


.timeline__block {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
}

.timeline__block-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.timeline__block-year {
    width: 100%;
    font-family: var(--font-text);
    font-weight: 400;
    font-size: var(--fs-label);
    line-height: 1.7;
    letter-spacing: -0.01em;
    text-align: center;
    color: #FFFFFF;
    transition: color 0.3s ease, font-weight 0.3s ease;
}

.timeline__block--active .timeline__block-year {
    color: var(--color-primary);
    font-weight: 500;
}

.timeline__block-label {
    width: 100%;
    font-family: var(--font-text);
    font-weight: 400;
    font-size: var(--fs-body-sm);
    line-height: 1.21;
    letter-spacing: -0.01em;
    text-align: center;
    color: #FFFFFF;
    transition: color 0.3s ease;
}

.timeline__block--active .timeline__block-label {
    color: var(--color-primary);
}

/* Track e barra de progresso */
.timeline__block-track {
    position: relative;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 29px;
    overflow: hidden;
}

.timeline__block-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--color-primary);
    border-radius: 29px;
}

/* Past items (não-ativo, mas já passou): barra branca cheia */
.timeline__block--filled:not(.timeline__block--active) .timeline__block-bar {
    width: 100%;
    background: rgba(255, 255, 255, 0.7);
}

/* Active item: laranja, animando do 0 ao 100% em 8s */
.timeline__block--active .timeline__block-bar {
    background: var(--color-primary);
    animation: timeline-fill 8s linear forwards;
}

@keyframes timeline-fill {
    from { width: 0%; }
    to   { width: 100%; }
}

/* Acessibilidade: usuários que preferem menos animação ficam com a barra cheia direta */
@media (prefers-reduced-motion: reduce) {
    .timeline__block--active .timeline__block-bar {
        animation: none;
        width: 100%;
    }
}

/* ===== Responsivo ===== */

/* Desktop menor: aproxima a composição (desloca as duas fotos para a esquerda,
   mantendo a separação) para a foto da direita não sair da janela. Mesmos
   breakpoints usados no restante do site (1280 / 1024). */
@media (max-width: 1280px) {
    .timeline__photo--main {
        left: 0.5%;
    }

    .timeline__photo--sec {
        left: 51.96%;
    }
}

@media (max-width: 1024px) {
    .timeline__photo--main {
        left: -4.5%;
    }

    .timeline__photo--sec {
        left: 47.96%;
    }
}

@media (max-width: 768px) {
    .timeline {
        padding: 56px 0 48px;
        /* Sem margin-top negativo — a seção de cima não tem mais clip-path no mobile. */
        margin-top: 0;
    }

    .timeline__content {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 40px;
    }

    .timeline__text {
        max-width: 100%;
        gap: 8px;
        /* Reserva espaço pra slide mais longo (2018) — evita "bump" ao trocar */
        min-height: 280px;
    }

    /* Foto acima do texto no mobile */
    .timeline__images {
        order: -1;
        width: 100%;
        max-width: 340px;
        margin: 0 auto;
    }

    /* Mobile: composição centrada, com mais separação entre as duas fotos
       (esquerda um pouco mais à esquerda, direita mais à direita). */
    .timeline__photo--main {
        left: -4.5%;
    }

    .timeline__photo--sec {
        left: 47.96%;
    }

    /* Scroll horizontal sem scrollbar visível — 1 bloco por vez (snap) */
    .timeline__blocks {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        cursor: grab;
    }

    .timeline__blocks.is-dragging {
        cursor: grabbing;
        scroll-behavior: auto;
    }

    .timeline__blocks::-webkit-scrollbar {
        display: none;
    }

    /* Nav vira coluna no mobile: blocos em cima, controles centralizados embaixo */
    .timeline__nav {
        flex-direction: column;
        gap: 24px;
    }

    /* Container dos botões prev/next aparece no mobile, centralizado */
    .timeline__nav-controls {
        display: flex;
        padding-top: 16px;
    }

    /* Largura fixa + fontes menores + altura padronizada pra 2 linhas de label,
       evitando o deslocamento quando "Estruturação da empresa" quebra em 2 linhas. */
    /* 1 barra por vez no mobile (cada bloco ocupa a largura toda) */
    .timeline__block {
        flex-shrink: 0;
        min-width: 100%;
        gap: 8px;
        scroll-snap-align: center;
    }

    .timeline__block-text {
        /* Altura fixa pra year (1 linha) + label (até 2 linhas) centralizados. */
        min-height: 56px;
        justify-content: center;
        align-items: center;
    }

    .timeline__block-label {
        /* Reserva espaço pra 2 linhas mesmo quando o label tem 1 linha —
           garante alinhamento vertical consistente entre todos os blocos. */
        min-height: calc(12px * 1.3 * 2);
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .timeline {
        padding: 48px 0 32px;
    }

    .timeline__content {
        gap: 16px;
        margin-bottom: 32px;
    }

    .timeline__images {
        max-width: 300px;
    }

    .timeline__block {
        min-width: 100%;
    }

    .timeline__block-track {
        height: 6px;
    }

    .timeline__nav-controls {
        gap: 24px;
    }
}
