/* =========================================================
   CATEGORÍAS
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Road+Rage&display=swap');


/* =========================================================
   PÁGINA
   ========================================================= */

.categories-page {
    width: 100%;
    background: #ffffff;
    font-family: Arial, sans-serif;
    padding: 0;
}

.categories-page__container {
    width: 94%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 20px 0 80px;
}


/* =========================================================
   TÍTULO
   ========================================================= */

.categories-page__title {
    margin: 0 0 60px;

    font-family: "Road Rage", sans-serif;
    font-size: 58px;
    font-weight: 400;
    line-height: 1;

    color: #111111;
}


/* =========================================================
   GRILLA PRINCIPAL
   ========================================================= */

.categories-grid {
    display: grid;

    grid-template-columns: repeat(4, 320px);

    gap: 28px;

    justify-content: space-between;
    align-items: start;
}


/* =========================================================
   BLOQUE DE CATEGORÍA
   ========================================================= */

.category-block {
    width: 320px;
}


/* =========================================================
   TARJETA PRINCIPAL
   ========================================================= */

.category-card,
.category-card:hover,
.category-card:focus,
.category-card:active {
    position: relative;

    display: block;

    width: 320px;
    height: 320px;

    padding: 0;
    margin: 0;

    border: none !important;
    border-radius: 0;

    overflow: hidden;

    background-color: #aaaaaa !important;

    cursor: pointer;

    text-decoration: none !important;

    box-shadow: none;

    color: #ffffff !important;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}


/* =========================================================
   IMAGEN PRINCIPAL
   ========================================================= */

.category-card__image {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;

    transition: transform 0.3s ease;
}


/* =========================================================
   CAPA OSCURA
   ========================================================= */

.category-card__overlay {
    position: absolute;

    inset: 0;

    background: rgba(0, 0, 0, 0.34);

    z-index: 2;

    transition: background 0.25s ease;
}


/* =========================================================
   NOMBRE
   ========================================================= */

.category-card__name {
    position: absolute;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    z-index: 3;

    width: 90%;

    font-family: Arial, sans-serif;
    font-size: 34px;
    font-weight: 700;

    line-height: 1.1;

    text-align: center;

    color: #ffffff !important;

    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);

    pointer-events: none;

    transition: color 0.2s ease;
}


/* =========================================================
   HOVER PRINCIPAL
   ========================================================= */

.category-card:hover {
    transform: translateY(-6px) scale(1.02);

    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25) !important;
}


.category-card:hover .category-card__image {
    transform: scale(1.04);
}


.category-card:hover .category-card__overlay {
    background: rgba(0, 0, 0, 0.42);
}


/* =========================================================
   COLOR TEXTO PRINCIPAL AL HACER HOVER
   ========================================================= */

.category-card:hover .category-card__name {
    color: #FF1B1B !important;
}


/* =========================================================
   CONTENEDOR DE SUBCATEGORÍAS
   ========================================================= */

.categories-children-container {
    width: 100%;

    margin-top: 20px;
}


/* =========================================================
   PANEL DE SUBCATEGORÍAS
   ========================================================= */

.category-children {
    display: none;

    width: 100%;

    grid-template-columns: repeat(4, 320px);

    gap: 20px;

    /*
     * IMPORTANTE:
     * Las tarjetas empiezan exactamente desde
     * el mismo punto que las tarjetas principales.
     */
    justify-content: space-between;

    align-items: start;

    margin: 0;
    padding: 0;
}


/* =========================================================
   PANEL ABIERTO
   ========================================================= */

.category-children.is-open {
    display: grid;
}


/* =========================================================
   TARJETA HIJA
   ========================================================= */

.category-child,
.category-child:hover,
.category-child:focus,
.category-child:active {
    position: relative;

    display: flex;

    align-items: center;
    justify-content: center;

    width: 320px;
    height: 320px;

    padding: 0;
    margin: 0;

    box-sizing: border-box;

    overflow: hidden;

    background: #aaaaaa;

    border: none !important;

    color: #ffffff !important;

    text-align: center;

    text-decoration: none !important;

    box-shadow: none;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}


/* =========================================================
   IMAGEN SUBCATEGORÍA
   ========================================================= */

.category-child .category-card__image {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;

    transition: transform 0.3s ease;
}


/* =========================================================
   OVERLAY SUBCATEGORÍA
   ========================================================= */

.category-child .category-card__overlay {
    position: absolute;

    inset: 0;

    background: rgba(0, 0, 0, 0.34);

    z-index: 2;

    transition: background 0.25s ease;
}


/* =========================================================
   NOMBRE SUBCATEGORÍA
   ========================================================= */

.category-child .category-card__name {
    position: absolute;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    z-index: 3;

    width: 90%;

    font-family: Arial, sans-serif;
    font-size: 30px;
    font-weight: 700;

    line-height: 1.1;

    text-align: center;

    color: #ffffff !important;

    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);

    pointer-events: none;

    transition: color 0.2s ease;
}


/* =========================================================
   HOVER SUBCATEGORÍA
   ========================================================= */

.category-child:hover {
    transform: translateY(-6px) scale(1.02);

    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25) !important;

    color: #ffffff !important;

    text-decoration: none !important;
}


.category-child:hover .category-card__image {
    transform: scale(1.04);
}


.category-child:hover .category-card__overlay {
    background: rgba(0, 0, 0, 0.42);
}


/* =========================================================
   COLOR TEXTO SUBCATEGORÍA AL HACER HOVER
   ========================================================= */

.category-child:hover .category-card__name {
    color: #FF1B1B !important;
}


/* =========================================================
   SIN SUBCATEGORÍAS
   ========================================================= */

.category-child--empty {
    height: auto;

    min-height: 60px;

    padding: 20px;

    color: #777777 !important;

    background: #ffffff;

    border: 1px solid #d7d7d7 !important;

    cursor: default;
}


.category-child--empty:hover {
    transform: none;

    box-shadow: none !important;

    color: #777777 !important;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1400px) {

    .categories-grid {
        grid-template-columns: repeat(3, 320px);

        justify-content: center;
    }


    .category-children {
        grid-template-columns: repeat(3, 320px);

        justify-content: center;
    }

}


@media (max-width: 1050px) {

    .categories-page__container {
        width: 92%;
    }


    .categories-grid {
        grid-template-columns: repeat(2, 320px);

        justify-content: center;
    }


    .category-children {
        grid-template-columns: repeat(2, 320px);

        justify-content: center;
    }

}


@media (max-width: 700px) {

    .categories-page__container {
        width: 92%;

        padding-top: 20px;
    }


    .categories-page__title {
        font-size: 48px;

        margin-bottom: 40px;
    }


    .categories-grid {
        grid-template-columns: 320px;

        justify-content: center;
    }


    .category-children {
        grid-template-columns: 320px;

        justify-content: center;
    }

}


@media (max-width: 380px) {

    .categories-grid {
        grid-template-columns: 1fr;
    }


    .category-children {
        grid-template-columns: 1fr;
    }


    .category-block,
    .category-card,
    .category-child {
        width: 100%;
    }


    .category-card,
    .category-child {
        height: auto;

        aspect-ratio: 1 / 1;
    }

}