/*
 * Home v3 fold 3: Ways to learn + offer. Prefix .fp-. Tokens only (base.css).
 * De-congested 27 Nov 2026: four blocks with real air between them: head, four format cards, one detail panel, one offer band.
 * Mobile first; breakpoints 640 / 1024 / 1200. From 1024px the section is a one-screen fold (.v3-fold in base.css);
 * it fits by showing less, never by shrinking: there are no short-screen squeeze rules, a low screen simply scrolls.
 * Selectors carry .fp-root where skin.css ([class*="-card"] transitions) would otherwise win.
 * Motion: transform, opacity, colour and shadow only; all of it is switched off under prefers-reduced-motion.
 */

/* ---------- Layout: one column in DOM order: head, cards, detail panel, offer band ---------- */
.home-v3 .fp-grid { display: flex; flex-direction: column; gap: 32px; }
.home-v3 .fp-head .v3-h2 { margin-top: 0; }
.home-v3 .fp-answer { max-width: 62ch; font-size: 17px; line-height: 1.6; color: var(--mute); }

/* ---------- Four format radio cards ---------- */
.home-v3 .fp-form { margin: 0; }
.home-v3 .fp-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.home-v3 .fp-cards { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 12px; }
.home-v3 .fp-card { position: relative; display: block; margin: 0; cursor: pointer; font-size: inherit; line-height: inherit; }
.home-v3 .fp-radio { position: absolute; top: 18px; left: 18px; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.home-v3 .fp-root .fp-card-body {
    position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; height: 100%;
    padding: 20px 18px 22px; border: 1px solid var(--l200); border-radius: var(--r-card); background: var(--white);
    transition: border-color 240ms ease, box-shadow 240ms ease, transform 240ms var(--ease);
}
.home-v3 .fp-root .fp-card-tile {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; margin-bottom: 10px;
    border-radius: 14px; background: var(--l100); color: var(--brand-deep);
    transition: background-color 260ms ease, color 260ms ease, transform 300ms var(--ease);
}
.home-v3 .fp-card-tile .v3-i { width: 22px; height: 22px; }
.home-v3 .fp-root .fp-card-name { padding-right: 0; font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--ink); transition: color 240ms ease; }
.home-v3 .fp-card-best { font-size: 15px; line-height: 1.55; color: var(--mute); } /* never clamped: text is not hidden */
.home-v3 .fp-root .fp-card-check {
    position: absolute; top: 18px; right: 18px; display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 999px; border: 2px solid var(--l300); color: var(--white); background: var(--white);
    transition: background-color 220ms ease, border-color 220ms ease, transform 300ms var(--ease);
}
.home-v3 .fp-root .fp-card-check .v3-i { width: 13px; height: 13px; stroke-width: 3; opacity: 0; transform: scale(.4); transition: opacity 200ms ease, transform 300ms var(--ease); }

/* chosen card: ring, filled icon tile and a filled tick (state never by colour alone) */
.home-v3 .fp-root .fp-radio:checked + .fp-card-body { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand), 0 18px 34px -22px rgba(108, 53, 233, .6); }
.home-v3 .fp-root .fp-radio:checked + .fp-card-body .fp-card-tile { background: var(--brand); color: var(--white); }
.home-v3 .fp-root .fp-radio:checked + .fp-card-body .fp-card-name { color: var(--brand-deep); }
.home-v3 .fp-root .fp-radio:checked + .fp-card-body .fp-card-check { background: var(--brand); border-color: var(--brand); transform: scale(1.08); }
.home-v3 .fp-root .fp-radio:checked + .fp-card-body .fp-card-check .v3-i { opacity: 1; transform: none; }
.home-v3 .fp-root .fp-radio:focus-visible + .fp-card-body { outline: var(--focus-light); outline-offset: 4px; }

/* sliding highlight (added by formats.js): one ring that glides to the chosen card, so the card's own ring steps back */
.home-v3 .fp-glider {
    position: absolute; z-index: 2; top: 0; left: 0; pointer-events: none; border-radius: var(--r-card);
    border: 2px solid var(--brand); box-shadow: 0 18px 34px -22px rgba(108, 53, 233, .6);
}
.home-v3 .fp-glider.is-ready { transition: transform 420ms var(--ease); }
.home-v3 .fp-root .fp-cards.has-glider .fp-radio:checked + .fp-card-body { border-color: transparent; box-shadow: none; }

@media (pointer: fine) {
    .home-v3 .fp-root .fp-card:hover .fp-radio:not(:checked) + .fp-card-body { transform: translateY(-3px); border-color: var(--l300); box-shadow: var(--shadow-card); }
    .home-v3 .fp-root .fp-card:hover .fp-card-tile { transform: scale(1.08) rotate(-4deg); }
}

/* ---------- Detail panel: one calm white panel for the chosen format ---------- */
.home-v3 .fp-detail { padding: 26px 22px; border-radius: var(--r-panel); background: var(--white); box-shadow: var(--shadow-card); }
.home-v3 .fp-panel { display: grid; gap: 22px; min-width: 0; }
.home-v3 .fp-panel + .fp-panel { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--l200); } /* only seen without :has() */
.home-v3 .fp-panel-head { display: grid; gap: 6px; min-width: 0; }
.home-v3 .fp-panel-text { font-size: 16px; line-height: 1.6; color: var(--mute); }
.home-v3 .fp-facts { gap: 12px; }
.home-v3 .fp-facts li { font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.home-v3 .fp-team-links { display: grid; justify-items: start; gap: 0; }
.home-v3 .fp-team-links .v3-link { font-size: 16px; }
.home-v3 .fp-team-arrow { transition: transform 220ms var(--ease); }
@media (pointer: fine) { .home-v3 .fp-team-strip:hover .fp-team-arrow { transform: translateX(4px); } }
.home-v3 .fp-btn { width: 100%; min-height: 52px; padding-left: 28px; padding-right: 28px; white-space: nowrap; }

/* CSS-only switch (progressive enhancement): the four panels share one grid cell and cross-fade.
   Without :has() they stack as a plain list, each with its own button. */
@supports selector(:has(*)) {
    .home-v3 .fp-panels { display: grid; }
    .home-v3 .fp-panel {
        grid-area: 1 / 1; align-self: center; visibility: hidden; opacity: 0; transform: translate3d(0, 10px, 0);
        transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms; /* outgoing: fades out, then leaves the tab order */
    }
    .home-v3 .fp-panel + .fp-panel { margin-top: 0; padding-top: 0; border-top: 0; }
    .home-v3 .fp-root:has(#fp-live:checked) .fp-panel[data-f="live_online"],
    .home-v3 .fp-root:has(#fp-self:checked) .fp-panel[data-f="self_paced"],
    .home-v3 .fp-root:has(#fp-class:checked) .fp-panel[data-f="classroom"],
    .home-v3 .fp-root:has(#fp-onsite:checked) .fp-panel[data-f="onsite"] {
        visibility: visible; opacity: 1; transform: none;
        transition: opacity 340ms var(--ease) 140ms, transform 420ms var(--ease) 140ms, visibility 0s; /* incoming: glides in after the old one has gone */
    }
}

/* ---------- Offer: one slim ink band ---------- */
.home-v3 .fp-offer {
    position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; gap: 18px 20px;
    padding: 24px 22px; border-radius: var(--r-panel); scroll-margin-top: 96px;
}
.home-v3 .fp-offer::before { /* quiet brand glow, decoration only */
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(60% 140% at 0% 50%, rgba(108, 53, 233, .5), transparent 70%);
}
.home-v3 .fp-offer > * { position: relative; }
.home-v3 .fp-numeral {
    flex: none; display: flex; align-items: baseline; font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -.03em; color: var(--amber);
    transform-origin: 0 60%; transition: transform 320ms var(--ease);
}
.home-v3 .fp-numeral span { margin-left: 6px; font-size: 18px; font-weight: 600; letter-spacing: 0; }
@media (pointer: fine) { .home-v3 .fp-offer:hover .fp-numeral { transform: scale(1.06); } }
.home-v3 .fp-offer-copy { flex: 1 1 180px; display: grid; gap: 2px; min-width: 0; }
.home-v3 .fp-offer-title { font-size: 18px; font-weight: 600; line-height: 1.35; color: var(--on-dark); }
.home-v3 .fp-offer-deal, .home-v3 .fp-fallback { font-size: 15px; line-height: 1.55; color: var(--on-dark-2); }
.home-v3 .fp-timer { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.home-v3 .fp-ends { font-size: 15px; line-height: 1.5; color: var(--on-dark-2); }
.home-v3 .fp-ends time { font-weight: 600; color: var(--on-dark); white-space: nowrap; }
.home-v3 .fp-cells { display: flex; gap: 8px; }
.home-v3 .fp-cell {
    flex: none; min-width: 52px; padding: 4px 4px; text-align: center; border-radius: var(--r-btn);
    background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
}
.home-v3 .fp-cell b { display: block; font-size: 20px; font-weight: 700; line-height: 1.15; color: var(--on-dark); font-variant-numeric: tabular-nums; }
.home-v3 .fp-cell small { display: block; font-size: 13px; line-height: 1.3; color: var(--on-dark-3); }
.home-v3 .fp-offer-act { flex: 1 1 100%; }
.home-v3 .fp-offer-btn { width: 100%; white-space: nowrap; }

/* ---------- 640+: roomier panels; buttons take their own width ---------- */
@media (min-width: 640px) {
    .home-v3 .fp-grid { gap: 36px; }
    .home-v3 .fp-cards { gap: 16px; }
    .home-v3 .fp-root .fp-card-body { padding: 24px 22px; }
    .home-v3 .fp-root .fp-card-check { top: 22px; right: 22px; }
    .home-v3 .fp-detail { padding: 30px 32px; }
    .home-v3 .fp-btn { width: auto; }
    .home-v3 .fp-panel-act { justify-self: start; }
    .home-v3 .fp-offer { flex-wrap: nowrap; gap: 28px; padding: 22px 32px; }
    .home-v3 .fp-offer-copy { flex: 1 1 auto; }
    .home-v3 .fp-timer { flex: none; flex-wrap: nowrap; }
    .home-v3 .fp-ends { max-width: 14ch; }
    .home-v3 .fp-offer-act { flex: none; }
    .home-v3 .fp-offer-btn { width: auto; }
}
@media (min-width: 640px) and (max-width: 899px) {
    .home-v3 .fp-offer:has(.fp-timer) { flex-wrap: wrap; }
}

/* ---------- 1024+: one-screen fold. Head in two columns, four cards in a row, the panel as one row, the band ---------- */
@media (min-width: 1024px) {
    .home-v3 .fp-grid { gap: clamp(28px, 4.2vh, 44px); }
    .home-v3 .fp-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: end; gap: clamp(32px, 5vw, 72px); }
    .home-v3 .fp-head .v3-h2 { margin-top: 0; }
    .home-v3 .fp-head .fp-answer { margin-top: 0; max-width: 60ch; line-height: 1.6; }
    .home-v3 .fp-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }

    .home-v3 .fp-detail { padding: 28px 40px; }
    .home-v3 .fp-panel { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; align-items: center; gap: 40px; }
    .home-v3 .fp-facts, .home-v3 .fp-team-links { padding-left: 40px; border-left: 1px solid var(--l200); }
    .home-v3 .fp-panel-act { justify-self: end; }

    .home-v3 .fp-offer { gap: 32px; padding: 22px 40px; }
    .home-v3 .fp-offer-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
}

/* ---------- 1200+: the icon sits beside the name, so the cards stay low and wide ---------- */
@media (min-width: 1200px) {
    .home-v3 .fp-root .fp-card-body {
        display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "tile name" "best best";
        align-items: center; align-content: start; gap: 14px 12px;
    }
    .home-v3 .fp-root .fp-card-tile { grid-area: tile; margin-bottom: 0; }
    .home-v3 .fp-root .fp-card-name { grid-area: name; padding-right: 28px; }
    .home-v3 .fp-card-best { grid-area: best; }
    .home-v3 .fp-root .fp-card-check { top: 34px; right: 22px; } /* centred on the icon row */
}

/* ---------- Reduced motion: states still change, nothing moves ---------- */
@media (prefers-reduced-motion: reduce) {
    .home-v3 .fp-root .fp-card-body, .home-v3 .fp-root .fp-card-tile, .home-v3 .fp-root .fp-card-name, .home-v3 .fp-root .fp-card-check,
    .home-v3 .fp-root .fp-card-check .v3-i, .home-v3 .fp-glider.is-ready, .home-v3 .fp-root .fp-panel, .home-v3 .fp-numeral, .home-v3 .fp-team-arrow { transition: none !important; }
    .home-v3 .fp-root .fp-panel, .home-v3 .fp-root .fp-card:hover .fp-card-body, .home-v3 .fp-root .fp-card:hover .fp-card-tile,
    .home-v3 .fp-offer:hover .fp-numeral, .home-v3 .fp-team-strip:hover .fp-team-arrow { transform: none !important; }
}

/* ---------- Forced colours: keep the chosen card and the panels outlined ---------- */
@media (forced-colors: active) {
    .home-v3 .fp-root .fp-radio:checked + .fp-card-body { outline: 3px solid Highlight; }
    .home-v3 .fp-glider { display: none; }
    .home-v3 .fp-detail, .home-v3 .fp-offer { border: 1px solid CanvasText; }
}
