/* xag-cards.css  CARD ALIGNMENT STANDARD (owner: "alignment is key").
   Cards of the same kind in a row must be the same height, and the image, title, tag, meta line, description and buttons must start at the
   same height in every card of the row. One shared pattern, used by new markup and applied to the existing card families below.

   New markup:   <div class="xc-grid"> <article class="xc-card"> <img class="xc-img"> <div class="xc-body">
                    <h3 class="xc-title">  <div class="xc-tag">  <div class="xc-meta">  <div class="xc-desc">  <div class="xc-actions"> ...
   Rules:  1. the grid stretches every card to the height of the tallest card of its row (grid items stretch);
           2. a card is a flex column; its body grows (flex: 1) so the action area is pinned to the bottom of the card;
           3. titles and descriptions use fixed line clamps AND a matching min-height, so a short title still takes the room of two lines;
           4. images share one aspect ratio; the tag and meta rows always keep their height, even when empty;
           5. the action area has a fixed height and the same button order in every card (secondary first, primary last).
   Only shared tokens (xag-space.css, the theme files): no colours or fonts here. */

/* ---- 1. the grids ---- */
.xc-grid, .course-grid, .xag-card-grid, .ds-grid, .mk-grid, .xlf-grid, .dash-grid, .sp-grid {
  display: grid; align-items: stretch;
}
.xc-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--xag-sp-4); margin: var(--xag-sp-4) 0; }
.xc-grid > *, .course-grid > *, .xag-card-grid > *, .ds-grid > *, .mk-grid > *, .xlf-grid > *, .dash-grid > *, .sp-grid > * { min-width: 0; }

/* ---- 2. a card is a flex column; the body grows; the last block is pinned to the bottom ---- */
.xc-card, .course-card, .ds-card, .mk-card, .xag-card:not(.sim-wide), .xtp-gcard, .sp-grid > .sp-card {
  display: flex; flex-direction: column;
}
.xc-body, .course-card .cc-body, .ds-body, .mk-body, .xtp-gbody { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.xc-card > .xc-img, .course-grid .course-card > img, .course-grid .course-card > .xcp-ph, .xlf-grid .course-card > img {
  width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; flex: none;
}

/* ---- 3. line clamps with matching min-heights (title 2 lines, tag 1 row, meta 1 line, description 3 lines) ---- */
.xc-title, .course-card .cc-body h3, .ds-name, .mk-t, .xtp-gname {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  line-height: 1.3; min-height: calc(2 * 1.3em); overflow-wrap: anywhere;
}
/* the title row has ONE fixed height in rem (not em): a title that fit-line.js shrank to fit still leaves the description at the same top line as its neighbours (owner 2026-11-05, /trust/ cards) */
.xc-title { --xc-title-h: 3rem; height: var(--xc-title-h); min-height: var(--xc-title-h); max-height: var(--xc-title-h); box-sizing: border-box; align-content: start; }
.xc-title > a { display: inline; }
.xc-tag, .course-card .cc-tag { min-height: var(--xag-sp-5); display: flex; align-items: flex-start; flex-wrap: wrap; gap: var(--xag-sp-1); }
.xc-meta, .course-card .cc-meta {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1; overflow: hidden;
  line-height: 1.4; min-height: 1.4em;
}
.xc-desc, .course-card .cc-desc, .xtp-gbio {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
  line-height: 1.45; min-height: calc(3 * 1.45em); max-height: calc(3 * 1.45em); flex: none; margin: 0; overflow-wrap: anywhere;
}
.xc-desc > *, .course-card .cc-desc > * { margin: 0; }
.course-card .cc-body > p.cc-desc { flex: none; }
.ds-blurb, .mk-s, .xtp-gheadline {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; min-height: calc(2 * 1.4em); line-height: 1.4;
}

/* ---- 4. the action area: pinned to the bottom, fixed height, same order ---- */
.xc-actions, .course-card .cc-actions {
  margin-top: auto; padding-top: var(--xag-sp-2);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--xag-sp-2); align-content: end; align-items: stretch;
}
.xc-actions > .btn, .course-card .cc-actions > .btn, .course-card .cc-actions > .cc-more-btn {
  min-height: 40px; width: 100%; justify-content: center; text-align: center; white-space: normal; line-height: 1.2; margin: 0;
}
/* the "More about this course" button is always the first, full-width row; the other buttons share the row under it */
.course-card .cc-actions > .cc-more-btn, .xc-actions > .xc-wide { grid-column: 1 / -1; }
.course-card .cc-actions > .btn:only-child, .xc-actions > .btn:only-child { grid-column: 1 / -1; }
/* "Book / Request" takes the whole row when there is no visible "Add to cart" beside it (prices off, or a card without a cart button) */
html:not([data-xag-prices="1"]) .course-card .cc-actions > .cc-book, .course-card .cc-actions:not(:has(.cc-cart)) > .cc-book { grid-column: 1 / -1; }
.course-card .cc-price { grid-column: 1 / -1; margin: 0; }

/* ---- 5. other card families: pin the last block, same title room ---- */
.ds-card .ds-more, .mk-card .mk-p, .xtp-gcard .xtp-gact, .xag-card:not(.sim-wide) a.xag-card-cta, .sp-grid > .sp-card > :is(.sp-btn, .sp-cta):last-child { margin-top: auto; }
.xag-card:not(.sim-wide) > p { flex: 1 1 auto; }
.xag-card:not(.sim-wide) a.xag-card-cta { align-self: flex-start; }
.xtp-gcard .xtp-gact .btn { width: 100%; min-height: 40px; justify-content: center; }
.dash-grid > .dash-card { display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* ---- 6. prices off (setting show_course_prices, default off): the price and "Add to cart" of course cards are hidden, not deleted ---- */
html:not([data-xag-prices="1"]) .course-card .cc-price,
html:not([data-xag-prices="1"]) .course-card [data-pd-cart],
html:not([data-xag-prices="1"]) .course-card .cc-actions > .btn[onclick^="addToCart"] { display: none; }

/* ---- 7. the "More about this course" dialog and the Professional Development top row ---- */
.xc-more-dlg {
  width: min(720px, calc(100vw - 2 * var(--xag-sp-4))); max-height: calc(100vh - 2 * var(--xag-sp-4)); padding: 0; overflow: hidden;
  border: 1px solid var(--xag-c-line, currentColor); border-radius: var(--xag-radius, 12px); background: var(--xag-c-surface); color: var(--xag-c-text);
}
.xc-more-dlg::backdrop { background: rgba(3, 10, 30, .6); }
.xc-more-dlg .xc-more-head { display: flex; align-items: center; justify-content: space-between; gap: var(--xag-sp-3); padding: var(--xag-sp-3) var(--xag-sp-4); border-bottom: 1px solid var(--xag-c-line, currentColor); }
.xc-more-dlg .xc-more-head h2 { margin: 0; font-size: 1.1rem; }
.xc-more-dlg .xc-more-body { padding: var(--xag-sp-4); overflow: auto; max-height: calc(100vh - 8 * var(--xag-sp-4)); }
.xpd-includes ul { margin: var(--xag-sp-2) 0 0; padding-inline-start: var(--xag-sp-5); list-style: disc; display: grid; gap: var(--xag-sp-1); }
.xpd-includes li { line-height: 1.5; }
.xpd-top { margin-bottom: var(--xag-sp-4); }
.xpd-top .xag-side-main > .info-block { margin: 0; max-width: none; }
.xpd-top .xag-side-actions { position: static; }

@media (max-width: 640px) {
  .xc-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- 8. bullet lists in boxes ("what is included" and similar): one idea per bullet, no run-together paragraphs ---- */
.xag-bullets { margin: var(--xag-sp-2) 0 0; padding-inline-start: var(--xag-sp-5); list-style: disc; display: grid; gap: var(--xag-sp-1); }
.xag-bullets li { line-height: 1.5; }

/* ---- 9. result counts ("Showing 33 of 33 items") are not shown on listing pages; screen readers still hear them ---- */
.xcf-count, .xlf-count { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- 10. COURSE CARD ACCENT (owner 2026-11-04: "make them ALIVE"): ONE rule keyed on a category token, used by the academy, School Connect, marketplace and Studio cards ----
   Usage: class "xag-cat-card" + data-xag-cat="<key>" on the card; an icon ring <span class="xag-cat-ico"> with one outline icon (XagIcons.ring). Colour tokens live in typo-fit.css "COURSE CATEGORY TOKENS" (3:1 or better on white and on navy, test/cat-accent.test.mjs). */
[data-xag-cat="foundations"] { --cat: var(--xag-cat-foundations); } [data-xag-cat="communication"] { --cat: var(--xag-cat-communication); }
[data-xag-cat="classroom"] { --cat: var(--xag-cat-classroom); } [data-xag-cat="safety"] { --cat: var(--xag-cat-safety); } [data-xag-cat="growth"] { --cat: var(--xag-cat-growth); }
[data-xag-cat="offer"] { --cat: var(--xag-cat-offer); } [data-xag-cat="need"] { --cat: var(--xag-cat-need); } [data-xag-cat="event"] { --cat: var(--xag-cat-event); }
[data-xag-cat="exchange"] { --cat: var(--xag-cat-exchange); } [data-xag-cat="partnership"] { --cat: var(--xag-cat-partnership); } [data-xag-cat="project"] { --cat: var(--xag-cat-project); }
[data-xag-cat="news"] { --cat: var(--xag-cat-news); } [data-xag-cat="polls"] { --cat: var(--xag-cat-polls); } [data-xag-cat="access"] { --cat: var(--xag-cat-access); }
.xag-cat-card {
  position: relative; overflow: hidden; border: 1px solid color-mix(in srgb, var(--cat) 40%, var(--xag-c-line, currentColor)); border-top: 4px solid var(--cat);
  border-radius: var(--xag-radius, 16px);
  background: linear-gradient(180deg, color-mix(in srgb, var(--cat) 14%, transparent), transparent 55%), var(--a-card, var(--xag-c-surface));
  box-shadow: 0 10px 26px -18px color-mix(in srgb, var(--cat) 80%, transparent);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.xag-cat-card:hover, .xag-cat-card:focus-within { transform: translateY(-3px); box-shadow: 0 0 0 1px color-mix(in srgb, var(--cat) 55%, transparent), 0 14px 32px -12px color-mix(in srgb, var(--cat) 75%, transparent); }
.xag-cat-ico {
  flex: none; width: 48px; height: 48px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--cat); background: color-mix(in srgb, var(--cat) 18%, transparent); color: var(--cat);
}
.xag-cat-ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.xag-cat-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.xag-cat-head > h3 { margin: 0; min-width: 0; flex: 1 1 auto; }
/* progress and state chips in the category colour; state colours stay readable (text uses the page ink, colour is the ring and tint) */
.xag-chip { display: inline-flex; align-items: center; padding: 2px 12px; border-radius: var(--xag-btn-radius, 28px); font-size: .8rem; font-weight: 700; white-space: nowrap; border: 1.5px solid var(--cat); background: color-mix(in srgb, var(--cat) 16%, transparent); color: inherit; }
.xag-chip.is-ok { --cat: var(--xag-c-solid-ok); } .xag-chip.is-warn { --cat: var(--xag-cat-growth); } .xag-chip.is-new { --cat: var(--xag-cat-foundations); } .xag-chip.is-idle { --cat: var(--xag-cat-idle); }

/* ---- 11. SECTION HEAD (owner 2026-11-04: a visual element for every section): ring icon + optional step number + heading, coloured edge from the category token ---- */
.xag-sec-head {
  display: flex; align-items: center; gap: 16px; padding: 12px 16px; min-height: 72px;
  border-left: 6px solid var(--cat); border-radius: var(--xag-radius, 16px);
  background: linear-gradient(90deg, color-mix(in srgb, var(--cat) 16%, transparent), transparent 70%);
}
.xag-sec-head > h2 { margin: 0; min-width: 0; flex: 1 1 auto; }
.xag-sec-head .xag-cat-ico { width: 56px; height: 56px; }
.xag-sec-head .xag-cat-ico svg { width: 28px; height: 28px; }
.xag-sec-num { flex: none; min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--xag-btn-radius, 28px); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--xag-c-on-accent, currentColor); background: var(--xag-btn-grad, var(--cat)); box-shadow: var(--xag-btn-glow, none); }
@media (prefers-reduced-motion: reduce) { .xag-cat-card { transition: none; } .xag-cat-card:hover, .xag-cat-card:focus-within { transform: none; } }
/* section head heading size beats the global heading rule */
html body .xag-sec-head > h2:not(#xag) { font-size: 1.875rem; line-height: 1.2; }
@media (max-width: 640px) { html body .xag-sec-head > h2:not(#xag) { font-size: 1.5rem; } }

/* ---- 12. CHOICE CARDS, COURSE CARDS AND FRAMED BOXES (owner 2026-11-05, #fusion; also the rule for any page that lets a visitor choose) ----
   .xc-choice  = a big whole-card choice button: category ring icon (64px, same place in every card), title, short bullet lines (study mode, group size).
   .xc-whole    = the WHOLE card is the link/button (focus ring on the card); .xc-band = fixed-height icon band; the action line is pinned to the bottom.
   .xag-fframe = ONE framed box: heading (yellow with dot, from typo-fit.css), intro line, then the controls; equal padding, no empty bottom area.
   .xag-acts   = the action list of a framed box: one primary pill first, then outline pills of equal width and height, each with its helper line beside it. */
.xc-choice-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.xc-choice { align-items: stretch; justify-content: flex-start; gap: var(--xag-sp-3); padding: var(--xag-sp-5); text-align: start; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.xc-choice .xag-cat-ico { width: 64px; height: 64px; align-self: flex-start; }
.xc-choice .xag-cat-ico svg { width: 34px; height: 34px; }
.xc-choice .xc-title { min-height: calc(2 * 1.3em); font-size: 1.25rem; }
.xc-subs { display: grid; gap: var(--xag-sp-1); }
.xc-subs > span { display: block; position: relative; padding-inline-start: var(--xag-sp-4); line-height: 1.4; }
.xc-subs > span::before { content: ""; position: absolute; inset-inline-start: 0; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--cat); }
.group-size-card.xc-card { padding: var(--xag-sp-4); gap: var(--xag-sp-3); height: auto; cursor: default; }
.group-size-card .xag-cat-ico { width: 56px; height: 56px; }
.group-size-card .xag-cat-ico svg { width: 30px; height: 30px; }
.group-size-card .xag-bullets { margin: 0; }
.group-size-card .pkg-row { margin-top: auto; }

.xc-whole { text-align: start; font: inherit; color: inherit; cursor: pointer; padding: 0; width: 100%; }
.xc-whole:focus-visible { outline: 3px solid var(--xag-c-solid-warn); outline-offset: 3px; }
.xc-whole .xc-band { position: relative; flex: none; height: 88px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: color-mix(in srgb, var(--cat) 20%, transparent); }
.xc-whole .xc-band .xcs-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.xc-whole .xc-band .xag-cat-ico { position: relative; width: 64px; height: 64px; background: var(--xag-c-surface); }
.xc-whole .xc-band .xag-cat-ico svg { width: 34px; height: 34px; }
.xc-whole .xc-body { padding: var(--xag-sp-4); gap: var(--xag-sp-2); }
.xc-whole .xc-title, .xc-whole .xc-tag, .xc-whole .xc-meta, .xc-whole .xc-desc { display: block; }
.xc-whole .xc-title { display: -webkit-box; font-size: 1.05rem; }
.xc-whole .xc-desc { display: -webkit-box; }
.xc-whole .xc-meta { font-size: .82rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xc-whole .xc-actions { display: block; padding-top: var(--xag-sp-2); }
.xc-whole .course-select-cta { display: inline-block; font-weight: 700; color: var(--xag-c-accent-text, currentColor); }

.xag-fframe { padding: var(--xag-sp-4); margin: 0 0 var(--xag-sp-4); display: flow-root; }
.xag-fframe > :last-child { margin-bottom: 0; }
.xag-fframe > h2 { margin: 0 0 var(--xag-sp-2); }
.xag-fframe-intro { margin: 0 0 var(--xag-sp-3); }
.xag-fframe-act { margin-top: var(--xag-sp-3); }
.xag-fframe .xcf.xcf-in-frame { margin: 0; padding: 0; border: 0; background: none; max-width: none; border-radius: 0; }
.xag-fframe:not(:has(#fusionFilterSlot > .xcf:not([hidden]))) #fusionFilterSlot { display: none; }
.xag-acts { list-style: none; margin: var(--xag-sp-3) 0 0; padding: 0; display: grid; gap: var(--xag-sp-3); }
.xag-act { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: var(--xag-sp-3); align-items: center; }
.xag-act-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--xag-sp-2); width: 100%; min-height: 48px; margin: 0; text-align: center; white-space: normal; line-height: 1.2; }
.xag-act-btn .xi { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.xag-act-note { margin: 0; font-size: .9rem; line-height: 1.4; opacity: .9; }
@media (max-width: 640px) { .xag-act { grid-template-columns: minmax(0, 1fr); gap: var(--xag-sp-1); } }
#fusion-steps .step-link .xi { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; margin-inline-end: var(--xag-sp-2); vertical-align: -4px; }
.xag-fframe.xag-fullbox { width: auto; }   /* a BFC box with auto width sits beside the floated photo strip instead of dropping below it */
.xc-whole .xc-title { color: var(--xag-h-sub); }
.xc-choice .xc-title { color: var(--xag-h-sub); }
.xc-clear { clear: both; }   /* a long card grid drops below a floated photo strip and uses the full width */
html body .xag-cat-head > h3:not(#xag)::before { display: none; }   /* the ring icon is the marker, no second dot */
.group-size-card .pkg-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--xag-sp-2); }
.group-size-card .pkg-row .btn { width: 100%; min-width: 0; min-height: 64px; flex: none; margin: 0; border-radius: var(--xag-radius); }
.xc-whole .xc-title { height: calc(2 * 1.3em); min-height: 0; line-height: 1.3; }   /* every title takes exactly two lines, so the rows below start at the same height in every card */
.xc-whole .xc-tag { height: 1.5rem; min-height: 0; overflow: hidden; }
.xc-whole .xc-meta { height: 1.4em; line-height: 1.4; }

/* balanced wrapping: no one-word last line in card titles (audit 2026-11-10: /#trust at 1920, /sitemap/ at 768) */
.xc-title { text-wrap: balance; }

/* poll icon (polls.js): a standard outline icon, or an https picture on white so any image reads in every theme; the ring colour is the polls token */
.po-head { margin: 0 0 4px; }
.po-ico.po-ico-img { overflow: hidden; background: var(--xag-c-white, white); }
.po-ico img { display: block; width: 28px; height: 28px; object-fit: contain; }
