/* =========================================================
   AYS OBRAS — REFORMAS A MEDIDA
========================================================= */

.ays-reforms-stage {
    position: relative;
    z-index: 80;

    width: 100%;
    /* Un relevo breve tras cubrir Metodología, sin scroll interno vacío. */
    /* Mantiene Reformas fija mientras la tarjeta final comienza a subir. */
    height: 235dvh;

    /* Ocupa el último viewport reservado por Metodología. */
    margin-top: -100dvh;
}

.ays-reforms {
    --ays-navy: #102b3f;
    --ays-gold: #feeAAF;
    --ays-paper: #f7f7f5;
    --ays-text: #333333;
    /* El giro de la guía no depende de la altura del navegador. */
    --ays-reforms-guide-y: 72px;

    position: relative;
    z-index: 80;

    width: 100%;
    height: 100dvh;
    min-height: 100dvh;

    overflow: hidden;

    background: #ffffff;
    color: var(--ays-text);

    padding: clamp(82px, 10dvh, 120px) 5vw 0;

    box-sizing: border-box;
}

/* LÍNEAS GUÍA */
.ays-reforms-guide {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.ays-reforms-guide span {
    position: absolute;
    display: block;
    background: var(--ays-gold);
}

.ays-reforms-line-entry {
    top: 0;
    right: 8%;
    width: 3px;
    height: var(--ays-reforms-guide-y);
    transform-origin: top center;
}

.ays-reforms-line-horizontal {
    top: var(--ays-reforms-guide-y);
    left: 8%;
    /* Llega hasta la vertical de entrada situada a la derecha. */
    width: 84%;
    height: 3px;
    transform-origin: right center;
}

.ays-reforms-line-exit {
    top: var(--ays-reforms-guide-y);
    bottom: 0;
    left: 8%;
    width: 3px;
    height: auto;
    transform-origin: top center;
}

/* CABECERA */
.ays-reforms-header {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.ays-reforms-header h2 {
    margin: 0;
    color: var(--ays-navy);
    font-family: "Bebas Neue", sans-serif;
    font-size: clamp(58px, 7vw, 104px);
    font-weight: 400;
    line-height: .9;
    letter-spacing: .01em;
}

.ays-reforms-intro {
    max-width: 520px;
    margin: 22px auto 0;
    color: #6c7c8b;
    font-family: "Montserrat", sans-serif;
    font-size: clamp(16px, 1.15vw, 19px);
    line-height: 1.6;
}

/* TARJETAS */
.ays-reforms-grid {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: stretch;
    gap: clamp(16px, 2vw, 34px);
    max-width: 1320px;
    height: clamp(445px, 50dvh, 510px);
    margin: clamp(50px, 7dvh, 70px) auto 0;
}

.ays-reform-card {
    min-width: 0;
    height: 100%;

    display: grid;
    /* El texto tiene prioridad sobre el bloque visual. */
    grid-template-rows: 60% 40%;
    flex: 1 1 0;

    cursor: pointer;

    transition: flex .55s cubic-bezier(.22, 1, .36, 1), opacity .3s ease;
}

.ays-reform-card.is-active {
    flex: 2.25 1 0;
}

.ays-reforms-grid.has-active .ays-reform-card:not(.is-active) {
    opacity: .62;
}

.ays-reform-card:focus-visible {
    outline: 3px solid var(--ays-gold);
    outline-offset: 5px;
}

.ays-reform-card-content {
    position: relative;
    height: 100%;
    min-height: 0;
    padding: 30px 26px 24px;
    background: var(--ays-paper);

    transition: background-color .35s ease;
}

.ays-reform-number {
    display: block;
    color: var(--ays-text);
    font-family: "Bebas Neue", sans-serif;
    font-size: clamp(25px, 2vw, 34px);
    line-height: 1;
}

.ays-reform-dot {
    display: block;
    width: 13px;
    height: 13px;
    margin: 11px 0 12px;
    border-radius: 50%;
    background: var(--ays-gold);
}

.ays-reform-card h3 {
    margin: 0;
    color: var(--ays-text);
    font-family: "Bebas Neue", sans-serif;
    font-size: clamp(27px, 2.2vw, 39px);
    font-weight: 400;
    line-height: .94;
}

.ays-reform-card p {
    margin: 18px 0 0;
    color: #728092;
    font-family: "Montserrat", sans-serif;
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.5;

    transition: color .35s ease;
}

.ays-reform-image {
    position: relative;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #d8d8d6;
}

/* Capa de contraste para que el contenido interactivo se lea sobre la foto. */
.ays-reform-image::after {
    position: absolute;
    z-index: 1;
    inset: 0;

    content: "";

    background: linear-gradient(180deg, rgba(7, 20, 30, .58), rgba(7, 20, 30, .78));
    opacity: 0;
    pointer-events: none;

    transition: opacity .35s ease;
}

.ays-reform-card.is-active .ays-reform-image::after {
    opacity: 1;
}

.ays-reform-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ays-reform-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(16, 43, 63, .12), rgba(254, 234, 175, .34)), #d6d6d4;

    transition: opacity .35s ease, transform .55s ease;
}

.ays-reform-card.is-active .ays-reform-card-content {
    background: var(--ays-navy);
}

.ays-reform-card.is-active .ays-reform-number,
.ays-reform-card.is-active h3 {
    color: var(--ays-gold);
}

.ays-reform-card.is-active p {
    color: rgba(255, 255, 255, .76);
}

.ays-reform-card.is-active .ays-reform-image {
    background: var(--ays-navy);
}

.ays-reform-card.is-active .ays-reform-image-placeholder {
    opacity: .12;
    transform: scale(1.08);
}

.ays-reform-details {
    position: absolute;
    z-index: 2;
    inset: 0;

    display: flex;
    flex-direction: column;
    justify-content: center;

    padding: 24px 28px;

    color: #ffffff;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);

    transition: opacity .3s ease, transform .35s ease, visibility 0s linear .35s;
}

.ays-reform-card.is-active .ays-reform-details {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);

    transition-delay: .16s, .16s, 0s;
}

.ays-reform-details-lead {
    margin: 0 0 16px;

    color: var(--ays-gold);

    font-family: "Bebas Neue", sans-serif;
    font-size: clamp(24px, 2.1vw, 34px);
    font-weight: 400;
    line-height: .95;
}

.ays-reform-details-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 20px;

    margin: 0;
    padding: 0;

    list-style: none;
}

.ays-reform-details-list li {
    padding-top: 7px;

    border-top: 1px solid rgba(254, 234, 175, .5);

    color: rgba(255, 255, 255, .88);

    font-family: "Montserrat", sans-serif;
    font-size: clamp(13px, .92vw, 16px);
    line-height: 1.35;
}

@media (max-width: 1100px) {
    .ays-reforms-stage {
        height: auto;
        margin-top: 0;
    }

    .ays-reforms {
        height: auto;
        min-height: 0;
        padding-bottom: 80px;

        overflow: visible;
    }

    .ays-reforms-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        height: auto;
    }

    .ays-reform-card {
        grid-template-rows: 270px 190px;
    }

    .ays-reform-card.is-active {
        flex: initial;
    }

}

@media (max-width: 1100px) {
    .ays-reforms-stage {
        /*
         * Reservamos un viewport extra: Reformas asciende sobre Metodología,
         * queda completa en pantalla y después cede el paso a Contacto.
         */
        height: 200dvh;
        margin-top: -100dvh;
    }

    .ays-reforms {
        height: 100dvh;
        min-height: 640px;
        /* Separa el titular del borde y del botón de menú. */
        padding: clamp(76px, 10dvh, 92px) 6vw 0;
        overflow: hidden;
    }

    .ays-reforms-line-entry {
        right: 9%;
    }

    .ays-reforms-line-horizontal {
        left: 9%;
        width: 82%;
    }

    .ays-reforms-line-exit {
        left: 9%;
    }

    .ays-reforms-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
        height: auto;
        /* El titular necesita una pausa antes del selector de reformas. */
        margin-top: clamp(38px, 5dvh, 48px);
    }

    .ays-reforms-header {
        padding-left: 12vw;
        text-align: left;
    }

    .ays-reforms-header h2 {
        font-size: clamp(42px, 11vw, 52px);
    }

    .ays-reforms-intro {
        display: none;
    }

    /*
     * En una pantalla táctil no existe hover. Cada reforma se convierte en
     * una pestaña: al tocarla se abre su imagen y el contenido relacionado.
     */
    .ays-reform-card {
        display: grid;
        flex: 0 0 auto;
        grid-template-rows: 68px 0;
        height: auto;
        overflow: hidden;
        transition: grid-template-rows .35s ease;
    }

    .ays-reform-card.is-active {
        flex: 0 0 auto;
        grid-template-rows: 76px minmax(210px, 32dvh);
    }

    .ays-reforms-grid.has-active .ays-reform-card:not(.is-active) {
        opacity: 1;
    }

    .ays-reform-card-content {
        display: flex;
        align-items: center;
        box-sizing: border-box;
        min-height: 0;
        padding: 6px 16px;
        background: var(--ays-paper);
    }

    .ays-reform-number {
        margin-right: 11px;
        font-size: 25px;
    }

    .ays-reform-dot,
    .ays-reform-card p {
        display: none;
    }

    .ays-reform-card h3 {
        font-size: clamp(24px, 6.3vw, 29px);
        line-height: 1;
    }

    .ays-reform-card.is-active .ays-reform-card-content {
        background: var(--ays-navy);
    }

    .ays-reform-image {
        min-height: 0;
    }

    .ays-reform-details {
        justify-content: flex-end;
        padding: 18px 20px;
    }

    .ays-reform-details-lead {
        max-width: 280px;
        margin-bottom: 12px;
        font-size: clamp(23px, 6.2vw, 29px);
    }

    .ays-reform-details-list {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .ays-reform-details-list li {
        font-size: 14px;
        line-height: 1.25;
    }

}
