/* =========================================================
   COURSE DETAILS (course-details.php) — builds on home.css (.hm)
   ========================================================= */

/* ---------- Hero ---------- */
.hm .cd-hero {
    padding: 24px 0 clamp(40px, 5vw, 72px);
    background:
        radial-gradient(60% 70% at 90% 10%, rgba(20, 184, 166, 0.14) 0%, rgba(20, 184, 166, 0) 70%),
        linear-gradient(180deg, #f6fdfb 0%, #ffffff 100%);
}

.cd-crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: clamp(24px, 3vw, 40px);
    font-size: 0.85rem;
    color: var(--muted);
}

.cd-crumbs a {
    color: var(--muted);
    font-weight: 500;
}

.cd-crumbs a:hover {
    color: var(--teal-d);
}

.cd-crumbs svg {
    width: 14px;
    height: 14px;
    color: #cbd5e1;
}

.cd-crumbs span {
    color: var(--ink);
    font-weight: 600;
    max-width: 40ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cd-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: clamp(32px, 5vw, 64px);
    align-items: center;
}

.hm .cd-title {
    margin-top: 18px;
    font-family: var(--font-h);
    font-size: clamp(2.1rem, 4vw, 3.3rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.cd-desc {
    margin-top: 16px;
    max-width: 600px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--muted);
}

.cd-facts {
    list-style: none;
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 560px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.cd-facts li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 14px 16px;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--ink);
}

.cd-facts li:nth-child(even) {
    border-left: 1px solid var(--line);
}

.cd-facts li:nth-child(n + 3) {
    border-top: 1px solid var(--line);
}

.cd-facts li > span {
    min-width: 0;
}

.cd-facts small {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--muted);
}

.cd-facts svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--teal);
}

.cd-rating {
    margin-top: 18px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

.cd-rating strong {
    color: var(--ink);
}

.cd-hero-media {
    position: relative;
    border-radius: 28px;
    overflow: hidden;
    align-self: center;
    border: 6px solid #ffffff;
    box-shadow: var(--shadow-lg);
    background: #e2e8f0;
}

/* Course banners carry their own text, so show the whole image at its natural shape — never crop it. */
.cd-hero-media img {
    display: block;
    width: 100%;
    height: auto;
}

/* ---------- Body layout ---------- */
.hm .cd-body {
    padding: clamp(40px, 5vw, 72px) 0 clamp(56px, 6vw, 96px);
    background: #ffffff;
}

.cd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: clamp(28px, 4vw, 56px);
    align-items: start;
}

.hm .cd-block {
    padding: 0;
}

.cd-block + .cd-block {
    margin-top: clamp(48px, 5vw, 72px);
}

.hm .cd-h2 {
    font-family: var(--font-h);
    font-size: clamp(1.6rem, 2.6vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.cd-block-sub {
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.65;
}

/* Curriculum modules */
.cd-modules {
    list-style: none;
    margin-top: 24px;
    border-radius: 20px;
    border: 1px solid var(--line);
    overflow: hidden;
    background: #ffffff;
}

.cd-module + .cd-module {
    border-top: 1px solid var(--line);
}

.cd-module summary,
.cd-module-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    list-style: none;
}

.cd-module summary {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.cd-module summary::-webkit-details-marker {
    display: none;
}

.cd-module summary:hover {
    background: var(--soft);
}

.cd-module summary:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

.cd-module-num {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--mint);
    color: var(--teal-d);
    font-family: var(--font-h);
    font-size: 0.95rem;
    font-weight: 800;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cd-module-title {
    flex: 1;
    min-width: 0;
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
}

.cd-module-chev {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--muted);
    transition: transform 0.25s ease;
}

.cd-module details[open] .cd-module-chev {
    transform: rotate(180deg);
}

.cd-module details[open] .cd-module-num {
    background: var(--teal);
    color: #ffffff;
}

.cd-module details[open] summary {
    background: #fbfefd;
}

.cd-module details p {
    padding: 0 20px 20px 76px;
    color: var(--muted);
    line-height: 1.65;
    background: #fbfefd;
    animation: cd-reveal 0.25s ease;
}

/* No-syllabus fallback */
.cd-plan {
    list-style: none;
    margin-top: 22px;
    display: grid;
    gap: 10px;
}

.cd-plan li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 16px;
    background: var(--soft);
    border: 1px solid var(--line);
    font-weight: 600;
    color: var(--ink);
}

.cd-plan svg {
    width: 22px;
    height: 22px;
    color: var(--teal);
}

/* How lessons work */
.cd-how {
    list-style: none;
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.cd-how li {
    padding: 22px;
    border-radius: 18px;
    background: var(--soft);
    border: 1px solid var(--line);
}

.cd-how li > span {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #ffffff;
    color: var(--teal-d);
    border: 1px solid var(--line);
}

.cd-how svg {
    width: 20px;
    height: 20px;
}

.hm .cd-how h3 {
    margin-top: 14px;
    font-family: var(--font-h);
    font-size: 1.08rem;
    font-weight: 700;
}

.cd-how p {
    margin-top: 6px;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--muted);
}

/* ---------- Enrol card ---------- */
.cd-aside {
    position: sticky;
    top: 92px;
}

.cd-enrol {
    padding: 28px 24px 22px;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
}

.cd-enrol-ribbon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    background: #fff1f2;
    color: #e11d48;
    font-family: var(--font-ui);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.cd-enrol-ribbon svg {
    width: 14px;
    height: 14px;
}

.hm .cd-enrol-title {
    margin-top: 14px;
    font-family: var(--font-h);
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.cd-enrol-price {
    margin-top: 8px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
}

.cd-enrol-price strong {
    font-family: var(--font-h);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.03em;
    vertical-align: middle;
}

.cd-enrol-list {
    list-style: none;
    margin: 18px 0 22px;
    display: grid;
    gap: 10px;
}

.cd-enrol-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.93rem;
    color: var(--ink-2);
}

.cd-enrol-list svg {
    width: 18px;
    height: 18px;
    padding: 3px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--mint);
    color: var(--teal);
    stroke-width: 3;
}

.cd-enrol .hm-btn + .hm-btn {
    margin-top: 10px;
}

.hm .cd-enrol-btn {
    justify-content: space-between;
}

.cd-enrol-note {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--muted);
}

.cd-enrol-note svg {
    width: 15px;
    height: 15px;
    color: var(--teal);
}

.hm .cd-btn-plain {
    padding: 0 22px;
}

/* ---------- Related ---------- */
.hm .cd-related {
    background: var(--soft);
    border-top: 1px solid var(--line);
}

.cd-related-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

/* ---------- Not found ---------- */
.cd-notfound {
    max-width: 620px;
    text-align: center;
}

.cd-notfound .hm-hero-actions {
    justify-content: center;
}

.cd-notfound-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--mint);
    color: var(--teal);
}

.cd-notfound-icon svg {
    width: 30px;
    height: 30px;
}

/* ---------- Mobile booking bar ---------- */
.cd-mobile-bar {
    display: none;
}

@keyframes cd-reveal {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .cd-hero-grid,
    .cd-layout {
        grid-template-columns: 1fr;
    }

    .cd-hero-media {
        order: -1;
    }

    .cd-aside {
        position: static;
    }

    .cd-enrol {
        max-width: 560px;
    }

    .cd-mobile-bar {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        z-index: 900;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 10px 10px 18px;
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid var(--line);
        box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.35);
        backdrop-filter: blur(10px);
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .cd-mobile-bar.is-hidden {
        transform: translateY(140%);
        opacity: 0;
        pointer-events: none;
    }

    .cd-mobile-bar > div {
        min-width: 0;
    }

    .cd-mobile-bar strong {
        display: block;
        font-family: var(--font-ui);
        font-size: 0.92rem;
        color: var(--ink);
    }

    .cd-mobile-bar small {
        display: block;
        font-size: 0.76rem;
        color: var(--muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .cd-mobile-bar .hm-btn {
        min-height: 46px;
        flex-shrink: 0;
        font-size: 0.9rem;
    }

    /* Leave room so the bar never covers the footer */
    .hm.cd {
        padding-bottom: 84px;
    }
}

@media (max-width: 640px) {
    .cd-crumbs span {
        max-width: 22ch;
    }

    .cd-how {
        grid-template-columns: 1fr;
    }

    .cd-module summary,
    .cd-module-row {
        gap: 12px;
        padding: 16px;
    }

    .cd-module-num {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 0.85rem;
    }

    .cd-module-title {
        font-size: 0.95rem;
    }

    .cd-module details p {
        padding: 0 16px 18px 62px;
        font-size: 0.92rem;
    }

    .cd-enrol {
        padding: 24px 20px 20px;
    }
}
