/* ============================================================================
   Course category page, design "Je bent hier" (design review Nov 2026,
   version C, plus the owner's two points: one hero size everywhere and a
   topics block under the grid).

   Markup: template-parts/browse/category-page.php, category-rail.php,
   category-topics.php, category-lower.php and filter-bar.php (class pr-bar).
   Loads after pages/browse.css and reuses its filter bar, sheets, grid,
   pagination and FAQ rows. Class names are the ones of the approved design
   (pr- hero, bar, rail; pc- lower blocks; px- chips), so the page can be
   checked against it one to one.

     1. Frame and containers
     2. Hero: one fixed size per breakpoint
     3. Featured course (the slot is always there)
     4. Filter bar: the bottom edge of the hero
     5. Rail "You are here"
     6. Section heads, text links, chips
     7. Topics
     8. Programs band
     9. New in, instructors, blogs
    10. Hand-written text + questions
    11. Inside the signed-in side panel
    12. Tablet and phone
    13. Motion (reveal on scroll) and reduced motion
   All colour, radius and shadow values are tokens (tokens.css).
   ========================================================================= */

/* ── 1. Frame and containers ────────────────────────────────────────────── */

.sf-catc {
    /* Fixed hero measures. Rows are the lines each part may take; the text
       block is exactly as high as all of them together, so the hero has one
       height on every category page, whatever the name or intro length. */
    --pr-title-size: clamp(28px, 3vw, 38px);
    --pr-title-rows: 1;
    --pr-title-md: .8;   /* 31 to 36 characters: still one line */
    --pr-title-lg: .5;   /* longer: two small lines in the same height */
    --pr-intro-size: 16px;
    --pr-intro-rows: 2;
    --pr-text-h: calc(
        62px
        + var(--pr-title-rows) * 1.12 * var(--pr-title-size)
        + var(--pr-intro-rows) * 1.55 * var(--pr-intro-size)
    );
    --pr-feature-w: 400px;
    --pr-feature-h: 136px;
    --pr-feature-media: 150px;
}

.pc-wrap {
    max-width: var(--container-browse);
    margin: 0 auto;
    padding: 0 24px;
}

.sf-catc > .sf-cat.pr,
.sf-catc > .sf-cat.pc {
    padding-bottom: 8px;
}

.sf-catc > .sf-cat:last-child {
    padding-bottom: 56px;
}

/* ── 2. Hero ────────────────────────────────────────────────────────────── */

.pr-hero {
    padding: 18px 0 46px;
    background: var(--blue-fill);
    border-bottom: 1px solid var(--card-border);
}

.pr-hero__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.pr-hero__text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    height: var(--pr-text-h);
}

/* One line, never wrapping: a long trail cuts off at the current page. */
.pr-hero .sf-cat-crumbs {
    flex: none;
    flex-wrap: nowrap;
    height: 20px;
    margin: 0 0 8px;
    overflow: hidden;
    line-height: 20px;
    white-space: nowrap;
}

.pr-hero .sf-cat-crumbs > * {
    flex: none;
}

.pr-hero .sf-cat-crumbs > [aria-current] {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pr-hero__title {
    display: -webkit-box;
    flex: none;
    margin: 0 0 6px;
    overflow: hidden;
    color: var(--ink);
    font-size: var(--pr-title-size);
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: -.01em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--pr-title-rows);
    line-clamp: var(--pr-title-rows);
}

.pr-hero__title--md {
    font-size: calc(var(--pr-title-size) * var(--pr-title-md));
}

.pr-hero__title--lg {
    font-size: calc(var(--pr-title-size) * var(--pr-title-lg));
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.pr-hero__intro {
    display: -webkit-box;
    flex: none;
    max-width: 76ch;
    margin: 0;
    overflow: hidden;
    color: var(--body);
    font-size: var(--pr-intro-size);
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--pr-intro-rows);
    line-clamp: var(--pr-intro-rows);
}

/* The proof line closes the block at the same place on every page. */
.pr-hero__proof {
    flex: none;
    height: 20px;
    margin: auto 0 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── 3. Featured course ─────────────────────────────────────────────────── */

.pr-feature {
    display: flex;
    flex: 0 0 var(--pr-feature-w);
    height: var(--pr-feature-h);
    overflow: hidden;
    border: 1px solid var(--card-border);
    border-radius: var(--r-card);
    background: var(--white);
    box-shadow: var(--shadow-card);
    color: var(--ink);
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

a.pr-feature:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-pop);
}

.pr-feature:focus-visible,
.pr-item:focus-visible,
.pr-acc__toggle:focus-visible,
.pc-textlink:focus-visible,
.px-tag:focus-visible,
.pc-teach__item:focus-visible,
.pc-blog:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.pr-feature__media {
    flex: 0 0 var(--pr-feature-media);
    min-width: 0;
    overflow: hidden;
    background: var(--blue-tint);
}

.pr-feature__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pr-feature__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 12px 14px;
}

.pr-feature__label {
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: var(--yellow-fill);
    color: var(--yellow-ink);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pr-feature__name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.pr-feature__proof {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.pr-feature__reviews,
.pr-feature__reviews-short {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pr-feature__reviews-short {
    display: none;
}

.pr-feature__foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    color: var(--muted);
    font-size: 13px;
}

.pr-feature__teacher {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pr-feature__price {
    display: inline-flex;
    flex: none;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}

/* No course to show: the same box, quiet, so the hero keeps its size. */
.pr-feature--empty {
    box-shadow: none;
    background: var(--glass-white);
}

.pr-feature--empty .pr-feature__media {
    display: grid;
    place-items: center;
    color: var(--deep-blue);
}

.pr-feature--empty .pr-feature__media .sf-icon {
    width: 40px;
    height: 40px;
}

.pr-feature--empty .pr-feature__body {
    justify-content: center;
}

.pr-feature--empty .pr-feature__name {
    color: var(--muted);
}

/* ── 4. Filter bar: the bottom edge of the hero ─────────────────────────── */

.pr .sf-cat-toolbar.pr-bar {
    z-index: 40;
    margin: -28px 0 22px;
    padding: 8px 12px;
    border: 1px solid var(--card-border);
    border-radius: var(--r-card-sm);
    background: var(--glass-white);
    box-shadow: var(--shadow-float);
}

.pr .sf-cat-toolbar.pr-bar.is-stuck {
    border-radius: 0 0 var(--r-card-sm) var(--r-card-sm);
    border-bottom-color: var(--card-border);
}

.pr .sf-cat-toolbar__row {
    align-items: center;
}

.pr-lib {
    padding-top: 0;
}

/* An anchor jump (#sf-catalogue, #sf-browse-results) lands under the bar. */
.pr-lib,
.sf-catc .sf-bresults {
    scroll-margin-top: calc(var(--sf-cat-sticky-top, var(--sf-nav-h, 75px)) + var(--sf-cat-bar-h, 62px) + 12px);
}

/* The "Category: <name>" button. On a phone it shows the name only (the
   full label stays for screen readers) and gives way with an ellipsis, so
   Category, Filters and Sort always fit one row. */
.pr-bar__nav-short {
    display: none;
}

@media (max-width: 899px) {
    .pr-bar .sf-cat-toolbar__filters {
        flex: 1 1 auto;
    }

    .pr-bar .sf-cat-toolbar__filters > .pr-bar__nav {
        flex: 0 1 auto;
        min-width: 0;
    }

    .pr-bar__nav > .sf-cat-dd__btn {
        display: flex;
        max-width: 100%;
    }

    .pr-bar__nav > .sf-cat-dd__btn > .sf-icon {
        flex: none;
    }

    .pr-bar__nav-full,
    .pr-bar__nav-short {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 600px) {
    .pr-bar__nav-full {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .pr-bar__nav-short {
        display: block;
    }

    /* A little tighter, so a name like "Gezondheid" shows in full. */
    .pr-bar .sf-cat-toolbar__row,
    .pr-bar .sf-cat-toolbar__filters {
        gap: 6px;
    }

    .pr-bar .sf-cat-dd__btn {
        gap: 5px;
        padding: 0 10px;
    }
}

/* Phones: the active-filter chips stay one row that scrolls sideways, so
   the sticky bar never grows past two rows. */
@media (max-width: 760px) {
    .pr-bar .sf-cat-chips,
    .pr-bar .sf-cat-chips__list {
        flex-wrap: nowrap;
    }

    .pr-bar .sf-cat-chips {
        overflow-x: auto;
        margin-top: 8px;
        scrollbar-width: none;
    }

    .pr-bar .sf-cat-chips::-webkit-scrollbar {
        display: none;
    }

    .pr-bar .sf-cat-chips li,
    .pr-bar .sf-cat-chips__clear {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* A category without courses has nothing to filter: on a desktop the rail
   is on screen, so the bar (then only the "Category" button) is left out. */
@media (min-width: 900px) {
    .sf-catc:not(.sf-catc--in-panel) .pr-bar--nav-only {
        display: none;
    }

    .sf-catc:not(.sf-catc--in-panel) .pr-bar--nav-only + .pr-lib {
        padding-top: 24px;
    }
}

/* ── 5. Category menu (the rail) ────────────────────────────────────────── */

.pr-rail {
    position: sticky;
    /* Under the sticky filter bar; browse.js keeps both measures exact. */
    top: calc(var(--sf-cat-sticky-top, var(--sf-nav-h, 75px)) + var(--sf-cat-bar-h, 62px) + 12px);
    max-height: calc(100vh - var(--sf-cat-sticky-top, var(--sf-nav-h, 75px)) - var(--sf-cat-bar-h, 62px) - 28px);
    overflow-y: auto;
    padding: 0 6px 12px 0;
    scrollbar-width: thin;
}

.pr-nav {
    display: flex;
    flex-direction: column;
}

.pr-rail__label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 18px 0 6px;
    padding: 0 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* On one line with "Showing 1 to 12 of N courses" next to it. */
.pr-rail__label--first {
    margin-top: 0;
    line-height: 20px;
}

.pr-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.pr-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: var(--r-btn);
    color: var(--ink);
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    transition: background-color .15s, color .15s;
}

a.pr-item:hover {
    background: var(--blue-fill);
}

.pr-item__icon {
    display: inline-grid;
    flex: none;
    place-items: center;
    color: var(--body);
}

.pr-item__icon .sf-icon {
    width: 20px;
    height: 20px;
}

.pr-item__name {
    flex: 1;
    min-width: 0;
}

.pr-item__count {
    flex: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.pr-item.is-current {
    background: var(--blue-fill);
    color: var(--deep-blue);
    font-weight: 800;
    box-shadow: inset 3px 0 0 var(--blue);
}

.pr-item.is-current .pr-item__count,
.pr-item.is-current .pr-item__icon {
    color: var(--deep-blue);
}

/* One category: its link, and the button that opens its subcategories. The
   button is a control of its own, so the name stays a normal link. */
.pr-acc__row {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pr-acc__row > .pr-item {
    flex: 1 1 auto;
    min-width: 0;
}

/* A row without subcategories keeps the counts in one column. */
.pr-acc__row > .pr-item:only-child {
    margin-right: 34px;
}

/* The collections have no subcategories at all: their names get the room. */
.pr-acc--plain .pr-acc__row > .pr-item:only-child {
    margin-right: 0;
}

.pr-acc__toggle {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: var(--r-btn);
    background: none;
    color: var(--muted);
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.pr-acc__toggle:hover {
    background: var(--blue-fill);
    color: var(--deep-blue);
}

.pr-acc__toggle .sf-icon {
    transition: transform .18s ease;
}

.pr-acc__item.is-open > .pr-acc__row > .pr-acc__toggle .sf-icon {
    transform: rotate(180deg);
}

/* The branch the visitor is in. */
.pr-acc__item.is-here > .pr-acc__row > .pr-item {
    color: var(--deep-blue);
    font-weight: 800;
}

.pr-acc__item.is-here > .pr-acc__row > .pr-item .pr-item__icon {
    color: var(--deep-blue);
}

.pr-acc__subs {
    display: none;
    margin: 2px 0 8px 19px;
    padding-left: 8px;
    border-left: 2px solid var(--card-border);
}

.pr-acc__item.is-open > .pr-acc__subs {
    display: block;
}

.pr-item--sub {
    min-height: 36px;
    /* The count sits in the same column as the category counts. */
    margin-right: 34px;
    color: var(--body);
    font-size: 14px;
}

/* Without scripting nothing can open a branch: show every subcategory. */
@media (scripting: none) {
    .pr-acc__subs {
        display: block;
    }

    .pr-acc__toggle {
        visibility: hidden;
    }
}

/* ── 6. Section heads, text links, chips ────────────────────────────────── */

.pc-sec {
    margin-top: 48px;
}

.pc-sechead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 14px;
}

.pc-sechead__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--ink);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
}

.pc-textlink {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    color: var(--deep-blue);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
}

.pc-textlink .sf-icon {
    transition: transform .18s ease;
}

.pc-textlink:hover {
    text-decoration: underline;
}

.pc-textlink:hover .sf-icon {
    transform: translateX(3px);
}

.pc-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 10px;
    color: var(--deep-blue);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.pc-eyebrow--plain {
    margin-top: 0;
}

.pc-eyebrow__icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--r-btn);
    background: var(--white);
    color: var(--deep-blue);
    box-shadow: var(--shadow-soft);
}

.px-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.px-tag {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--card-border);
    border-radius: var(--r-pill);
    background: var(--white);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}

.px-tag:hover {
    border-color: var(--blue);
    background: var(--blue-tint);
}

.px-tag--toggle {
    border-style: dashed;
    color: var(--deep-blue);
}

/* A finger needs a taller chip than a mouse. */
@media (pointer: coarse) {
    .px-tag {
        min-height: 44px;
    }
}

/* ── 7. Topics ──────────────────────────────────────────────────────────── */

.pc-topics {
    margin-top: 40px;
}

/* The chips past the first rows wait behind "Show all N topics". */
.px-tags:not(.is-open) .px-tag-more {
    display: none;
}

.px-tags.is-open .px-tags__toggle {
    display: none;
}

/* Without scripting nothing can open them: show every topic. */
@media (scripting: none) {
    .px-tags:not(.is-open) .px-tag-more {
        display: block;
    }

    .px-tags .px-tags__toggle {
        display: none;
    }
}

/* ── 8. Programs band ───────────────────────────────────────────────────── */

.pc-band {
    margin-top: 48px;
    padding: 44px 0 48px;
    background: var(--blue-fill);
    border-top: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
}

.pc-band__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.pc-band__title {
    margin: 0 0 6px;
    color: var(--ink);
    font-size: 28px;
    font-weight: 900;
    line-height: 1.15;
}

.pc-band__sub {
    max-width: 62ch;
    margin: 0;
    color: var(--body);
    font-size: 16px;
    line-height: 1.55;
}

.pc-band .sf-pcard {
    transition: transform .2s ease, box-shadow .2s ease, border-color .15s;
}

.pc-band .sf-pcard:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

/* ── 9. New in, instructors, blogs ──────────────────────────────────────── */

.pc-grid4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* "New" as a chip on the image in this row (the card's own badge slot). */
.pc-grid4 .course-card__badge {
    top: 10px;
    right: 10px;
    left: auto;
    padding: 3px 9px;
    background: var(--orange-fill);
    color: var(--orange-ink);
    font-weight: 800;
    letter-spacing: 0;
}

.pc-teach {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pc-teach__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    padding: 18px 12px;
    border: 1px solid var(--card-border);
    border-radius: var(--r-card);
    background: var(--white);
    color: var(--ink);
    text-align: center;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

.pc-teach__item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

.pc-teach__photo {
    width: 72px;
    height: 72px;
    margin-bottom: 8px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--blue-fill);
}

.pc-teach__photo--initial {
    display: grid;
    place-items: center;
    color: var(--deep-blue);
    font-size: 26px;
    font-weight: 800;
}

.pc-teach__name {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.pc-teach__meta {
    color: var(--muted);
    font-size: 13px;
}

.pc-blogs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.pc-blog {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--card-border);
    border-radius: var(--r-card);
    background: var(--white);
    color: var(--ink);
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

.pc-blog:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}

.pc-blog__media {
    display: block;
    aspect-ratio: 900 / 471;
    overflow: hidden;
    background: var(--blue-fill);
}

.pc-blog__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.pc-blog:hover img {
    transform: scale(1.04);
}

.pc-blog__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px 18px;
}

.pc-blog__kicker {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.pc-blog__title {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.3;
}

.pc-blog__text {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.pc-blog__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    color: var(--deep-blue);
    font-size: 14px;
    font-weight: 700;
}

/* ── 10. Hand-written text + questions ──────────────────────────────────── */

.pc-seo {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
    gap: 40px;
    margin-top: 48px;
    padding: 32px;
    border: 1px solid var(--card-border);
    border-radius: var(--r-card);
    background: var(--white);
}

.pc-seo--text-only {
    grid-template-columns: minmax(0, 1fr);
}

.pc-seo__title {
    margin: 0 0 16px;
    color: var(--ink);
    font-size: 24px;
    font-weight: 800;
}

.pc-seo__item h3 {
    margin: 0 0 6px;
    color: var(--ink);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.3;
}

.pc-seo__item p {
    max-width: 78ch;
    margin: 0 0 18px;
    color: var(--body);
    font-size: 15px;
    line-height: 1.65;
}

.pc-seo__item a {
    color: var(--deep-blue);
    font-weight: 700;
}

.pc-seo__subtitle {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
}

.pc-faq {
    margin: 0;
}

/* ── In-place loading (browse.js marks the page root) ───────────────────── */

.sf-catc.is-loading {
    cursor: progress;
}

.sf-catc.is-loading .pr-hero__row,
.sf-catc.is-loading .sf-cat-main,
.sf-catc.is-loading .pc-sec,
.sf-catc.is-loading .pc-band,
.sf-catc.is-loading .pc-seo {
    opacity: .55;
    transition: opacity .15s ease .08s;
    pointer-events: none;
}

/* ── 11. Inside the signed-in side panel ────────────────────────────────── */

/* The panel's content column is at most 1000px and already has the app's
   left menu next to it. So: the hero and the band are rounded panels of the
   column's width, the text column is narrower (two title lines, three intro
   lines, like the public page on a small desktop), and the category rail
   only shows where the column is wide enough for the rail plus three cards.
   Narrower, the "Category: …" button in the bar opens the same list. */
.sf-catc--in-panel {
    --pr-title-size: 30px;
    --pr-title-rows: 2;
    --pr-title-md: 1;
    --pr-title-lg: .75;
    --pr-intro-rows: 3;
    --pr-feature-w: 340px;
    --pr-feature-media: 124px;
}

/* The narrower course card says "5,0 (11)" (the full sentence stays for
   screen readers). */
.sf-catc--in-panel .pr-feature__reviews {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.sf-catc--in-panel .pr-feature__reviews-short {
    display: block;
}

/* A column of 950px or more (1280px with the app menu open, 1100px with it
   folded): the title fits one line. */
@media (min-width: 1280px) {
    .sf-catc--in-panel {
        --pr-title-rows: 1;
        --pr-title-md: .9;
        --pr-title-lg: .6;
    }
}

@media (min-width: 1100px) {
    html.sf-panel-collapsed .sf-catc--in-panel {
        --pr-title-rows: 1;
        --pr-title-md: .9;
        --pr-title-lg: .6;
    }
}

/* Category button, four filters and the sort stay on one row in the
   narrower column. The category button never grows past a fixed width (a
   long name ends in an ellipsis); below 1280px the sort button says "Sort"
   (its menu still ticks the order) and below 1180px the category button
   shows the name without "Category:" (the full label stays for screen
   readers). With the app menu folded there is room up to 1120px. */
.pr-bar__tree > .sf-cat-dd__btn {
    display: flex;
    max-width: 240px;
}

.pr-bar__tree > .sf-cat-dd__btn > .sf-icon {
    flex: none;
}

.pr-bar__tree .pr-bar__nav-full,
.pr-bar__tree .pr-bar__nav-short {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 900px) and (max-width: 1279px) {
    html:not(.sf-panel-collapsed) .sf-catc--in-panel .sf-cat-sort__full {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    html:not(.sf-panel-collapsed) .sf-catc--in-panel .sf-cat-sort__short {
        display: inline;
    }
}

@media (min-width: 900px) and (max-width: 1119px) {
    html.sf-panel-collapsed .sf-catc--in-panel .sf-cat-sort__full {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    html.sf-panel-collapsed .sf-catc--in-panel .sf-cat-sort__short {
        display: inline;
    }
}

@media (min-width: 900px) and (max-width: 1179px) {
    html:not(.sf-panel-collapsed) .pr-bar__tree > .sf-cat-dd__btn {
        max-width: 180px;
    }

    html:not(.sf-panel-collapsed) .pr-bar__tree .pr-bar__nav-full {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    html:not(.sf-panel-collapsed) .pr-bar__tree .pr-bar__nav-short {
        display: block;
    }
}

@media (min-width: 900px) and (max-width: 1099px) {
    html:not(.sf-panel-collapsed) .pr-bar__tree > .sf-cat-dd__btn {
        max-width: 124px;
    }

    html:not(.sf-panel-collapsed) .sf-catc--in-panel .pr-bar .sf-cat-dd__btn {
        padding: 0 10px;
    }
}

.sf-catc--in-panel > .sf-cat.pr,
.sf-catc--in-panel > .sf-cat.pc,
.sf-catc--in-panel > .sf-cat:last-child {
    padding: 0;
}

.sf-catc--in-panel .pc-wrap {
    max-width: none;
    padding: 0 20px;
}

.sf-catc--in-panel .pr-hero {
    border: 1px solid var(--card-border);
    border-radius: var(--r-card);
}

.sf-catc--in-panel .pc-band {
    margin-top: 40px;
    padding: 28px 0 32px;
    border: 1px solid var(--card-border);
    border-radius: var(--r-card);
}

/* Four across, as on the public page (the panel's own grid rule would
   auto-fill three and leave one card over). */
.sf-catc--in-panel .pc-grid4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sf-catc--in-panel .pr-rail {
    display: none;
}

.sf-catc--in-panel .pr-lib {
    display: block;
}

.pr-bar__tree-panel {
    width: min(320px, 80vw);
}

/* The featured course needs a column of about 860px next to the text. */
@media (max-width: 1199px) {
    html:not(.sf-panel-collapsed) .sf-catc--in-panel .pr-feature {
        display: none;
    }
}

/* Three across in the narrower column: the row then shows three courses
   (no single card left over on a second row). */
@media (min-width: 761px) and (max-width: 1199px) {
    .sf-catc--in-panel .pc-grid4 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sf-catc--in-panel .pc-grid4 > :nth-child(n+4) {
        display: none;
    }

    .sf-catc--in-panel .pc-teach {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Rail from a 980px column: 1320px wide with the app menu open, 1120px with
   the menu folded to its icon rail (html.sf-panel-collapsed). */
@media (min-width: 1320px) {
    .sf-catc--in-panel .pr-rail {
        display: block;
    }

    .sf-catc--in-panel .pr-lib {
        display: grid;
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 24px;
    }

    .sf-catc--in-panel .pr-lib .sf-bgrid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sf-catc--in-panel .pr-bar__tree {
        display: none;
    }
}

@media (min-width: 1120px) {
    html.sf-panel-collapsed .sf-catc--in-panel .pr-rail {
        display: block;
    }

    html.sf-panel-collapsed .sf-catc--in-panel .pr-lib {
        display: grid;
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 24px;
    }

    html.sf-panel-collapsed .sf-catc--in-panel .pr-lib .sf-bgrid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    html.sf-panel-collapsed .sf-catc--in-panel .pr-bar__tree {
        display: none;
    }
}

/* ── 12. Tablet and phone ───────────────────────────────────────────────── */

@media (max-width: 1100px) {
    .sf-catc {
        --pr-title-rows: 2;
        --pr-title-md: 1;
        --pr-title-lg: .75;
        --pr-intro-rows: 3;
        --pr-feature-w: 340px;
        --pr-feature-media: 124px;
    }

    .pr-feature__reviews {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .pr-feature__reviews-short {
        display: block;
    }

    .pc-grid4 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .pc-teach {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Three across shows three courses (no single card on a second row). */
@media (min-width: 761px) and (max-width: 1100px) {
    .pc-grid4 > :nth-child(n+4) {
        display: none;
    }
}

/* A tablet has the whole width for the text: the title fits one line. */
@media (min-width: 700px) and (max-width: 899px) {
    .sf-catc,
    html.sf-panel-collapsed .sf-catc--in-panel {
        --pr-title-rows: 1;
        --pr-title-md: .9;
        --pr-title-lg: .75;
    }
}


@media (max-width: 899px) {
    .pr-lib,
    .sf-catc--in-panel .pr-lib {
        display: block;
    }

    .pr-rail,
    .sf-catc--in-panel .pr-rail,
    html.sf-panel-collapsed .sf-catc--in-panel .pr-rail {
        display: none;
    }

    .pr-feature,
    html.sf-panel-collapsed .sf-catc--in-panel .pr-feature {
        display: none;
    }

    .pr-hero {
        padding: 14px 0 40px;
    }

    /* In the phone sheet the rail is a normal list. */
    .sf-cat-sheet__body .pr-nav {
        padding: 4px 4px 16px;
    }

    .sf-cat-sheet__body .pr-item,
    .sf-cat-sheet__body .pr-acc__toggle {
        min-height: 44px;
    }

    .sf-cat-sheet__body .pr-acc__toggle {
        width: 44px;
    }

    .sf-cat-sheet__body .pr-acc__row > .pr-item:only-child,
    .sf-cat-sheet__body .pr-item--sub {
        margin-right: 46px;
    }

    .sf-cat-sheet__body .pr-acc--plain .pr-acc__row > .pr-item:only-child {
        margin-right: 0;
    }

    /* The sheet's own title already says "Categories". */
    .sf-cat-sheet__body .pr-rail__label--first {
        display: none;
    }

    .pc-seo {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .pc-blogs,
    .pc-band .sf-pcard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .pc-grid4,
    .sf-catc--in-panel .pc-grid4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .sf-catc {
        --pr-intro-size: 15px;
        --pr-intro-rows: 4;
    }

    .pc-wrap {
        padding: 0 16px;
    }

    .sf-catc > .sf-cat:last-child {
        padding-bottom: 40px;
    }

    .sf-catc--in-panel > .sf-cat:last-child {
        padding-bottom: 0;
    }

    .sf-catc--in-panel .pc-wrap {
        padding: 0 16px;
    }

    .pr .sf-cat-toolbar.pr-bar {
        margin: -24px 0 16px;
        padding: 6px;
    }

    .pc-sechead {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .pc-sechead__title {
        font-size: 21px;
    }

    .pc-band__head {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .pc-band__title {
        font-size: 24px;
    }

    /* Rows of cards become a sideways scroller so the page stays short. */
    .pc--after .pc-grid4,
    .pc-blogs,
    .pc-band .sf-pcard-grid {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        margin-right: -16px;
        margin-left: -16px;
        padding: 0 16px 8px;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .pc--after .pc-grid4::-webkit-scrollbar,
    .pc-blogs::-webkit-scrollbar,
    .pc-band .sf-pcard-grid::-webkit-scrollbar {
        display: none;
    }

    .pc--after .pc-grid4 > *,
    .pc-blogs > *,
    .pc-band .sf-pcard-grid > * {
        flex: 0 0 78%;
        scroll-snap-align: center;
    }

    .pc-teach,
    .sf-catc--in-panel .pc-teach {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pc-seo {
        padding: 20px 16px;
    }
}

/* ── 13. Motion ─────────────────────────────────────────────────────────── */

/* Soft reveal of the lower blocks while scrolling. Only when browse.js
   switched it on (html.px-reveal-on), so nothing is ever hidden without it. */
.px-reveal-on [data-px-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .45s ease, transform .45s ease;
}

.px-reveal-on [data-px-reveal].is-in {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .pr-feature,
    .pr-item,
    .pr-acc__toggle,
    .pr-acc__toggle .sf-icon,
    .px-tag,
    .pc-teach__item,
    .pc-blog,
    .pc-blog__media img,
    .pc-band .sf-pcard,
    .pc-textlink .sf-icon,
    .sf-catc.is-loading .pr-hero__row,
    .sf-catc.is-loading .sf-cat-main,
    .sf-catc.is-loading .pc-sec,
    .sf-catc.is-loading .pc-band,
    .sf-catc.is-loading .pc-seo {
        transition: none;
    }

    a.pr-feature:hover,
    .pc-teach__item:hover,
    .pc-blog:hover,
    .pc-blog:hover img,
    .pc-band .sf-pcard:hover,
    .pc-textlink:hover .sf-icon {
        transform: none;
    }

    .px-reveal-on [data-px-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
