/*
 * Focus: a group and its items draw their ring on an `::after` overlay rather than the element's own box-shadow,
 * because their children (cards, tiles) usually paint opaque backgrounds that would cover an inset shadow. The ring
 * takes Next's focus-ring variables; a group also shows it, or the error colour, while a member reports a
 * state (`data-focus-state`), and `border` keeps a separator edge visible at rest.
 */

@layer dx-components {
  .dx-focus-group,
  .dx-focus-item {
    position: relative;
    outline: none;
  }
  .dx-focus-group::after,
  .dx-focus-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
  }
  /* A Card shares the element and writes `data-border='false'` for no edge, which a presence match would read as one. */
  .dx-focus-group[data-border]:where(:not([data-border='false']))::after,
  .dx-focus-item[data-border]:where(:not([data-border='false']))::after {
    box-shadow: inset 0 0 0 1px var(--color-separator);
  }
  /* A tile in a list (`data-focus-click`) is where the arrow keys continue from, so it shows the ring after a click too. */
  .dx-focus-group:focus-visible::after,
  .dx-focus-item:focus-visible::after,
  .dx-focus-item[data-focus-click]:focus::after {
    box-shadow: inset 0 0 0 var(--dx-focus-ring-width) var(--dx-focus-ring-color);
  }
  /* A group a drag is over takes the focus ring's colour, so the drop target reads as the focus does. */
  .dx-focus-group[data-focus-state='active']::after {
    box-shadow: inset 0 0 0 var(--dx-focus-ring-width) var(--dx-focus-ring-color);
  }
  .dx-focus-group[data-focus-state='error']::after {
    box-shadow: inset 0 0 0 var(--dx-focus-ring-width) var(--color-error-bg);
  }
}
