/* ==========================================================================
   VIÑAMETRICS by AGM GLOBAL — PÁGINA METODOLOGÍA
   Mismo estilo de foto que metodologia (alta a sangre con fundido),
   círculo numerado dentro de cada foto y una sola línea curva que las
   une en zigzag (GSAP + ScrollTrigger)
   Reutiliza el sistema de style.css (tipografías, colores, cabecera, pie)
   ========================================================================== */

/* Cabecera de página a pantalla completa, con el círculo origen */
.page-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 100svh;
    min-height: 100dvh;
    overflow: hidden;
    background:
        linear-gradient(
            135deg,
            rgba(17, 29, 51, 0.94) 0%,
            rgba(30, 53, 91, 0.82) 45%,
            rgba(78, 115, 223, 0.7) 100%
        ),
        url('../img/fondo-hero-1920.webp') center / cover no-repeat,
        #111d33;
    color: #fff;
    padding-top: var(--hero-pad-top);
    /* Aire extra abajo: el titular sube como en quienes-somos */
    padding-bottom: calc(clamp(3rem, 6vw, 5rem) + 4rem);
}

.page-hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    text-align: center;
}

.page-hero-lede {
    font-size: 1.3rem;
    color: #e2e8f0;
    line-height: 1.7;
    margin: 0 auto;
    max-width: 44rem;
    text-align: center;
}

@media (max-height: 760px) {
    .page-hero {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}

.tl-origin {
    position: absolute;
    left: 50%;
    bottom: 2.5rem;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin-left: -34px;
    border-radius: 50%;
    background: var(--vm-blue);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    border: 5px solid #fff;
    box-shadow: 0 8px 24px rgba(17, 29, 51, 0.45);
    /* Solo opacidad: un desplazamiento movería el arranque de la línea */
    animation: heroOriginIn 0.9s ease 0.35s both;
}

@keyframes heroOriginIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tl-origin {
        animation: none;
    }
}

/* Recorrido a sangre */
.tl-journey {
    position: relative;
    margin-inline: -5vw;
    margin-top: 1rem;
}

.tl-wire {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.tl-wire-core {
    fill: none;
    stroke: #fff;
    stroke-width: 3px;
    stroke-linecap: round;
    filter: drop-shadow(0 2px 6px rgba(17, 29, 51, 0.45));
}

.tl-phase {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: stretch;
    height: calc(100svh - 5.625rem);
    height: calc(100dvh - 5.625rem);
    background: #fff;
}

.tl-phase:nth-of-type(even) {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    background: var(--bg-page);
}

.tl-phase:nth-of-type(odd) .tl-phase-media {
    grid-column: 1;
    grid-row: 1;
}

.tl-phase:nth-of-type(odd) .tl-phase-text {
    grid-column: 2;
    grid-row: 1;
}

.tl-phase:nth-of-type(even) .tl-phase-text {
    grid-column: 1;
    grid-row: 1;
}

.tl-phase:nth-of-type(even) .tl-phase-media {
    grid-column: 2;
    grid-row: 1;
}

.tl-phase-text {
    /* La línea viaja sobre las fotos pero por detrás del texto */
    position: relative;
    z-index: 2;
    background: #fff;
    align-self: center;
    padding: 0 5vw 0 4rem;
    max-width: 42rem;
}

.tl-phase:nth-of-type(even) .tl-phase-text {
    padding: 0 4rem 0 5vw;
    justify-self: end;
    background: var(--bg-page);
}

/* La línea solo se ve sobre las fotos: máscara opaca del lado del texto */
.tl-phase::after {
    content: '';
    position: absolute;
    z-index: 1;
}

.tl-phase:nth-of-type(odd)::after {
    top: 0;
    bottom: 0;
    left: 58.3333%;
    right: 0;
    background: #fff;
}

.tl-phase:nth-of-type(even)::after {
    top: 0;
    bottom: 0;
    left: 0;
    width: 41.6667%;
    background: var(--bg-page);
}

.tl-num {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.tl-title {
    font-size: clamp(2rem, 3.5vw, 3.25rem);
    font-weight: 800;
    color: var(--agm-navy);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
}

.tl-desc {
    font-size: 1.15rem;
    color: var(--text-primary);
    line-height: 1.65;
    margin: 0;
}

.tl-phase-media {
    position: relative;
    margin: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--agm-navy-dark);
}

.tl-phase-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.15);
}

/* Círculo numerado dentro de la foto: apagado (azul sobre blanco) hasta
   que la bolita viajera lo alcanza y lo colorea */
.tl-badge {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin-top: -34px;
    margin-left: -34px;
    border-radius: 50%;
    background: #fff;
    color: var(--vm-blue);
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    border: 4px solid var(--vm-blue);
    box-shadow: 0 8px 24px rgba(17, 29, 51, 0.45);
}

.tl-badge.lit {
    background: var(--vm-blue);
    color: #fff;
    border-color: #fff;
}

.tl-phase:nth-of-type(odd) .tl-badge {
    left: 30%;
}

.tl-phase:nth-of-type(even) .tl-badge {
    left: 70%;
}

/* Bolita azul que baja por la línea y colorea los círculos */
.tl-traveler {
    position: absolute;
    top: 0;
    left: 0;
    /* Sobre las fotos pero tras los nodos: los transforms la tapaban. */
    z-index: 1;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-radius: 50%;
    background: var(--vm-blue);
    border: 4px solid #fff;
    box-shadow:
        0 0 0 6px rgba(78, 115, 223, 0.18),
        0 4px 12px rgba(17, 29, 51, 0.35);
    pointer-events: none;
    opacity: 0;
}

@media (max-width: 991px) {
    .tl-phase {
        display: block;
        min-height: 0;
        height: auto;
        padding-bottom: 3rem;
    }

    .tl-phase-media img {
        height: 44svh;
    }

    .tl-badge {
        width: 56px;
        height: 56px;
        font-size: 1.1rem;
        top: 1.5rem;
        margin: 0;
    }

    .tl-phase:nth-of-type(odd) .tl-badge,
    .tl-phase:nth-of-type(even) .tl-badge {
        left: 1.5rem;
        right: auto;
    }

    .tl-phase-text {
        padding: 2.5rem 5vw 0;
        max-width: none;
    }

    /* El padding de escritorio de las pares gana por especificidad: se iguala */
    .tl-phase:nth-of-type(even) .tl-phase-text {
        padding: 2.5rem 5vw 0;
    }

    /* En móvil la máscara cubre la franja inferior: la línea entra con la foto */
    .tl-phase:nth-of-type(odd)::after,
    .tl-phase:nth-of-type(even)::after {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: auto;
        height: 3rem;
    }

    .tl-phase:nth-of-type(odd)::after {
        background: #fff;
    }

    .tl-phase:nth-of-type(even)::after {
        background: var(--bg-page);
    }
}

/* Lenis: sin esto el scroll-behavior suave del CSS pelearía con él */
html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

@media (min-width: 992px) {
    .tl-origin {
        left: auto;
        right: 5vw;
        top: 50%;
        bottom: auto;
        margin: -34px 0 0 0;
    }
}

.tl-section {
    padding-top: 0;
    padding-bottom: 1.5rem;
}

.tl-journey {
    margin-top: 0;
}
