/* BBMc switches — language (NL/EN/DE) over target group (5 sectors). Owner: lane A.
   Contract D4. Derived from Jean's skeuomorphic 2-stop toggle, restyled into the
   BBMc tokens and generalised to N stops:

     --n  number of stops      (set inline, server-side)
     --i  active index, 0-based (set inline server-side, updated by segment.js)

   Knob:  left = pad + i * (100% - 2*pad - knob) / (n - 1)
   Track: ink -> ink-deep, inset shadow, gold only as the hairline border.
   Knob:  navy gradient + drop shadow; sky ring = the active indicator, which
          re-animates on change (segment.js toggles .is-changing).
   Markup: see bbmc_switches_html() in build_wp_theme.py (I18N_PHP).
   (2026-09-27: a literal port of the uiverse template was tried and reverted at
   Jean's request — this segmented design is the chosen one.) */

.bbmc-switches {
  --sw-h: 30px;
  --sw-pad: 3px;
  --sw-font: 0.6875rem;              /* 11px */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex: 0 0 auto;
  position: relative;
}
/* The stack is 65px; the nav row's content box is ~50px (the rest is padding).
   Borrow the padding instead of growing the bar (measured 108px -> 94px). */
.bbmc-switches--bar { margin-block: -8px; }

/* ---------------------------------------------------------------- track -- */
.bbmc-switch {
  --n: 2;
  --i: 0;
  --knob: calc((100% - 2 * var(--sw-pad)) / var(--n));
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  align-items: stretch;
  height: var(--sw-h);
  padding: var(--sw-pad);
  box-sizing: border-box;
  border-radius: 165px;
  background: linear-gradient(180deg, var(--ink-deep, #0C1A26), var(--ink, #132636));
  border: 1px solid rgba(201, 154, 62, 0.34);                /* gold: hairline only */
  box-shadow:
    inset 0 5px 10px 0 #060e15,
    0 3px 6px -2px rgba(28, 53, 71, 0.9);
  font-family: var(--font-sans, system-ui, sans-serif);
  isolation: isolate;
}
.bbmc-switch--lang { width: 7.5rem; }
.bbmc-switch--tg   { width: 30rem; max-width: 100%; }
.bbmc-switch--tg .bbmc-switch__stop { letter-spacing: 0.02em; padding: 0 0.25rem; }

/* ----------------------------------------------------------------- knob -- */
.bbmc-switch__knob {
  position: absolute;
  z-index: 0;
  top: var(--sw-pad);
  bottom: var(--sw-pad);
  width: var(--knob);
  left: calc(var(--sw-pad) + var(--i) * (100% - 2 * var(--sw-pad) - var(--knob)) / (var(--n) - 1));
  border-radius: 165px;
  background: linear-gradient(180deg, #2B4B63, var(--navy, #1C3547) 55%, #16293A);
  box-shadow:
    inset 0 3px 3px 0 rgba(169, 196, 222, 0.22),
    0 4px 12px 0 #03080d;
  transition: left 0.3s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
  pointer-events: none;
}
/* the active ring (reference: 3px ring that animates to a new colour) */
.bbmc-switch__knob::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 2px solid var(--sky, #5E9AC8);
  opacity: 0.85;
}
.bbmc-switch.is-changing .bbmc-switch__knob::after {
  animation: bbmc-switch-ring 0.45s var(--ease-out, ease-out);
}
@keyframes bbmc-switch-ring {
  0%   { border-color: var(--steel, #A9C4DE); opacity: 0.3; transform: scale(0.92); }
  60%  { border-color: var(--sky, #5E9AC8); opacity: 1; transform: scale(1.04); }
  100% { border-color: var(--sky, #5E9AC8); opacity: 0.85; transform: scale(1); }
}

/* ---------------------------------------------------------------- stops -- */
.bbmc-switch__stop {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  margin: 0;
  padding: 0 0.35rem;
  border: 0;
  border-radius: 165px;
  background: transparent;
  color: var(--text-2, #AEBFCB);
  font: inherit;
  font-size: var(--sw-font);
  font-weight: var(--w-regular, 400);
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.bbmc-switch--lang .bbmc-switch__stop { letter-spacing: 0.12em; }
.bbmc-switch__stop:hover { color: var(--pale, #E9F1F7); }
.bbmc-switch__stop[aria-current="true"],
.bbmc-switch__stop[aria-checked="true"] {
  color: var(--pale, #E9F1F7);
  font-weight: var(--w-accent, 600);
}
.bbmc-switch__stop:focus { outline: none; }
.bbmc-switch__stop:focus-visible {
  outline: 2px solid var(--sky, #5E9AC8);
  outline-offset: 2px;
}

/* ------------------------------------------ target group: chip + popover -- */
.bbmc-tg { position: relative; }
.bbmc-tg__chip {
  display: none;                     /* shown on narrow desktop, see below */
  align-items: center;
  gap: 0.35rem;
  height: var(--sw-h);
  padding: 0 0.8rem;
  border-radius: 165px;
  border: 1px solid rgba(201, 154, 62, 0.34);
  background: linear-gradient(180deg, var(--ink-deep, #0C1A26), var(--ink, #132636));
  box-shadow: inset 0 5px 10px 0 #060e15, 0 3px 6px -2px rgba(28, 53, 71, 0.9);
  color: var(--text-2, #AEBFCB);
  font: inherit;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: var(--sw-font);
  letter-spacing: 0.06em;
  white-space: nowrap;
  cursor: pointer;
}
.bbmc-tg__chip-label::after { content: ":"; }
.bbmc-tg__chip-value { color: var(--pale, #E9F1F7); font-weight: var(--w-accent, 600); }
.bbmc-tg__caret { font-size: 0.7em; transition: transform 0.2s ease; }
.bbmc-tg__chip[aria-expanded="true"] .bbmc-tg__caret { transform: rotate(180deg); }
.bbmc-tg__chip:focus-visible { outline: 2px solid var(--sky, #5E9AC8); outline-offset: 2px; }

/* Wide desktop: the full 5-stop control sits inline under the language switch. */
.bbmc-tg__pop { display: block; }

/* Narrow desktop: collapse to the chip "Sector: Alle ▾"; the control opens in a
   small popover under it. 1680px = where the menu, CTA and a 25rem control
   stop fitting on one ≤94px row (30rem control). */
@media (min-width: 761px) and (max-width: 1679px) {
  .bbmc-switches--bar .bbmc-tg__chip { display: inline-flex; }
  .bbmc-switches--bar .bbmc-tg__pop {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    padding: 10px;
    border-radius: var(--radius, 14px);
    background: rgba(12, 26, 38, 0.97);
    border: var(--hairline, 1px solid rgba(169, 196, 222, 0.16));
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.7);
  }
  .bbmc-switches--bar .bbmc-tg__pop.is-open { display: block; }
  .bbmc-switches--bar .bbmc-switch--tg { width: min(30rem, calc(100vw - 2rem)); }
}

/* Mobile: the bar copy goes; the drawer copy (first menu item) takes over. */
@media (max-width: 760px) {
  .bbmc-switches--bar { display: none; }
}
@media (min-width: 761px) {
  .alethia .topnav .navlinks > li.bbmc-switches-item,
  .navlinks > li.bbmc-switches-item { display: none; }
}

/* ------------------------------------------------------- mobile drawer -- */
.alethia .topnav .navlinks > li.bbmc-switches-item {
  padding: 0.9rem var(--gutter, 1.25rem) 1rem;
  border-bottom: var(--hairline, 1px solid rgba(169, 196, 222, 0.16));
}
.bbmc-switches--drawer {
  --sw-h: 38px;
  --sw-font: 0.8125rem;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}
.bbmc-switches--drawer .bbmc-switch--lang,
.bbmc-switches--drawer .bbmc-switch--tg { width: 100%; }
/* nav-mobile.css pads every drawer link; the switch stops are not menu links */
.alethia .topnav .navlinks .bbmc-switches-item a.bbmc-switch__stop {
  padding: 0 0.35rem;
  font-size: var(--sw-font);
  border: 0;
}

/* ------------------------------------------------------- reduced motion -- */
@media (prefers-reduced-motion: reduce) {
  .bbmc-switch__knob,
  .bbmc-switch__stop,
  .bbmc-tg__caret { transition: none; }
  .bbmc-switch.is-changing .bbmc-switch__knob::after { animation: none; }
}
