/* ============================================================
     COMPONENT: timeline.css
     Purpose  : Estilos refinados para línea del tiempo histórica
     Design   : Milena (Premium Refinement)
     Pattern  : BEM, mobile-first, diseño institucional premium
     ============================================================ */

/* ── CONTENEDOR PRINCIPAL ────────────────────────────────────────── */
.timeline {
    padding: 64px 32px;
    background: linear-gradient(160deg, #f0faf3 0%, #e8f5ec 45%, #f4f9f6 75%, #f8fafc 100%);
    margin: 48px 0 0; /* sin margen inferior — evita brecha blanca antes de la siguiente sección */
}

/* Limitar contenedor a 1200px máximo */
.timeline .container {
    max-width: 1200px;
}

/* ── CABECERA ────────────────────────────────────────────────────── */
.timeline__header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 48px;
}

.timeline__label {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #45A85A;
    margin-bottom: 8px;
}

.timeline__title {
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 800;
    color: #003824;
    line-height: 1.12;
    margin-bottom: 12px;
    letter-spacing: -0.03em;
}

/* "Presupuesto" — peso normal del título, color verde oscuro */
.timeline__title-word--accent {
    display: block;
    color: #003824;
    font-weight: 800;
}

/* "Participativo" — acento azul, mismo peso, sin efectos */
.timeline__title-word--outline {
    display: block;
    color: #1758A0;
    font-weight: 800;
}

.timeline__subtitle {
    font-size: 16px;
    color: #475569;
    line-height: 1.5;
    margin: 0;
}

/* ── SELECTOR DE AÑOS (NAV) ──────────────────────────────────────── */
.timeline__nav {
    position: relative;
    margin-bottom: 48px;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.timeline__track {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    padding: 24px 0;
}

/* Línea base del track — tricolor institucional: verde · azul · rojo */
.timeline__track::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 26px;
    right: 26px;
    height: 2px;
    background: linear-gradient(90deg, #45A85A 0%, #1758A0 50%, #E94E89 100%);
    z-index: 0;
    opacity: 0.55;
}

/* Nodos — círculos que contienen años */
.timeline__node {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease-out;
}

/* Círculo del nodo */
.timeline__node::before {
    content: '';
    position: absolute;
    inset: 0;
    width: 52px;
    height: 52px;
    background-color: #ffffff;
    border: 2px solid #a8d5b3;
    border-radius: 50%;
    transition: background-color 0.2s ease-out, border-color 0.2s ease-out, box-shadow 0.2s ease-out;
    z-index: 0;
}

/* Año dentro del círculo */
.timeline__node-year {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    line-height: 1;
    transition: color 0.2s ease-out;
    pointer-events: none;
    white-space: nowrap;
}

/* Estados Hover / Focus */
.timeline__node:hover,
.timeline__node:focus {
    outline: none;
    transform: scale(1.12);
}

.timeline__node:hover::before {
    background-color: #d1ead8;
    border-color: #45A85A;
    box-shadow: 0 0 0 5px rgba(69, 168, 90, 0.14);
}

.timeline__node:hover .timeline__node-year {
    color: #205F3E;
    font-weight: 700;
}

.timeline__node:focus-visible {
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(69, 168, 90, 0.35);
}

/* Estado Activo */
.timeline__node.is-active {
    cursor: default;
    transform: scale(1.18);
}

.timeline__node.is-active::before {
    background-color: #45A85A;
    border-color: #45A85A;
    box-shadow: 0 0 0 5px rgba(69, 168, 90, 0.18);
}

.timeline__node.is-active .timeline__node-year {
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
}

/* ── PANELES DE DETALLE ─────────────────────────────────────────── */
.timeline__panels {
    position: relative;
}

.timeline__detail {
    display: none;
    animation: timelineFadeIn 0.3s ease-out;
}

.timeline__detail.is-active {
    display: block;
}

@keyframes timelineFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* TARJETA (CARD) */
.timeline__card {
    background: linear-gradient(135deg, #ffffff 0%, #f8faf9 100%);
    border-radius: 16px;
    border: 1px solid #d4e8d9;
    /* Borde superior tricolor: verde · azul · rojo — delicado */
    border-top: 3px solid transparent;
    background-image:
        linear-gradient(135deg, #ffffff 0%, #f8faf9 100%),
        linear-gradient(90deg, #45A85A 0%, #1758A0 50%, #E94E89 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow:
        0 4px 6px -1px rgba(32, 95, 62, 0.06),
        0 20px 40px -10px rgba(32, 95, 62, 0.08);
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 48px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Acento decorativo en esquina — rojo delicado */
.timeline__card::after {
    content: '';
    position: absolute;
    bottom: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(217, 10, 28, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

/* Label de la card — rojo institucional delicado */
.timeline__card-label {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #E94E89;
    background-color: rgba(217, 10, 28, 0.06);
    border: 1px solid rgba(217, 10, 28, 0.18);
    border-radius: 999px;
    margin-bottom: 16px;
}

.timeline__card-title {
    font-size: 28px;
    font-weight: 800;
    color: #003824;
    margin: 0 0 16px;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.timeline__card-text {
    font-size: 16px;
    line-height: 1.6;
    color: #475569;
    margin: 0;
}

/* ── MÉTRICAS ────────────────────────────────────────────────────── */
.timeline__metrics {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(69, 168, 90, 0.20);
}

.timeline__metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.timeline__metric-value {
    font-size: 28px;
    font-weight: 800;
    color: #205F3E;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.timeline__metric-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.timeline__metric-icon {
    color: #45A85A;
    flex-shrink: 0;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────── */

/* Mobile */
@media (max-width: 767px) {
    .timeline {
        padding: 48px 16px;
        margin: 24px 0;
    }

    .timeline__header {
        margin-bottom: 32px;
    }

    .timeline__title {
        font-size: 26px;
    }

    .timeline__title-word--outline {
        -webkit-text-stroke-width: 1.5px;
    }

    .timeline__nav {
        overflow-x: auto;
        padding-bottom: 8px;
        scrollbar-width: none;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

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

    .timeline__track {
        justify-content: flex-start;
        gap: 12px;
        padding: 16px 12px;
    }

    .timeline__node {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }

    .timeline__node::before {
        width: 48px;
        height: 48px;
    }

    .timeline__card {
        padding: 32px 20px;
        max-width: 100%;
    }

    .timeline__card-title {
        font-size: 22px;
    }

    .timeline__card-text {
        font-size: 15px;
    }

    .timeline__metrics {
        flex-direction: column;
        gap: 20px;
        padding-top: 20px;
        margin-top: 20px;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    .timeline {
        padding: 56px 24px;
    }

    .timeline__node {
        width: 50px;
        height: 50px;
    }

    .timeline__node::before {
        width: 50px;
        height: 50px;
    }

    .timeline__card {
        padding: 36px 40px;
    }

    .timeline__card-title {
        font-size: 26px;
    }
}

/* Desktop */
@media (min-width: 1025px) {
.timeline {
    padding: 64px 32px;
    background: linear-gradient(160deg, #f8faf9 0%, #f3f7f5 40%, #f8fafc 100%);
    margin: 48px 0 0;
}

    .timeline__card {
        padding: 40px 48px;
    }

    .timeline__card-title {
        font-size: 28px;
    }
}
