/* ==========================================================================
   Chrysalis Labs · header proposal v2 · header-v2.css (6 Oct 2026)
   Local design proposal for owner review. Not live, not final typography.

   What this layer adds on top of base.css (which it never edits):
     1. Navigation type: 16 px Medium (was 15 px Regular), normal casing, same hover underline.
     2. "Shop" becomes a disclosure button with a small chevron and a dropdown panel
        (All products · Vials · Pens · Sprays). Opacity-only fade: 200 ms in, 180 ms out.
        No movement anywhere: the panel is absolutely positioned, so nothing in the page shifts.
     3. The Chrysalis icon family (.ci, sprite ids c-*) sizing contract, copied from
        icons/chrysalis/README.md so the header can use the original icons today.
   Everything else (circular controls, logo crossfade, sticky backdrop, mobile menu panel,
   40 px announcement strip at 14/13 px) is already in base.css v1.3 and stays as is.

   Load order:  base.css → header-v2.css → the direction's own CSS.
   Switch:      html[data-header-v="2"]  (type only)  or  .cl-header--v2  (markup from
                partials-header-v2.html: type + dropdown). header-v2.js sets both when it finds either.
   No JS:       the panel still opens on :hover / :focus-within (html without .cl-hv2-js), so the
                links stay reachable. header-v2.js adds html.cl-hv2-js and takes over; while the panel is
                closed (and during the 180 ms close fade) it is also `inert`, so its links are never in the
                tab order when they are invisible or disappearing.
   Reduced motion: no fade, no chevron turn (media query, so an OS change after load is honoured).
   ========================================================================== */

/* ---------- 0. Chrysalis icon family sizing (verbatim from icons/chrysalis/README.md) ---------- */
/* Identical to the README contract; duplicates are harmless. Remove when base.css adopts .ci. */
.ci { --i: 24px; display: inline-block; flex: none; width: var(--i); height: var(--i); vertical-align: middle;
      fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.ci--16 { --i: 16px; stroke-width: 1.65; }  /* 1.10px rendered: inline in small text, chips, chevron */
.ci--20 { --i: 20px; stroke-width: 1.5;  }  /* 1.25px: header circles, nav, footer, buttons */
.ci--24 { --i: 24px; stroke-width: 1.5;  }  /* 1.50px: hero trio, cards */
.ci--32 { --i: 32px; stroke-width: 1.25; }  /* 1.67px: section markers */
.ci--48 { --i: 48px; stroke-width: .95;  }  /* 1.90px: large markers */
/* Phone menu format rows (partials-header-v2.html H7): base.css places the arrow by .i only; the v2 markup uses .ci. */
.cl-menu__format .ci { grid-row: 1 / span 2; grid-column: 2; color: var(--fg-2); }

/* ---------- 1. Navigation type (applies with the html switch OR the v2 markup) ---------- */
: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 {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--target); padding: 0; margin: 0;
  font-family: var(--font-sans); font-size: 1rem; font-weight: 500; line-height: 1;
  letter-spacing: 0; text-transform: none; white-space: nowrap;
  color: var(--fg); opacity: .86; background: none; border: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: opacity var(--d-s) var(--ease-out);
}
:is(html[data-header-v="2"] .cl-header, .cl-header--v2) .cl-nav > a:hover,
:is(html[data-header-v="2"] .cl-header, .cl-header--v2) .cl-nav > a:focus-visible,
:is(html[data-header-v="2"] .cl-header, .cl-header--v2) .cl-nav__btn:hover,
:is(html[data-header-v="2"] .cl-header, .cl-header--v2) .cl-nav__btn:focus-visible,
:is(html[data-header-v="2"] .cl-header, .cl-header--v2) .cl-nav__btn[aria-expanded="true"] { opacity: 1; }

/* Hover / focus / open underline on the button, same drawing as base.css .cl-nav a::after.
   It stops before the chevron (16 px icon + 6 px gap) so only the word is underlined. */
.cl-header--v2 .cl-nav__btn::after {
  content: ""; position: absolute; left: 0; right: 22px; bottom: 9px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: 100% 50%; transition: transform .2s var(--ease-in);
}
.cl-header--v2 .cl-nav__btn:hover::after,
.cl-header--v2 .cl-nav__btn:focus-visible::after,
.cl-header--v2 .cl-nav__btn[aria-expanded="true"]::after {
  transform: scaleX(1); transform-origin: 0 50%; transition: transform var(--d-s) var(--ease-out);
}
.cl-header--v2 .cl-nav__btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

/* ---------- 2. The Shop item + chevron ---------- */
.cl-header--v2 .cl-nav__item { position: relative; display: inline-flex; align-items: center; }
.cl-header--v2 .cl-nav__chev {
  color: var(--fg-2); margin-top: 1px;   /* optical: sits on the x-height centre of a 16 px Medium label */
  stroke-width: 1.9;                     /* ~1.27 px rendered at 16 px: the Medium step of the label, same weight as the 20 px circle icons */
  transition: transform .2s var(--ease-out), color var(--d-s) var(--ease-out);
}
.cl-header--v2 .cl-nav__btn:hover .cl-nav__chev,
.cl-header--v2 .cl-nav__btn:focus-visible .cl-nav__chev,
.cl-header--v2 .cl-nav__btn[aria-expanded="true"] .cl-nav__chev { color: var(--fg); }
.cl-header--v2 .cl-nav__btn[aria-expanded="true"] .cl-nav__chev { transform: rotate(180deg); }

/* ---------- 3. Dropdown panel (absolute: opening never moves the header or the page) ---------- */
.cl-header--v2 .cl-dd {
  position: absolute; left: -20px; top: calc(100% + 18px); z-index: 2;   /* 8 px below the 64 px header line */
  min-width: 244px; padding: 8px; margin: 0;
  border-radius: var(--r-card);
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--rule);
  box-shadow: 0 24px 48px -24px rgba(0, 0, 0, .35);   /* visible on light headers; disappears on black */
  opacity: 0; visibility: hidden;
  transition: opacity .18s var(--ease-in), visibility 0s linear .18s;   /* close: 180 ms, then hidden */
}
/* Dark headers: the onyx plate tone (5 % white over the header colour), same as the format and FAQ cards,
   so the panel reads as an island on black and not as a hairline across the hero. Light stays white + shadow. */
.cl-header--v2:is([data-header-theme="void"], [data-header-theme="dark"], [data-header-theme="onyx"], [data-header-theme="ink"]) .cl-dd,
html.m-dark .cl-header--v2 .cl-dd { background: color-mix(in srgb, var(--fg) 5%, var(--bg)); }
.cl-header--v2 .cl-dd::before {   /* hover bridge over the 18 px gap, so the pointer can travel down */
  content: ""; position: absolute; left: 0; right: 0; top: -18px; height: 18px;
}
.cl-header--v2 .cl-dd.is-open {
  opacity: 1; visibility: visible;
  transition: opacity .2s var(--ease-out), visibility 0s;               /* open: 200 ms */
}
.cl-header--v2 .cl-dd__list { list-style: none; margin: 0; padding: 0; display: grid; row-gap: 2px; }
.cl-header--v2 .cl-dd__sep { height: 1px; margin: 6px 12px; background: var(--rule); }

/* Links inside the panel: reset the top-level nav link rules from base.css (.cl-nav a) */
.cl-header--v2 .cl-dd a {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: var(--target); padding: 0 12px; border-radius: calc(var(--r-card) - 8px);   /* concentric with the panel */
  font-size: .9375rem; font-weight: 400; line-height: 1.2; letter-spacing: 0; white-space: nowrap;
  text-decoration: none;   /* base.css underlines unclassed links inside <li>; these are nav items */
  color: var(--fg); opacity: .86;
  transition: background-color var(--d-s) var(--ease-out), opacity var(--d-s) var(--ease-out);
}
.cl-header--v2 .cl-dd a::after { content: none; }   /* no sliding underline inside the panel */
.cl-header--v2 .cl-dd a .ci { color: var(--fg-3); transition: color var(--d-s) var(--ease-out); }
/* Row highlight: 8 % of the text colour, the same mix as the format cards (.a-format__link:hover); var(--tint)
   at 5 % white is barely perceptible on black. */
@media (hover: hover) and (pointer: fine) {
  .cl-header--v2 .cl-dd a:hover { opacity: 1; background: color-mix(in srgb, var(--fg) 8%, transparent); }
  .cl-header--v2 .cl-dd a:hover .ci { color: var(--fg); }
}
.cl-header--v2 .cl-dd a:focus-visible { opacity: 1; background: color-mix(in srgb, var(--fg) 8%, transparent); outline: 2px solid var(--focus); outline-offset: 2px; }
.cl-header--v2 .cl-dd a:focus-visible .ci { color: var(--fg); }
.cl-header--v2 .cl-dd a:active { opacity: 1; background: color-mix(in srgb, var(--fg) 8%, transparent); }

/* ---------- 4. No-JS fallback: hover / focus-within opens the panel (header-v2.js removes this path) ---------- */
@media (min-width: 900px) {
  html:not(.cl-hv2-js) .cl-header--v2 .cl-nav__item--dd:hover .cl-dd,
  html:not(.cl-hv2-js) .cl-header--v2 .cl-nav__item--dd:focus-within .cl-dd { opacity: 1; visibility: visible; transition: opacity .2s var(--ease-out), visibility 0s; }
  html:not(.cl-hv2-js) .cl-header--v2 .cl-nav__item--dd:hover .cl-nav__chev,
  html:not(.cl-hv2-js) .cl-header--v2 .cl-nav__item--dd:focus-within .cl-nav__chev { transform: rotate(180deg); color: var(--fg); }
}

/* ---------- 5. Reduced motion: appear / disappear at once, chevron snaps ---------- */
/* base.css keeps a global 120 ms transition under reduced motion (!important); this panel goes to 0 s
   so there is no fade at all, as briefed. The brief's "no fade" also covers an OS change after load. */
@media (prefers-reduced-motion: reduce) {
  .cl-header--v2 .cl-dd, .cl-header--v2 .cl-dd.is-open { transition: none; transition-duration: 0s !important; transition-delay: 0s !important; }
  .cl-header--v2 .cl-nav__chev { transition: color var(--d-s) var(--ease-out); transition-duration: 0s !important; }
  .cl-header--v2 .cl-nav__btn::after { transition: none; transition-duration: 0s !important; }
}
