/*
 * Toggle: a Button whose pressed state (`aria-pressed` from the zag toggle machine, or `aria-checked` on a single-select
 * ToggleGroup's radio items) takes the accent; a SystemButton preset whose glyph already takes a valence for the
 * pressed state (Star, Bookmark) keeps its own fill.
 */

@layer dx-components {
  .dx-button:is([aria-pressed='true'], [aria-checked='true']):not([data-icon-valence]) {
    background: var(--color-accent-bg);
    color: var(--color-accent-fg);
  }
  .dx-button:is([aria-pressed='true'], [aria-checked='true']):not([data-icon-valence]):hover:not(:disabled) {
    background: var(--color-accent-bg-hover, var(--color-accent-bg));
  }

  /* A flex run like Group, spaced like toolbar items; roles and roving focus come from the zag machine. */
  .dx-toggle-group {
    display: inline-flex;
    align-items: center;
    gap: var(--dx-control-inset);
  }
  .dx-toggle-group[data-orientation='vertical'] {
    flex-direction: column;
    align-items: stretch;
  }
  /* In a toolbar, which adds no gap between its items, a group adds none between its own either. */
  .dx-toolbar > .dx-toggle-group {
    gap: 0;
  }
  .dx-toolbar > .dx-toggle-group > .dx-control:not([data-square]) {
    margin-inline: var(--dx-control-inset);
  }
}
