/*
 * Category pages v3 (GET /{category}). Spec: docs/ux-discovery/category/spec.md.
 * Uses ONLY the home v3 tokens (public/style/home-v3/base.css) and its fold contract; loaded after base.css and skin.css.
 * Prefix: cg-. Finder rules adapted from catalogue-v3/page.css; form rules modelled on contact-v3/contact.css.
 * No text under 16px. One amber primary per fold (the finder has none). Motion: transform / opacity only.
 */

/* ---------- Shared ---------- */
html:has(main.category-v3) { scroll-snap-type: none !important; }
.category-v3 { --cg-ink-70: rgba(31, 3, 45, .7); --cg-line: rgba(31, 3, 45, .08); }
.category-v3 .v3-lead { font-size: 18px; }
.category-v3 a:not(.v3-btn) { color: var(--brand-deep); }
.category-v3 address { font-style: normal; }
.category-v3 .v3-btn .v3-i { width: 18px; height: 18px; }
.category-v3 .v3-link .v3-i-sm, .category-v3 .cg-topic-h .v3-i-sm { transition: transform var(--t-fast) var(--ease); }
@media (pointer: fine) { .category-v3 a:hover > .v3-i-sm { transform: translateX(3px); } }
.category-v3 .cg-ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.category-v3 .v3-h2, .category-v3 .v3-lead, .category-v3 .cg-intro p { text-wrap: pretty; }
.category-v3 [data-cg-row][hidden], .category-v3 [data-cg-topic][hidden], .category-v3 [data-cg-onreq][hidden],
.category-v3 [data-cg-onreq-item][hidden], .category-v3 .cg-filter[hidden], .category-v3 .cg-filter-empty[hidden] { display: none !important; }
.category-v3 .v3-section[id] { scroll-margin-top: 80px; }
.category-v3 .cg-topic { scroll-margin-top: 104px; }

/* ---------- Fold 1: hero ---------- */
.category-v3 .cg-hero { padding: 24px 0 48px; background: radial-gradient(60% 70% at 92% 10%, rgba(108, 53, 233, .08), transparent 70%), var(--l50); }
.category-v3 .cg-hero-grid { display: grid; gap: 28px; }
.category-v3 :is(.cg-hero-grid, .cg-topics, .cg-contact-grid, .cg-pair) > * { min-width: 0; }
.category-v3 .cg-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; margin: 0; padding: 0; list-style: none; }
.category-v3 .cg-crumbs li { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; color: var(--mute); }
.category-v3 .cg-crumbs li + li::before { content: '/'; color: var(--l300); }
.category-v3 .cg-crumbs a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.category-v3 .cg-crumbs [aria-current] { color: var(--ink-2); font-weight: 500; }
.category-v3 .cg-eyebrow { margin-top: 4px; font-family: var(--v3-head); font-size: 16px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-deep); }
.category-v3 .cg-h1 { margin-top: 6px; font-size: 34px; line-height: 1.08; font-weight: 700; letter-spacing: -.025em; color: var(--ink); text-wrap: balance; }
.category-v3 .cg-intro { margin-top: 16px; max-width: 60ch; color: var(--mute); }
.category-v3 .cg-intro p { font-size: 16px; line-height: 1.6; }
.category-v3 .cg-intro p + p { margin-top: .6em; }
.category-v3 .cg-intro a { text-decoration: underline; text-underline-offset: 3px; }
.category-v3 .cg-intro-long.is-clamped { display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.category-v3 .cg-more { margin-top: 2px; font-size: 16px; }
.category-v3 .cg-counts { margin-top: 14px; font-size: 16px; color: var(--cg-ink-70); }
.category-v3 .cg-counts .v3-num { font-weight: 600; color: var(--ink); }
.category-v3 .cg-hero-link { margin-top: 2px; }
.category-v3 .cg-hero-link .v3-link { font-size: 17px; }
.category-v3 .cg-hero .cg-ctas { margin-top: 22px; }

/* Topic panel: desktop only (phones go straight from the buttons to the finder) */
.category-v3 .cg-panel { display: none; }
.category-v3 .cg-panel-label { font-family: var(--v3-head); font-size: 18px; font-weight: 600; color: var(--ink); }
.category-v3 .cg-panel-list { display: grid; gap: 4px; margin: 12px 0 0; padding: 0; list-style: none; }
.category-v3 .cg-panel-list a {
    display: flex; flex-direction: column; justify-content: center; gap: 0; min-height: 48px; padding: 8px 14px;
    border-radius: 12px; background: rgba(255, 255, 255, .8); text-decoration: none; color: var(--ink-2);
    transition: background-color var(--t-fast) ease, transform var(--t-fast) var(--ease), box-shadow var(--t-fast) ease;
}
.category-v3 .cg-panel-name { font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.category-v3 .cg-panel-meta { font-size: 16px; line-height: 1.35; color: var(--cg-ink-70); }
.category-v3 .cg-panel-list a:hover { background: var(--white); box-shadow: var(--shadow-card); }
.category-v3 .cg-panel-list a:hover .cg-panel-name { color: var(--brand-deep); }
@media (pointer: fine) { .category-v3 .cg-panel-list a:hover { transform: translateY(-2px); } }

/* Hero entrance (pure CSS from first paint; page.js adds .cg-done after 1.3s, forcing the end state) */
@keyframes cgUp { from { opacity: 0; transform: translate3d(0, 12px, 0); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
    html.hv-motion .category-v3 .cg-hero:not(.cg-done) .cg-hero-text { animation: cgUp 400ms var(--ease) both; }
    html.hv-motion .category-v3 .cg-hero:not(.cg-done) .cg-panel { animation: cgUp 400ms var(--ease) 80ms both; }
}

/* ---------- Section 2: course finder ---------- */
.category-v3 .cg-finder { padding: 56px 0 64px; }
.category-v3 .cg-finder-head { margin-bottom: 24px; max-width: 760px; }
.category-v3 .cg-extra { margin-top: 6px; }
.category-v3 .cg-extra .v3-link { font-size: 16px; }

.category-v3 .cg-filter { margin-bottom: 20px; }
.category-v3 .cg-filter-label { display: block; font-size: 16px; font-weight: 600; color: var(--ink); }
.category-v3 .cg-filter-box { position: relative; margin-top: 8px; max-width: 560px; }
.category-v3 .cg-filter-i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--mute); pointer-events: none; }
.category-v3 .cg-filter-input { width: 100%; min-height: 52px; padding: 12px 16px 12px 44px; border: 2px solid var(--l200); border-radius: var(--r-choice); background: var(--white); color: var(--ink); font-size: 16px; line-height: 1.3; transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease; }
.category-v3 .cg-filter-input::placeholder { color: var(--mute); opacity: 1; }
.category-v3 .cg-filter-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(108, 53, 233, .12); outline: none; }
.category-v3 .cg-chips { display: flex; gap: 8px; margin: 14px -16px 0; padding: 0 16px 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
.category-v3 .cg-chips::-webkit-scrollbar { display: none; }
.category-v3 .cg-chip { flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: var(--r-chip); border: 1px solid var(--l200); background: var(--l50); color: var(--ink-2); font-size: 16px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease; }
.category-v3 .cg-chip:hover { border-color: var(--brand); color: var(--brand-deep); }
.category-v3 .cg-chip[aria-pressed="true"] { background: var(--l100); border-color: var(--brand); color: var(--brand-deep); font-weight: 600; }
.category-v3 .cg-chip:focus-visible, .category-v3 .cg-row-enq:focus-visible { outline: var(--focus-light); outline-offset: 2px; }
.category-v3 .cg-filter-status { min-height: 1.6em; margin-top: 8px; font-size: 16px; color: var(--cg-ink-70); }
.category-v3 .cg-filter-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 8px; padding: 16px 18px; border-radius: var(--r-card); background: var(--l50); }
.category-v3 .cg-filter-empty p { font-size: 16px; }

.category-v3 .cg-topics { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.category-v3 .cg-topic { padding: 18px 18px 6px; border-radius: var(--r-card); background: var(--l50); border: 1px solid var(--l200); transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) ease; }
@media (pointer: fine) { .category-v3 .cg-topic:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -18px rgba(44, 29, 67, .3); } }
.category-v3 .cg-topic-h { font-size: 19px; line-height: 1.3; font-weight: 600; }
.category-v3 .cg-topic-h a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); text-decoration: none; }
.category-v3 .cg-topic-h a .v3-i-sm { color: var(--brand-deep); }
.category-v3 .cg-topic-h a:hover { color: var(--brand-deep); text-decoration: underline; text-underline-offset: 4px; }
.category-v3 .cg-cert { display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 8px; font-size: 16px; line-height: 1.45; color: var(--ink-2); }
.category-v3 .cg-cert .v3-i { margin-top: 3px; color: var(--brand-deep); }
.category-v3 .cg-ato { margin: -4px 0 8px 24px; font-size: 16px; line-height: 1.45; color: var(--cg-ink-70); }
.category-v3 .cg-rows { margin: 4px 0 0; padding: 0; list-style: none; }
/* Phones: name on line 1; days left and Enquire right on line 2 */
.category-v3 .cg-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "days enq"; align-items: center; column-gap: 12px; min-height: 52px; padding: 10px 0; border-top: 1px solid var(--l200); }
.category-v3 .cg-row-name { grid-area: name; display: block; font-size: 16px; font-weight: 500; line-height: 1.4; color: var(--ink-2) !important; text-decoration: none; }
.category-v3 .cg-row-name::after { content: ''; position: absolute; inset: 0; }
.category-v3 .cg-row-name:hover { color: var(--brand-deep) !important; text-decoration: underline; text-underline-offset: 3px; }
.category-v3 .cg-row-days { grid-area: days; font-size: 16px; color: var(--cg-ink-70); white-space: nowrap; }
.category-v3 .cg-row-enq { grid-area: enq; position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 8px 12px; border-radius: 10px; color: var(--brand-deep); font-size: 16px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--l300); transition: background-color var(--t-fast) ease, text-decoration-color var(--t-fast) ease; }
.category-v3 .cg-row-enq:hover { background: var(--l100); text-decoration-color: currentColor; }
.category-v3 .cg-row.cg-back-in { animation: cgFade 150ms ease both; }
@keyframes cgFade { from { opacity: 0; } to { opacity: 1; } }

.category-v3 .cg-onreq { margin-top: 0; padding: 18px 18px 6px; border-radius: var(--r-card); border: 1px dashed var(--l300); }
.category-v3 .cg-onreq-t { display: flex; align-items: center; min-height: 44px; font-size: 16px; font-weight: 600; color: var(--ink); }
.category-v3 .cg-onreq-list { display: grid; gap: 0 32px; margin: 4px 0 0; padding: 0; list-style: none; align-items: start; }
/* Same rhythm as the course rows: topic name left, "Ask about this topic" right, a hairline between rows */
.category-v3 .cg-onreq-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 14px; border-top: 1px solid var(--l200); }
.category-v3 .cg-onreq-ask { color: var(--brand-deep); text-decoration-color: var(--l300) !important; }
.category-v3 .cg-onreq-ask:hover { text-decoration-color: currentColor !important; }
.category-v3 .cg-onreq-list a { display: inline-flex; align-items: center; min-height: 44px; font-size: 16px; }
.category-v3 .cg-onreq-hub { font-weight: 500; color: var(--ink-2) !important; line-height: 1.35; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--l300); }
.category-v3 .cg-onreq-ask { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.category-v3 .cg-empty { display: grid; justify-items: start; gap: 16px; max-width: 760px; padding: 24px; border-radius: var(--r-panel); background: var(--l50); border: 1px solid var(--l200); }
.category-v3 .cg-empty p { font-size: 18px; color: var(--ink-2); }
.category-v3 .cg-empty a:not(.v3-btn) { text-decoration: underline; text-underline-offset: 3px; }

/* Finder card reveal (page.js arms the section below the screen; rows never animate) */
html.hv-motion .category-v3 .cg-finder.cg-armed:not(.cg-in) :is(.cg-topic, .cg-onreq) { opacity: 0; transform: translate3d(0, 12px, 0); }
html.hv-motion .category-v3 .cg-finder.cg-in :is(.cg-topic, .cg-onreq) { transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease), box-shadow var(--t-fast) ease; transition-delay: calc(var(--cg-i, 0) * 40ms); }
html.hv-motion .category-v3 .cg-finder.cg-settled :is(.cg-topic, .cg-onreq) { transition-delay: 0s; }

/* ---------- Fold 3: perfect course ---------- */
.category-v3 .cg-perfect { background: rgba(31, 3, 45, .03); }
.category-v3 .cg-perfect-wrap { max-width: 820px; }
.category-v3 .cg-perfect-text { margin-top: 14px; max-width: 68ch; color: var(--mute); }
.category-v3 .cg-perfect-text p { font-size: 18px; line-height: 1.6; }
.category-v3 .cg-formats { margin-top: 12px; font-size: 16px; color: var(--cg-ink-70); }
.category-v3 .cg-perfect-ctas { margin-top: 28px; }
.category-v3 .cg-call { font-size: 16px; }
.category-v3 .cg-call .v3-i-sm { color: var(--brand-deep); }

/* ---------- Fold 4: get in touch ---------- */
.category-v3 .cg-contact { background: var(--white); }
.category-v3 .cg-contact-grid { display: grid; gap: 28px; }
.category-v3 .cg-contact-list { display: grid; gap: 0; margin: 20px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--l200); }
.category-v3 .cg-contact-item { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 12px 0; border-bottom: 1px solid var(--l200); }
.category-v3 .cg-contact-ico { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--l100); color: var(--brand-deep); }
.category-v3 .cg-contact-info { min-width: 0; }
.category-v3 .cg-contact-info h3 { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.4; color: var(--cg-ink-70); }
.category-v3 .cg-contact-info a, .category-v3 .cg-contact-info address { display: inline-block; font-family: var(--v3-head); font-size: 18px; font-weight: 600; line-height: 1.4; color: var(--ink) !important; overflow-wrap: anywhere; }
.category-v3 .cg-contact-info a { min-height: 32px; text-decoration: underline; text-decoration-color: var(--l300); text-underline-offset: 5px; }
.category-v3 .cg-contact-info a:hover { color: var(--brand-deep) !important; text-decoration-color: currentColor; }
.category-v3 .cg-contact-info address { font-size: 17px; font-weight: 500; }

/* The form card */
.category-v3 .cg-card { padding: 22px 18px; border-radius: var(--r-panel); background: var(--white); border: 1px solid var(--cg-line); box-shadow: var(--shadow-panel), 0 1px 2px rgba(31, 3, 45, .05); }
.category-v3 #contact_form { margin: 0; }
.category-v3 #contact_form .cg-step { display: grid; gap: 14px; }
.category-v3 #contact_form .cg-step + .cg-step { margin-top: 14px; }
.category-v3 #contact_form.is-stepped .cg-step + .cg-step { margin-top: 0; }
.category-v3 #contact_form .cg-step[hidden] { display: none; }
.category-v3 #contact_form .cg-step-label { margin: 0 0 12px; font-family: var(--v3-head); font-size: 16px; font-weight: 600; color: var(--cg-ink-70); font-variant-numeric: tabular-nums; }
.category-v3 #contact_form .cg-pair { display: grid; gap: 14px; align-items: start; }
.category-v3 #contact_form .cg-pair:not(:has(> :not([style*="none"]))) { display: none; }
.category-v3 #contact_form .cg-req { color: #B42318; }
.category-v3 #contact_form .cg-opt { font-weight: 400; color: var(--cg-ink-70); }
.category-v3 #contact_form .cg-fund { margin: 0; padding: 0; border: 0; }
.category-v3 #contact_form .cg-fund-l { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--ink); }
.category-v3 #contact_form .cg-fund-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.category-v3 #contact_form .select-name { position: relative; display: flex; align-items: center; justify-content: center; min-height: 48px; margin: 0; padding: 8px 10px; border: 1.5px solid var(--l200); border-radius: var(--r-choice); background: var(--l50); cursor: pointer; text-align: center; transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease; }
.category-v3 #contact_form .select-name p { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.25; color: var(--ink-2); }
.category-v3 #contact_form .select-name .select-hide { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.category-v3 #contact_form .select-name:hover { border-color: var(--l300); }
.category-v3 #contact_form .select-name:is(.select-active, :has(input:checked)) { border-color: var(--brand); background: var(--l100); }
.category-v3 #contact_form .select-name:is(.select-active, :has(input:checked)) p { color: var(--brand-deep); font-weight: 600; }
.category-v3 #contact_form .select-name:has(input:focus-visible) { outline: var(--focus-light); outline-offset: 2px; }
.category-v3 #contact_form .input-fields { position: relative; display: grid; gap: 6px; margin: 0; }
.category-v3 #contact_form .input-fields > label { font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.category-v3 #contact_form input[type="text"], .category-v3 #contact_form input[type="email"], .category-v3 #contact_form textarea, .category-v3 #contact_form select {
    width: 100%; min-height: 48px; margin: 0; padding: 10px 14px; border: 1.5px solid var(--l200); border-radius: var(--r-choice);
    background: var(--white); color: var(--ink); font-size: 16px; line-height: 1.35; box-shadow: none;
    transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.category-v3 #contact_form textarea { min-height: 0; height: auto; }
.category-v3 #contact_form :is(input, textarea, select):focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(108, 53, 233, .12); outline: none; }
.category-v3 #contact_form ::placeholder { color: #7A6B90; opacity: 1; }
.category-v3 #contact_form .phonecode-field { display: grid; grid-template-columns: 88px auto minmax(0, 1fr); align-items: center; gap: 8px; }
.category-v3 #contact_form .phonecode-field .prefix { font-size: 16px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.category-v3 #contact_form .phonecode-field .country-code { padding-right: 8px; }
.category-v3 #contact_form .is-invalid:is(input, textarea) { border-color: var(--danger, #B42318); }
.category-v3 #contact_form .input-fields .invalid-feedback, .category-v3 #contact_form .input-fields span.error { display: block; font-size: 16px !important; line-height: 1.4; color: var(--danger, #B42318); }
.category-v3 #contact_form .form-consent { display: flex; align-items: flex-start; gap: 10px; margin: 0; }
.category-v3 #contact_form .form-consent input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--brand); }
.category-v3 #contact_form .form-consent label { font-size: 16px; line-height: 1.45; color: var(--ink-2); }
.category-v3 #contact_form .consent-error p { margin: 0; font-size: 16px; line-height: 1.45; color: var(--danger, #B42318); }
.category-v3 #contact_form .cg-submit-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 0; }
.category-v3 #contact_form #myButton { min-width: 160px; font-size: 18px; }
.category-v3 #contact_form .cg-back { font-size: 16px; }
.category-v3 #contact_form .cg-continue { margin-top: 2px; }

/* Fold reveals for perfect and contact come from motion.js (.rv blocks, released by .is-in); page.js forces .is-in
   within 2.2s of arming, and never touches the form inputs. */

/* ---------- Mobile sticky bar (<768px; motion.js toggles .is-visible, page.js .cg-hold while #contact shows) ---------- */
.category-v3 .cg-sticky {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; display: flex; gap: 10px; min-height: 64px;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--white); box-shadow: 0 -1px 0 rgba(31, 3, 45, .08), 0 -10px 28px -10px rgba(31, 3, 45, .3);
    transform: translateY(110%); visibility: hidden;
    transition: transform var(--t-base) var(--ease), visibility 0s linear var(--t-base);
}
.category-v3 .cg-sticky.is-visible:not(.cg-hold) { transform: none; visibility: visible; transition: transform var(--t-base) var(--ease), visibility 0s linear 0s; }
.category-v3 .cg-sticky .v3-btn { min-height: 48px; padding: 10px 14px; }
.category-v3 .cg-sticky-main { flex: 1 1 auto; min-width: 0; }
.category-v3 .cg-sticky-call { flex: none; width: 56px; }

/* ---------- Phones ---------- */
@media (max-width: 599px) {
    /* The H1 and the primary must be on the first screen (390x660, 360x640) under the site header */
    .category-v3 .cg-hero { padding-top: 8px; }
    .category-v3 .cg-eyebrow { margin-top: 0; letter-spacing: 0; text-transform: none; line-height: 1.35; }
    .category-v3 .cg-h1 { margin-top: 4px; }
    .category-v3 .cg-intro { margin-top: 10px; }
    .category-v3 .cg-intro p { line-height: 1.45; }
    .category-v3 .cg-counts { margin-top: 8px; }
    .category-v3 .cg-hero .cg-ctas { margin-top: 14px; gap: 4px; }
    .category-v3 .cg-hero .cg-cta-main, .category-v3 .cg-perfect-ctas .v3-btn { width: 100%; justify-content: center; min-height: 56px; }
    /* Secondary as a text link on phones */
    .category-v3 .cg-hero .cg-browse { min-height: 44px; padding: 8px 0; border: 0; background: none; text-decoration: underline; text-underline-offset: 4px; }
    .category-v3 #contact_form #myButton { flex: 1 1 auto; }
}

@media (max-width: 400px) {
    .category-v3 .cg-h1 { font-size: 30px; }
}

/* ---------- 600+ ---------- */
@media (min-width: 600px) {
    .category-v3 #contact_form .cg-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .category-v3 #contact_form .cg-pair > [style*="none"] + * , .category-v3 #contact_form .cg-pair > :only-child { grid-column: 1 / -1; }
    .category-v3 .cg-onreq-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .category-v3 .cg-card { padding: 28px; }
    /* Rows: name | days | enquire on one line */
    .category-v3 .cg-row { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name days enq"; }
}

/* ---------- 768+ ---------- */
@media (min-width: 768px) {
    .category-v3 .cg-sticky { display: none; }
    .category-v3 .cg-h1 { font-size: clamp(40px, 4.2vw, 56px); }
    .category-v3 .cg-h1-long { font-size: clamp(36px, 3.6vw, 48px); }
    .category-v3 .cg-intro p { font-size: 18px; }
    .category-v3 .cg-chips { flex-wrap: wrap; margin: 14px 0 0; padding: 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }
    .category-v3 .cg-finder { padding: 72px 0 80px; }
}

/* ---------- 1024+: two-column hero, two-column finder, 5/7 contact ---------- */
@media (min-width: 1024px) {
    .category-v3 .cg-hero-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 56px; align-items: center; }
    .category-v3 .cg-hero-solo .cg-hero-grid { grid-template-columns: minmax(0, 1fr); max-width: 800px; }
    .category-v3 .cg-panel { display: block; padding: 32px; border-radius: var(--r-panel); border: 1px solid var(--cg-line); background: linear-gradient(135deg, rgba(108, 53, 233, .06), rgba(138, 68, 236, .06)), var(--l100); }
    .category-v3 .cg-panel-2col { padding: 28px; }
    .category-v3 .cg-panel-2col .cg-panel-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .category-v3 .cg-panel-2col .cg-panel-list a { min-height: 64px; padding: 8px 12px; }
    .category-v3 .cg-topics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
    /* On-request: beside a lone last card, or a full-width band under an even number of cards */
    .category-v3 .cg-topics > .cg-onreq:nth-child(odd) { grid-column: 1 / -1; }
    .category-v3 .cg-topics > .cg-onreq:nth-child(odd) .cg-onreq-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .category-v3 .cg-onreq-list li { flex-wrap: nowrap; }
    .category-v3 .cg-topics > .cg-onreq:nth-child(even) .cg-onreq-list { grid-template-columns: minmax(0, 1fr); }
    .category-v3 .cg-finder-head { max-width: 900px; margin-bottom: 20px; }
    .category-v3 .cg-finder-head .v3-lead { max-width: 80ch; }
    .category-v3 .cg-row { min-height: 52px; padding: 4px 0; }
    .category-v3 .cg-contact-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: center; }
    .category-v3 .cg-finder { padding: 88px 0 96px; }
}
/* Small desktops (1024-1279): a long two-column topic panel (e.g. 10 topics) wraps more; tighter rows keep the hero in budget */
@media (min-width: 1024px) and (max-width: 1279px) {
    .category-v3 .cg-panel-2col { padding: 24px; }
    .category-v3 .cg-panel-2col .cg-panel-list a { min-height: 56px; padding: 6px 10px; }
    .category-v3 .cg-finder-head { margin-bottom: 12px; }
    .category-v3 .cg-topics { gap: 16px; }
}

/* ---------- Desktop folds (>=1024 x >=620): sized to content (base.css 28 Nov note), steady spacing ---------- */
@media (min-width: 1024px) and (min-height: 620px) {
    .category-v3 .v3-fold .v3-lead { font-size: clamp(16px, .6rem + 1vh, 18px); }
    .category-v3 .v3-section.v3-fold.cg-hero { display: block; padding: 32px 0 72px; }
    .category-v3 .cg-finder { padding: clamp(64px, 10vh, 120px) 0; }
    .category-v3 .cg-perfect-wrap { text-align: center; }
    .category-v3 .cg-perfect-text { margin-left: auto; margin-right: auto; }
    .category-v3 .cg-perfect-ctas { justify-content: center; }
    .category-v3 .cg-contact .v3-h2 { margin-top: 0; }
}

/* ---------- Reduced motion, forced colours, print ---------- */
@media (prefers-reduced-motion: reduce) {
    .category-v3 :is(.cg-topic, .cg-onreq, .cg-hero-text, .cg-panel, .v3-wrap) { opacity: 1 !important; transform: none !important; animation: none !important; }
}
@media (forced-colors: active) {
    .category-v3 .cg-chip[aria-pressed="true"] { outline: 2px solid Highlight; }
    .category-v3 .cg-topic, .category-v3 .cg-panel, .category-v3 .cg-card { border: 1px solid CanvasText; }
}
@media print {
    .category-v3 .cg-sticky, .category-v3 .cg-filter { display: none !important; }
    .category-v3 :is(.cg-topic, .cg-onreq, .v3-wrap) { opacity: 1 !important; transform: none !important; }
}
