/* timeline.css */
:root {
    --negro: #1a1a1a;
    --amarillo-mostaza: #D9B206;
    --amarillo-mostaza-oscuro: #C9A400;
    --amarillo-mostaza-claro: #F7DC6F;
    --gris-suave: #f5f5f5;
    --sombra-suave: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#body {
    font-family: 'Roboto', sans-serif;
    overflow-x: hidden;
    background-color: var(--gris-suave);
    border-radius: 10px;
    padding: 30px;
}

/* .timeline-section {
    position: relative;
    background-color: var(--gris-suave);
    background-image: url('https://via.placeholder.com/1500x800');
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    background-color: rgba(245, 245, 245, 0.8);
} */

.timeline-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.timeline {
    display: flex;
    position: relative;
    transition: transform 0.6s ease-out;
    gap: 40px;
    padding: 40px 0;
}

/* .timeline::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: var(--amarillo-mostaza);
    transform: translateY(-50%);
    z-index: 0;
    border-radius: 3px;
    box-shadow: var(--sombra-suave);
} */

.timeline-item {
    flex: 0 0 auto;
    width: 320px;
    min-width: 250px;
    position: relative;
    opacity: 1; /* Forzado a visible inicialmente */
    transform: translateY(0); /* Elimina la animación inicial hasta que funcione */
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--amarillo-mostaza-claro);
    border: 4px solid var(--amarillo-mostaza);
    border-radius: 50%;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    z-index: 1;
    box-shadow: var(--sombra-suave);
    transition: transform 0.3s ease;
}

.timeline-item:hover::after {
    transform: translate(-50%, -50%) scale(1.2);
}

.timeline-year {
    position: absolute;
    top: -30px;
    left: 0;
    transform: translateX(130%);
    font-size: 1.3em;
    font-weight: 700;
    color: var(--negro);
    background-color: var(--amarillo-mostaza-claro);
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 2;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.timeline-card {
    perspective: 1000px;
    cursor: pointer;
    margin-top: 30px;
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid var(--amarillo-mostaza-claro);
    height: 400px; /* Altura fija para asegurar visibilidad */
}

.timeline-card .card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    transition: transform 0.6s ease;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: var(--sombra-suave);
}

.timeline-card .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    border-radius: 12px;
    transition: transform 0.6s ease;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: var(--sombra-suave);
    z-index: 1;
}

.timeline-card .card-front {
    z-index: 2;
}

.timeline-card .card-back {
    transform: rotateY(180deg);
}

.timeline-card.flipped .card-front {
    transform: rotateY(180deg);
}

.timeline-card.flipped .card-back {
    transform: rotateY(0deg);
}

.card-overlay {
    background-color: rgba(0, 0, 0, 0.1); /* Opacidad para legibilidad sobre la imagen */
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: end;
    align-items: center;
    padding: 5px;
    border-radius: 12px;
}

.card-icon {
    font-size: 2em;
    color: var(--amarillo-mostaza-oscuro);
    margin-bottom: 15px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.card-front h2 {
    margin: 10px 0;
    font-size: 1.7em;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.card-front p {
    margin: 0;
    font-size: 1.1em;
    color: #ffffff;
    line-height: 1.6;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.card-back p {
    margin: 0 0 20px;
    font-size: 1em;
    line-height: 1.7;
    color: #555;
    flex-grow: 1;
    overflow-y: auto;
}

.close-button {
    padding: 12px 25px;
    background-color: var(--negro);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s ease, transform 0.2s ease;
    align-self: center;
}

.close-button:hover {
    background-color: var(--amarillo-mostaza);
    transform: scale(1.1);
}

.nav-buttons {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    z-index: 10;
    padding: 0 15px;
}

.nav-button {
    background-color: var(--amarillo-mostaza);
    color: var(--negro);
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.8em;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: var(--sombra-suave);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-button:hover {
    background-color: var(--amarillo-mostaza-oscuro);
    transform: scale(1.15);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.nav-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Media Queries para responsividad */
@media screen and (max-width: 1024px) {
    .timeline-item {
        width: 280px;
        min-width: 220px;
    }
    .nav-button {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
    }
}

@media screen and (max-width: 768px) {
    .timeline-item {
        width: 90%;
        min-width: 200px;
    }
    .timeline-card {
        height: 350px;
    }
    .nav-buttons {
        top: auto;
        bottom: -70px;
        transform: none;
    }
    .timeline-year {
        font-size: 1.2em;
        top: -45px;
    }
}

@media screen and (max-width: 480px) {
    .timeline-item {
        width: 90%;
        min-width: 180px;
    }
    .timeline-card {
        height: 320px;
    }
    .nav-buttons {
        bottom: -60px;
    }
    .timeline-year {
        font-size: 1.1em;
        top: -40px;
    }
    .card-front h2 {
        font-size: 1.5em;
    }
    .card-front p {
        font-size: 1em;
    }
    .nav-button {
        width: 45px;
        height: 45px;
        font-size: 1.3em;
    }
}