/* ==========================================================================
   Chrysalis Labs · v2 foundation glue for WordPress · foundation.css · 6 Oct 2026 (local integration)
   Loads after base.css → type-proposals.css → header-v2.css (handle cl-v2-foundation). Tokens only.
   1  icons: the original Chrysalis family is a 24-grid, so .i strokes are retuned per size (same as a-hero.css)
   2  WordPress glue: screen-reader-text, admin bar offset, scroll lock while an overlay is open
   3  header extras: cart badge (any fragment markup), phone nav without JavaScript
   4  cart drawer (#minicart)
   5  search overlay (#search)
   6  reduced motion
   7  breadcrumb hit areas
   8  contrast: kit surface wells keep the text colours of their own surface (fix pass 6 Oct)
   ========================================================================== */

/* ---------- 1. Icons (sprite = assets/v2/icons/icons-chrysalis.svg, inlined at wp_body_open; ids c-*) ---------- */
/* README contract: 1.5 at 24px, heavier small, lighter large. .i--ph keeps the one Phosphor glyph (i-volume, 256 grid). */
.i { stroke-width: 1.5; }
.i--16 { stroke-width: 1.65; }
.i--20, .i--24 { stroke-width: 1.5; }
.i--32 { stroke-width: 1.25; }
.i--48 { stroke-width: .95; }
.i--ph, .i--ph.i--24 { stroke-width: 13.85; }
.i--ph.i--20 { stroke-width: 15.36; }

/* ---------- 2. WordPress glue ---------- */
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.screen-reader-text:focus { position: fixed !important; left: var(--side); top: 12px; z-index: 300; width: auto; height: auto; padding: 12px 18px; clip: auto; clip-path: none; background: var(--c-white); color: var(--c-void); border-radius: var(--r-btn); }
/* logged-in admins: the sticky header sits under the WordPress toolbar (the toolbar scrolls away below 600px) */
body.admin-bar .cl-header { top: var(--wp-admin--admin-bar--height, 32px); }
@media (max-width: 600px) { body.admin-bar .cl-header { top: 0; } }
html.cl-ov-open { overflow: hidden; }
/* main is the skip-link target */
main#main:focus { outline: none; }
/* Egor's assets/css/toast.css is still loaded (it styles the #clab-msg "Added to cart" card that toast.js raises) but it
   also carries page-level rules of the old layer: a 0.6 s page-in fade on every <body> child (its selector is 4 ids
   strong, hence !important), #minicart / #search positioned relative, and a minicart opacity fade. Neutralised here,
   so the v2 gate, header and overlays behave as designed whatever that file does. */
html body.cl-v2 > * { animation: none !important; }
html body.cl-v2.clab-leave > * { opacity: 1 !important; }
html #minicart.cl-drawer, html #search.cl-search { position: fixed; z-index: 120; opacity: 1; transition: none; pointer-events: auto; }

/* ---------- 3. Header extras ---------- */
.cl-nowrap { white-space: nowrap; }
/* The badge is replaced by a WooCommerce cart fragment after every cart change: style it by its data attribute too,
   so whatever markup a fragment carries it stays the v2 disc on the circle's edge. */
.cl-header [data-minicart-count-badge] {
  position: absolute; left: auto; top: -3px; right: -4px; transform: none;
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
  background: var(--fg); color: var(--bg);
  font-family: var(--font-sans); font-size: 11px; font-weight: 500; line-height: 1; letter-spacing: 0;
  font-variant-numeric: tabular-nums; pointer-events: none;
}
/* phones without JavaScript: the menu button is hidden (noscript rule in <head>), so the main links show as one row */
.cl-nojs-nav { display: flex; flex-wrap: wrap; gap: 0 20px; padding-bottom: 6px; }
.cl-nojs-nav a { display: inline-flex; align-items: center; min-height: var(--target); font-size: .9375rem; }
@media (min-width: 900px) { .cl-nojs-nav { display: none; } }
/* Target size (WCAG 2.5.8, fix pass 6 Oct): the shortest top-level words measured 31 px (FAQ) and 42 px (About) wide.
   Every top-level item gets 7 px of padding on each side and the same negative margin (the 15 px no-JS phone row 8 px:
   its FAQ is 28.6 px), so its box, hit area and focus ring are at least 44 px wide while every word, gap and underline
   stays exactly where it was. */
:is(html[data-header-v="2"] .cl-header, .cl-header--v2) .cl-nav > a,
:is(html[data-header-v="2"] .cl-header, .cl-header--v2) .cl-nav__btn,
.cl-nojs-nav a { --nav-hit: 7px; padding-inline: var(--nav-hit); margin-inline: calc(var(--nav-hit) * -1); }
.cl-nojs-nav a { --nav-hit: 8px; }
.cl-header--v2 .cl-nav > a::after { left: var(--nav-hit, 0px); right: var(--nav-hit, 0px); }
.cl-header--v2 .cl-nav .cl-nav__btn::after { left: var(--nav-hit, 0px); right: calc(22px + var(--nav-hit, 0px)); }

/* ---------- 4. Cart drawer (footer.php #minicart; body = inc/minicart.php fragment) ---------- */
.cl-drawer { position: fixed; inset: 0; z-index: 120; }
.cl-drawer[hidden] { display: none; }
.cl-drawer__scrim {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .42);
  opacity: 0; transition: opacity .3s var(--ease-out);
}
.cl-drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 100%;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); color: var(--fg);
  opacity: 0; transform: translateX(24px);
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.cl-drawer__panel:focus { outline: none; }
.cl-drawer__panel:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (min-width: 600px) {
  .cl-drawer__panel {
    top: 12px; right: 12px; bottom: 12px; width: min(480px, calc(100vw - 24px));
    border-radius: var(--r-block); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .55);
  }
}
.cl-drawer[data-open] .cl-drawer__scrim { opacity: 1; }
.cl-drawer[data-open] .cl-drawer__panel { opacity: 1; transform: none; }
.cl-drawer:not([data-open]) .cl-drawer__scrim,
.cl-drawer:not([data-open]) .cl-drawer__panel { transition-duration: .22s; transition-timing-function: var(--ease-in); }
.cl-drawer__head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 72px; padding: 12px 14px 12px 24px; border-bottom: 1px solid var(--rule);
}
.cl-drawer__title { font-size: var(--fs-h4); font-weight: 500; line-height: 1.2; letter-spacing: -.01em; }
.cl-drawer__n { color: var(--fg-2); font-variant-numeric: tabular-nums; }
.cl-drawer__body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
.cl-drawer__body > [data-minicart-fragment] { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ---------- 5. Search overlay (footer.php #search; results = inc/search.php rows via search.js) ---------- */
.cl-search { position: fixed; inset: 0; z-index: 120; }
.cl-search[hidden] { display: none; }
.cl-search [data-search-panel].hidden { display: none !important; }   /* search.js switches panels with class "hidden" */
.cl-search__scrim {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .42);
  opacity: 0; transition: opacity .3s var(--ease-out);
}
.cl-search__panel {
  position: absolute; left: 0; right: 0; top: 0; max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  border-radius: 0 0 var(--r-block) var(--r-block); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .55);
  opacity: 0; transform: translateY(-12px);
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.cl-search__panel:focus { outline: none; }
@media (max-width: 599px) { .cl-search__panel { bottom: 0; border-radius: 0; } }
.cl-search[data-open] .cl-search__scrim { opacity: 1; }
.cl-search[data-open] .cl-search__panel { opacity: 1; transform: none; }
.cl-search:not([data-open]) .cl-search__scrim,
.cl-search:not([data-open]) .cl-search__panel { transition-duration: .2s; transition-timing-function: var(--ease-in); }
.cl-search__bar { flex: none; display: flex; align-items: center; gap: 12px; min-height: 84px; padding-block: 14px; border-bottom: 1px solid var(--rule); }
.cl-search__form {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 0 22px; border-radius: var(--r-btn);
  background: color-mix(in srgb, var(--fg) 5%, var(--bg));
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow var(--d-s) var(--ease-out);
}
.cl-search__form:focus-within { box-shadow: inset 0 0 0 1px var(--fg); }
.cl-search__i { color: var(--fg-2); }
.cl-search__input {
  flex: 1 1 auto; min-width: 0; height: 52px; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--fg); font: inherit; font-size: 1.0625rem; line-height: 1.2;
  -webkit-appearance: none; appearance: none;
}
.cl-search__input::placeholder { color: var(--fg-3); opacity: 1; }
.cl-search__input:focus { outline: none; }
.cl-search__input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.cl-search__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-block: 24px 28px; }
.cl-search__formats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 600px) { .cl-search__formats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); } }
.cl-search__format {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; column-gap: 16px;
  min-height: 104px; padding: 10px 14px 10px 10px;
  background: var(--tint); color: var(--fg);
  transition: background-color var(--d-s) var(--ease-out);
}
.cl-search__format:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .cl-search__format:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); } }
.cl-search__format-media {
  position: relative; display: block; width: 72px; aspect-ratio: 4 / 5;
  background: radial-gradient(95% 80% at 50% 36%, var(--bg) 0%, color-mix(in srgb, var(--fg) 4%, var(--bg)) 60%, color-mix(in srgb, var(--fg) 9%, var(--bg)) 100%);
}
.cl-search__format-media img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.cl-search__format-name { display: block; font-size: 1.375rem; font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
.cl-search__format-body .t-meta { display: block; margin-top: 6px; }
.cl-search__format-go {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--rule-2); color: var(--fg);
  transition: background-color var(--d-s) var(--ease-out), color var(--d-s) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .cl-search__format:hover .cl-search__format-go { background: var(--fg); color: var(--bg); }
  .cl-search__format:hover .cl-search__format-go .i { transform: translateX(var(--nudge)); }
}
.cl-search__format-go .i { transition: transform var(--d-s) var(--ease-out); }
.cl-search__none { display: grid; justify-items: center; gap: 12px; padding-block: 16px 4px; text-align: center; }
.cl-search__none > .i { color: var(--fg-3); }
.cl-search__none-title { font-size: var(--fs-h4); font-weight: 500; line-height: 1.2; }
.cl-search__none-body { max-width: 40ch; color: var(--fg-2); }
.cl-search__none .btn { margin-top: 12px; }
.cl-search__fine { margin-top: 24px; color: var(--fg-3); font-size: var(--fs-micro); }
/* neutral fallback for the result rows inc/search.php renders (its owner styles them properly) */
.cl-search [data-search-panel="results"] ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cl-search [data-search-panel="results"] li > a { display: flex; align-items: center; gap: 16px; min-height: var(--target); padding: 8px 0; }
.cl-search [data-search-panel="results"] img { flex: none; width: 64px; height: 64px; border-radius: var(--r-tile); object-fit: contain; background: var(--tint); }
.cl-search [data-search-panel="results"] .search-eyebrow { font-size: var(--fs-label); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); margin: 16px 0 8px; }

/* ---------- 6. Reduced motion: overlays appear / disappear without sliding ---------- */
@media (prefers-reduced-motion: reduce) {
  .cl-drawer__panel, .cl-search__panel { transform: none !important; }
  .cl-drawer__scrim, .cl-drawer__panel, .cl-search__scrim, .cl-search__panel { transition-duration: 0s !important; }
}

/* ---------- 7. Breadcrumb hit areas (review fix 6 Oct) ----------
   .k-crumbs a::after (kit + catalogue.css) widens each crumb link to >= 44px, centred on the word. Every crumb <li> is
   a flex item and paints atomically, so the NEXT crumb's box covered the right half of that area (measured: "Home"
   answered only from -22px to +14px around its centre). The <li> boxes take no pointer hits; links and the
   current-page label still do, so the whole 44px area reaches the link. */
.k-crumbs li { pointer-events: none; }
.k-crumbs li > a, .k-crumbs li > [aria-current] { pointer-events: auto; }

/* ---------- 8. Contrast fix (fix pass 6 Oct): kit surface wells keep the text colours of their own surface ----------
   The inner-page kit (site-kit.css and its copies in catalogue.css, commerce*.css, info.css) paints its wells
   (.k-panel without data-tone, .k-empty, .k-notice, .k-ico, ...) with var(--k-surface), which every section / island
   computes from its OWN data-theme or data-tone (white section -> mist well, mist section -> white well, dark section or
   island -> 6% white tint). Their text did not: with motion on (html.m-theme) the text tokens follow the one page
   colour, and the page turns void as the footer (data-theme="void") crosses 55% of the window. A light well still on
   screen then had white text on its light surface (reproduced 6 Oct: /faq/ "Still have a question?" panel and its icon
   disc, /cart/ empty state and its button focus ring, /library/ and /lab-results/ empty states, the policy pages'
   "On this page" focus ring; evidence: Website/2026-10-06 Local fix pass (Claude)/evidence/contrast/).
   Now a well takes its text tokens from the same scope as its surface (inherited --k-on-* tokens, so the closest
   section / island / white kit card decides, exactly like --k-surface): an opaque light surface always has the dark
   text family; in a dark scope the well is a translucent tint, so it keeps following that scope's own tokens as before.
   Static mode (no JS, reduced motion) and every steady state are unchanged: only the mismatch while / after the page
   crossfades to the void footer is gone. :where() keeps it at zero specificity, so every colour a kit rule sets on
   these elements (e.g. .k-notice and .k-step__n use --fg-2) still wins. */
:root { --k-on-fg: var(--fg); --k-on-fg-2: var(--fg-2); --k-on-fg-3: var(--fg-3); --k-on-rule: var(--rule); --k-on-rule-2: var(--rule-2); --k-on-line-ui: var(--line-ui); --k-on-tint: var(--tint); --k-on-wipe: var(--wipe); --k-on-focus: var(--focus); }
[data-theme], [data-tone],
:is([data-theme="white"], [data-theme="light"], [data-theme="mist"], [data-theme="fog"], [data-tone="white"], [data-tone="light"], [data-tone="mist"], [data-tone="fog"]),
:is(.k-card, .k-box, .k-sum, .k-step, .k-cart__lines, .k-infocard, .k-linkcard, .k-table-wrap, .k-search, .k-acc--cards .cl-acc__item) {
  --k-on-fg: var(--l-fg); --k-on-fg-2: var(--l-fg-2); --k-on-fg-3: var(--l-fg-3);
  --k-on-rule: rgba(14,14,16,.12); --k-on-rule-2: rgba(14,14,16,.26); --k-on-line-ui: rgba(14,14,16,.52);
  --k-on-tint: rgba(14,14,16,.04); --k-on-wipe: var(--c-graphite); --k-on-focus: #0E0E10;
}
:is([data-theme="void"], [data-theme="dark"], [data-theme="onyx"], [data-theme="ink"], [data-tone="void"], [data-tone="dark"], [data-tone="onyx"], [data-tone="ink"]) {
  --k-on-fg: var(--fg); --k-on-fg-2: var(--fg-2); --k-on-fg-3: var(--fg-3); --k-on-rule: var(--rule); --k-on-rule-2: var(--rule-2);
  --k-on-line-ui: var(--line-ui); --k-on-tint: var(--tint); --k-on-wipe: var(--wipe); --k-on-focus: var(--focus);
}
:where(.k-panel, .k-empty, .k-notice, .k-ico, .k-step__n, .k-sum__notes, .k-toc details, .woocommerce-error, .woocommerce-message, .woocommerce-info):where(:not([data-tone]):not([data-theme])) {
  --fg: var(--k-on-fg); --fg-2: var(--k-on-fg-2); --fg-3: var(--k-on-fg-3);
  --rule: var(--k-on-rule); --rule-2: var(--k-on-rule-2); --line-ui: var(--k-on-line-ui);
  --tint: var(--k-on-tint); --wipe: var(--k-on-wipe); --focus: var(--k-on-focus);
  color: var(--fg);
}

/* Stock words only: inherit the page theme; opaque white cards remain light islands. */
:root,
html:is([data-theme="void"], [data-theme="dark"], [data-theme="onyx"], [data-theme="ink"]),
html:not(.m-theme) :is([data-theme="void"], [data-theme="dark"], [data-theme="onyx"], [data-theme="ink"]),
:is([data-tone="void"], [data-tone="dark"], [data-tone="onyx"], [data-tone="ink"]) {
  --cl-stock-green: #88B298;
}
html:is([data-theme="white"], [data-theme="light"], [data-theme="mist"], [data-theme="fog"]),
html:not(.m-theme) :is([data-theme="white"], [data-theme="light"], [data-theme="mist"], [data-theme="fog"]),
:is([data-tone="white"], [data-tone="light"], [data-tone="mist"], [data-tone="fog"]),
:is(.k-card, .k-box, .k-sum, .k-step, .k-cart__lines, .k-infocard, .k-linkcard, .k-table-wrap, .k-search, .k-acc--cards .cl-acc__item, .rel__a) {
  --cl-stock-green: #376F4B;
}
.cl-v2 .cl-stock.cl-stock--in { color: var(--cl-stock-green); }
.cl-v2 .cl-stock.cl-stock--unavailable { color: var(--fg-3); }
