@charset "utf-8";
/* CSS Document */

@font-face {
    font-family: 'LatoBlack';
    src: url("../fuentes/Lato-Black.ttf");
}

@font-face {
    font-family: 'LatoMedium';
    src: url("../fuentes/Lato-Medium.ttf");
}

@font-face {
    font-family: 'Cyborg';
    src: url("../fuentes/Cyborg.otf");
}

:root{
    --verdeoscuro: #0f1b0d;
    --verdemedio:  #548c33;
    --verdeclaro:  #72b62f;
}

/* CONTENEDOR GENERAL */
.timeline-wrapper{
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    padding: 2rem 0;
    min-height: 30rem;
}

/* BOTONES */
.timeline-btn{
    flex: 0 0 auto;
    background: var(--verdeoscuro);
    color: #fff;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    z-index: 10;
}
.timeline-btn:hover{
    background: var(--verdeclaro);
}

/* CARRIL PRINCIPAL */
.timeline{
    display: flex;
    gap: 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 0 6px;
    height: 30rem;
}
.timeline::-webkit-scrollbar{
    display: none;
}

.timeline{
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.timeline {
    overflow-x: auto;
    overflow-y: visible;
}

/* COLUMNA DE CADA AÑO */
.year-column{
    position: relative;
    min-width: 12rem;
    height: 30rem;
    padding: 0 10px;
    box-sizing: border-box;
    flex-shrink: 0;
    --color-year: #000; /* fallback */
}

.year-column .year-segment.verdeoscuro {
    background: var(--verdeoscuro);
}
.year-column.verdeoscuro {
    --color-year: var(--verdeoscuro);
}

.year-column.verdemedio {
    --color-year: var(--verdemedio);
}

.year-column.verdeclaro {
    --color-year: var(--verdeclaro);
}

/* Ancho dinámico basado en número de eventos */
.year-column[data-events="1"] { min-width: 200px; }
.year-column[data-events="2"] { min-width: 400px; }
.year-column[data-events="3"] { min-width: 600px; }
.year-column[data-events="4"] { min-width: 800px; }
.year-column[data-events="5"] { min-width: 1000px; }
.year-column[data-events="6"] { min-width: 1200px; }

/* BARRA CENTRAL - POSICIÓN FIJA EN EL CENTRO */
.year-segment{
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2rem;
    transform: translateY(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    z-index: 2;
    color: #fff;                 /* texto SIEMPRE blanco */
    --color-year: transparent;   /* se define abajo */
}

.year-segment.verdeoscuro{
    background: var(--verdeoscuro);
    --color-year: var(--verdeoscuro);
}

.year-segment.verdemedio{
    background: var(--verdemedio);
    --color-year: var(--verdemedio);
}

.year-segment.verdeclaro{
    background: var(--verdeclaro);
    --color-year: var(--verdeclaro);
}

.year-label{
    font-size: 1.1rem;
}

/* CONTENEDORES DE EVENTOS */
.events-top,
.events-bottom{
    position: absolute;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    z-index: 1;
}

/* EVENTOS ARRIBA */
.events-top{
    top: 0;
    /*height: calc(50% - 50px);
    align-items: flex-end;
    padding-bottom: 20px;*/
}

/* EVENTOS ABAJO */
.events-bottom{
    bottom: 0;
    /*height: calc(50% - 50px);
    align-items: flex-start;
    padding-top: 20px;*/
}

/* Cuando hay eventos solo en un lado */
.year-column:has(.events-top:not(.empty)):has(.events-bottom.empty) .events-top {
    height: calc(100% - 20rem);
    align-items: center;
    padding-bottom: 0;
}

.year-column:has(.events-bottom:not(.empty)):has(.events-top.empty) .events-bottom {
    height: calc(100% - 20rem);
    align-items: center;
    padding-top: 0;
}

.events-top.empty,
.events-bottom.empty{
    display: none;
}

/* TARJETAS DE EVENTO - CON POSICIÓN RELATIVA PARA LOS CONECTORES */
.evento{
    background: #fff;
    border: 2px solid #ccc;
    border-radius: 10px;
    padding: 0.75rem;
    width: 12rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: relative;
    text-align: left;
    flex-shrink: 0;
    overflow: visible;
    position: relative;
    z-index: 3;
}

.evento h4{
    text-align: center;
    font-family: 'Cyborg';
    color: var(--verdeclaro);
    /*margin: 0 0 10px 0;*/
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.evento ul{
    font-family: 'LatoBlack';
    margin: 0 0 0 2rem;
    padding: 0;
    font-size: 0.85rem;
    max-height: 80px;
    overflow-y: auto;
}

/* Scrollbar estilizada para lista de autores */
.evento ul::-webkit-scrollbar {
    width: 4px;
}

.evento ul::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* ============================================
   LÍNEAS CONECTORAS - DESDE EL CENTRO DE CADA TARJETA
   ============================================ */

/* CONECTORES PARA EVENTOS ARRIBA */
.events-top .evento {
    /* Espacio para la línea */
    margin-bottom: 25px;
}

.events-top .evento::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    width: 4px;
    height: 8.5rem;                 /* ← CLAVE */
    background: var(--color-year);
    z-index: 2;
}


/* CONECTORES PARA EVENTOS ABAJO */
.events-bottom .evento {
    /* Espacio para la línea */
    margin-top: 25px;
}

.events-bottom .evento::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    width: 4px;
    height: 8.5rem;                 /* ← CLAVE */
    background: var(--color-year);
    z-index: 2;
}

.events-top,
.events-bottom{
    overflow: visible;
}

/* Para años con muchos eventos */
.year-column[data-events] .events-top,
.year-column[data-events] .events-bottom {
    justify-content: flex-start;
    overflow-x: visible;
    flex-wrap: nowrap;
}

/* Imágenes dentro de eventos */
.evento img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
    display: block;
}

/* ==========================
   RESPONSIVE
   ========================== */

/* TABLETS GRANDES */
@media (max-width: 1200px) {
    .timeline-wrapper {
        min-height: 550px;
    }

    .timeline {
        height: 550px;
    }

    .year-column {
        height: 550px;
    }

    .events-top {
        height: calc(50% - 40px);
        padding-bottom: 15px;
    }

    .events-bottom {
        height: calc(50% - 40px);
        padding-top: 15px;
    }

    /* Ajustar conectores en tablet */
    .events-top .evento {
        margin-bottom: 20px;
    }

    .events-bottom .evento {
        margin-top: 20px;
    }

    .year-column[data-events="4"],
    .year-column[data-events="5"],
    .year-column[data-events="6"] {
        min-width: 100%;
    }

    .year-column[data-events="4"] .events-top,
    .year-column[data-events="4"] .events-bottom,
    .year-column[data-events="5"] .events-top,
    .year-column[data-events="5"] .events-bottom {
        flex-wrap: wrap;
        justify-content: center;
    }

    .year-column[data-events="4"] .evento,
    .year-column[data-events="5"] .evento {
        flex: 0 0 calc(50% - 20px);
        margin-bottom: 15px;
    }
}

/* TABLETS */
@media (max-width: 900px) {
    .timeline-wrapper {
        min-height: 500px;
    }

    .timeline {
        height: 500px;
    }

    .year-column {
        height: 500px;
        min-width: 180px;
    }

    .evento {
        min-width: 150px;
        max-width: 200px;
        padding: 12px;
        max-height: 180px;
    }

    .evento h4 {
        font-size: 0.95rem;
        min-height: 2.6em;
    }

    .evento ul {
        max-height: 70px;
        font-size: 0.8rem;
    }

    .events-top {
        height: calc(50% - 35px);
        padding-bottom: 10px;
    }

    .events-bottom {
        height: calc(50% - 35px);
        padding-top: 10px;
    }

    /* Ajustar conectores en tablet pequeña */
    .events-top .evento {
        margin-bottom: 15px;
    }

    .events-bottom .evento {
        margin-top: 15px;
    }
}

/* MÓVILES */
@media (max-width: 600px) {
    .timeline-wrapper {
        min-height: 450px;
        padding: 10px 0;
    }

    .timeline {
        height: 450px;
    }

    .timeline-btn {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    .year-column {
        height: 450px;
        min-width: 160px;
        padding: 0 8px;
    }

    .evento {
        min-width: 140px;
        max-width: 160px;
        padding: 10px;
        max-height: 160px;
    }

    .evento h4 {
        font-size: 0.9rem;
        min-height: 2.4em;
        -webkit-line-clamp: 2;
    }

    .evento ul {
        font-size: 0.75rem;
        max-height: 60px;
        margin-left: 15px;
    }

    .evento img {
        height: 80px;
    }

    .events-top {
        height: calc(50% - 30px);
        padding-bottom: 8px;
    }

    .events-bottom {
        height: calc(50% - 30px);
        padding-top: 8px;
    }

    /* Ajustar conectores en móvil */
    .events-top .evento {
        margin-bottom: 12px;
    }

    .events-bottom .evento {
        margin-top: 12px;
    }
}