
/* =====================================================
   NOTESREALM - POPULAR COURSES
   Desktop grid + responsive mobile carousel
   ===================================================== */

.courses-section,
.courses-section * {
    box-sizing: border-box;
}

.courses-section {
    width: 100%;
    padding: 76px 20px;
    background: var(--surface, #ffffff);
    overflow: hidden;
}

.courses-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* =====================================================
   SECTION HEADING
   ===================================================== */

.courses-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 36px;
}

.courses-heading-content {
    max-width: 700px;
}

.courses-heading .section-eyebrow {
    display: inline-block;
    margin-bottom: 11px;
    color: var(--secondary, #0891b2);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1.4px;
}

.courses-heading h2 {
    margin: 0 0 12px;
    color: var(--text, #172033);
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 750;
    line-height: 1.2;
}

.courses-heading p {
    max-width: 650px;
    margin: 0;
    color: var(--muted, #64748b);
    font-size: 1rem;
    line-height: 1.65;
}

/* View all courses */

.view-all-courses {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    padding: 10px 15px;

    border: 1px solid var(--border, #dbe4ee);
    border-radius: 9px;

    color: var(--primary, #0f4c81);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;

    transition: background 0.2s ease, border-color 0.2s ease;
}

.view-all-courses:hover {
    background: #eaf6fb;
    border-color: var(--accent, #22d3ee);
}

.view-all-courses span {
    font-size: 1.1rem;
}

/* =====================================================
   COURSE GRID - DESKTOP
   ===================================================== */

.courses-carousel {
    width: 100%;
}

.courses-grid {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
}

/* =====================================================
   COURSE CARD
   ===================================================== */

.course-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 22px;

    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #dbe4ee);
    border-radius: var(--radius, 16px);

    box-shadow: 0 3px 14px rgba(15, 23, 42, 0.045);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.course-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent, #22d3ee);
    box-shadow: var(--shadow, 0 8px 24px rgba(15, 23, 42, 0.10));
}

/* =====================================================
   COURSE CARD TOP
   ===================================================== */

.course-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 19px;
}

.course-category {
    color: var(--secondary, #0891b2);
    font-size: 0.76rem;
    font-weight: 700;
}

.course-level {
    padding: 4px 9px;
    border-radius: 20px;
    background: #eaf6fb;
    color: var(--primary, #0f4c81);
    font-size: 0.68rem;
    font-weight: 700;
}

/* =====================================================
   COURSE ICONS
   ===================================================== */

.course-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 48px;
    width: 48px;
    height: 48px;

    margin-bottom: 16px;
    border-radius: 12px;

    font-size: 1.4rem;
    font-weight: 700;
}

.course-icon-programming {
    background: #e8f2fb;
    color: #0f4c81;
}

.course-icon-security {
    background: #e6f7f8;
    color: #0891b2;
}

.course-icon-digital {
    background: #eef2ff;
    color: #4f46e5;
}

.course-icon-web {
    background: #ecfdf5;
    color: #059669;
}

.course-icon-maths {
    background: #fff7ed;
    color: #c2410c;
}

.course-icon-language {
    background: #fdf2f8;
    color: #be185d;
}

/* =====================================================
   COURSE CONTENT
   ===================================================== */

.course-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.course-content h3 {
    margin: 0 0 10px;
    color: var(--text, #172033);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: break-word;
}

.course-content p {
    margin: 0 0 17px;
    color: var(--muted, #64748b);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* =====================================================
   COURSE TOPIC TAGS
   ===================================================== */

.course-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
    margin-bottom: 19px;
}

.course-topics span {
    padding: 5px 8px;

    border: 1px solid var(--border, #dbe4ee);
    border-radius: 20px;
    background: #f8fafc;

    color: var(--muted, #64748b);
    font-size: 0.7rem;
    line-height: 1.3;
}

/* =====================================================
   COURSE CARD FOOTER
   ===================================================== */

.course-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    padding-top: 14px;
    border-top: 1px solid var(--border, #dbe4ee);
}

.course-format {
    min-width: 0;
    color: var(--muted, #64748b);
    font-size: 0.72rem;
    line-height: 1.4;
}

.course-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;

    color: var(--primary, #0f4c81);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
}

.course-link:hover {
    color: var(--secondary, #0891b2);
}

/* =====================================================
   CAROUSEL CONTROLS
   Hidden on desktop
   ===================================================== */

.courses-carousel-controls {
    display: none;
}

/* =====================================================
   SECTION FOOTER
   ===================================================== */

.courses-bottom {
    margin-top: 30px;
    text-align: center;
}

.courses-bottom p {
    margin: 0;
    color: var(--muted, #64748b);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* =====================================================
   TABLET AND MOBILE CAROUSEL
   Up to 767px
   ===================================================== */

@media screen and (max-width: 767px) {

    .courses-section {
        padding: 46px 16px;
    }

    /* Heading */

    .courses-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 15px;
        margin-bottom: 25px;
    }

    .courses-heading .section-eyebrow {
        margin-bottom: 8px;
        font-size: 0.72rem;
    }

    .courses-heading h2 {
        margin-bottom: 9px;
        font-size: 1.7rem;
    }

    .courses-heading p {
        font-size: 0.9rem;
        line-height: 1.55;
    }

    .view-all-courses {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    /* Carousel viewport */

    .courses-carousel {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;

        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scrollbar-width: none;

        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    .courses-carousel::-webkit-scrollbar {
        display: none;
    }

    /* Convert grid to horizontal track */

    .courses-section .courses-grid {
        display: flex;
        box-sizing: border-box;
        width: 100%;
        padding-inline: 6%;
        grid-template-columns: none;
        gap: 12px;
        align-items: stretch;
    }

    /* One centered card visible at a time */

    .courses-section .course-card {
        flex: 0 0 100%;
        width: 100%;
        min-width: 0;

        padding: 17px;
        border-radius: 13px;

        scroll-snap-align: center;
        scroll-snap-stop: always;
    }

    /* Card top */

    .course-card-top {
        gap: 7px;
        margin-bottom: 14px;
    }

    .course-category {
        font-size: 0.76rem;
    }

    .course-level {
        padding: 4px 8px;
        font-size: 0.68rem;
    }

    /* Icons */

    .course-icon {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
        margin-bottom: 12px;
        border-radius: 10px;
        font-size: 1.2rem;
    }

    /* Content */

    .course-content h3 {
        margin-bottom: 8px;
        font-size: 1rem;
        line-height: 1.4;
    }

    .course-content p {
        margin-bottom: 13px;
        font-size: 0.84rem;
        line-height: 1.5;
    }

    /* Tags */

    .course-topics {
        gap: 6px;
        margin-bottom: 13px;
    }

    .course-topics span {
        padding: 5px 7px;
        font-size: 0.68rem;
    }

    /* Footer */

    .course-card-footer {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding-top: 12px;
    }

    .course-format {
        font-size: 0.72rem;
    }

    .course-link {
        font-size: 0.8rem;
    }

    /* Carousel navigation */

    .courses-carousel-controls {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 16px;
        margin-top: 20px;
    }

    .courses-carousel-btn {
        display: flex;
        align-items: center;
        justify-content: center;

        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        padding: 0;

        border: 1px solid var(--border, #dbe4ee);
        border-radius: 50%;
        background: var(--surface, #ffffff);

        color: var(--primary, #0f4c81);
        font-size: 1.1rem;
        cursor: pointer;

        transition: background 0.2s ease, border-color 0.2s ease;
    }

    .courses-carousel-btn:hover {
        background: #eaf6fb;
        border-color: var(--secondary, #0891b2);
    }

    /* Dots */

    .courses-carousel-dots {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
    }

    .courses-carousel-dot {
        display: block;
        flex: 0 0 8px;

        width: 8px;
        height: 8px;
        padding: 0;

        border: 0;
        border-radius: 50%;
        background: #cbd5e1;

        cursor: pointer;

        transition:
            width 0.2s ease,
            background 0.2s ease;
    }

    .courses-carousel-dot.active {
        flex-basis: 22px;
        width: 22px;
        border-radius: 10px;
        background: var(--primary, #0f4c81);
    }

    .courses-carousel-btn:focus-visible,
    .courses-carousel-dot:focus-visible {
        outline: 2px solid var(--secondary, #0891b2);
        outline-offset: 3px;
    }

    .courses-bottom {
        margin-top: 22px;
    }

    .courses-bottom p {
        font-size: 0.82rem;
    }
}

/* =====================================================
   SMALL MOBILE
   ===================================================== */

@media screen and (max-width: 480px) {

    .courses-section {
        padding: 38px 12px;
    }

    .courses-heading {
        margin-bottom: 22px;
    }

    .courses-heading h2 {
        font-size: 1.55rem;
    }

    .courses-heading p {
        font-size: 0.86rem;
    }

    .courses-section .courses-grid {
        gap: 10px;
        padding-inline: 4%;
    }

    .courses-section .course-card {
        flex-basis: 100%;
        width: 100%;
        padding: 16px;
    }

    .course-card-top {
        gap: 7px;
        margin-bottom: 13px;
    }

    .course-category {
        font-size: 0.74rem;
    }

    .course-content h3 {
        font-size: 0.96rem;
    }

    .course-content p {
        font-size: 0.82rem;
    }

    .course-format {
        font-size: 0.7rem;
    }

    .course-link {
        font-size: 0.78rem;
    }

    .courses-carousel-controls {
        gap: 13px;
        margin-top: 17px;
    }
}

/* =====================================================
   VERY NARROW MOBILE
   ===================================================== */

@media screen and (max-width: 359px) {

    .courses-section {
        padding: 32px 10px;
    }

    .courses-heading h2 {
        font-size: 1.4rem;
    }

    .courses-section .courses-grid {
        padding-inline: 3%;
    }

    .courses-section .course-card {
        flex-basis: 100%;
        width: 100%;
        padding: 14px;
    }

    .course-card-top {
        gap: 6px;
    }

    .course-content h3 {
        font-size: 0.92rem;
    }

    .course-content p {
        font-size: 0.79rem;
    }

    .course-card-footer {
        flex-wrap: wrap;
    }

    .course-format {
        font-size: 0.67rem;
    }
}

/* =====================================================
   ACCESSIBILITY
   ===================================================== */

@media (hover: none) {
    .course-card:hover {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .courses-carousel {
        scroll-behavior: auto;
    }

    .course-card,
    .view-all-courses,
    .courses-carousel-btn,
    .courses-carousel-dot {
        transition: none;
    }

    .course-card:hover {
        transform: none;
    }
}
