/*
 * Home v3 fold 6: Team Brief Builder (#team). Prefix .tb-. Tokens only (see base.css); rgba of ink/white/brand allowed.
 * Mobile first; breakpoints 640 / 1024 / 1200. The ink ticket carries .v3-ink, so the dark-surface variants
 * (amber focus ring, white headings) come from base.css. Fonts come from skin.css: never set font-family here.
 *
 * De-congested 27 Nov 2026. One-screen fold (.v3-fold, base.css): from 1024px the content is two columns
 * (heading, one sentence, clients, a review disclosure | the builder card). The fold fits one screen by showing
 * less, never by shrinking: sizes only ever grow with the viewport height, and on short screens the fold simply
 * grows taller than the screen. Motion lives in the prefers-reduced-motion: no-preference block near the end.
 */

.home-v3 .tb-team { scroll-margin-top: 72px; }
.home-v3 .tb-anchor { position: absolute; top: 0; left: 0; width: 1px; height: 1px; scroll-margin-top: 72px; }

/* ---------- Layout ---------- */
.home-v3 .tb-main { display: flex; flex-direction: column; gap: 36px; }
.home-v3 .tb-head, .home-v3 .tb-proof { min-width: 0; }
.home-v3 .tb-proof { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }

/* ---------- 1. Head ---------- */
.home-v3 .tb-intro { max-width: 46ch; color: var(--ink-2); }
.home-v3 .tb-how { margin-top: 12px; font-size: 16px; }

/* ---------- 2. Builder card ---------- */
.home-v3 .tb-card {
    position: relative; display: flex; flex-direction: column; min-width: 0;
    background: var(--white); border-radius: var(--r-panel);
    box-shadow: 0 1px 2px rgba(31, 3, 45, .05), 0 36px 70px -34px rgba(31, 3, 45, .3);
}

/* 2a. Form: three numbered questions */
.home-v3 .tb-form { display: flex; flex-direction: column; flex: 1 1 auto; gap: 28px; min-width: 0; padding: 24px 22px 28px; }
.home-v3 .tb-q { position: relative; min-width: 0; }
.home-v3 .tb-legend { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; font-size: 16px; line-height: 1.4; font-weight: 600; color: var(--ink); }

/* Step number: an outlined circle that fills and shows a tick once the question is answered */
.home-v3 .tb-num {
    position: relative; display: inline-flex; flex: none; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 999px;
    background: var(--l100); color: var(--brand-deep); box-shadow: inset 0 0 0 1.5px var(--l300);
    font-size: 13px; line-height: 1; font-weight: 600;
}
.home-v3 .tb-num-ok { position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; stroke-width: 3; opacity: 0; transform: scale(.4); }
.home-v3 .tb-q.is-done .tb-num { background: var(--brand); color: var(--white); box-shadow: inset 0 0 0 1.5px var(--brand); }
.home-v3 .tb-q.is-done .tb-num-n { opacity: 0; transform: scale(.4); }
.home-v3 .tb-q.is-done .tb-num-ok { opacity: 1; transform: none; }

.home-v3 .tb-grid { position: relative; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
/* Course: chips wrap and each row stretches to the full width */
.home-v3 .tb-grid-course { display: flex; flex-wrap: wrap; }
.home-v3 .tb-grid-course .tb-opt { flex: 1 1 auto; }
.home-v3 .tb-grid-size { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.home-v3 .tb-opt-wide { grid-column: 1 / -1; }
.home-v3 .tb-thumb { display: none; }

/* Chips: label > input.sr-only + span.tb-chip (sibling selectors) */
.home-v3 .tb-opt { position: relative; display: flex; min-width: 0; margin: 0; cursor: pointer; font-size: inherit; }
.home-v3 .tb-chip {
    position: relative; display: flex; flex: 1 1 auto; align-items: center; gap: 12px; min-width: 0;
    min-height: 52px; padding: 8px 18px;
    border: 1.5px solid rgba(31, 3, 45, .42); border-radius: var(--r-choice);
    background: var(--white); color: var(--ink);
}
.home-v3 .tb-chip-t { font-size: 15px; line-height: 1.35; font-weight: 600; }
.home-v3 .tb-chip-s { font-size: 13px; line-height: 1.4; color: var(--mute); white-space: nowrap; font-variant-numeric: tabular-nums; }
.home-v3 .tb-chip-course { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; min-height: 56px; }
.home-v3 .tb-chip-ic { display: inline-flex; flex: none; color: var(--brand-deep); }
.home-v3 .tb-chip-size { justify-content: center; padding: 8px 6px; text-align: center; }
.home-v3 .tb-chip-size .tb-chip-t { white-space: nowrap; }

.home-v3 .tb-badge {
    position: absolute; top: -8px; right: -8px; z-index: 2; display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 999px; background: var(--brand); color: var(--white);
    box-shadow: 0 0 0 2.5px var(--white);
    opacity: 0; transform: scale(.4);
}
.home-v3 .tb-badge .v3-i-sm { width: 12px; height: 12px; stroke-width: 3.5; }

@media (hover: hover) and (pointer: fine) {
    .home-v3 .tb-opt:hover .tb-chip { z-index: 1; border-color: var(--brand); box-shadow: 0 10px 22px -14px rgba(108, 53, 233, .55); }
}
.home-v3 .tb-opt input:checked + .tb-chip { z-index: 1; border-color: var(--brand); background: var(--l100); color: var(--brand-deep); box-shadow: inset 0 0 0 1px var(--brand); }
.home-v3 .tb-opt input:checked + .tb-chip .tb-badge { opacity: 1; transform: none; }
.home-v3 .tb-opt input:focus-visible + .tb-chip { z-index: 2; outline: var(--focus-light); outline-offset: 2px; }

/* 2b. Ticket: ink strip under the form with a perforated top edge. Progress, the one-line brief, the one amber CTA. */
.home-v3 .tb-ticket { position: relative; min-width: 0; border-radius: 0 0 var(--r-panel) var(--r-panel); }
.home-v3 .tb-perf { position: absolute; top: 0; left: 0; right: 0; height: 10px; pointer-events: none;
    background: radial-gradient(circle at 50% 0, var(--white) 0 5px, transparent 5.5px) 3px 0 / 18px 10px repeat-x; }
.home-v3 .tb-ticket-in { padding: 32px 22px 24px; }
.home-v3 .tb-ticket-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.home-v3 .tb-brief { min-width: 0; }
.home-v3 .tb-brief-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.home-v3 .tb-ticket-title { font-size: 13px; line-height: 1.5; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--on-dark-3); }
.home-v3 .tb-prog-wrap { display: flex; align-items: center; gap: 10px; }
.home-v3 .tb-prog { display: flex; gap: 5px; width: 78px; }
.home-v3 .tb-seg { position: relative; flex: 1; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.home-v3 .tb-seg i { position: absolute; inset: 0; border-radius: inherit; background: var(--amber); transform: scaleX(0); transform-origin: left center; }
.home-v3 .tb-prog[data-n="1"] .tb-seg:nth-child(-n+1) i,
.home-v3 .tb-prog[data-n="2"] .tb-seg:nth-child(-n+2) i,
.home-v3 .tb-prog[data-n="3"] .tb-seg i { transform: scaleX(1); }
.home-v3 .tb-prog-txt { color: var(--on-dark-3); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Two lines are reserved, so the card keeps its height as the brief grows */
.home-v3 .tb-summary { min-height: 3em; margin-top: 8px; font-size: 16px; line-height: 1.5; font-weight: 600; color: var(--on-dark); text-wrap: balance; }
.home-v3 .tb-summary.is-empty { font-weight: 400; color: var(--on-dark-2); }
.home-v3 .tb-cta { width: 100%; }

/* ---------- 3. Proof: trained-companies line, client logos, the team review behind a disclosure ---------- */
.home-v3 .tb-clients { display: flex; flex-direction: column; gap: 16px; width: 100%; min-width: 0; }
.home-v3 .tb-count-txt { font-size: 16px; line-height: 1.55; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.home-v3 .tb-logos-cap { margin-bottom: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.home-v3 .tb-logo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; }
.home-v3 .tb-logo-grid li { display: flex; align-items: center; justify-content: flex-start; height: 40px; }
.home-v3 .tb-logo-grid img { display: block; width: auto; max-width: 100%; height: auto; max-height: 34px; object-fit: contain; filter: grayscale(1); opacity: .7; }
@media (hover: hover) and (pointer: fine) {
    .home-v3 .tb-logo-grid li:hover img { filter: none; opacity: 1; }
}

.home-v3 .tb-review-more { position: relative; width: 100%; }
.home-v3 .tb-review-more summary { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; list-style: none; font-size: 16px; font-weight: 600; color: var(--brand-deep); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.home-v3 .tb-review-more summary::-webkit-details-marker { display: none; }
.home-v3 .tb-review-more summary:focus-visible { outline: var(--focus-light); outline-offset: 2px; border-radius: 6px; }
.home-v3 details[open] > summary .tb-chev { transform: rotate(180deg); }
.home-v3 .tb-review { margin: 12px 0 0; padding: 24px; border: 1px solid var(--l200); border-radius: var(--r-card); background: var(--white); box-shadow: var(--shadow-card); }
.home-v3 .tb-review-q { margin: 0; padding: 0; border: 0; }
.home-v3 .tb-review-q p { font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.home-v3 .tb-review-by { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 16px; }
.home-v3 .tb-review-by strong { font-size: 15px; line-height: 1.4; color: var(--ink); }
.home-v3 .tb-review-by .v3-micro { color: var(--mute); }
.home-v3 .tb-review-stars { display: inline-flex; gap: 2px; color: var(--brand); }
.home-v3 .tb-star { width: 15px; height: 15px; }

/* ---------- 640+ ---------- */
@media (min-width: 640px) {
    .home-v3 .tb-form { padding: 28px 28px 30px; }
    /* Format: one row, widths follow the labels; the icons only show in the stacked phone list */
    .home-v3 .tb-grid-format { display: flex; }
    .home-v3 .tb-grid-format .tb-opt { flex: 1 1 auto; }
    .home-v3 .tb-chip-format { justify-content: center; text-align: center; }
    .home-v3 .tb-chip-ic { display: none; }

    /* Team size: one segmented control; a white thumb slides to the chosen answer */
    .home-v3 .tb-grid-size { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; padding: 4px; border-radius: var(--r-choice); background: var(--l100); box-shadow: inset 0 0 0 1.5px var(--l300); }
    .home-v3 .tb-opt-wide { grid-column: auto; }
    .home-v3 .tb-grid-size .tb-opt { z-index: 1; }
    .home-v3 .tb-chip-size { min-height: 46px; border-color: transparent; border-radius: calc(var(--r-choice) - 4px); background: transparent; }
    .home-v3 .tb-chip-size .tb-badge { display: none; }
    .home-v3 .tb-thumb {
        display: block; position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 5);
        border-radius: calc(var(--r-choice) - 4px); background: var(--white);
        box-shadow: inset 0 0 0 1.5px var(--brand), 0 8px 18px -10px rgba(108, 53, 233, .6);
        opacity: 0; pointer-events: none;
    }
    @supports selector(:has(*)) {
        .home-v3 .tb-grid-size .tb-opt input:checked + .tb-chip { border-color: transparent; background: transparent; box-shadow: none; }
        .home-v3 .tb-grid-size:has(input:checked) .tb-thumb { opacity: 1; }
        .home-v3 .tb-grid-size:has(.tb-opt:nth-child(2) input:checked) .tb-thumb { transform: translateX(100%); }
        .home-v3 .tb-grid-size:has(.tb-opt:nth-child(3) input:checked) .tb-thumb { transform: translateX(200%); }
        .home-v3 .tb-grid-size:has(.tb-opt:nth-child(4) input:checked) .tb-thumb { transform: translateX(300%); }
        .home-v3 .tb-grid-size:has(.tb-opt:nth-child(5) input:checked) .tb-thumb { transform: translateX(400%); }
    }
    @supports not selector(:has(*)) {
        .home-v3 .tb-thumb { display: none; }
        .home-v3 .tb-grid-size .tb-opt input:checked + .tb-chip { background: var(--white); }
    }
    @media (hover: hover) and (pointer: fine) {
        .home-v3 .tb-grid-size .tb-opt:hover .tb-chip { border-color: transparent; box-shadow: none; color: var(--brand-deep); }
    }

    .home-v3 .tb-ticket-in { padding: 32px 28px 24px; }
    .home-v3 .tb-ticket-main { flex-direction: row; align-items: center; gap: 28px; }
    .home-v3 .tb-brief { flex: 1 1 0; }
    .home-v3 .tb-cta { flex: none; width: auto; }

    .home-v3 .tb-logo-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---------- 1024+ (desktop): two columns. Sizes grow on taller screens and never shrink below the phone values ---------- */
@media (min-width: 1024px) {
    .home-v3 .tb-team {
        --tb-gap: clamp(28px, 3.5vh, 40px);
        --tb-pad: clamp(26px, 3.3vh, 34px);
    }
    .home-v3 .tb-main { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); grid-template-rows: auto auto; gap: 40px clamp(36px, 3.4vw, 48px); }
    .home-v3 .tb-head { grid-column: 1; grid-row: 1; align-self: start; padding-top: 8px; }
    .home-v3 .tb-proof { grid-column: 1; grid-row: 2; align-self: end; padding-bottom: 4px; }
    .home-v3 .tb-card { grid-column: 2; grid-row: 1 / span 2; }

    .home-v3 .tb-form { gap: var(--tb-gap); padding: var(--tb-pad) var(--tb-pad) calc(var(--tb-pad) - 2px); }
    .home-v3 .tb-chip { min-height: clamp(52px, 6.6vh, 62px); }
    .home-v3 .tb-chip-course { min-height: clamp(56px, 7.4vh, 70px); }
    .home-v3 .tb-chip-size { min-height: clamp(46px, 5.9vh, 54px); }
    .home-v3 .tb-ticket-in { padding: calc(var(--tb-pad) - 2px) var(--tb-pad) calc(var(--tb-pad) - 6px); }

    .home-v3 .tb-logo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 28px; }

    /* The review opens as a card above its link, so opening it never changes the height of the fold */
    .home-v3 .tb-review { position: absolute; z-index: 5; left: 0; bottom: calc(100% + 8px); width: 100%; max-width: 460px; margin: 0; box-shadow: var(--shadow-panel); }
}

/* Narrow desktop: the brief can run to three lines beside the button, so three are reserved */
@media (min-width: 1024px) and (max-width: 1199px) {
    .home-v3 .tb-summary { min-height: 4.5em; }
}

/* Fold mode (same condition as base.css, which also clears the fixed site header): the legacy #onsite anchor lands with the fold */
@media (min-width: 1024px) and (min-height: 620px) {
    .home-v3 .v3-fold .tb-anchor { scroll-margin-top: 0; }
    .home-v3 .tb-team .v3-h2 { margin-top: 0; }
    .home-v3 .tb-team .tb-intro { margin-top: 16px; font-size: clamp(16px, .62rem + .95vh, 18px); line-height: 1.6; }
}

/* ---------- Motion: only transform, opacity, colour and shadow; every end state is the static style above ---------- */
@media (prefers-reduced-motion: no-preference) {
    .home-v3 .tb-chip { transition: transform 220ms var(--ease), border-color 200ms ease, background-color 240ms ease, color 200ms ease, box-shadow 240ms ease; }
    .home-v3 .tb-opt:active .tb-chip { transform: scale(.97); }
    .home-v3 .tb-badge { transition: opacity 180ms var(--ease), transform 180ms var(--ease); }
    .home-v3 .tb-opt input:checked + .tb-chip .tb-badge { animation: tbPop 360ms var(--ease); }
    .home-v3 .tb-chip-ic { transition: transform 220ms var(--ease); }
    .home-v3 .tb-opt input:checked + .tb-chip .tb-chip-ic { transform: scale(1.12); }
    .home-v3 .tb-thumb { transition: transform 360ms var(--ease), opacity 200ms ease; }

    .home-v3 .tb-num { transition: background-color 280ms ease, color 280ms ease, box-shadow 280ms ease; }
    .home-v3 .tb-num-n, .home-v3 .tb-num-ok { transition: opacity 220ms var(--ease), transform 280ms var(--ease); }
    .home-v3 .tb-q.is-done .tb-num { animation: tbPop 400ms var(--ease); }

    .home-v3 .tb-seg i { transition: transform 420ms var(--ease); }
    .home-v3 .tb-seg:nth-child(2) i { transition-delay: 60ms; }
    .home-v3 .tb-seg:nth-child(3) i { transition-delay: 120ms; }
    .home-v3 .tb-summary { transition: color 240ms ease; }
    .home-v3 .tb-summary.is-swap { animation: tbSwap 340ms var(--ease); }
    .home-v3 .tb-prog-txt.is-swap { animation: tbSwap 300ms var(--ease); }

    .home-v3 .tb-logo-grid img { transition: opacity 220ms ease, filter 220ms ease, transform 220ms var(--ease); }
    .home-v3 .tb-chev { transition: transform 240ms var(--ease); }
    @media (hover: hover) and (pointer: fine) {
        .home-v3 .tb-opt:hover .tb-chip { transform: translateY(-2px); }
        .home-v3 .tb-opt:active .tb-chip { transform: scale(.97); }
        .home-v3 .tb-grid-size .tb-opt:hover .tb-chip { transform: none; }
        .home-v3 .tb-logo-grid li:hover img { transform: translateY(-2px); }
        /* The card itself stays still (skin.css gives every "-card" a transition; no lift here: the chips move instead) */
        .home-v3 .tb-card:hover { transform: none; }
    }
}
@keyframes tbPop { 0% { transform: scale(.4); } 60% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes tbSwap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Forced colours: selection never relies on colour alone ---------- */
@media (forced-colors: active) {
    .home-v3 .tb-opt input:checked + .tb-chip { outline: 3px solid Highlight; outline-offset: 1px; }
    .home-v3 .tb-badge { forced-color-adjust: none; background: Highlight; color: HighlightText; }
    .home-v3 .tb-seg i { background: Highlight; }
    .home-v3 .tb-thumb, .home-v3 .tb-perf { display: none; }
}
