/* Layout only; native buttons retain their own tokens, state and behavior. */
/* Shipped in a cascade layer: unlayered host CSS wins without !important. */
@layer ds.tokens, ds.base, ds.components;
@layer ds.components {
.ds-button-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-3);
  max-inline-size: 100%;
  vertical-align: middle;

  &[data-layout="joined"] {
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    isolation: isolate;

    & > button {
      position: relative;
      border-radius: 0;
    }
    & > button ~ button { margin-inline-start: calc(-1 * var(--ds-control-border-width)); }
    & > button:first-of-type {
      border-start-start-radius: var(--ds-radius-button);
      border-end-start-radius: var(--ds-radius-button);
    }
    & > button:last-of-type {
      border-start-end-radius: var(--ds-radius-button);
      border-end-end-radius: var(--ds-radius-button);
    }
    & > button:focus-visible { z-index: 1; }
    /* Filled neighbours share one colour: a seam of the label colour (visp-sibe's split) parts them. It
       is decoration (each half has its own label or icon), so standard contrast keeps visp-sibe's subtle
       25%; higher contrast draws it at full strength, over 3:1 against the fill (DESIGN.md). */
    & > [data-variant="primary"] + [data-variant="primary"] {
      border-inline-start-color: color-mix(in srgb, currentColor calc(25% + var(--ds-contrast-amount) * .75), transparent);
    }
  }
}
}
