/*
 * Topics overview (page role "topics"; soofos.nl /onderwerp/).
 * Definition: inc/public-page-migrations/topics-nl.php. The index itself is
 * the soofos/topic-index block (soofos-portal Blocks\TopicIndex).
 *
 * Reads like the index of a book: per category a card, each topic a row with
 * its name, a dotted leader and its course count. Mobile first.
 */

.sf-topics {
    overflow: clip;
    background: var(--page);
    color: var(--body);
    font-family: var(--font);
}

.sf-topics .sf-topics__inner {
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
    padding: var(--soofos-space-2xl) var(--soofos-space-lg);
}

/* ── Hero ─────────────────────────────────────────────────────────────── */

.sf-topics .sf-topics__hero {
    background: var(--blue-tint);
    border-bottom: 1px solid var(--blue-border);
}

.sf-topics .sf-topics__title {
    margin: 0;
    color: var(--ink);
    font-size: clamp(2.25rem, 8vw, 4rem);
    font-weight: var(--soofos-font-weight-black);
    letter-spacing: -.035em;
    line-height: 1.05;
}

.sf-topics .sf-topics__lead {
    max-width: 40rem;
    margin: var(--soofos-space-lg) 0 0;
    color: var(--muted);
    font-size: 1.125rem;
    line-height: 1.65;
}

/* ── Jump list: the categories, one tap from their section ────────────── */

.sf-topics .sf-topics__jump {
    margin: 0 0 var(--soofos-space-xl);
}

.sf-topics .sf-topics__jump-list {
    display: flex;
    gap: var(--soofos-space-sm);
    margin: 0;
    padding: 0 0 var(--soofos-space-xs);
    overflow-x: auto;
    list-style: none;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.sf-topics .sf-topics__jump-list > li {
    flex: 0 0 auto;
    margin: 0;
    scroll-snap-align: start;
}

.sf-topics .sf-topics__jump-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--soofos-control-min-height);
    padding: 0 var(--soofos-space-lg);
    border: 1px solid var(--card-border);
    border-radius: var(--r-btn);
    background: var(--white);
    color: var(--ink);
    font-size: .9375rem;
    font-weight: var(--soofos-font-weight-bold);
    text-decoration: none;
    white-space: nowrap;
}

.sf-topics .sf-topics__jump-link:hover {
    border-color: var(--blue-border);
    background: var(--blue-fill);
}

/* ── Category cards ───────────────────────────────────────────────────── */

.sf-topics .sf-topics__group {
    margin: 0 0 var(--soofos-space-lg);
    padding: var(--soofos-space-lg);
    border: 1px solid var(--card-border);
    border-radius: var(--r-card);
    background: var(--white);
    box-shadow: var(--shadow-soft);
    scroll-margin-top: var(--soofos-space-3xl);
}

.sf-topics .sf-topics__group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--soofos-space-xs) var(--soofos-space-lg);
    margin: 0 0 var(--soofos-space-md);
}

.sf-topics .sf-topics__group-title {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.375rem, 4vw, 1.75rem);
    font-weight: var(--soofos-font-weight-black);
    letter-spacing: -.02em;
    line-height: 1.2;
}

.sf-topics .sf-topics__group-link {
    color: var(--deep-blue);
    font-size: .9375rem;
    font-weight: var(--soofos-font-weight-bold);
    text-decoration: underline;
    text-underline-offset: .2em;
}

.sf-topics .sf-topics__list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: var(--soofos-space-2xl);
    margin: 0;
    padding: 0;
    list-style: none;
}

.sf-topics .sf-topics__item {
    margin: 0;
    border-top: 1px solid var(--card-border);
}

.sf-topics .sf-topics__topic {
    display: flex;
    align-items: baseline;
    gap: var(--soofos-space-sm);
    min-height: var(--soofos-control-min-height);
    padding: var(--soofos-space-sm) var(--soofos-space-xs);
    color: var(--ink);
    text-decoration: none;
}

.sf-topics .sf-topics__name {
    font-weight: var(--soofos-font-weight-bold);
    line-height: 1.4;
}

/* The count, with a dotted leader before it, as in a book's index. */
.sf-topics .sf-topics__count {
    display: flex;
    flex: 1 0 auto;
    gap: var(--soofos-space-sm);
    align-items: baseline;
    justify-content: flex-end;
    color: var(--muted);
    font-size: .875rem;
    white-space: nowrap;
}

.sf-topics .sf-topics__count::before {
    content: "";
    flex: 1 1 auto;
    min-width: var(--soofos-space-lg);
    border-bottom: 2px dotted var(--blue-border);
    transform: translateY(-.3em);
}

.sf-topics .sf-topics__topic:hover {
    background: var(--blue-tint);
}

.sf-topics .sf-topics__topic:hover .sf-topics__name {
    color: var(--deep-blue);
    text-decoration: underline;
    text-underline-offset: .2em;
}

.sf-topics .sf-topics__jump-link:focus-visible,
.sf-topics .sf-topics__group-link:focus-visible,
.sf-topics .sf-topics__topic:focus-visible,
.sf-topics .sf-topics__button .wp-block-button__link:focus-visible {
    outline: 2px solid var(--deep-blue);
    outline-offset: 2px;
}

.sf-topics .sf-topics__empty {
    color: var(--muted);
}

/* ── Start band ───────────────────────────────────────────────────────── */

.sf-topics .sf-topics__start {
    background: var(--blue-fill);
}

.sf-topics .sf-topics__start-title {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.5rem, 5vw, 2.25rem);
    font-weight: var(--soofos-font-weight-black);
    letter-spacing: -.02em;
    line-height: 1.2;
}

.sf-topics .sf-topics__start-text {
    max-width: 36rem;
    margin: var(--soofos-space-md) 0 0;
    color: var(--body);
    line-height: 1.65;
}

.sf-topics .sf-topics__buttons {
    margin: var(--soofos-space-xl) 0 0;
}

.sf-topics .sf-topics__button .wp-block-button__link {
    display: inline-flex;
    align-items: center;
    min-height: var(--soofos-control-min-height);
    padding: 0 var(--soofos-space-xl);
    border-radius: var(--r-btn);
    background: var(--blue);
    color: var(--white);
    font-weight: var(--soofos-font-weight-extrabold);
    text-decoration: none;
}

.sf-topics .sf-topics__button .wp-block-button__link:hover {
    background: var(--blue-hover);
}

/* ── Wider screens ────────────────────────────────────────────────────── */

@media (min-width: 640px) {
    .sf-topics .sf-topics__inner {
        padding: var(--soofos-space-3xl) var(--soofos-space-xl);
    }

    .sf-topics .sf-topics__group {
        padding: var(--soofos-space-xl);
    }

    .sf-topics .sf-topics__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sf-topics .sf-topics__jump-list {
        flex-wrap: wrap;
        overflow-x: visible;
    }
}

@media (min-width: 1024px) {
    .sf-topics .sf-topics__list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: no-preference) {
    html:has(.sf-topics) {
        scroll-behavior: smooth;
    }
}
