/* ============================================
   Course Catalog Styles - Code Blue Academy
   Matches homepage dark/light aesthetic with
   brand gradients, glows, and premium cards.
   ============================================ */

/* ===== 1. CATALOG HERO =====
   Both catalogs use the page hero (css/pages/hero.css, #424); the CE
   catalog puts its search where the other pages have their buttons. */


/* ── Search bar ── */

.catalog-search {
    flex: 1 1 100%;
    max-width: 34rem;
}

.catalog-search__form {
    display: flex;
    align-items: center;
    background-color: var(--color-midnight-800);
    border: 1px solid var(--color-midnight-700);
    border-radius: var(--radius-lg);
    padding: var(--space-1);
    transition: border-color var(--duration-fast) var(--ease-default),
                box-shadow var(--duration-fast) var(--ease-default);
}

.catalog-search__form:focus-within {
    border-color: var(--color-cb-blue-400);
    box-shadow: 0 0 0 3px rgba(68, 120, 204, 0.15),
                0 0 30px rgba(68, 120, 204, 0.08);
}

.catalog-search__icon {
    color: var(--color-slate-500);
    margin-inline-start: var(--space-4);
    flex-shrink: 0;
}

.catalog-search__input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-white);
    font-size: var(--text-base);
    padding: var(--space-3) var(--space-4);
    outline: none;
}

.catalog-search__input::placeholder {
    color: var(--text-muted);
}

.catalog-search__btn {
    flex-shrink: 0;
}

.catalog-search__btn-icon {
    display: none;
}

/* A phone keeps a way to run the search on the page: the button becomes a
   square magnifier (the word stays as its name for a screen reader), and
   the field's own magnifier, now a duplicate, goes. */
@media (max-width: 36em) {
    .catalog-search__btn {
        min-width: var(--field-height);
        padding-inline: 0;
    }

    .catalog-search__btn-icon {
        display: block;
    }

    .catalog-search__btn-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .catalog-search__icon {
        display: none;
    }
}

/* ── CE at a Glance on a phone ──
   The CE catalog's hero card is not shown at 48em and below (owner,
   2026-11-12): the subtitle already gives the course and category counts,
   and the card stood between the search and the first course. display:
   none, so assistive technology skips it there too. From 48em up it is
   the page hero's card, unchanged; the hero's own spacing is hero.css's. */
@media (max-width: 48em) {
    .hero__visual.catalog-glance {
        display: none;
    }
}


/* ===== THE SITE HEADER'S HEIGHT =====
   What sticks under the sticky site header (the pill band and the filter
   panel here, the enroll bar on a course page) starts where the header
   ends: its top row is 79 px, and the program bar under it makes 124 px
   above 48em and 130 px above 64em (_navigation.css). The page scripts set
   the header's real height once they run (courses.js, course_detail.js). */
:root {
    --site-header-h: 4.9375rem;
    /* The pill band's own height: its row and padding. */
    --catalog-pills-h: 5.9375rem;
}

@media (min-width: 48.0625em) {
    :root {
        --site-header-h: 7.75rem;
    }
}

@media (min-width: 64.0625em) {
    :root {
        --site-header-h: 8.125rem;
    }
}


/* ===== 2. CATEGORY PILLS ===== */

.catalog-categories {
    background-color: var(--color-midnight-950);
    border-top: 1px solid var(--color-midnight-800);
    border-bottom: 1px solid var(--color-midnight-800);
    padding-block: var(--space-5);
    position: sticky;
    top: var(--site-header-h); /* under the site header, never behind it */
    z-index: var(--z-raised); /* over the cards that scroll under it, under the header (--z-sticky) */
}

.catalog-categories__scroll {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-block: var(--space-2);
}

/* Centred while the pills fit; when they are wider than the row they start
   at its left edge, so the first one ("All Courses") can be scrolled to.
   (justify-content: center spills past both edges, and the left spill
   cannot be reached.) */
.catalog-categories__scroll > :first-child {
    margin-inline-start: auto;
}

.catalog-categories__scroll > :last-child {
    margin-inline-end: auto;
}

.catalog-categories__scroll::-webkit-scrollbar {
    display: none;
}

.catalog-pill {
    --pill-color: 100, 116, 139; /* slate default */
    visibility: visible !important;
    opacity: 1 !important;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-white);
    background-color: rgba(var(--pill-color), 0.6);
    border: none;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--duration-normal) ease;
    flex-shrink: 0;
}

.catalog-pill:hover {
    background-color: rgba(var(--pill-color), 0.8);
    transform: translateY(-1px);
}

.catalog-pill--active {
    background-color: rgb(var(--pill-color));
    box-shadow: 0 0 20px rgba(var(--pill-color), 0.4);
}

.catalog-pill__count {
    font-size: var(--text-xs);
    color: var(--color-white);
    background-color: rgba(255, 255, 255, 0.2);
    padding: 1px var(--space-2);
    border-radius: var(--radius-full);
    font-weight: var(--weight-semibold);
}


/* ===== 3. MAIN CATALOG AREA ===== */

.catalog-main {
    background-color: var(--color-midnight-900);
    padding-block-start: var(--space-10);
    padding-block-end: 6rem;
    min-height: 60vh;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--space-8);
    align-items: start;
}

@media (max-width: 64em) {
    .catalog-layout {
        grid-template-columns: 1fr;
    }
}


/* ===== 4. SIDEBAR FILTERS ===== */

/* Under the header and the pill band. Taller than the window that is left,
   the panel scrolls by itself, so its last group and Clear All Filters can
   be reached while it is stuck. The padding (taken back by the margin)
   leaves room for a checkbox's focus ring inside the scrolling box. */
.catalog-filters {
    position: sticky;
    top: calc(var(--site-header-h) + var(--catalog-pills-h) + var(--space-4));
    max-height: calc(100vh - var(--site-header-h) - var(--catalog-pills-h) - var(--space-8));
    margin: calc(-1 * var(--space-2));
    padding: var(--space-2);
    overflow-y: auto;
    scrollbar-width: thin;
}

.catalog-filters__toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background-color: var(--color-midnight-800);
    border: 1px solid var(--color-midnight-700);
    border-radius: var(--radius-md);
    color: var(--color-slate-300);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.catalog-filters__toggle:hover {
    border-color: var(--color-slate-500);
    color: var(--color-white);
}

.catalog-filters__chevron {
    transition: transform var(--duration-fast) var(--ease-default);
}

/* Phones only (the open panel's Show N Courses bar, below). */
.catalog-filters__show-bar {
    display: none;
}

.catalog-filters__chevron--open {
    transform: rotate(180deg);
}

@media (max-width: 64em) {
    .catalog-filters {
        position: static;
        max-height: none;
        margin: 0;
        padding: 0;
        overflow-y: visible;
    }

    .catalog-filters__toggle {
        display: flex;
    }

    .catalog-filters__body {
        display: none;
        margin-block-start: var(--space-4);
    }

    .catalog-filters__body--open {
        display: block;
    }

    /* The foot (Clear All Filters) belongs to the open panel. */
    .catalog-filters__foot {
        display: none;
    }

    .catalog-filters__foot--open {
        display: block;
    }

    /* Show N Courses: at the bottom of the screen for as long as the open
       panel is in view, since the results it changes load under the panel.
       The right-hand room is the floating scroll-to-top button's. */
    .catalog-filters__show-bar--open {
        display: block;
        position: sticky;
        bottom: 0;
        margin-block-start: var(--space-4);
        padding-block: var(--space-3);
        padding-inline-end: calc(var(--tap-min) + var(--space-6));
        background-color: var(--color-midnight-900);
        border-top: 1px solid var(--color-midnight-800);
    }

    .catalog-filters__show {
        width: 100%;
    }
}

.catalog-filter-group {
    padding-block-end: var(--space-6);
    margin-block-end: var(--space-6);
    border-bottom: 1px solid var(--color-midnight-800);
}

.catalog-filter-group:last-of-type {
    border-bottom: none;
    margin-block-end: var(--space-4);
}

.catalog-filter-group__title {
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-white);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    margin-block-end: var(--space-4);
}

/* One line under a group's heading that says what its options mean (Price). */
.catalog-filter-group__key {
    max-width: none;
    margin: calc(-1 * var(--space-2)) 0 var(--space-4);
    font-size: var(--text-xs);
    line-height: var(--leading-normal);
    color: var(--text-muted);
}

.catalog-filter-group__options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Custom checkbox */
.catalog-filter-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    padding: var(--space-1) 0;
}

.catalog-filter-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.catalog-filter-option__check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--control-border);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    position: relative;
    transition: all var(--duration-fast) var(--ease-default);
}

.catalog-filter-option input:checked + .catalog-filter-option__check {
    background-color: var(--color-cb-blue);
    border-color: var(--color-cb-blue);
}

.catalog-filter-option input:checked + .catalog-filter-option__check::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.catalog-filter-option input:focus-visible + .catalog-filter-option__check {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
}

.catalog-filter-option__label {
    font-size: var(--text-sm);
    color: var(--color-slate-400);
    transition: color var(--duration-fast) var(--ease-default);
}

.catalog-filter-option:hover .catalog-filter-option__label {
    color: var(--color-slate-200);
}

.catalog-filters__clear {
    width: 100%;
    margin-block-start: var(--space-2);
}

/* With no filter on there is nothing to clear (.btn sets a display, so the
   hidden attribute needs saying). */
.catalog-filters__clear[hidden] {
    display: none;
}


/* ===== 5. TOOLBAR ===== */

.catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-block-end: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.catalog-toolbar__count {
    font-size: var(--text-sm);
    color: var(--color-slate-400);
}

.catalog-toolbar__count strong {
    color: var(--color-white);
}

/* A filter, sort, search or page change is on its way (courses.js puts
   is-loading on the results until the answer or a failure lands): the
   spinner shows beside the count and the old results dim, so a tick is
   answered at once. */
.catalog-toolbar__spin {
    display: none;
    margin-inline-start: var(--space-2);
    vertical-align: middle;
}

.catalog-results.is-loading .catalog-toolbar__spin {
    display: inline-block;
}

.catalog-results.is-loading > :not(.catalog-toolbar) {
    opacity: 0.5;
    transition: opacity var(--duration-fast) var(--ease-default);
}

@media (prefers-reduced-motion: reduce) {
    .catalog-results.is-loading > :not(.catalog-toolbar) {
        transition: none;
    }
}

.catalog-toolbar__sort {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.catalog-toolbar__sort-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.catalog-toolbar__sort-select {
    appearance: none;
    background-color: var(--color-midnight-800);
    border: 1px solid var(--color-midnight-700);
    border-radius: var(--radius-md);
    color: var(--color-slate-300);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color var(--duration-fast) var(--ease-default);
}

.catalog-toolbar__sort-select:hover {
    border-color: var(--color-slate-500);
}

.catalog-toolbar__sort-select:focus {
    outline: none;
    border-color: var(--color-cb-blue-400);
    box-shadow: 0 0 0 3px rgba(68, 120, 204, 0.15);
}


/* ===== 6. COURSE GRID ===== */

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
    align-items: stretch;
}

@media (max-width: 80em) {
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 48em) {
    .catalog-grid {
        grid-template-columns: 1fr;
    }
}


/* The shared pager (_components.css) under the grid: room between its top
   hairline and the last row of cards, which it sat against. */
.catalog-results .gx-pagination {
    margin-block-start: var(--space-8);
}


/* ===== 7. COURSE CARD ===== */

/* Start invisible for GSAP entrance — avoids layout flash */
.catalog-grid .course-card {
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    .catalog-grid .course-card {
        opacity: 1;
    }
}

.course-card {
    /* The containing block of the stretched link (.course-card__cta::after) */
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--color-midnight-800);
    border: 2px solid rgb(var(--cc));
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow:
        0 0 40px rgba(var(--cc), 0.25),
        0 0 80px rgba(var(--cc), 0.08);
    transition: transform var(--duration-slow) ease,
                box-shadow var(--duration-slow) ease;
}

.course-card:hover {
    transform: translateY(-6px);
    box-shadow:
        0 0 60px rgba(var(--cc), 0.45),
        0 0 120px rgba(var(--cc), 0.15);
}

/* ── Card image ── */

.course-card__image {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.course-card__image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        135deg,
        rgba(var(--cc), 0.15) 0%,
        rgba(var(--cc), 0.05) 40%,
        var(--color-midnight-900) 100%
    );
    color: rgba(var(--cc), 0.4);
}

.course-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Badge overlay */
.course-card__badge {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px var(--space-3);
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--badge-color, var(--color-white));
    /* The badge's tint over a dark, blurred backing like the format label's,
       so it reads over a cover image as well as over the placeholder (#234). */
    background-color: color-mix(in srgb, var(--color-midnight-950) 85%, transparent);
    background-image: linear-gradient(
        color-mix(in srgb, var(--badge-color, #fff) 18%, transparent),
        color-mix(in srgb, var(--badge-color, #fff) 18%, transparent)
    );
    backdrop-filter: blur(8px);
    border: 1px solid color-mix(in srgb, var(--badge-color, #fff) 45%, transparent);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color-midnight-950) 50%, transparent);
}

/* Stack multiple badges vertically (a badge is 27 px tall at the 12 px
   --text-xs: 32 px a step) */
.course-card__badge + .course-card__badge {
    top: calc(var(--space-3) + var(--space-8));
}

.course-card__badge + .course-card__badge + .course-card__badge {
    top: calc(var(--space-3) + var(--space-16));
}

.course-card__badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Format label */
.course-card__format {
    position: absolute;
    bottom: var(--space-3);
    right: var(--space-3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px var(--space-3);
    border-radius: var(--radius-full);
    background-color: rgba(11, 17, 32, 0.8);
    backdrop-filter: blur(8px);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-slate-300);
}

/* ── Card body ── */

.course-card__body {
    flex: 1;
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
}

.course-card__category {
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    /* The category's colour lifted toward white, as the training catalog's
       program link is: a dark accent (red) was 1.77:1 on the card. */
    color: color-mix(in srgb, rgb(var(--cc)) 45%, var(--color-white));
    margin-block-end: var(--space-2);
}

.course-card__title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-snug);
    margin-block-end: var(--space-3);
    color: var(--color-white);
    transition: color var(--duration-fast) var(--ease-default);
}

.course-card:hover .course-card__title {
    color: var(--color-cb-blue-400);
}

/* View Course is the card's one link and its ::after stretches over the
   whole card (the training course tile's recipe, _components.css). No
   lift on the button: a transform would make it the containing block of
   the ::after. */
.course-card__cta,
.course-card__cta:hover,
.course-card__cta:active {
    transform: none;
}

.course-card__cta::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.course-card__desc {
    font-size: var(--text-sm);
    color: var(--color-slate-400);
    line-height: var(--leading-normal);
    margin-block-end: var(--space-4);
    flex: 1;

    /* Clamp to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Instructor */
.course-card__instructor {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.course-card__instructor-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(var(--cc), 0.3), rgba(var(--cc), 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: var(--weight-semibold);
    color: var(--color-white);
    flex-shrink: 0;
}

.course-card__instructor-name {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ── Card footer ── */

.course-card__footer {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid rgba(var(--cc), 0.15);
}

/* Meta row: hours, rating, enrolled */
.course-card__meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-5);
}

.course-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-slate-400);
}

.course-card__meta-item svg {
    color: var(--color-slate-500);
    flex-shrink: 0;
}

.course-card__meta-item--rating svg {
    color: var(--neon-gold);
}

/* An Exam Only course gives no certificate */
.course-card__exam-only {
    margin: 0;
    max-width: none;
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-slate-300);
    text-align: center;
}

/* Action row: price + enroll */
.course-card__action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* A longer label (Included With Pro) wraps beside the button, clear of it. */
    gap: var(--space-2);
}

.course-card__price {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
}

.course-card__price--free {
    color: var(--status-ok);
}

.course-card__price--premium {
    color: var(--color-gold-500);
}


/* ===== SUBHEADING UTILITY (shared with homepage) ===== */

.subheading {
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
}


/* ===== ACTIVE FILTER CHIPS ===== */

.catalog-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-block-end: var(--space-4);
}

.catalog-active-filter {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    color: var(--color-slate-300);
    background-color: var(--color-midnight-800);
    border: 1px solid var(--color-midnight-700);
    border-radius: var(--radius-full);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-default);
    cursor: pointer;
}

.catalog-active-filter:hover {
    background-color: rgba(193, 0, 0, 0.15);
    border-color: rgba(193, 0, 0, 0.3);
    color: var(--color-white);
}

.catalog-active-filter--clear {
    color: var(--color-cb-red-400);
    border-color: rgba(193, 0, 0, 0.3);
    background-color: rgba(193, 0, 0, 0.08);
}


/* ===== EMPTY STATE ===== */

.catalog-empty {
    text-align: center;
    padding: var(--space-16) var(--space-6);
}

.catalog-empty__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-6);
    border-radius: var(--radius-full);
    background-color: var(--color-midnight-800);
    border: 1px solid var(--color-midnight-700);
    color: var(--color-slate-500);
}

.catalog-empty__title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--color-slate-200);
    margin-block-end: var(--space-3);
}

.catalog-empty__text {
    font-size: var(--text-base);
    color: var(--color-slate-400);
    max-width: 40ch;
    margin: 0 auto var(--space-8);
    line-height: var(--leading-relaxed);
}


/* ===== COURSE REQUEST FORM ===== */

.catalog-request {
    margin-block-start: var(--space-12);
    padding-block-start: var(--space-10);
    border-top: 1px solid var(--color-midnight-700);
    max-width: 540px;
    margin-inline: auto;
    text-align: left;
}

.catalog-request__header {
    text-align: center;
    margin-block-end: var(--space-8);
}

.catalog-request__title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-white);
    margin-block-end: var(--space-2);
}

.catalog-request__subtitle {
    font-size: var(--text-sm);
    color: var(--color-slate-400);
    line-height: var(--leading-relaxed);
}

.catalog-request__form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* Under a page of results the form waits behind one line: the question and
   a Request a Course button (a details and its summary). */
.catalog-request__ask {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-3) var(--space-4);
    list-style: none;
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--color-slate-300);
}

.catalog-request__ask::-webkit-details-marker {
    display: none;
}

.catalog-request__more-intro {
    margin-block: var(--space-6);
    text-align: center;
}

.catalog-request__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
}

@media (max-width: 36em) {
    .catalog-request__row {
        grid-template-columns: 1fr;
    }
}

.catalog-request__field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.catalog-request__label {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-slate-300);
}

/* The fields are the site's one input (.input, _components.css) and their
   errors .form-error: the approved field, 16 px text, on --field-bg with a
   --field-border edge. */

/* Whole-form problem (send failure, too many requests) */
.catalog-request__alert {
    margin: 0;
    max-width: none;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-cb-red-300);
    background: rgba(var(--accent-red-rgb), 0.1);
    border: 1px solid rgba(var(--accent-red-rgb), 0.5);
    border-radius: var(--radius-md);
}

.catalog-request__submit {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

/* ── Request success state ── */

.catalog-request__success {
    text-align: center;
    padding: var(--space-8) var(--space-4);
}

.catalog-request__success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-5);
    border-radius: var(--radius-full);
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #22c55e;
}

.catalog-request__success-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-white);
    margin-block-end: var(--space-2);
}

.catalog-request__success-text {
    font-size: var(--text-sm);
    color: var(--color-slate-400);
    line-height: var(--leading-relaxed);
    max-width: 38ch;
    margin-inline: auto;
}

.catalog-request__success-action {
    margin-block-start: var(--space-6);
}


/* ===== 8. TRAINING COURSES (/training/, #121, #420) =====
   The training catalog (programs/catalog.html) has the page hero too and
   lists every public program's courses: one group per program in its
   accent (--cc), the shared course tile (components/_program_tile.html)
   with no price. Section backgrounds: hero 950, the groups 900. */

.catalog-programs {
    background-color: var(--color-midnight-900);
    padding-block: var(--space-16);
}

.catalog-programs__empty {
    margin: 0 auto;
    max-width: 60ch;
    font-size: var(--text-lg);
    color: var(--color-slate-300);
    text-align: center;
}

.catalog-programs__empty a {
    color: var(--color-white);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* The jump row at the head of the list: one link per program with its
   course count, in the program's accent (--cc), each to its group below.
   On phones, where the groups stack to one long column, it stays under
   the navbar as one line that scrolls sideways. */
.catalog-jump {
    margin-block-end: var(--space-12);
}

/* position: the links' screen reader text is positioned in the list, so the
   list's own sideways scroll on phones holds it. */
.catalog-jump__list {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.catalog-jump__link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--tap-min);
    padding: var(--space-2) var(--space-5);
    border: 1px solid rgba(var(--cc), 0.45);
    border-radius: var(--radius-full);
    background-color: rgba(var(--cc), 0.1);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-white);
    text-decoration: none;
    white-space: nowrap;
    transition:
        border-color var(--duration-fast) var(--ease-default),
        background-color var(--duration-fast) var(--ease-default);
}

.catalog-jump__link:hover,
.catalog-jump__link:focus-visible {
    border-color: rgba(var(--cc), 0.85);
    background-color: rgba(var(--cc), 0.2);
}

.catalog-jump__count {
    font-size: var(--text-xs);
    color: color-mix(in srgb, rgb(var(--cc)) 45%, var(--color-white));
}

@media (max-width: 48em) {
    /* A hair under the navbar's lower edge (it is just under 5rem tall
       here), so no strip of the list shows between the two. */
    .catalog-jump {
        position: sticky;
        top: calc(var(--space-20) - var(--space-1));
        z-index: var(--z-raised);
        margin-block-end: var(--space-8);
        padding-block: var(--space-2);
        background-color: var(--color-midnight-900);
        border-bottom: 1px solid var(--color-midnight-800);
    }

    .catalog-jump__list {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .catalog-jump__list::-webkit-scrollbar {
        display: none;
    }

    .catalog-jump__list li {
        flex: none;
    }

    /* A jump stops with the group's heading below the navbar and this row. */
    .catalog-program__title {
        scroll-margin-top: var(--space-16);
    }
}

@media (prefers-reduced-motion: reduce) {
    .catalog-jump__link {
        transition: none;
    }
}

.catalog-program + .catalog-program {
    margin-block-start: var(--space-16);
}

.catalog-program__header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2) var(--space-6);
    margin-block-end: var(--space-6);
    padding-block-end: var(--space-3);
    border-bottom: 1px solid rgba(var(--cc), 0.4);
}

.catalog-program__title {
    margin: 0;
    font-size: var(--text-2xl);
    color: var(--color-white);
}

.catalog-program__link {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: color-mix(in srgb, rgb(var(--cc)) 45%, var(--color-white));
    text-decoration: none;
}

.catalog-program__link:hover,
.catalog-program__link:focus-visible {
    color: var(--color-white);
    text-decoration: underline;
}

.catalog-program__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-6);
    align-items: stretch;
}

@media (max-width: 64em) {
    .catalog-program__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 36em) {
    .catalog-program__grid {
        grid-template-columns: 1fr;
    }
}
