:root {
    --color-primary: #1a5f6f;
    --color-primary-light: #2a8fa0;
    --color-primary-dark: #0d3b48;
    --color-accent: #ff6b4a;
    --color-accent-light: #ff8566;
    --color-bg-1: #ecece6;
    --color-bg-2: #f7f7f2;
    --color-surface: #ffffff;
    --color-text: #2c2c2c;
    --color-text-light: #666666;
    --color-border: #e0ddd8;
    --color-success: #4a9d6f;
    --space: 1rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
    width: 100%;
    scroll-behavior: smooth;
}

body {
    width: 100%;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
}

/* Header */
header,
.sub-header {
    width: 100%;
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    color: white;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    height: 227px;
}

/* ************************* */
/* --- ESTILOS DEL MENÚ DE NAVEGACIÓN --- */

#autores {
    scroll-margin-top: 250px;
}

#intro,
#filtro,
#conclusiones {
    scroll-margin-top: 220px;
}

.main-nav {
    width: 100%;
    margin-bottom: 20px; /* Separación con el título H1 */
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Línea divisoria muy sutil */
}

.main-nav ul {
    display: flex;
    flex-wrap: wrap; /* Para que se adapte bien en móviles */
    justify-content: center; /* Centrar los elementos */
    gap: 30px; /* Espacio entre enlaces */
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-nav li {
    position: relative;
}

.main-nav a {
    padding-bottom: 5px;
    color: #ffffff; /* Color del texto (asumiendo fondo oscuro) */
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-decoration: none;
    opacity: 0.9;
    transition: color 0.3s ease;
}

/* --- EFECTOS SUTILES (Hover) --- */

/* Cambio de color al pasar el ratón */
.main-nav a:hover {
    color: #ff9f43; /* Un color acento (naranja/ámbar) que destaque */
    opacity: 1;
}

/* La línea que se expande debajo del texto */
.main-nav a::after {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: #ff9f43; /* Mismo color que el texto hover */
    transition: width 0.3s ease-in-out, left 0.3s ease-in-out;
    content: "";
}

.main-nav a:hover::after {
    left: 0;
    width: 100%;
}
/* ************************* */

.sub-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 130px;
    padding-top: 180px;
    padding-bottom: 1.5rem;
}

.sub-header img {
    display: block;
    max-width: 100%;
    height: auto;
}

header h1 {
    margin-bottom: 0.5rem;
    color: var(--color-bg-1);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-subtitle {
    margin: 0.5rem 0 2rem 0;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0.95;
}

.header-content,
.conclusion-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    /* margin-top: 2rem; */
    padding: 2rem;
    background-color: var(--color-bg-1);
}
body {
    background-color: var(--color-bg-2);
}

.header-authors {
    width: 90%;
    max-width: 600px;
    margin: 1.5rem auto 0;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.header-intro,
.conclusion-section {
    max-width: 800px;
    margin: 0 auto;
    font-size: 0.95rem;
    line-height: 1.8;
    text-align: justify;
    opacity: 0.95;
}

.conclusion-section ol {
    margin: 1rem 1.5rem 1rem 3rem;
}

.filter-section {
    position: sticky;
    top: 225px;
    z-index: 1;
    padding: 1rem 0;
    background-color: var(--color-bg-1);
}

.authors-label {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.9;
}

.authors-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.author {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    line-height: 1.6;
}

.author-org {
    margin-top: 0.2rem;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Main Container */
.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem var(--space);
}

/* --- FILTER SECTION (NUEVOS ESTILOS PARA SELECT) --- */
.filter-section {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.filter-wrapper {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.filter-label {
    color: var(--color-text);
    font-size: 1rem;
    font-weight: 600;
}

.filter-select {
    min-width: 220px;
    padding: 0.75rem 2.5rem 0.75rem 1.5rem;
    border: 2px solid var(--color-border);
    border-radius: 25px;
    background-color: var(--color-surface);

    /* Flecha personalizada SVG codificada en base64 para no depender de archivos externos */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%231a5f6f%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 0.75em auto;
    color: var(--color-text);
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none; /* Quitamos la flecha por defecto */
    -webkit-appearance: none;
    outline: none;
}

.filter-select:hover {
    border-color: var(--color-primary);
}

.filter-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 111, 0.1);
}

/* Timeline Container */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline::before {
    position: absolute;
    left: 50%;
    width: 3px;
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(to bottom, var(--color-primary), var(--color-accent));
    content: "";
    transform: translateX(-50%);
}

/* Timeline Item */
.timeline-item {
    margin-bottom: 2.5rem;
    opacity: 0;
    animation: slideIn 0.6s ease-out forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.timeline-content {
    display: grid;
    align-items: center;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.timeline-item:nth-child(odd) .timeline-content {
    direction: rtl;
}

.timeline-item:nth-child(odd) .timeline-text {
    direction: ltr;
}

/* Dot on timeline */
.timeline-dot {
    position: absolute;
    top: 40px;
    left: 50%;
    z-index: 2;
    width: 20px;
    height: 20px;
    border: 4px solid var(--color-primary);
    border-radius: 50%;
    background: var(--color-surface);
    box-shadow: 0 0 0 3px var(--color-bg);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.timeline-item:hover .timeline-dot {
    border-color: var(--color-accent);
    background: var(--color-accent);
    box-shadow: 0 0 0 8px rgba(26, 95, 111, 0.2);
}

/* Text Box */
.timeline-text {
    padding: 1.75rem;
    border-left: 4px solid var(--color-primary);
    border-radius: 10px;
    background: var(--color-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-item:hover .timeline-text {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-8px);
    border-left-color: var(--color-accent);
}

.timeline-year {
    margin-bottom: 0.5rem;
    color: var(--color-primary);
    font-size: 1.3rem;
    font-weight: 700;
}

.timeline-title {
    margin-bottom: 0.75rem;
    color: var(--color-text);
    font-size: 1.2rem;
    font-weight: 600;
}

.timeline-description {
    margin-bottom: 1rem;
    color: var(--color-text-light);
    font-size: 0.95rem;
    line-height: 1.7;
}

.timeline-category {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    background: rgba(26, 95, 111, 0.1);
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* --- FLIP CARD STYLES --- */
.timeline-image {
    position: relative;
    width: 100%;
    height: 300px;
    cursor: pointer;
    perspective: 1000px;
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.timeline-image:hover .flip-inner {
    transform: rotateY(180deg);
}

.flip-front,
.flip-back {
    position: absolute;
    overflow: hidden;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.flip-front {
    background-color: var(--color-surface);
}

.flip-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.flip-back {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 2rem;
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    color: white;
    text-align: center;
    transform: rotateY(180deg);
}

.flip-back p {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.6;
}

.flip-back span {
    font-style: italic;
}

/* Footer */
footer {
    padding: 2rem var(--space);
    background-color: var(--color-primary-dark);
    color: white;
    font-size: 0.9rem;
    text-align: center;
    opacity: 0.9;
}

.no-results {
    padding: 3rem var(--space);
    color: var(--color-text-light);
    font-size: 1.1rem;
    text-align: center;
}

.hidden {
    display: none;
}

.copy {
    margin-top: 1rem;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* *********************************** */
.timeline-id {
    display: block;
    margin-top: 15px; /* Separación del contenido superior */
    padding-top: 5px;
    border-top: 1px dotted #eee; /* Opcional: una línea muy sutil encima */
    color: #bdc3c7; /* Color gris muy suave/discreto */
    font-family: monospace; /* Fuente tipo máquina/código */
    font-size: 0.75rem; /* Tamaño pequeño */
    text-align: right; /* Alineado a la derecha */
    opacity: 0.7;
    user-select: none; /* Evita que se seleccione al copiar texto */
}

/* Opcional: Efecto sutil al pasar el ratón por la tarjeta */
.timeline-item:hover .timeline-id {
    color: #95a5a6; /* Se oscurece ligeramente al hacer hover */
    opacity: 1;
}

/* --- ESTILOS DEL BOTÓN HAMBURGUESA (Por defecto oculto en escritorio) --- */
.nav-container {
    display: flex;
    justify-content: center; /* Centrado en escritorio */
    align-items: center;
    width: 100%;
}

.menu-toggle {
    z-index: 1001;
    display: none; /* Oculto en escritorio */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.menu-toggle .bar {
    width: 100%;
    height: 3px;
    border-radius: 10px;
    background-color: white;
    transition: all 0.3s ease-in-out;
}

/* Clase auxiliar para desactivar el sticky */
.filter-section.stop-sticky {
    position: relative !important; /* Anula el sticky */
    top: auto !important;
    z-index: 0;
    transition: all 0.3s ease; /* Opcional: suaviza el cambio */
}

/* --- MEDIA QUERIES --- */

/* @media (max-width: 1070px) {
    header {
        height: 212px;
    }
    header h1 {
        font-size: 1.9rem;
    }
} */

@media (max-width: 900px) {
    .main-nav {
        margin-bottom: 5px;
        padding: 2px 0;
    }
    .menu-toggle {
        width: 25px;
        height: 15px;
    }

    header {
        height: 97px;
    }
    header h1 {
        font-size: 1.5rem;
        line-height: 1.5rem;
    }

    .header-subtitle {
        line-height: 0.8rem;
    }

    .sub-header {
        margin-top: 0px;
        padding-top: 120px;
    }

    .filter-section {
        top: 96px;
        margin-bottom: 0;
    }

    .timeline {
        position: relative;
        padding: 0;
    }

    #autores {
        scroll-margin-top: 120px;
    }

    #intro {
        scroll-margin-top: 97px;
    }

    #filtro {
        scroll-margin-top: 95px;
    }
    #conclusiones {
        scroll-margin-top: 97px;
    }
    .timeline-text {
        padding: 1.75rem 1.74rem 0 1.75rem;
    }
    .timeline-id {
        margin-top: 0;
        padding-top: 5px;
    }
}
/* @media (orientation: portrait) and (max-width: 900px) {
    header {
        height: 202px;
    }

    header h1 {
        color: yellow;
        font-size: 1.5rem;
    }

    .filter-section {
        top: 200px;
    }

    #autores {
        scroll-margin-top: 225px;
    }

    #intro {
        scroll-margin-top: 190px;
    }

    #filtro {
        scroll-margin-top: 80px;
    }
    #conclusiones {
        scroll-margin-top: 180px;
    }
} */
@media (max-width: 768px) {
    .timeline::before {
        left: 30px;
    }

    .timeline-content {
        grid-template-columns: 1fr;
    }

    .timeline-item:nth-child(odd) .timeline-content {
        direction: ltr;
    }

    .timeline-dot {
        left: 30px;
    }

    .timeline-image {
        height: 250px;
    }

    header {
        height: 130px;
        padding-right: 1rem;
        padding-left: 1rem;
    }

    header h1 {
        /* color: red; */
        font-size: 1.5rem;
        line-height: 1.3;
        word-wrap: break-word;
    }

    .header-subtitle {
        font-size: 0.8rem;
    }

    /* Ajuste Header Fluido */
    .sub-header {
        width: 100%;
        padding-top: 144px;
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .sub-header img {
        width: 100%;
        height: auto;
    }

    .header-authors {
        width: 100%;
        max-width: none;
        margin: 1.5rem 0 0 0;
        border-radius: 10px;
    }

    .header-intro {
        padding: 0 0.5rem;
        text-align: left;
    }

    .filter-section {
        top: 131px;
    }
    .timeline-dot {
        display: none;
    }

    .nav-container {
        justify-content: flex-end; /* Botón a la derecha */
        padding: 0 1.5rem; /* Margen lateral */
    }

    .menu-toggle {
        display: flex; /* Mostrar botón */
    }

    /* Estilo del menú desplegable */
    .main-nav ul {
        position: absolute;
        top: 100%; /* Justo debajo del header */
        left: 0;
        display: flex;
        overflow: hidden;
        flex-direction: column;
        width: 100%;

        /* Efecto de ocultar/mostrar (Slide) */
        max-height: 0;
        padding: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        background-color: var(--color-primary-dark); /* Fondo oscuro */
        box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
        transition: max-height 0.4s ease-in-out, padding 0.4s ease;
    }

    /* Clase activa para abrir el menú */
    .main-nav.active ul {
        max-height: 300px; /* Altura suficiente para el contenido */
        padding: 20px 0;
    }

    .main-nav li {
        width: 100%;
        margin-bottom: 15px;
        text-align: center;
    }

    .main-nav li:last-child {
        margin-bottom: 0;
    }

    /* --- Animación del botón a 'X' --- */
    .menu-toggle.is-active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .menu-toggle.is-active .bar:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.is-active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    #autores {
        scroll-margin-top: 150px;
    }

    #intro {
        scroll-margin-top: 140px;
    }

    #filtro {
        scroll-margin-top: 110px;
    }
    #conclusiones {
        scroll-margin-top: 130px;
    }
}
