/*
 * Home top v2
 * Estilos encapsulados para no alterar las secciones existentes de la home.
 */
/* El header histórico puede superar el ancho intermedio; la home no debe desplazarse lateralmente. */
body.home {
    overflow-x: hidden;
}

#home-top-v2 {
    --home-top-v2-ink: #121A1B;
    --home-top-v2-green: #042825;
    --home-top-v2-accent: #A3F27C;
    --home-top-v2-muted: rgba(18, 26, 27, 0.58);
    --home-top-v2-soft: #F1F3F1;
    --home-top-v2-radius: 22px;
    --home-top-v2-metric-title-size: 30px;
    color: var(--home-top-v2-ink);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
}

/* Fallback para navegadores que aún no implementan overflow: clip. */
@supports not (overflow: clip) {
    #home-top-v2 {
        overflow-x: hidden;
    }
}

#home-top-v2 #home-hero {
    width: min(calc(100% - 40px), 1240px);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 292px;
    gap: 20px;
    margin: 32px auto 22px;
    padding: 0;
}

#home-top-v2 #home-hero #home-hero-imgs {
    width: 100%;
    height: 560px;
    min-width: 0;
    margin: 0;
    border-radius: var(--home-top-v2-radius);
    overflow: hidden;
}

#home-top-v2 #home-hero #home-hero-imgs .swiper-slide::before {
    background: linear-gradient(90deg, rgba(4, 40, 37, 0.66) 0%, rgba(4, 40, 37, 0.16) 72%, rgba(4, 40, 37, 0.08) 100%);
}

#home-top-v2 #home-hero #home-hero-imgs .swiper-slide h3 {
    left: 50px;
    width: min(68%, 560px);
    max-width: calc(100% - 100px);
    box-sizing: border-box;
    overflow-wrap: normal;
    font-size: clamp(3.2rem, 5.7vw, 5.35rem);
    line-height: 0.98;
    letter-spacing: -0.065em;
}

#home-top-v2 #home-hero #home-hero-imgs .swiper-slide.slide-alpa-new h3 .alpa-title,
#home-top-v2 #home-hero #home-hero-imgs .swiper-slide.slide-alpa-new h3 .alpa-subtitle {
    display: block;
}

#home-top-v2 #home-hero #home-hero-imgs .swiper-slide.slide-alpa-new h3 .alpa-subtitle {
    margin-top: 0.08em;
    font-size: clamp(1.15rem, 2vw, 1.65rem);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: 0.015em;
}

#home-top-v2 #home-hero #home-hero-imgs .swiper-slide.slide-alpa-new h3 a {
    display: inline-block;
}

#home-top-v2 #home-hero #home-hero-imgs .swiper-slide h3 a {
    margin-top: 28px;
    padding: 15px 20px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    background: var(--home-top-v2-accent);
    color: var(--home-top-v2-green);
    font-weight: 700;
    transition: transform 180ms ease, background-color 180ms ease;
}

#home-top-v2 #home-hero #home-hero-imgs .swiper-slide h3 a:hover,
#home-top-v2 #home-hero #home-hero-imgs .swiper-slide h3 a:focus-visible {
    background: #ffffff;
    color: var(--home-top-v2-green);
    transform: translateY(-2px);
}

#home-top-v2 #home-hero #home-hero-imgs .swiper-scrollbar {
    bottom: 28px;
    left: 50px;
    width: calc(100% - 100px);
    height: 3px;
    background: rgba(255, 255, 255, 0.35);
}

#home-top-v2 #home-hero #home-hero-imgs .swiper-scrollbar-drag {
    background: var(--home-top-v2-accent);
}

#home-top-v2 #home-hero #home-hero-data {
    position: static;
    width: 100%;
    height: auto;
    min-width: 0;
}

#home-top-v2 #home-hero #home-hero-data > div {
    gap: 16px;
}

#home-top-v2 #home-hero #home-hero-data > div > div {
    flex: 1 1 0;
    min-height: 0;
    padding: 26px 24px 24px;
    border: 1px solid rgba(18, 26, 27, 0.05);
    border-radius: var(--home-top-v2-radius);
    background: var(--home-top-v2-soft);
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    transition: border-color 420ms ease, box-shadow 420ms ease;
}

#home-top-v2 #home-hero #home-hero-data > div > div::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: var(--home-top-v2-progress, 14.2857%);
    height: 4px;
    border-radius: 0 0 6px 0;
    background: #A3F27C;
    opacity: 0.9;
    transform-origin: left center;
    transition: width 520ms ease, opacity 420ms ease;
}

/* Progreso visual del carrusel: la última slide deja la línea completa. */
#home-top-v2:has(#home-hero-imgs .swiper-slide:nth-child(2).swiper-slide-active) #home-hero-data > div > div::before {
    width: 28.5714%;
}

#home-top-v2:has(#home-hero-imgs .swiper-slide:nth-child(3).swiper-slide-active) #home-hero-data > div > div::before {
    width: 42.8571%;
}

#home-top-v2:has(#home-hero-imgs .swiper-slide:nth-child(4).swiper-slide-active) #home-hero-data > div > div::before {
    width: 57.1428%;
}

#home-top-v2:has(#home-hero-imgs .swiper-slide:nth-child(5).swiper-slide-active) #home-hero-data > div > div::before {
    width: 71.4285%;
}

#home-top-v2:has(#home-hero-imgs .swiper-slide:nth-child(6).swiper-slide-active) #home-hero-data > div > div::before {
    width: 85.7142%;
}

#home-top-v2:has(#home-hero-imgs .swiper-slide:nth-child(7).swiper-slide-active) #home-hero-data > div > div::before {
    width: 100%;
}

#home-top-v2 #home-hero #home-hero-data > div > div > div.active {
    display: block !important;
    animation: home-top-v2-metric-in 520ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes home-top-v2-metric-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#home-top-v2 #home-hero #home-hero-data > div > div h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    color: var(--home-top-v2-ink);
    font-size: var(--home-top-v2-metric-title-size);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

#home-top-v2 #home-hero #home-hero-data > div > div h3 img {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    object-fit: contain;
    opacity: 0.58;
}

/* Los indicadores de Economía Circular son conceptuales, no contadores. */
#home-top-v2 #home-hero #home-hero-data > div > div > div.slide-nueva1 h3 {
    position: relative;
    padding-right: 32px;
    font-size: var(--home-top-v2-metric-title-size);
    white-space: normal;
}

#home-top-v2 #home-hero #home-hero-data > div > div > div.slide-nueva1 h3 span {
    display: block;
    min-width: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    overflow-wrap: anywhere;
}

#home-top-v2 #home-hero #home-hero-data > div > div > div.slide-nueva1 h3 img {
    position: absolute;
    top: 0.08em;
    right: 0;
    width: 50px;
    height: 50px;
}

#home-top-v2 #home-hero #home-hero-data > div > div p {
    width: 100%;
    height: auto;
    margin: 0;
    color: var(--home-top-v2-muted);
    font-size: 17px;
    line-height: 1.18;
    letter-spacing: -0.02em;
}

#home-top-v2 #home-alianzas-socios-top-v2 {
    position: relative;
    isolation: isolate;
    width: min(calc(100% - 40px), 1240px);
    height: 126px;
    display: block;
    box-sizing: border-box;
    margin: 0 auto 34px;
    padding: 16px 0 16px 270px;
    overflow: hidden;
    border-top: 1px solid rgba(18, 26, 27, 0.1);
    border-bottom: 1px solid rgba(18, 26, 27, 0.1);
}

#home-top-v2 #home-alianzas-socios-top-v2 > p {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 270px;
    height: 100%;
    margin: 0;
    padding-right: 24px;
    background: #ffffff;
    color: var(--home-top-v2-ink);
    font-size: 16px;
    line-height: 1.2;
    white-space: normal;
    text-wrap: wrap;
    overflow: visible;
}

#home-top-v2 #home-alianzas-socios-top-v2 > p span {
    position: static;
    display: block;
    transform: none;
}

#home-top-v2 #home-alianzas-socios-top-v2 > p::after {
    display: none;
}

#home-top-v2 #home-alianzas-socios-top-v2 .swiper-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
}

#home-top-v2 #home-alianzas-socios-top-v2 a.item-acompanan {
    flex: 0 0 165px;
    width: 165px;
    height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 8px;
    overflow: visible;
    padding: 0;
    border-radius: 12px;
    opacity: 1;
    transition: opacity 180ms ease, transform 180ms ease;
}

#home-top-v2 #home-alianzas-socios-top-v2 a.item-acompanan:hover,
#home-top-v2 #home-alianzas-socios-top-v2 a.item-acompanan:focus-visible {
    opacity: 1;
    transform: translateY(-2px);
}

#home-top-v2 #home-alianzas-socios-top-v2 a.item-acompanan img {
    display: block;
    width: 100%;
    max-width: 165px;
    height: 78px;
    padding: 4px 12px;
    object-fit: contain;
    filter: none;
    mix-blend-mode: normal;
}

@media (max-width: 1200px) {
    #home-top-v2 #home-hero {
        grid-template-columns: 1fr;
    }

    #home-top-v2 #home-hero #home-hero-imgs {
        height: min(68vw, 560px);
    }

    #home-top-v2 #home-hero #home-hero-data > div {
        display: flex;
        flex-direction: row;
        height: auto;
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: none;
    }

    #home-top-v2 #home-hero #home-hero-data > div::-webkit-scrollbar {
        display: none;
    }

    #home-top-v2 #home-hero #home-hero-data > div > div {
        flex: 0 0 250px;
    }
}

@media (max-width: 600px) {
    #home-top-v2 {
        --home-top-v2-metric-title-size: 24px;
    }

    #home-top-v2 #home-hero,
    #home-top-v2 #home-alianzas-socios-top-v2 {
        width: calc(100% - 32px);
    }

    #home-top-v2 #home-hero {
        gap: 14px;
        margin-top: 16px;
    }

    #home-top-v2 #home-hero #home-hero-imgs {
        height: 440px;
        border-radius: 18px;
    }

    #home-top-v2 #home-hero #home-hero-imgs .swiper-slide h3 {
        left: 26px;
        width: calc(100% - 52px);
        max-width: calc(100% - 52px);
        font-size: clamp(2.55rem, 12vw, 4rem);
    }

    #home-top-v2 #home-hero #home-hero-imgs .swiper-scrollbar {
        left: 26px;
        width: calc(100% - 52px);
        bottom: 22px;
    }

    #home-top-v2 #home-hero #home-hero-data > div > div {
        flex-basis: 230px;
        padding: 22px 20px;
        border-radius: 18px;
    }

    #home-top-v2 #home-hero #home-hero-data > div > div > div.slide-nueva1 h3 {
        font-size: var(--home-top-v2-metric-title-size);
    }

    #home-top-v2 #home-hero #home-hero-data > div > div h3 img,
    #home-top-v2 #home-hero #home-hero-data > div > div > div.slide-nueva1 h3 img {
        width: 32px;
        height: 32px;
    }

    #home-top-v2 #home-hero #home-hero-data > div > div > div.slide-nueva1 h3 {
        padding-right: 38px;
    }

    #home-top-v2 #home-alianzas-socios-top-v2 {
        display: block;
        height: auto;
        margin-bottom: 24px;
        padding: 18px 0 8px;
    }

    #home-top-v2 #home-alianzas-socios-top-v2 > p {
        position: static;
        display: block;
        width: 100%;
        height: auto;
        padding: 0 0 12px;
    }

    #home-top-v2 #home-alianzas-socios-top-v2 .swiper-wrapper {
        height: 92px;
    }

    #home-top-v2 #home-alianzas-socios-top-v2 a.item-acompanan {
        flex-basis: 145px;
        width: 145px;
    }

    #home-top-v2 #home-alianzas-socios-top-v2 a.item-acompanan img {
        max-width: 145px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #home-top-v2 * {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
