/* --- ESTRUCTURA BASE --- */
#custom-accordion-section {
    padding: 30px 0;
    background: #ffffff;
    width: 100%;
    overflow: hidden;
    position: relative;
    /* Para no sobrepasar otros módulos como .eco-mobile-toggle */
    z-index: 1; 
}

.accordion-wrapper {
    display: flex;
    width: 95%;
    max-width: 1400px;
    margin: 0 auto !important;
    gap: 10px;
    height: 450px;
}

.accordion-item {
    position: relative;
    flex: 1;
    background-size: cover;
    background-position: center;
    transition: flex 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    cursor: pointer;
    overflow: hidden;
    border-radius: 5px;
    transform: skewX(-10deg); /* Inclinación Escritorio */
}

/* --- IMAGEN (ESCRITORIO) --- */
.accordion-item::before {
    content: '';
    position: absolute;
    top: 0; 
    left: -35%; 
    width: 170%; 
    height: 100%;
    background-image: inherit;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    transform: skewX(10deg); /* Endereza imagen en escritorio */
    z-index: 1;
    transition: all 0.5s ease;
}

.accordion-item::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.35);
    transition: opacity 0.4s ease;
    z-index: 2;
}

/* --- ESTADO ACTIVO (ESCRITORIO) --- */
.accordion-item.active { flex: 5; }
.accordion-item.active::after { opacity: 0; }

.accordion-item.active::before { 
    height: 55% !important; 
    width: 170% !important; 
    left: -35% !important; 
    top: 0 !important;
    background-size: contain !important; 
    background-position: center center !important;
    background-repeat: no-repeat !important;
    transform: skewX(10deg) !important;
}

/* --- TÍTULOS Y CONTENIDO --- */
.category-title {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) rotate(-90deg) skewX(10deg) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 1.6rem !important;
    text-transform: uppercase !important;
    z-index: 10;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

.accordion-item.active .category-title { opacity: 0; visibility: hidden; }

.active-card-content {
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 50%;
    background: #ffffff;
    display: flex;
    align-items: center; justify-content: center;
    flex-direction: column;
    transform: translateY(101%);
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 20;
}

.accordion-item.active .active-card-content { transform: translateY(0); }

.content-inner { transform: skewX(10deg); text-align: center; padding: 20px; opacity: 0; transition: opacity 0.3s ease 0.2s; }
.accordion-item.active .content-inner { opacity: 1; }

.card-title { font-size: 1.8rem; font-weight: 900; color: #000; text-transform: uppercase; margin-bottom: 5px; }
.card-desc { font-size: 0.95rem; color: #444; margin-bottom: 20px; line-height: 1.4; }

.acc-btn-ver {
    display: inline-block; padding: 10px 30px; background: #0076b6; color: #fff !important;
    border-radius: 50px; font-weight: bold; text-decoration: none !important;
}

.wave-divider {
    position: absolute; top: -31px; left: 0; width: 100%; height: 32px;
    background-image: url('/img/wave.svg'); background-size: cover; 
    z-index: 21; transform: skewX(10deg);
}

/* --- MÓVIL: RESETEO TOTAL Y COMPATIBILIDAD --- */
@media (max-width: 767px) {
    #custom-accordion-section {
        /* Bajamos el z-index para que .eco-mobile-toggle mande si están cerca */
        z-index: 0 !important; 
        padding: 20px 0;
    }

    .accordion-wrapper { 
        flex-direction: column !important; 
        height: auto !important; 
        gap: 8px !important; 
    }
    
    .accordion-item { 
        width: 100% !important; 
        height: 80px !important; 
        flex: none !important; 
        transform: none !important; /* RECTO ABSOLUTO */
        border-radius: 5px !important;
    }
    
    .accordion-item.active { height: 450px !important; }
    
    .accordion-item::before { 
        left: 0 !important; 
        width: 100% !important; 
        height: 100% !important;
        transform: none !important; /* IMAGEN RECTA ABSOLUTA */
        background-position: center center !important;
        background-size: cover !important;
    }
    
    .accordion-item.active::before { 
        height: 45% !important; 
        top: 2% !important;
        background-size: contain !important;
        transform: none !important; /* RESET TRANSFORM */
    }
    
    .category-title { 
        transform: translate(-50%, -50%) !important; 
        rotate: 0deg !important; 
        font-size: 1.3rem !important;
        /* Evitar que el título del acordeón cerrado tape otros elementos */
        z-index: 5 !important;
    }
    
    .active-card-content { 
        height: 55% !important; 
        z-index: 10 !important;
    }
    
    .content-inner, .wave-divider { 
        transform: none !important; /* TEXTOS RECTOS */
    }
}