/* Courses Grid Section */
.courses-grid {
    position: relative;
    width: 100vw;
    display: grid;
    grid-template-columns: repeat(4, 25%);
    grid-template-rows: repeat(4, 33.33vh);
    gap: 0;
    z-index: 5;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    contain: layout style paint;
    -webkit-font-smoothing: antialiased;
}

.course-pair {
    position: relative;
    grid-column: span 2;
    display: flex;
    cursor: pointer;
    overflow: visible;
    transform: translateZ(0);
    will-change: transform;
}

/* Course Content */
.course-content {
    position: relative;
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 50%;
    height: 100%;
    z-index: 2;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
    transform: translateZ(0);
    padding-bottom: 60px;
}

/* Course Image */
.course-image {
    position: relative;
    width: 50%;
    height: 100%;
    overflow: hidden;
    will-change: transform, opacity;
    transform: translateZ(0);
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.course-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Text Elements */
.edition {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-family: Arial, sans-serif;
    color: rgba(0, 0, 0, 0.7);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.course-content h2 {
    font-size: 2.2rem;
    line-height: 1.2;
    font-weight: bold;
    margin-bottom: 1rem;
    font-family: Arial, sans-serif;
    color: #1b3241;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.description {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 2.5rem;
    font-family: Arial, sans-serif;
    color: #1b3241;
    min-height: 2.8em;
    max-height: 2.8em;
    overflow: hidden;
    position: relative;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity, max-height;
}

.description:before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 1.4em;
    background: linear-gradient(to bottom, transparent, #FFFADD);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity;
}

.description:after {
    content: '...';
    position: absolute;
    right: 0;
    bottom: 0;
}

.arrow-link {
    font-size: 2.5rem;
    color: #1b3241;
    position: absolute;
    bottom: 25px;
    left: 25px;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    transform: translateZ(0);
}

/* Hover Effects */
.course-pair:hover .course-content {
    position: absolute;
    width: 100%;
    z-index: 10;
    padding: 35px;
    height: 100%;
    left: 0;
    top: 0;
}

.course-pair:hover .description {
    min-height: 0;
    max-height: none;
    overflow: visible;
    margin-bottom: 3.5rem;
}

.course-pair:hover .description:before,
.course-pair:hover .description:after {
    opacity: 0;
    visibility: hidden;
}

.course-pair:hover .arrow-link {
    transform: translateX(20px) translateZ(0);
    left: 35px;
    bottom: 35px;
}

.course-pair:hover .course-image {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.05) translateZ(0);
}

/* Colors */
.green {
    background-color: #FFFADD;
    transform: translateZ(0);
}

.purple {
    background-color: #DBDB00;
    transform: translateZ(0);
}

.yellow {
    background-color: #DBDB00;
    transform: translateZ(0);
}

.orange {
    background-color: #FFFADD;
    transform: translateZ(0);
}

.blue {
    background-color: #FFFADD;
    transform: translateZ(0);
}

.red {
    background-color: #DBDB00;
    transform: translateZ(0);
}

.turquoise {
    background-color: #DBDB00;
    transform: translateZ(0);
}

.coral {
    background-color: #FFFADD;
    transform: translateZ(0);
}

/* Gradientes para descripción */
.green .description:before {
    background: linear-gradient(to bottom, transparent, #FFFADD);
}

.purple .description:before {
    background: linear-gradient(to bottom, transparent, #DBDB00);
}

.yellow .description:before {
    background: linear-gradient(to bottom, transparent, #DBDB00);
}

.orange .description:before {
    background: linear-gradient(to bottom, transparent, #FFFADD);
}

.blue .description:before {
    background: linear-gradient(to bottom, transparent, #FFFADD);
}

.red .description:before {
    background: linear-gradient(to bottom, transparent, #DBDB00);
}

.turquoise .description:before {
    background: linear-gradient(to bottom, transparent, #DBDB00);
}

.coral .description:before {
    background: linear-gradient(to bottom, transparent, #FFFADD);
}

/* Image Overlay Effects */
.course-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    z-index: 2;
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* Overlay Colors */
.green+.course-image::before {
    background-color: #FFFADD;
}

.purple+.course-image::before {
    background-color: #DBDB00;
}

.yellow+.course-image::before {
    background-color: #DBDB00;
}

.orange+.course-image::before {
    background-color: #FFFADD;
}

.blue+.course-image::before {
    background-color: #FFFADD;
}

.red+.course-image::before {
    background-color: #DBDB00;
}

.turquoise+.course-image::before {
    background-color: #DBDB00;
}

.coral+.course-image::before {
    background-color: #FFFADD;
}

/* Hover Image Effects */
.course-pair:hover .course-image::before {
    left: 0;
    opacity: 1;
    transform: translateZ(0);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .courses-grid {
        grid-template-columns: 1fr;
        transform: translateZ(0);
    }

    .course-pair {
        flex-direction: column;
        transform: translateZ(0);
    }

    .course-content,
    .course-image {
        width: 100%;
        transform: translateZ(0);
    }

    .course-pair:hover .course-content {
        position: relative;
        padding: 25px;
        height: auto;
        padding-bottom: 60px;
        transform: translateZ(0);
    }

    .description {
        min-height: 0;
        max-height: none;
        overflow: visible;
    }

    .description:before,
    .description:after {
        display: none;
    }

    .course-content h2 {
        font-size: 1.8rem;
    }
}