/* ==========================================================================
   Monster Timeline
   Todo está acotado a .monster-tl-root para no tocar el tema de WordPress.
   No hay reset global (ni * { margin:0 }): eso rompería el tema.
   ========================================================================== */

.monster-tl-root {
    font-family: inherit;
    color: #111111;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.monster-tl-root *,
.monster-tl-root *::before,
.monster-tl-root *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Conmutación de versiones
   - Tablet y escritorio (>= 768px): slider horizontal
   - Móvil (< 768px): timeline vertical
   ========================================================================== */

@media (min-width: 768px) {
    .monster-tl-root .monster-tl {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .monster-tl-root .monster-timeline-container {
        display: none;
    }
}

/* Forzar una sola versión: [monster_timeline mode="vertical"] */
.monster-tl-root--vertical .monster-tl {
    display: block;
}

.monster-tl-root--slider .monster-timeline-container {
    display: block;
}

/* ==========================================================================
   SLIDER (tablet y escritorio)
   ========================================================================== */

.monster-tl-root .monster-timeline-container {
    position: relative;
    width: 100%;
    padding: 20px 0;
}

/* --- Cabecera: años y línea --- */

.monster-tl-root .timeline-header-wrapper {
    display: flex;
    align-items: center;
    gap: 30px;
    width: 100%;
    margin-bottom: 40px;
}

.monster-tl-root .timelineNavSwiper {
    flex: 1;
    position: relative;
    padding-top: 10px;
    padding-bottom: 15px;
    overflow: hidden;
}

.monster-tl-root .timeline-line-bg {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #d1d5db;
    z-index: 1;
}

.monster-tl-root .timeline-year-node {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    cursor: pointer;
    z-index: 2;
    width: auto !important;
    padding: 0 6%;
}

.monster-tl-root .timeline-year-text {
    font-size: 15px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 12px;
    transition: color 0.25s ease;
}

.monster-tl-root .timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #9ca3af;
    transition: all 0.25s ease;
}

.monster-tl-root .swiper-slide-thumb-active .timeline-year-text,
.monster-tl-root .timeline-year-node:hover .timeline-year-text {
    color: #000000;
}

.monster-tl-root .swiper-slide-thumb-active .timeline-dot {
    background-color: #000000;
    width: 18px;
    border-radius: 10px;
}

/* --- Flechas --- */

.monster-tl-root .timeline-arrows-container {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.monster-tl-root .timeline-arrow-btn {
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    user-select: none;
}

.monster-tl-root .timeline-arrow-btn:hover,
.monster-tl-root .timeline-arrow-btn:focus-visible {
    background-color: #cc0000;
    transform: scale(1.05);
}

.monster-tl-root .timeline-arrow-btn svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

.monster-tl-root .swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Tarjetas --- */

.monster-tl-root .timelineContentSwiper {
    width: 100%;
    /* Necesario para que Swiper recorte las diapositivas fuera de vista.
       El "peek" de la siguiente tarjeta lo da slidesPerView: 1.25.
       El !important neutraliza un `overflow: visible !important` que haya
       quedado en el CSS adicional del tema y que provoca scroll horizontal. */
    overflow: hidden !important;
}

.monster-tl-root .history-card {
    background-color: #f4f5f7;
    border-radius: 8px;
    overflow: hidden;
    height: auto;
}

.monster-tl-root .history-card-inner {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: 380px;
}

.monster-tl-root .history-text-side {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.monster-tl-root .history-text-side h3 {
    font-size: 32px;
    font-weight: 700;
    color: #111111;
    margin: 0 0 15px 0;
}

.monster-tl-root .history-text-side p {
    font-size: 15px;
    line-height: 1.6;
    color: #444444;
    margin: 0;
}

.monster-tl-root .history-text-side p + p,
.monster-tl-root .history-text-side ul + p {
    margin-top: 10px;
}

.monster-tl-root .history-text-side ul {
    margin: 10px 0 0;
    padding-left: 18px;
    font-size: 15px;
    line-height: 1.6;
    color: #444444;
}

.monster-tl-root .history-huge-year {
    font-size: 85px;
    font-weight: 800;
    /* Antes #b0b5bc: 1.9:1 sobre la tarjeta. Ahora 3.2:1 (AA para texto grande). */
    color: #858b93;
    line-height: 0.9;
    margin-top: 30px;
    letter-spacing: -2px;
}

.monster-tl-root .history-image-side {
    flex: 1;
    position: relative;
    background-color: #dddddd;
}

.monster-tl-root .history-image-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
}

@media (max-width: 768px) {
    .monster-tl-root .monster-timeline-container {
        padding: 10px 0;
    }

    .monster-tl-root .timeline-header-wrapper {
        flex-direction: column;
        align-items: flex-end;
        gap: 15px;
    }

    .monster-tl-root .timelineNavSwiper {
        width: 100%;
    }

    .monster-tl-root .timeline-arrow-btn {
        width: 38px;
        height: 38px;
    }

    .monster-tl-root .timeline-arrow-btn svg {
        width: 16px;
        height: 16px;
    }

    .monster-tl-root .history-card-inner {
        flex-direction: column-reverse !important;
        min-height: auto;
    }

    .monster-tl-root .history-image-side {
        width: 100%;
        height: 220px;
    }

    .monster-tl-root .history-text-side {
        width: 100%;
        padding: 24px 20px;
    }

    .monster-tl-root .history-text-side h3 {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .monster-tl-root .history-text-side p {
        font-size: 14px;
        line-height: 1.5;
    }

    .monster-tl-root .history-huge-year {
        font-size: 50px;
        margin-top: 15px;
    }
}

/* ==========================================================================
   TIMELINE VERTICAL (móvil)
   ========================================================================== */

.monster-tl {
    --tl-ink: #111111;
    --tl-text: #4b5563;
    --tl-muted: #6b7280;
    --tl-line: #e4e7eb;
    --tl-card: #ffffff;
    --tl-radius: 16px;
    --tl-gutter: 38px;
    --tl-gap: 34px;
    --tl-sticky-top: 0px;

    max-width: 520px;
    margin: 0 auto;
    padding: 0 20px 40px;
    color: var(--tl-ink);
}

/* --- Barra fija: año actual + progreso --- */

.monster-tl__sticky {
    position: sticky;
    top: var(--tl-sticky-top, 0px);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 52px;
    margin: 0 -20px 24px;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--tl-line);
}

/* La barra de administración de WordPress es fija y se superpone al contenido.
   Desplazamos la barra del año justo debajo de ella (solo para usuarios
   conectados; un visitante normal no ve ningún cambio). */
body.admin-bar .monster-tl__sticky {
    top: calc(var(--tl-sticky-top, 0px) + 32px);
}

@media (max-width: 782px) {
    body.admin-bar .monster-tl__sticky {
        top: calc(var(--tl-sticky-top, 0px) + 46px);
    }
}

.monster-tl__sticky-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tl-muted);
}

.monster-tl__year-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--tl-ink);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.monster-tl__year-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cc0000;
    flex: none;
}

.monster-tl__sticky-progress {
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 2px;
    background: var(--tl-ink);
    transform: scaleX(0);
    transform-origin: 0 50%;
    transition: transform 0.35s cubic-bezier(0.22, 0.68, 0.16, 1);
}

/* --- Lista y línea conectora --- */

.monster-tl__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.monster-tl__item {
    position: relative;
    margin: 0 0 var(--tl-gap);
    padding-left: var(--tl-gutter);
}

.monster-tl__item:last-child {
    margin-bottom: 0;
}

.monster-tl__item::before,
.monster-tl__item::after {
    content: "";
    position: absolute;
    top: 10px;
    left: 6px;
    width: 2px;
    height: calc(100% + var(--tl-gap));
    border-radius: 2px;
    z-index: 0;
}

.monster-tl__item::before {
    background: var(--tl-line);
}

.monster-tl__item::after {
    background: var(--tl-ink);
    transform: scaleY(0);
    transform-origin: 50% 0;
    transition: transform 0.6s cubic-bezier(0.22, 0.68, 0.16, 1);
}

.monster-tl__item:last-child::before,
.monster-tl__item:last-child::after {
    display: none;
}

.monster-tl__item.is-passed::after {
    transform: scaleY(1);
}

/* --- Marcador: punto + año --- */

.monster-tl__marker {
    position: relative;
    display: flex;
    align-items: center;
    height: 20px;
    margin-bottom: 12px;
}

.monster-tl__dot {
    position: absolute;
    left: calc(-1 * var(--tl-gutter));
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #cbd0d7;
    z-index: 1;
    transition:
        background-color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease,
        transform 0.3s ease;
}

.monster-tl__item.is-passed .monster-tl__dot {
    background: var(--tl-ink);
    border-color: var(--tl-ink);
}

.monster-tl__item.is-current .monster-tl__dot {
    background: var(--tl-ink);
    border-color: var(--tl-ink);
    box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.08);
    transform: scale(1.12);
}

.monster-tl__year {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tl-muted);
    transition: color 0.25s ease;
}

.monster-tl__item.is-passed .monster-tl__year,
.monster-tl__item.is-current .monster-tl__year {
    color: var(--tl-ink);
}

/* --- Tarjeta --- */

.monster-tl__card {
    position: relative;
    background: var(--tl-card);
    border: 1px solid #e9ebef;
    border-radius: var(--tl-radius);
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 14px 30px -20px rgba(15, 23, 42, 0.35);
}

.monster-tl__media {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #e9ebef;
}

.monster-tl__media img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
}

.monster-tl__body {
    padding: 16px 18px 18px;
}

.monster-tl__body h3 {
    margin: 0 0 8px;
    font-size: 19px;
    line-height: 1.25;
    letter-spacing: -0.01em;
    font-weight: 700;
    color: var(--tl-ink);
}

.monster-tl__body p {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--tl-text);
}

.monster-tl__body p + p {
    margin-top: 10px;
}

.monster-tl__body ul {
    margin: 12px 0 0;
    padding-left: 18px;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--tl-text);
}

.monster-tl__body ul + p {
    margin-top: 12px;
}

.monster-tl__body li + li {
    margin-top: 4px;
}

/* --- Aparición al scroll (solo si hay JS) --- */

.monster-tl.is-anim .monster-tl__item {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.5s ease,
        transform 0.65s cubic-bezier(0.22, 0.68, 0.16, 1);
    transition-delay: calc(var(--tl-delay, 0) * 70ms);
}

.monster-tl.is-anim .monster-tl__item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.monster-tl.is-anim .monster-tl__media img {
    transform: scale(1.06);
    transition: transform 1.1s cubic-bezier(0.22, 0.68, 0.16, 1);
}

.monster-tl.is-anim .monster-tl__item.is-visible .monster-tl__media img {
    transform: scale(1);
}

/* --- Accesibilidad: sin movimiento --- */

@media (prefers-reduced-motion: reduce) {
    .monster-tl.is-anim .monster-tl__item {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .monster-tl.is-anim .monster-tl__media img {
        transform: none;
        transition: none;
    }

    .monster-tl__item::after,
    .monster-tl__dot,
    .monster-tl__sticky-progress {
        transition: none;
    }
}

/* --- Pantallas muy estrechas --- */

@media (max-width: 360px) {
    .monster-tl {
        --tl-gutter: 32px;
        --tl-gap: 28px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .monster-tl__sticky {
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .monster-tl__body {
        padding: 14px 15px 16px;
    }
}
