/*
 * Courses: public pages ([cbtt_courses], [cbtt_course_withdrawal]).
 *
 * Scope: every rule hangs off .cbtt-courses. The palette variables are set
 * on .cbtt-scope.cbtt-courses by cbtt_courses_inline_css() (specificity
 * 0,2,0, above the suite palette on .cbtt-scope); never on :root. With the
 * palette "theme" they are `inherit`, so on CBTT-Turbo they resolve to the
 * theme's own values and elsewhere fall through to the fallbacks below
 * (one fallback chain per token, defined once on .cbtt-courses).
 *
 * Course colour (--cbtt-course-color, per course from the inline CSS) is
 * decoration on public pages: the teacher's corporate design, an exception
 * to the suite's "status colours only" rule that governs the admin UI.
 *
 * Cacheable views load this file only; uncached views add cbtt-ui.css,
 * which this file does not depend on.
 *
 * Background and text always come from the same source: where a surface
 * colour of the palette paints a box, its text uses the palette's text
 * colour (var(--cbtt-text)); with the theme palette both fall back to the
 * theme (surfaces transparent, text inherited), so a dark theme never puts
 * light text on a white card. Muted text is the current text colour at 72 %,
 * never the suite's light grey token — it stays readable on every surface.
 */

.cbtt-courses {
    --cbtt-courses-primary: var(--cbtt-primary, var(--wp--preset--color--primary, #1f2733));
    --cbtt-courses-primary-hover: var(--cbtt-primary-hover, var(--cbtt-courses-primary));
    --cbtt-courses-on-primary: var(--cbtt-on-primary, #ffffff);
    --cbtt-courses-accent-ink: var(--cbtt-accent-ink, var(--cbtt-courses-primary));
    --cbtt-courses-surface: var(--cbtt-surface, transparent);
    --cbtt-courses-surface-alt: var(--cbtt-surface-alt, #f7f3ec);
    --cbtt-courses-border: var(--cbtt-border, #e6e1d7);
    --cbtt-courses-muted: #5b6270;
    --cbtt-courses-radius: var(--cbtt-radius-md, 11px);
    --cbtt-courses-error: var(--cbtt-error-ink, #992e26);
    --cbtt-courses-success: var(--cbtt-success-ink, #1d6b3a);
    font-family: var(--cbtt-font-sans, inherit);
    max-width: 100%;
    margin: 0 0 2rem;
}

@supports (color: color-mix(in srgb, red 50%, transparent)) {
    .cbtt-courses {
        --cbtt-courses-surface-alt: var(--cbtt-surface-alt, color-mix(in srgb, currentColor 6%, transparent));
        --cbtt-courses-border: var(--cbtt-border, color-mix(in srgb, currentColor 22%, transparent));
        --cbtt-courses-muted: color-mix(in srgb, currentColor 72%, transparent);
    }
}

.cbtt-courses *,
.cbtt-courses *::before,
.cbtt-courses *::after {
    box-sizing: border-box;
}

/* Boxes painted with a palette surface take the palette's text colour too. */
.cbtt-course-card,
.cbtt-course-detail,
.cbtt-course-booking,
.cbtt-course-summary,
.cbtt-courses .cbtt-ui-input,
.cbtt-courses .cbtt-btn--secondary {
    color: var(--cbtt-text, inherit);
}

.cbtt-courses .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Buttons (own copy: cbtt-ui.css is not loaded on cacheable views) -- */

.cbtt-courses .cbtt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--cbtt-courses-radius);
    font: inherit;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.cbtt-courses .cbtt-btn:focus-visible,
.cbtt-courses summary:focus-visible,
.cbtt-courses a:focus-visible,
.cbtt-courses input:focus-visible {
    outline: 2px solid var(--cbtt-courses-accent-ink);
    outline-offset: 2px;
}

.cbtt-courses .cbtt-btn--primary {
    background: var(--cbtt-courses-primary);
    color: var(--cbtt-courses-on-primary);
}

.cbtt-courses .cbtt-btn--primary:hover {
    background: var(--cbtt-courses-primary-hover);
}

.cbtt-courses .cbtt-btn--secondary {
    background: var(--cbtt-courses-surface);
    border-color: var(--cbtt-courses-border);
}

.cbtt-courses .cbtt-btn--secondary:hover {
    background: var(--cbtt-courses-surface-alt);
}

.cbtt-courses .cbtt-btn--ghost {
    background: transparent;
    color: var(--cbtt-courses-accent-ink);
    padding-left: 8px;
    padding-right: 8px;
}

.cbtt-courses .cbtt-btn--ghost:hover {
    background: var(--cbtt-courses-surface-alt);
}

.cbtt-courses .cbtt-btn[disabled],
.cbtt-courses .cbtt-btn[aria-busy="true"] {
    opacity: 0.6;
    cursor: progress;
}

/* Theme link trap: prose link rules (.entry-content a) outrank a single class. */
.cbtt-courses a.cbtt-btn:is(:link, :visited, :hover, :focus, :active) {
    text-decoration: none;
}

.cbtt-courses a.cbtt-btn--primary:is(:link, :visited, :hover, :focus, :active) {
    color: var(--cbtt-courses-on-primary);
}

.cbtt-courses a.cbtt-btn--secondary:is(:link, :visited, :hover, :focus, :active) {
    color: var(--cbtt-text, inherit);
}

.cbtt-courses a.cbtt-btn--ghost:is(:link, :visited, :hover, :focus, :active) {
    color: var(--cbtt-courses-accent-ink);
}

/* ---- Card list -------------------------------------------------------- */

.cbtt-courses__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    gap: 1.25rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}

/*
 * A short list is centred. When the n cards (20rem each, 1.25rem gap) take up
 * at most 80 % of the viewport, the grid shrinks to exactly that width and
 * sits in the middle instead of leaving empty tracks on the right. The
 * viewport thresholds are (n × 20rem + (n − 1) × 1.25rem) / 0.8 — media
 * queries cannot take a variable, hence one block per count. Longer lists and
 * narrower viewports keep the full-width grid; below 600 px it is one column.
 */

@media (min-width: 38rem) {
    .cbtt-courses__grid[data-count="1"] {
        width: 20rem;
        max-width: 100%;
        margin-inline: auto;
    }
}

@media (min-width: 51.5625rem) {
    .cbtt-courses__grid[data-count="2"] {
        width: 41.25rem;
        max-width: 100%;
        margin-inline: auto;
    }
}

@media (min-width: 78.125rem) {
    .cbtt-courses__grid[data-count="3"] {
        width: 62.5rem;
        max-width: 100%;
        margin-inline: auto;
    }
}

@media (min-width: 104.688rem) {
    .cbtt-courses__grid[data-count="4"] {
        width: 83.75rem;
        max-width: 100%;
        margin-inline: auto;
    }
}

@media (min-width: 131.25rem) {
    .cbtt-courses__grid[data-count="5"] {
        width: 105rem;
        max-width: 100%;
        margin-inline: auto;
    }
}

@media (min-width: 157.812rem) {
    .cbtt-courses__grid[data-count="6"] {
        width: 126.25rem;
        max-width: 100%;
        margin-inline: auto;
    }
}

@media (min-width: 184.375rem) {
    .cbtt-courses__grid[data-count="7"] {
        width: 147.5rem;
        max-width: 100%;
        margin-inline: auto;
    }
}

@media (min-width: 210.938rem) {
    .cbtt-courses__grid[data-count="8"] {
        width: 168.75rem;
        max-width: 100%;
        margin-inline: auto;
    }
}

.cbtt-courses__empty {
    color: var(--cbtt-courses-muted);
}

.cbtt-course-card,
.cbtt-course-booking {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
    margin: 0;
    padding: 0 1.25rem 1.25rem;
    overflow: hidden;
    background: var(--cbtt-courses-surface);
    border: 1px solid var(--cbtt-courses-border);
    border-radius: var(--cbtt-courses-radius);
    box-shadow: none;
}

.cbtt-course-detail,
.cbtt-course-booking {
    margin-bottom: 1.5rem;
}

.cbtt-course-detail {
    min-width: 0;
    margin-top: 0;
    padding: 0 1.25rem 1.5rem;
    background: var(--cbtt-courses-surface);
    border: 1px solid var(--cbtt-courses-border);
    border-radius: var(--cbtt-courses-radius);
    box-shadow: none;
}

.cbtt-course-card__band {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 -1.25rem 0.25rem;
    padding: 0.75rem 1.25rem 0;
    border-top: 6px solid var(--cbtt-course-color, var(--cbtt-courses-primary));
}

.cbtt-course-booking {
    padding-top: 1rem;
    border-top: 6px solid var(--cbtt-course-color, var(--cbtt-courses-primary));
}

.cbtt-course-card__icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cbtt-course-color, var(--cbtt-courses-primary));
    color: var(--cbtt-course-on, var(--cbtt-courses-on-primary));
    font-size: 22px;
}

.cbtt-course-card__series {
    margin: 0;
    color: var(--cbtt-courses-muted);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/*
 * Tags (v14): small label chips, own copy (cbtt-ui.css is not loaded on
 * cacheable views, see the file header). A fixed, neutral rotation of six
 * hues — deliberately NOT the teacher's brand colour (--cbtt-course-color,
 * used by the band/icon above): tags need to stay visually distinct from
 * each other regardless of which single brand colour a course carries.
 */
.cbtt-course-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0;
}

.cbtt-ui-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.cbtt-ui-tag--1 { background: #e3eefc; color: #1c4e80; }
.cbtt-ui-tag--2 { background: #e5f3e8; color: #1d6b3a; }
.cbtt-ui-tag--3 { background: #f3e8fb; color: #5b2e8c; }
.cbtt-ui-tag--4 { background: #fdf0dc; color: #8a5a10; }
.cbtt-ui-tag--5 { background: #e3f6f3; color: #0f6e63; }
.cbtt-ui-tag--6 { background: #fbe8ee; color: #99294f; }
.cbtt-ui-tag--7 { background: #dff1fb; color: #14587a; }
.cbtt-ui-tag--8 { background: #e6e8fb; color: #2f3a8f; }
.cbtt-ui-tag--9 { background: #e4ebf2; color: #35506b; }
.cbtt-ui-tag--10 { background: #dcf2f6; color: #0e6577; }
.cbtt-ui-tag--11 { background: #dde9ec; color: #1e5560; }
.cbtt-ui-tag--12 { background: #dcf4e9; color: #13694a; }
.cbtt-ui-tag--13 { background: #edf4d6; color: #4b6310; }
.cbtt-ui-tag--14 { background: #f0f2d8; color: #5c6010; }
.cbtt-ui-tag--15 { background: #e8efe4; color: #365a32; }
.cbtt-ui-tag--16 { background: #fbf4cc; color: #76600a; }
.cbtt-ui-tag--17 { background: #fdebc4; color: #7c4a03; }
.cbtt-ui-tag--18 { background: #efe6dc; color: #5e4426; }
.cbtt-ui-tag--19 { background: #fde5e5; color: #a12626; }
.cbtt-ui-tag--20 { background: #ffe9df; color: #a1401f; }
.cbtt-ui-tag--21 { background: #f8e1ee; color: #86206a; }
.cbtt-ui-tag--22 { background: #ece8fb; color: #4a3a9a; }
.cbtt-ui-tag--23 { background: #eeeaf4; color: #4f4470; }
.cbtt-ui-tag--24 { background: #f6e6f6; color: #7a2a7a; }

.cbtt-course-card__title,
.cbtt-course-detail__title {
    margin: 0.25rem 0 0;
    line-height: 1.25;
}

.cbtt-course-card__title a,
.cbtt-course-detail__title a {
    color: inherit;
    text-decoration: none;
}

.cbtt-course-card__title a:hover,
.cbtt-course-detail__title a:hover {
    text-decoration: underline;
}

.cbtt-course-card__subtitle,
.cbtt-course-card__byline {
    margin: 0;
    color: var(--cbtt-courses-muted);
}

.cbtt-course-card__group {
    padding-top: 0.75rem;
    border-top: 1px solid var(--cbtt-courses-border);
}

.cbtt-course-card__group-label {
    margin: 0 0 0.25rem;
    font-weight: 600;
}

.cbtt-course-card__facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.25rem 0.75rem;
    margin: 0.25rem 0;
}

.cbtt-course-fact {
    display: contents;
}

/* "display: contents" would beat the hidden attribute (the discount rows). */
.cbtt-course-fact[hidden] {
    display: none;
}

.cbtt-course-card__facts dt {
    font-weight: 600;
}

.cbtt-course-card__facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* Price information: body colour, never muted (PAngV, § 312j BGB). */
.cbtt-course-taxnote {
    display: block;
    color: inherit;
    font-size: 0.875rem;
}

/* "display: block" would beat the hidden attribute: a free total has no tax note. */
.cbtt-course-taxnote[hidden] {
    display: none;
}

.cbtt-course-card__state {
    margin: 0.25rem 0;
    font-weight: 600;
}

.cbtt-course-card__actions {
    margin: 0.5rem 0 0;
}

.cbtt-course-card__more {
    margin: 0.75rem 0 0;
}

.cbtt-course-card__pay {
    margin: auto 0 0;
    padding-top: 0.5rem;
    color: inherit;
    font-size: 0.875rem;
}

/* ---- Detail ----------------------------------------------------------- */

.cbtt-course-detail__description,
.cbtt-course-detail__good,
.cbtt-course-legal,
.cbtt-courses p {
    max-width: var(--cbtt-measure, 52ch);
}

/*
 * The description's bar-chart points. The text sits below the bar, not
 * inside it — a 20% bar cannot hold a sentence. Not a <progress> element or
 * role="progressbar": these are facts, not a task in progress.
 */
.cbtt-course-metrics {
    max-width: var(--cbtt-measure, 52ch);
    margin: 1rem 0;
}

.cbtt-course-metric {
    margin-bottom: 0.75rem;
}

.cbtt-course-metric__label {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.cbtt-course-metric__bar {
    position: relative;
    height: 0.6rem;
    border-radius: var(--cbtt-courses-radius);
    background: var(--cbtt-courses-surface-alt);
    overflow: hidden;
}

.cbtt-course-metric__fill {
    display: block;
    height: 100%;
    background: var(--cbtt-course-color, var(--cbtt-courses-primary));
}

.cbtt-course-metric__text {
    margin: 0.25rem 0 0;
    color: var(--cbtt-courses-muted);
}

.cbtt-course-session--pause,
.cbtt-course-session--cancelled {
    color: var(--cbtt-courses-muted);
}

.cbtt-course-session--pause {
    font-style: italic;
}

/*
 * The detail page of one course. The article is the container: below 48rem
 * of its own width everything stacks in the order of the markup (title, the
 * booking panel, then the text); from 48rem the panel moves to the right and,
 * with a single group, stays in view while the text scrolls. Width is
 * measured on the article, not the viewport, because the theme decides how
 * wide the content column is. Without container-query support the page stays
 * one column. Only courses-public.css is loaded here (no cbtt-ui.css).
 */

.cbtt-course-detail {
    display: block;
    container: cbtt-course-detail / inline-size;
    /* clip, not hidden: hidden makes the article a scroll container and the sticky panel would never stick. */
    overflow: clip;
}

.cbtt-course-detail__head {
    margin: 0;
}

.cbtt-courses .cbtt-course-detail__title {
    margin: 0.75rem 0 0.25rem;
    font-size: clamp(1.625rem, 1.25rem + 1.6vw, 2.375rem);
    line-height: 1.15;
}

.cbtt-courses .cbtt-course-detail__subtitle {
    max-width: none;
    font-size: 1.125rem;
    line-height: 1.4;
}

/*
 * The course image keeps its own format, nothing is cropped (a 16:9 frame cut the lecturer's head off). A wide image
 * runs across the text column; a portrait or square one (--portrait on the layout) is narrower and, on a wide article,
 * gets a column of its own (container query below). The max-height with contain is only a guard against extreme
 * formats (a very tall poster); the usual photo never reaches it.
 */
.cbtt-course-detail__image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 36rem;
    margin: 0;
    object-fit: contain;
    object-position: left top;
    border-radius: var(--cbtt-courses-radius);
}

.cbtt-course-detail__layout--portrait > .cbtt-course-detail__image {
    width: auto;
    max-width: min(100%, 18rem);
}

.cbtt-course-detail__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    margin-top: 1.25rem;
}

/* The booking panel: one block per group. */
.cbtt-course-detail__aside {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.cbtt-courses .cbtt-course-detail__aside p {
    max-width: none;
}

.cbtt-course-detail .cbtt-course-group {
    padding: 1.25rem;
    color: var(--cbtt-text, inherit);
    background: var(--cbtt-courses-surface-alt);
    border: 1px solid var(--cbtt-courses-border);
    border-top: 4px solid var(--cbtt-course-color, var(--cbtt-courses-primary));
    border-radius: var(--cbtt-courses-radius);
}

.cbtt-course-group__title {
    margin: 0 0 0.75rem;
    font-size: 1.125rem;
    line-height: 1.3;
}

/* A panel's facts are a stack of label and value; the price is the one number to find. */
.cbtt-course-group__facts {
    margin: 0 0 0.75rem;
}

.cbtt-course-group__facts .cbtt-course-price {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.cbtt-course-group__dates {
    margin: 0.75rem 0;
    padding-top: 0.25rem;
    border-top: 1px solid var(--cbtt-courses-border);
}

.cbtt-course-group__dates > summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-weight: 600;
    cursor: pointer;
}

.cbtt-course-sessions {
    margin: 0;
    padding: 0;
    list-style: none;
    font-variant-numeric: tabular-nums;
}

.cbtt-course-sessions > li {
    padding: 0.375rem 0;
    border-top: 1px solid var(--cbtt-courses-border);
}

.cbtt-course-sessions > li:first-child {
    border-top: 0;
}

.cbtt-course-group__min {
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.cbtt-course-detail .cbtt-course-card__state {
    margin: 0.75rem 0 0.5rem;
}

.cbtt-course-detail .cbtt-course-card__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
}

.cbtt-course-detail .cbtt-course-card__actions .cbtt-btn {
    width: 100%;
}

/* The rule that applies after the button: small print, body colour, never muted (PAngV, § 312j BGB). */
.cbtt-course-group__cancel {
    grid-template-columns: minmax(0, 1fr);
    margin: 1rem 0 0;
    font-size: 0.875rem;
}

.cbtt-course-detail__legal,
.cbtt-course-detail__aside .cbtt-course-card__pay {
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
}

/* The text column. */
.cbtt-course-detail__main {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    min-width: 0;
}

.cbtt-course-detail__main > * {
    margin-top: 0;
    margin-bottom: 0;
}

/*
 * The text uses the whole column. This knowingly breaks the line-length rule (UX 3.1, --cbtt-measure) on the
 * detail page: the booking box beside it already narrows the page, and a thin text column next to empty space
 * looked worse than long lines (operator decision 2026-10-20).
 */
.cbtt-courses .cbtt-course-detail__main :is(p, div, ul, ol) {
    max-width: none;
}

.cbtt-course-detail__description {
    font-size: 1.0625rem;
    line-height: 1.65;
}

/* Bar points: first, in a frame, full width; the explanation sits right behind the label ("Intensity – very intensive"). */
.cbtt-course-detail .cbtt-course-metrics {
    margin: 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--cbtt-courses-border);
    border-radius: var(--cbtt-courses-radius);
}

.cbtt-course-detail .cbtt-course-metric {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.5rem;
    margin: 0 0 1rem;
}

.cbtt-course-detail .cbtt-course-metric:last-child {
    margin-bottom: 0;
}

.cbtt-course-detail .cbtt-course-metric__label {
    margin: 0;
}

.cbtt-course-detail .cbtt-course-metric__text {
    margin: 0;
}

.cbtt-course-detail .cbtt-course-metric__text::before {
    content: "\2013\00a0";
}

.cbtt-course-detail .cbtt-course-metric__bar {
    flex: 0 0 100%;
    order: 3;
    margin-top: 0.375rem;
}

.cbtt-course-detail__description > :first-child {
    margin-top: 0;
}

.cbtt-course-detail__description > :last-child {
    margin-bottom: 0;
}

.cbtt-course-detail__section > :is(h2, h3, h4, h5, h6) {
    margin: 0 0 0.5rem;
}

.cbtt-course-detail__section--good {
    padding: 1rem 1.25rem;
    background: var(--cbtt-courses-surface-alt);
    border-left: 4px solid var(--cbtt-course-color, var(--cbtt-courses-primary));
    border-radius: var(--cbtt-courses-radius);
}

.cbtt-course-detail__good > :first-child {
    margin-top: 0;
}

.cbtt-course-detail__good > :last-child {
    margin-bottom: 0;
}

.cbtt-course-detail__address {
    font-style: normal;
}

/* Lecturers: photo beside name and vita, as many per row as fit. */
.cbtt-course-detail__lecturers {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
}

.cbtt-course-detail__lecturer {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    max-width: none;
}

.cbtt-course-detail__lecturer-text {
    flex: 1 1 auto;
    min-width: 0;
}

.cbtt-course-detail__lecturer-photo {
    display: block;
    flex: 0 0 auto;
    width: 5rem;
    height: 5rem;
    margin: 0;
    max-width: none;
    object-fit: cover;
    border-radius: 50%;
}

.cbtt-course-detail__lecturer-name {
    margin: 0;
    font-weight: 600;
}

.cbtt-course-detail__lecturer-vita {
    margin: 0.25rem 0 0;
}

/* A long vita: three lines and an ellipsis; the checkbox (visually hidden, still focusable) opens the rest. */
.cbtt-course-detail__vita > .cbtt-course-detail__lecturer-vita {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.cbtt-course-detail__vita-toggle:checked ~ .cbtt-course-detail__lecturer-vita {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}

.cbtt-course-detail__vita-more {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--cbtt-courses-accent-ink);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.cbtt-course-detail__vita-toggle:focus-visible ~ .cbtt-course-detail__vita-more {
    outline: 2px solid var(--cbtt-courses-accent-ink);
    outline-offset: 2px;
}

.cbtt-course-detail__vita-close,
.cbtt-course-detail__vita-toggle:checked ~ .cbtt-course-detail__vita-more .cbtt-course-detail__vita-open {
    display: none;
}

.cbtt-course-detail__vita-toggle:checked ~ .cbtt-course-detail__vita-more .cbtt-course-detail__vita-close {
    display: inline;
}

@container cbtt-course-detail (min-width: 48rem) {
    .cbtt-course-detail__layout {
        grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
        gap: 2rem 2.5rem;
        align-items: start;
    }

    .cbtt-course-detail__main {
        grid-column: 1;
        grid-row: 1;
    }

    .cbtt-course-detail__aside {
        grid-column: 2;
        grid-row: 1;
    }

    /* With an image: it sits above the text only, and the panel starts at the top beside both. */
    .cbtt-course-detail__layout--image > .cbtt-course-detail__image {
        grid-column: 1;
        grid-row: 1;
    }

    .cbtt-course-detail__layout--image > .cbtt-course-detail__main {
        grid-row: 2;
    }

    .cbtt-course-detail__layout--image > .cbtt-course-detail__aside {
        grid-row: 1 / span 2;
    }

    /* Sticky only for one group: a taller stack would have its lower groups out of reach. */
    .cbtt-course-detail__aside--single {
        position: sticky;
        top: var(--cbtt-courses-sticky-top, 1.5rem);
    }
}

/*
 * A portrait or square image gets its own left column, the text and the panel follow: image | text | panel. Narrower
 * than 60rem the image stays above the text at a small width (14rem between 48 and 60rem, 18rem on a phone).
 */
@container cbtt-course-detail (min-width: 48rem) {
    .cbtt-course-detail__layout--portrait > .cbtt-course-detail__image {
        max-width: min(100%, 14rem);
    }
}

@container cbtt-course-detail (min-width: 60rem) {
    .cbtt-course-detail__layout--portrait {
        grid-template-columns: minmax(12rem, 17rem) minmax(0, 1fr) minmax(17rem, 22rem);
    }

    .cbtt-course-detail__layout--portrait > .cbtt-course-detail__image {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        max-width: none;
        max-height: 40rem;
    }

    .cbtt-course-detail__layout--portrait > .cbtt-course-detail__main {
        grid-column: 2;
        grid-row: 1;
    }

    .cbtt-course-detail__layout--portrait > .cbtt-course-detail__aside {
        grid-column: 3;
        grid-row: 1;
    }
}

.cbtt-course-back {
    margin: 1rem 0;
}

/* ---- Forms ------------------------------------------------------------ */

.cbtt-course-summary {
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--cbtt-courses-surface-alt);
    border-left: 6px solid var(--cbtt-course-color, var(--cbtt-courses-primary));
    border-radius: var(--cbtt-courses-radius);
}

.cbtt-course-summary > :first-child {
    margin-top: 0;
}

.cbtt-course-form {
    max-width: 720px;
    margin: 0 0 1.5rem;
}

.cbtt-course-form--inline {
    max-width: none;
    margin: 0.5rem 0;
}

.cbtt-course-form__group {
    min-width: 0;
    margin: 0 0 1.5rem;
    padding: 0;
    border: 0;
}

.cbtt-course-form__group > legend {
    margin-bottom: 0.5rem;
    padding: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.cbtt-courses .cbtt-ui-field {
    margin-bottom: 1rem;
}

.cbtt-courses .cbtt-ui-field > label,
.cbtt-courses .cbtt-course-radios > legend {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.cbtt-courses .cbtt-course-radios {
    min-width: 0;
    padding: 0;
    border: 0;
}

.cbtt-courses .cbtt-ui-input {
    display: block;
    width: 100%;
    max-width: min(420px, 100%);
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--cbtt-courses-border);
    border-radius: 8px;
    background: var(--cbtt-courses-surface);
    font: inherit;
}

.cbtt-courses .cbtt-ui-input--narrow {
    max-width: 10rem;
}

.cbtt-courses .cbtt-ui-input[aria-invalid="true"] {
    border-color: var(--cbtt-courses-error);
}

.cbtt-courses .cbtt-ui-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 44px;
    padding: 6px 0;
    font-weight: 400;
    cursor: pointer;
}

.cbtt-courses .cbtt-ui-check input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
}

.cbtt-courses .cbtt-ui-help {
    display: block;
    margin: 4px 0 0;
    color: var(--cbtt-courses-muted);
    font-size: 0.875rem;
}

/* The UWG notice under the email field and in "My booking": body colour. */
.cbtt-courses .cbtt-ui-help.cbtt-course-uwg {
    color: inherit;
}

.cbtt-courses .cbtt-ui-field-error {
    display: flex;
    gap: 8px;
    margin: 6px 0 0;
    color: var(--cbtt-courses-error);
    font-size: 0.875rem;
}

.cbtt-courses .cbtt-ui-field-error[hidden] {
    display: none;
}

.cbtt-courses .cbtt-ui-field-error::before {
    content: "!";
    flex: 0 0 auto;
    width: 1.15em;
    height: 1.15em;
    border-radius: 50%;
    background: var(--cbtt-courses-error);
    color: #ffffff;
    font-weight: 700;
    line-height: 1.15em;
    text-align: center;
}

.cbtt-course-optional {
    color: var(--cbtt-courses-muted);
    font-weight: 400;
}

.cbtt-course-optional[hidden] {
    display: none;
}

/* ---- Discount code (booking form) -------------------------------------- */

.cbtt-course-code {
    margin: 1rem 0 0;
}

.cbtt-course-code__row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
}

.cbtt-course-code__row .cbtt-ui-input {
    flex: 1 1 12rem;
    min-width: 0;
    min-height: 44px;
    text-transform: uppercase;
}

.cbtt-course-code__row .cbtt-btn {
    min-height: 44px;
}

.cbtt-course-code__status .cbtt-btn {
    min-height: 44px;
    margin-left: 0.25rem;
}

/* .cbtt-btn sets display: inline-flex, which beats the hidden attribute. */
.cbtt-courses .cbtt-btn[hidden] {
    display: none;
}

.cbtt-course-price,
.cbtt-courses [data-cbtt-price-list],
.cbtt-courses [data-cbtt-price-discount] {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
    .cbtt-course-code__row {
        flex-direction: column;
    }

    /* Stacked: the 12rem basis would become the field's height. */
    .cbtt-course-code__row .cbtt-ui-input {
        flex: 0 0 auto;
        width: 100%;
    }
}

.cbtt-course-mandatory {
    margin: 1.5rem 0 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--cbtt-courses-border);
    border-radius: var(--cbtt-courses-radius);
}

.cbtt-course-mandatory > :first-child {
    margin-top: 0;
}

.cbtt-course-legal-details,
.cbtt-course-dates,
.cbtt-course-access {
    margin: 0.5rem 0;
}

.cbtt-courses summary {
    min-height: 44px;
    padding: 10px 0;
    cursor: pointer;
    font-weight: 600;
}

.cbtt-course-form__process {
    margin: 1rem 0 0.5rem;
}

.cbtt-course-form__status:empty {
    display: none;
}

.cbtt-course-form__status {
    margin: 0.5rem 0;
}

.cbtt-course-form__submit {
    margin: 0.5rem 0 0;
}

.cbtt-course-notice {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--cbtt-courses-border);
    background: var(--cbtt-courses-surface-alt);
}

.cbtt-course-notice--success {
    border-left-color: var(--cbtt-courses-success);
}

.cbtt-course-notice--error {
    border-left-color: var(--cbtt-courses-error);
}

.cbtt-course-provider {
    margin: 1rem 0 0;
    font-style: normal;
}

.cbtt-course-privacy {
    margin: 1rem 0;
    font-size: 0.875rem;
}

/* ---- My booking -------------------------------------------------------- */

.cbtt-course-pay {
    margin: 0.5rem 0;
}

.cbtt-course-pay__value {
    font-variant-numeric: tabular-nums;
}

/* "Already paid?" inside the payment block. */
.cbtt-course-paid {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--cbtt-courses-border);
}

.cbtt-course-pay__row dd {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
}

.cbtt-course-qr {
    width: 236px;
    max-width: 100%;
    margin: 1rem 0 0.5rem;
    padding: 8px;
    background: #ffffff;
    border: 1px solid var(--cbtt-courses-border);
}

.cbtt-course-qr img,
.cbtt-course-qr canvas {
    display: block;
    width: 100%;
    height: auto;
}

.cbtt-courses-withdraw > summary.cbtt-btn {
    display: inline-flex;
    list-style: none;
}

.cbtt-courses-withdraw > summary::-webkit-details-marker {
    display: none;
}

.cbtt-courses-withdraw__panel {
    margin: 0.75rem 0;
    padding: 1rem;
    border: 1px solid var(--cbtt-courses-border);
    border-radius: var(--cbtt-courses-radius);
}

.cbtt-course-booking__files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cbtt-courses-withdraw-entry {
    margin: 2rem 0 0;
    font-size: 0.875rem;
}

/* The "My booking" entry at the end of the list, detail and conditions views. */
.cbtt-courses-booking-entry {
    margin: 1rem 0 0;
    font-size: 0.875rem;
}

.cbtt-courses-booking-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

/* A teacher's hosted site: the teacher's own imprint and privacy policy. */
.cbtt-courses-site-legal {
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
}

/*
 * ---- Booking history (v17) ------------------------------------------------
 * Inside a booking card and in the account list of My booking: when the
 * booking was ordered, confirmed, paid, ended and refunded. A list of dated
 * lines in a disclosure; the state is the words, not a colour.
 */

.cbtt-course-history {
    margin: 0.5rem 0;
}

.cbtt-course-history__open {
    margin: 0 0 0.5rem;
    font-weight: 600;
}

.cbtt-course-history__events {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cbtt-course-history__event {
    display: flex;
    flex-wrap: wrap;
    gap: 0.125rem 0.75rem;
    padding: 0.375rem 0;
    border-top: 1px solid var(--cbtt-courses-border);
    font-size: 0.9375rem;
    line-height: 1.4;
}

.cbtt-course-history__event:first-child {
    border-top: 0;
}

.cbtt-course-history__when {
    flex: 0 0 auto;
    min-width: 11em;
    color: var(--cbtt-courses-muted);
    font-variant-numeric: tabular-nums;
}

.cbtt-course-history__what {
    flex: 1 1 14em;
    min-width: 0;
}

.cbtt-course-history__amount {
    margin-left: auto;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.cbtt-course-account {
    margin: 1.5rem 0 0;
}

.cbtt-course-booking--account {
    border-top-width: 1px;
}

/*
 * ---- Preview (v17) --------------------------------------------------------
 * A course that is not public yet, shown to a signed-in teacher only. The
 * state is told by text and symbol (the badge says "Preview" and the line
 * says "Draft" or the date), never by colour alone; the dashed border is the
 * extra cue. Tokens only, no status colour of its own.
 */

.cbtt-courses .cbtt-course-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.cbtt-courses .cbtt-course-badge--preview {
    border: 1px dashed currentColor;
    background: transparent;
    color: var(--cbtt-courses-accent-ink);
}

.cbtt-courses .cbtt-course-card__band .cbtt-course-badge {
    margin-left: auto;
}

.cbtt-courses .cbtt-course-card--preview,
.cbtt-courses .cbtt-course-detail--preview {
    border-style: dashed;
}

.cbtt-courses .cbtt-course-card__actions--preview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.cbtt-courses .cbtt-btn[disabled].cbtt-btn--preview {
    cursor: not-allowed;
}

.cbtt-courses .cbtt-course-preview-note {
    margin: 0.25rem 0 0;
}

/* An announced course: "Booking opens on <date>" from the server; with the
   script the time left (tabular digits, no jumping) and the date for screen
   readers only. Attribute selectors: the script adds no classes. */
.cbtt-course-countdown [data-cbtt-countdown-live]:not([hidden]) {
    display: block;
    font-variant-numeric: tabular-nums;
}

.cbtt-course-countdown[data-cbtt-countdown-ticking] [data-cbtt-countdown-date] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Small screens ------------------------------------------------------ */

@media (max-width: 600px) {
    .cbtt-courses__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .cbtt-course-card__facts {
        grid-template-columns: minmax(0, 1fr);
    }

    .cbtt-course-card__facts dt {
        margin-top: 0.25rem;
    }

    .cbtt-course-history__when {
        min-width: 0;
        flex-basis: 100%;
    }

    .cbtt-courses .cbtt-btn {
        width: 100%;
    }
}

/* ---- Print (conditions view, My booking) -------------------------------- */

@media print {
    .cbtt-course-form,
    .cbtt-courses-withdraw-entry,
    .cbtt-courses-booking-entry,
    .cbtt-courses .cbtt-btn,
    .cbtt-course-access {
        display: none !important;
    }

    .cbtt-course-legal,
    .cbtt-courses p {
        max-width: none;
    }

    .cbtt-course-card,
    .cbtt-course-detail,
    .cbtt-course-booking {
        border: 0;
        padding: 0;
    }
}

/* ---- Payment method (v18) ------------------------------------------------- */

/* One radio per method, the method's price beside it; the reduction a method gets sits under its name.
   The selector out-weighs ".cbtt-ui-field > label" (block, bold), which a label in this fieldset would get. */
.cbtt-courses .cbtt-ui-field > label.cbtt-course-paymethod {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.cbtt-courses .cbtt-course-paymethod__name {
    font-weight: 600;
}

.cbtt-courses .cbtt-course-paymethod__price {
    font-variant-numeric: tabular-nums;
}

.cbtt-courses .cbtt-course-paymethod__reduction {
    flex-basis: 100%;
    padding-left: 1.75rem;
    font-size: 0.875rem;
}

/* "display: flex" on the label would not hide a reduction that does not apply. */
.cbtt-courses .cbtt-course-paymethod__reduction[hidden] {
    display: none;
}

/* The line under a price that names the reduction of the methods that cost nothing extra. */
.cbtt-course-price-note {
    display: block;
    color: inherit;
    font-size: 0.875rem;
}

.cbtt-courses [data-cbtt-pay-reduction] {
    font-variant-numeric: tabular-nums;
}

/* Day groups (v19): kind of participation and the days of the booking form. */
.cbtt-courses .cbtt-course-daybook {
    display: grid;
    gap: 1rem;
}

.cbtt-courses .cbtt-course-kind__name {
    font-weight: 600;
}

.cbtt-courses .cbtt-course-kind__price {
    font-variant-numeric: tabular-nums;
}

.cbtt-courses .cbtt-course-kind[hidden] {
    display: none;
}

.cbtt-courses .cbtt-course-kind__fixed {
    margin: 0;
}

.cbtt-courses .cbtt-course-daylist {
    display: grid;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cbtt-courses .cbtt-course-day {
    display: grid;
    gap: 0;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--cbtt-courses-border);
    border-radius: 8px;
    background: var(--cbtt-courses-surface);
}

/* A day that cannot be added: muted, with its reason in the text under the name (the colour is never the only signal). */
.cbtt-courses .cbtt-course-day.is-unavailable {
    border-style: dashed;
    color: var(--cbtt-courses-muted);
}

.cbtt-courses .cbtt-course-day.is-unavailable input {
    cursor: not-allowed;
    opacity: 0.55;
}

.cbtt-courses .cbtt-course-day__note {
    margin: 0 0 0.25rem 30px;
}

.cbtt-courses .cbtt-course-days__hint {
    font-weight: 600;
}

.cbtt-courses .cbtt-course-days__sum {
    margin: 0.25rem 0 0;
    font-variant-numeric: tabular-nums;
}

.cbtt-courses .cbtt-course-days__sum:empty {
    display: none;
}

@media (min-width: 38rem) {
    .cbtt-courses .cbtt-course-daylist {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
