/* Page-specific CSS: ymd.html */
/* Layout y espaciados */
.ymd-wrapper {
    padding-top: 120px;
    padding-bottom: 80px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.ymd-container {
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    gap: clamp(2rem, 4vw, 4rem);
    align-items: start;
    margin-top: 2rem;
}

/* ─── TIMELINE IZQUIERDO ─── */
.ymd-sidebar {
    position: sticky;
    top: 120px;
    min-width: 0;
}

.ymd-timeline-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy-900);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--light-200);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ymd-timeline {
    --ymd-axis-width: 80px;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 0;
}

#ymdTimeline::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background-color: var(--light-200);
    transform: translateX(-50%);
    z-index: 0;
}

#ymdTimeline .timeline-row {
    position: relative;
    display: grid;
    grid-template-columns: 1fr var(--ymd-axis-width) 1fr;
    min-height: 100px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    background: transparent;
    border: 0;
    box-shadow: none;
    opacity: 1;
    transform: none;
    transition: none;
    width: 100%;
    box-sizing: border-box;
    z-index: 1;
}

#ymdTimeline .timeline-row:last-child {
    padding-bottom: 0;
}

#ymdTimeline .timeline-content {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    transition: color 0.3s ease;
    box-sizing: border-box;
}

#ymdTimeline .timeline-row.left .timeline-content {
    text-align: right;
    padding-right: 20px;
}

#ymdTimeline .timeline-row.right .timeline-content {
    text-align: left;
    padding-left: 20px;
}

/* ─── EJE + CONECTOR ─────────────────────────────────────────────────────────────
   Grid: 1fr [eje=48px] 1fr. La línea vertical corre por left:50% del timeline
   = exactamente el CENTRO de la columna del eje.

   El nodo se centra en el eje con justify-content:center → queda sobre la línea.

   El conector (::before del item, posicionado sobre el item completo) va:
     LEFT  → desde borde izq. del eje (50% - axis/2) hasta el centro (50%)
     RIGHT → desde el centro (50%)  hasta borde dcho. del eje (50% + axis/2)

   Así el conector siempre toca el nodo y la línea vertical,
   independientemente del ancho absoluto del sidebar.
───────────────────────────────────────────────────────────────────── */
#ymdTimeline .timeline-axis {
    position: relative;
    display: flex;
    justify-content: center;
}

#ymdTimeline .timeline-axis::before {
    display: none;
}

#ymdTimeline .timeline-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: var(--light-400);
    border: 0;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    transition: all 0.3s ease;
}

#ymdTimeline .timeline-connector {
    position: absolute;
    height: 2px;
    background-color: var(--light-200);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    transition: background-color 0.3s ease;
}

#ymdTimeline .timeline-row.left .timeline-dot {
    right: 0;
    transform: translate(50%, -50%);
}

#ymdTimeline .timeline-row.left .timeline-connector {
    right: calc(var(--ymd-axis-width) / -2);
    width: calc(var(--ymd-axis-width) / 2);
}

#ymdTimeline .timeline-row.right .timeline-dot {
    left: 0;
    transform: translate(-50%, -50%);
}

#ymdTimeline .timeline-row.right .timeline-connector {
    left: calc(var(--ymd-axis-width) / -2);
    width: calc(var(--ymd-axis-width) / 2);
}

#ymdTimeline .timeline-row:hover,
#ymdTimeline .timeline-content:hover {
    background: transparent;
    border-color: transparent;
    transform: none;
}

#ymdTimeline .timeline-row.active {
    background: transparent;
    box-shadow: none;
}

#ymdTimeline .timeline-row.active .timeline-dot {
    background-color: var(--gold-500);
    transform: translate(var(--x, 50%), -50%) scale(1.4);
    box-shadow: 0 0 10px rgba(217, 119, 6, 0.3);
}

#ymdTimeline .timeline-row.left.active .timeline-dot { --x: 50%; }
#ymdTimeline .timeline-row.right.active .timeline-dot { --x: -50%; }

#ymdTimeline .timeline-row.active .timeline-connector {
    background-color: var(--gold-500);
}

#ymdTimeline .timeline-year {
    font-size: 1.5rem;
    font-family: var(--font-title);
    font-weight: 800;
    color: var(--light-400);
    line-height: 1;
    margin: 0;
    transition: color 0.3s ease;
}

#ymdTimeline .timeline-status {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
    color: #6b7280;
    text-transform: uppercase;
}

#ymdTimeline .timeline-row.active .timeline-year {
    color: var(--gold-500);
}

/* ─── CONTENIDO PRINCIPAL DERECHO ─── */
.ymd-content {
    animation: fade-in 0.4s ease forwards;
    min-width: 0;
}

.ymd-header-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ymd-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ymd-status-badge.upcoming {
    background: var(--light-200);
    color: var(--navy-700);
}

.ymd-status-badge.current {
    background: var(--gold-500);
    color: var(--surface-white);
    box-shadow: 0 0 15px var(--gold-glow);
}

.ymd-status-badge.past {
    background: var(--navy-800);
    color: var(--light-300);
}

.ymd-content-title {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    line-height: 1;
    overflow-wrap: anywhere;
}

.ymd-content-subtitle {
    font-size: 1.5rem;
    color: var(--gold-500);
    margin-bottom: 2rem;
    overflow-wrap: anywhere;
}

.ymd-hero-visual {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2.5rem;
    background: var(--navy-900);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ymd-hero-visual::after {
    /* Corte geométrico decorativo tipo bloque editorial */
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30%;
    background: linear-gradient(135deg, transparent 50%, rgba(217, 119, 6, 0.1) 50%);
    pointer-events: none;
}

.ymd-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.5s ease;
}

.ymd-hero-fallback {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, var(--navy-900), var(--navy-800));
    display: flex;
    align-items: center;
    justify-content: center;
}

.ymd-hero-fallback.is-hidden {
    display: none;
}

.ymd-hero-fallback i {
    font-size: 5rem;
    color: rgba(255, 255, 255, 0.05);
}

.ymd-description {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text-muted-on-light);
    margin-bottom: 2.5rem;
    max-width: 800px;
    overflow-wrap: anywhere;
}

/* ─── BLOQUE DE DATOS RÁPIDOS ─── */
.ymd-quick-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 1.25rem;
    background: var(--surface-white);
    padding: clamp(1.25rem, 3vw, 2rem);
    border-radius: 8px;
    box-shadow: var(--shadow-card);
    margin-bottom: 2.5rem;
    border-left: 4px solid var(--gold-500);
}

.fact-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fact-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--light-400);
    font-weight: 600;
}

.fact-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--navy-900);
    overflow-wrap: anywhere;
}

.fact-value i {
    color: var(--gold-500);
    margin-right: 0.35rem;
}

/* ─── CTA ─── */
.ymd-cta-wrap {
    margin-top: 1rem;
}

.ymd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.85rem 2rem;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.9rem;
    transition: var(--transition-fast);
    cursor: pointer;
    border: none;
    max-width: 100%;
    text-align: center;
    white-space: normal;
}

.ymd-btn-primary {
    background: var(--navy-900);
    color: var(--surface-white);
}

.ymd-btn-primary:hover {
    background: var(--blue-light);
    color: var(--surface-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 30, 61, 0.15);
}

.ymd-btn-outline {
    background: transparent;
    border: 2px solid var(--navy-900);
    color: var(--navy-900);
}

.ymd-btn-outline:hover {
    background: var(--navy-900);
    color: var(--surface-white);
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
    .ymd-wrapper {
        padding-top: 104px;
        padding-bottom: 56px;
    }

    .ymd-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-top: 0;
    }

    .ymd-sidebar {
        position: relative;
        top: 0;
    }

    .ymd-timeline {
        width: 100%;
    }

    /* Grid es 24px 1fr. La línea vertical corre por el centro de col1 = left:12px */



    /* En mobile el eje ocupa col1 (24px); el nodo se centra en él */

    /*
      Grid mobile: 24px 1fr. La línea vertical está en left:12px del item.
      Conector: desde el borde izq. del eje (left: 50% - axis/2 = 50% - 12px)
      hasta el borde dcho. del eje (va hacia el contenido en col2).
      = left: calc(50% - 12px); right: 50%  → pero ya que 50% de 24px = 12px,
        queda: left:0; right:50%  (referenciado al item de 24px total en col1)
      En realidad, sobre el item completo (24px + contenido):
        left: calc(50% - var(--ymd-axis-width) / 2) = left: calc(50% - 12px)
        right: 50%  → llega al centro del item = centro del eje ✓
    */

    .ymd-timeline {
        --ymd-mobile-axis-left: 16px;
        --ymd-mobile-dot-left: 44px;
        --ymd-mobile-dot-radius: 8px;
        display: flex;
        flex-direction: column;
        gap: 0;
        width: 100%;
        margin: 0;
        padding-left: 0;
        padding-bottom: 0;
        border-bottom: 0;
    }

    #ymdTimeline::before {
        left: var(--ymd-mobile-axis-left);
    }

    #ymdTimeline .timeline-row,
    #ymdTimeline .timeline-row.left,
    #ymdTimeline .timeline-row.right {
        grid-template-columns: 68px minmax(0, 1fr);
        min-height: 80px;
    }

    #ymdTimeline .timeline-row div:nth-child(1) {
        order: 1;
    }

    #ymdTimeline .timeline-row .timeline-axis {
        order: 1;
        grid-column: 1;
    }

    #ymdTimeline .timeline-row .timeline-content {
        order: 2;
        grid-column: 2;
        text-align: left !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    #ymdTimeline .timeline-dot {
        left: calc(var(--ymd-mobile-dot-left) - 68px) !important;
        transform: translate(-50%, -50%) !important;
    }

    #ymdTimeline .timeline-row.left.active .timeline-dot,
    #ymdTimeline .timeline-row.right.active .timeline-dot {
        transform: translate(-50%, -50%) scale(1.4) !important;
    }

    #ymdTimeline .timeline-connector,
    #ymdTimeline .timeline-row.left .timeline-connector,
    #ymdTimeline .timeline-row.right .timeline-connector {
        display: block;
        left: calc(var(--ymd-mobile-axis-left) - 68px) !important;
        right: auto !important;
        width: calc(var(--ymd-mobile-dot-left) - var(--ymd-mobile-axis-left) - var(--ymd-mobile-dot-radius)) !important;
        transform: translateY(-50%);
    }

    .ymd-content-title {
        font-size: 2.5rem;
    }

    .ymd-content-subtitle {
        font-size: 1.25rem;
    }

    .ymd-hero-visual {
        min-height: 250px;
    }
}

@media (max-width: 560px) {
    .ymd-wrapper {
        padding-top: 92px;
        padding-bottom: 40px;
    }

    .ymd-timeline-title {
        font-size: 1rem;
        margin-bottom: 1.25rem;
    }

    #ymdTimeline .timeline-row,
    #ymdTimeline .timeline-row.left,
    #ymdTimeline .timeline-row.right {
        grid-template-columns: 60px minmax(0, 1fr);
        min-height: 68px;
    }

    #ymdTimeline::before {
        left: var(--ymd-mobile-axis-left);
    }

    #ymdTimeline .timeline-dot {
        left: calc(var(--ymd-mobile-dot-left) - 60px) !important;
    }

    #ymdTimeline .timeline-row .timeline-content {
        padding-left: 0 !important;
        min-width: 0;
    }

    #ymdTimeline .timeline-connector,
    #ymdTimeline .timeline-row.left .timeline-connector,
    #ymdTimeline .timeline-row.right .timeline-connector {
        left: calc(var(--ymd-mobile-axis-left) - 60px) !important;
        width: calc(var(--ymd-mobile-dot-left) - var(--ymd-mobile-axis-left) - var(--ymd-mobile-dot-radius)) !important;
    }

    #ymdTimeline .timeline-year {
        font-size: 1.25rem;
    }

    #ymdTimeline .timeline-status {
        font-size: 0.68rem;
    }

    .ymd-content-title {
        font-size: 2rem;
        line-height: 1.08;
    }

    .ymd-content-subtitle {
        font-size: 1.05rem;
        margin-bottom: 1.35rem;
    }

    .ymd-hero-visual {
        min-height: 0;
        aspect-ratio: 4 / 3;
        margin-bottom: 1.5rem;
    }

    .ymd-quick-facts {
        margin-bottom: 1.75rem;
        border-radius: 6px;
    }

    .ymd-description {
        font-size: 1rem;
        margin-bottom: 1.75rem;
    }

    .ymd-btn {
        width: 100%;
        padding-inline: 1rem;
    }
}

/* Spinner Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
