/* ==========================================================================
   Courses, course detail, tuition and schedule (page-courses.css)
   Builds on the shared pg-* system in pages.css. Prefix: cx-
   ========================================================================== */

/* ---------- Hero search (courses index aside) ---------- */
.cx-search {
    display: grid;
    gap: 0.5rem;
    padding: 1.1rem;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--pg-line);
    border-radius: var(--pg-r-lg);
    box-shadow: var(--pg-shadow-sm);
}

.cx-search__label {
    color: var(--pg-ink);
    font-size: 0.875rem;
    font-weight: 600;
}

.cx-search__field {
    position: relative;
}

.cx-search__field svg,
.cx-search__field [data-lucide] {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    width: 1.15rem;
    height: 1.15rem;
    transform: translateY(-50%);
    color: var(--pg-muted);
    pointer-events: none;
}

.cx-search__field input {
    width: 100%;
    min-height: 3rem;
    padding: 0.7rem 0.95rem 0.7rem 2.75rem;
    border: 1px solid var(--pg-line-strong);
    border-radius: 12px;
    background: #fff;
    color: var(--pg-ink);
    font: inherit;
    font-size: 1rem;
    transition: border-color var(--motion-fast, 180ms) var(--ease-out-soft, ease-out), box-shadow var(--motion-fast, 180ms) var(--ease-out-soft, ease-out);
}

.cx-search__field input:focus {
    outline: none;
    border-color: var(--pg-sky-ink);
    box-shadow: 0 0 0 4px rgba(79, 195, 247, 0.22);
}

.cx-search__count {
    margin: 0;
    color: var(--pg-muted);
    font-size: 0.8125rem;
}

/* ---------- Category navigation ---------- */
.cx-cats {
    display: grid;
    /* minmax(0, 1fr): without it the track grows to the max-content width of
       the category pill row and pushes the whole page sideways on phones,
       instead of letting the row scroll inside itself. */
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
    min-width: 0;
}

.cx-subcats {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
}

.cx-subcats::-webkit-scrollbar { display: none; }

.cx-subcats__label {
    flex-shrink: 0;
    margin-right: 0.25rem;
    color: var(--pg-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.cx-subcat {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.3rem 0.85rem;
    border: 1px solid var(--pg-line);
    border-radius: 999px;
    background: #fff;
    color: var(--pg-text);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color var(--motion-fast, 180ms), background-color var(--motion-fast, 180ms), color var(--motion-fast, 180ms);
}

.cx-subcat:hover { border-color: var(--pg-line-strong); }

.cx-subcat[aria-current="page"] {
    background: var(--pg-sky-soft);
    border-color: transparent;
    color: var(--pg-sky-ink);
}

.cx-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    min-width: 0;
}

.pg-filter--sm .pg-filter__btn {
    min-height: 2.25rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
}

/* ---------- Study-abroad cross-sell ---------- */
.cx-country {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.cx-country__text {
    display: grid;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.cx-country__title { color: var(--pg-ink); font-weight: 650; }

.cx-country__sub {
    color: var(--pg-muted);
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 639.98px) {
    .cx-country { flex-wrap: wrap; }
    .cx-country__go { width: 100%; }
}

/* ---------- Course cards ---------- */
.cx-grid .pg-card__media { aspect-ratio: 16 / 10; }

.cx-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    box-shadow: var(--pg-shadow-sm);
}

.cx-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.cx-card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 1.0625rem;
    transition: color var(--motion-fast, 180ms);
}

.pg-card--link:hover .cx-card__title { color: var(--pg-pink-ink); }

.cx-card__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    color: var(--pg-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.cx-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin: 0.15rem 0 0;
    color: var(--pg-text);
    font-size: 0.8125rem;
}

.cx-facts > div { display: inline-flex; align-items: center; gap: 0.35rem; min-width: 0; }
.cx-facts dt { display: inline-flex; color: var(--pg-muted); }
.cx-facts dt svg, .cx-facts dt [data-lucide] { width: 0.95rem; height: 0.95rem; }
.cx-facts dd { margin: 0; }

.cx-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.85rem;
    border-top: 1px solid var(--pg-line);
}

.cx-price {
    color: var(--pg-ink);
    font-size: 1.0625rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.cx-price--ask {
    color: var(--pg-muted);
    font-size: 0.875rem;
    font-weight: 600;
}

.cx-card__go { flex-shrink: 0; font-size: 0.875rem; }

.cx-no-match { margin-top: 0.5rem; }

/* ---------- Help callout ---------- */
.cx-help { padding-top: 0; }
.cx-help__box { max-width: 52rem; }
.cx-help__copy { min-width: 0; }
.cx-help__copy p { margin: 0.35rem 0 1rem; color: var(--pg-muted); line-height: 1.6; }

.cx-help__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
}

/* ---------- Course detail ---------- */
.cx-hero-media {
    margin: 0;
    overflow: hidden;
    border-radius: var(--pg-r-lg);
    box-shadow: var(--pg-shadow-md);
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, var(--pg-pink-soft), var(--pg-sky-soft));
}

.cx-hero-media img {
    display: block;
    width: 100%;
    height: 100%;
    /* Square course artwork with text: show it whole (see .course-card). */
    object-fit: contain;
    padding: 0.75rem;
}

.cx-detail {
    display: grid;
    gap: clamp(1.25rem, 3vw, 2rem);
    align-items: start;
}

@media (min-width: 1024px) {
    .cx-detail { grid-template-columns: minmax(0, 1fr) 22rem; }
    .cx-detail__side { position: sticky; top: 6rem; }
}

.cx-detail__main {
    display: grid;
    gap: clamp(1rem, 2.5vw, 1.5rem);
    min-width: 0;
}

.cx-blocks {
    display: grid;
    gap: clamp(1rem, 2.5vw, 1.5rem);
}

@media (min-width: 768px) {
    .cx-blocks:has(> .cx-block + .cx-block) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cx-block__title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.cx-block__text { margin: 0; color: var(--pg-text); line-height: 1.65; }
.cx-block__sub { margin: 0.5rem 0 0; color: var(--pg-ink); font-size: 0.875rem; font-weight: 650; }

.cx-checks {
    display: grid;
    gap: 0.55rem;
    margin: 0.25rem 0 0;
    padding: 0;
    list-style: none;
    color: var(--pg-text);
    line-height: 1.55;
}

.cx-checks li { display: flex; gap: 0.55rem; align-items: flex-start; }

.cx-checks svg,
.cx-checks [data-lucide] {
    flex-shrink: 0;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.2rem;
    color: var(--pg-ok);
}

.cx-checks--muted svg, .cx-checks--muted [data-lucide] { color: var(--pg-muted); }

.cx-content .pg-card__body { padding: clamp(1.25rem, 3vw, 2.25rem); }
.cx-prose { min-width: 0; overflow-wrap: break-word; }
.cx-prose img { max-width: 100%; height: auto; }
.cx-prose table { display: block; max-width: 100%; overflow-x: auto; }

/* Fact sheet */
.cx-sheet .pg-card__body { gap: 1rem; }

.cx-sheet__price {
    display: grid;
    justify-items: start;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    border-radius: var(--pg-r-md);
    background: var(--pg-sun-soft);
}

.cx-sheet__label {
    color: var(--pg-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.cx-sheet__amount {
    color: var(--pg-ink);
    font-family: var(--pg-display);
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.cx-sheet__amount--ask {
    font-family: inherit;
    font-size: 1.0625rem;
    font-weight: 700;
}

.cx-sheet__note { margin: 0; color: var(--pg-text); font-size: 0.875rem; line-height: 1.55; }

.cx-sheet__facts {
    display: grid;
    margin: 0;
}

.cx-sheet__facts > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--pg-line);
}

.cx-sheet__facts > div:last-child { border-bottom: 0; }

.cx-sheet__facts dt {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    color: var(--pg-muted);
    font-size: 0.875rem;
}

.cx-sheet__facts dt svg,
.cx-sheet__facts dt [data-lucide] { width: 1rem; height: 1rem; }

.cx-sheet__facts dd {
    margin: 0;
    color: var(--pg-ink);
    font-size: 0.9375rem;
    font-weight: 600;
    text-align: right;
    min-width: 0;
    overflow-wrap: anywhere;
}

.cx-sheet__ask { justify-content: center; font-size: 0.875rem; }

/* Phone-only enrol bar: sticky inside the detail section, above the shell CTA bar. */
.cx-mobile-bar { display: none; }

@media (max-width: 1023.98px) {
    .cx-mobile-bar {
        position: sticky;
        bottom: calc(var(--pg-mobile-cta-h, 0px) + 0.75rem + env(safe-area-inset-bottom, 0px));
        z-index: 20;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        margin-top: 1.25rem;
        padding: 0.7rem 0.75rem 0.7rem 1rem;
        background: rgba(255, 255, 255, 0.97);
        border: 1px solid var(--pg-line);
        border-radius: var(--pg-r-md);
        box-shadow: var(--pg-shadow-md);
    }
    .cx-mobile-bar__price { display: grid; min-width: 0; }
    .cx-mobile-bar__price strong {
        color: var(--pg-ink);
        font-size: 0.9375rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .cx-mobile-bar .pg-btn { flex-shrink: 0; }
}

@media (max-width: 767.98px) {
    .cx-mobile-bar { bottom: calc(var(--pg-mobile-cta-h, 76px) + 0.5rem + env(safe-area-inset-bottom, 0px)); }
}

/* Related courses */
.cx-mini {
    flex-direction: row;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem;
}

.cx-mini__thumb {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 4.5rem;
    height: 4.5rem;
    overflow: hidden;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--pg-pink-soft), var(--pg-sky-soft));
    color: var(--pg-pink-ink);
}

.cx-mini__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cx-mini__thumb svg { width: 1.6rem; height: 1.6rem; }
.cx-mini__body { display: grid; gap: 0.3rem; min-width: 0; }

.cx-mini__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--pg-ink);
    font-weight: 650;
    line-height: 1.35;
}

.cx-mini__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.75rem;
    color: var(--pg-muted);
    font-size: 0.8125rem;
}

/* ---------- Tuition ---------- */
.cx-fees {
    display: grid;
    gap: 0.85rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cx-fee {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: clamp(1rem, 2.4vw, 1.35rem) clamp(1.1rem, 2.6vw, 1.5rem);
}

@media (min-width: 768px) {
    .cx-fee {
        grid-template-columns: minmax(0, 1fr) 13rem auto;
        align-items: center;
        gap: 1.5rem;
    }
}

.cx-fee__info { display: grid; gap: 0.45rem; min-width: 0; }

.cx-fee__cat {
    color: var(--pg-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.cx-fee__link {
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
}

.cx-fee__link:hover { color: var(--pg-pink-ink); text-decoration: underline; text-underline-offset: 3px; }
.cx-fee__link:focus-visible { outline: none; box-shadow: var(--pg-focus); }

.cx-fee__price {
    display: grid;
    gap: 0.2rem;
    align-content: center;
}

@media (max-width: 767.98px) {
    .cx-fee__price {
        padding: 0.75rem 0.9rem;
        border-radius: var(--pg-r-sm);
        background: var(--pg-surface);
    }
}

.cx-fee__amount {
    color: var(--pg-ink);
    font-family: var(--pg-display);
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.cx-fee__amount--ask {
    font-family: inherit;
    color: var(--pg-text);
    font-size: 1rem;
    font-weight: 650;
}

.cx-fee__note {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--pg-muted);
    font-size: 0.8125rem;
}

.cx-fee__note--ok { color: var(--pg-ok); }
.cx-fee__note svg { width: 0.95rem; height: 0.95rem; }

.cx-fee__action .pg-btn { width: 100%; }

@media (min-width: 768px) {
    .cx-fee__action .pg-btn { width: auto; min-width: 9.5rem; }
}

.cx-tuition-notes {
    display: grid;
    gap: 1rem;
    margin-top: clamp(1.75rem, 4vw, 2.75rem);
}

@media (min-width: 768px) {
    .cx-tuition-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cx-note-text {
    margin: 0.35rem 0 0.75rem;
    color: var(--pg-text);
    line-height: 1.6;
}

/* ---------- Schedule ---------- */
.cx-schedule__course {
    color: var(--pg-ink);
    font-weight: 650;
    text-decoration: none;
}

.cx-schedule__course:hover { color: var(--pg-pink-ink); text-decoration: underline; text-underline-offset: 3px; }

.cx-schedule__group {
    display: block;
    margin-top: 0.15rem;
    color: var(--pg-muted);
    font-size: 0.8125rem;
}

.cx-schedule__seats { margin-top: 0.45rem; }

.cx-schedule-help { margin-top: clamp(1.5rem, 4vw, 2.5rem); max-width: 52rem; }

.cx-schedule-help .pg-btn { margin-top: 0.25rem; }

/* Course artwork is uploaded square (800 x 800) and often carries text, as
   the logo fallback does. Show the whole image on the soft card tint rather
   than cropping it to the 16:10 frame. */
.course-card .pg-card__media img {
    object-fit: contain;
    padding: 0.5rem;
}
