/* Archivo de cursos Masteriyo: marco cuadrado e imagen completa. */
body.post-type-archive-mto-course .masteriyo-courses-wrapper .masteriyo-course--img-wrap,
body.post-type-archive-mto-course .masteriyo-courses-wrapper .masteriyo-feature-img {
    height: auto !important;
    max-height: none !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper .masteriyo-course--img-wrap img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: contain !important;
    object-position: center !important;
    background-color: #fff;
}

/* Tres columnas en escritorio, con tarjetas de igual altura por fila. */
body.post-type-archive-mto-course .masteriyo-courses-wrapper.grid-view {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 30px !important;
    align-items: stretch !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.grid-view > .masteriyo-col {
    display: flex !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.grid-view .masteriyo-course-item--wrapper {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    /* Masteriyo usa align-self: baseline e impide igualar las alturas. */
    align-self: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 0 !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.grid-view .masteriyo-course-item--wrapper > .masteriyo-course--img-wrap {
    flex: 0 0 auto !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.grid-view .masteriyo-course--content {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.grid-view .masteriyo-course--content__wrapper {
    flex: 1 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
}

/* El espacio sobrante queda antes del pie, sin cortar ni fijar el texto. */
body.post-type-archive-mto-course .masteriyo-courses-wrapper.grid-view .masteriyo-course-archive--aside {
    flex: 0 0 auto !important;
    width: 100% !important;
    margin-top: auto !important;
}

@media (max-width: 1024px) {
    body.post-type-archive-mto-course .masteriyo-courses-wrapper.grid-view {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 24px !important;
    }
}

@media (max-width: 600px) {
    body.post-type-archive-mto-course .masteriyo-courses-wrapper.grid-view {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

/* Lista: una miniatura acotada evita que el original desplace el texto. */
body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 24px !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view > .masteriyo-col {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course-item--wrapper {
    display: grid !important;
    grid-template-columns: 240px minmax(0, 1fr) !important;
    align-items: stretch !important;
    align-self: stretch !important;
    gap: 24px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course-item--wrapper > .masteriyo-course--img-wrap {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 240px !important;
    align-self: start !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course--content {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 190px !important;
    align-items: center !important;
    gap: 24px !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 16px 20px 16px 0 !important;
    box-sizing: border-box !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course--content__wrapper,
body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course-archive--aside {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course-archive--aside {
    align-items: stretch !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course-card-footer {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    width: 100% !important;
    margin: 0 !important;
}

body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-single-course--btn {
    width: 100% !important;
    box-sizing: border-box !important;
    justify-content: center !important;
}

@media (max-width: 1024px) {
    body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course-item--wrapper {
        grid-template-columns: 180px minmax(0, 1fr) !important;
        gap: 20px !important;
    }

    body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course--content {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 16px !important;
    }
}

@media (max-width: 600px) {
    body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course-item--wrapper {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 0 !important;
    }

    body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course-item--wrapper > .masteriyo-course--img-wrap {
        max-width: 240px !important;
        justify-self: center !important;
    }

    body.post-type-archive-mto-course .masteriyo-courses-wrapper.list-view .masteriyo-course--content {
        padding: 20px !important;
    }
}
/* Ficha del curso: afiche completo y pequeno, con cabecera de altura natural. */
body.single-mto-course .masteriyo-single-header > .masteriyo-single-header__content {
    min-width: 0 !important;
}

body.single-mto-course .masteriyo-single-header > .masteriyo-single-header__img-wrap:has(.masteriyo-single-header__image > img) {
    flex: 0 1 auto !important;
    width: 240px !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
}

body.single-mto-course .masteriyo-single-header .masteriyo-single-header__image:has(> img) {
    width: 100% !important;
    max-width: 240px !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 auto;
}

body.single-mto-course .masteriyo-single-header .masteriyo-single-header__image > img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 240px !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: contain !important;
    object-position: center !important;
    box-sizing: border-box !important;
    background: #fff;
}

@media (max-width: 992px) {
    body.single-mto-course .masteriyo-single-header:has(.masteriyo-single-header__image > img) {
        gap: 24px !important;
    }

    body.single-mto-course .masteriyo-single-header > .masteriyo-single-header__img-wrap:has(.masteriyo-single-header__image > img) {
        width: 200px !important;
    }
}
