.navds-toggle-group__wrapper {
  display: grid;
  justify-items: start;
  gap: var(--ax-spacing-2);
}

.navds-toggle-group__wrapper--fill {
  justify-items: initial;
}

/* Main Togglegroup */
.navds-toggle-group {
  border-radius: var(--ax-border-radius-medium);
  background-color: transparent;
  box-shadow: inset 0 0 0 1px var(--ax-border-default);
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 1px;
}

/* Button */
.navds-toggle-group__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--ax-spacing-1) var(--ax-spacing-3);
  min-height: 3rem;
  border: none;
  cursor: pointer;
  background-color: transparent;
  color: var(--ax-text-default);
  border-radius: var(--ax-border-radius-medium);
  min-width: fit-content;
  position: relative;

  &:hover {
    background-color: var(--ax-bg-accent-moderate-hoverA);
    color: var(--ax-text-default);
  }

  &:focus-visible {
    outline: 2px solid var(--ax-border-focus);
    outline-offset: 2px;
    z-index: 1;
  }

  &[data-selected="true"] {
    background-color: var(--ax-bg-accent-strong-pressed);
    color: var(--ax-text-accent-contrast);
  }

  &:not([data-selected="true"], :first-child, &[data-selected="true"] + &)::before {
    content: "";
    display: block;
    width: 1px;
    height: 50%;
    background-color: var(--ax-border-subtleA);
    left: -1px;
    position: absolute;
  }
}

.navds-toggle-group__button-inner {
  display: flex;
  align-items: center;
  gap: var(--ax-spacing-2);

  > * {
    flex-shrink: 0;
  }

  > svg {
    font-size: var(--ax-font-size-heading-medium);
  }
}

/* Modifier neutral variant */
:where(.navds-toggle-group--neutral) .navds-toggle-group__button {
  &:hover {
    background-color: var(--ax-bg-neutral-moderate-hoverA);
  }

  &[data-selected="true"] {
    background-color: var(--ax-bg-neutral-strong-pressed);
    color: var(--ax-text-neutral-contrast);
  }
}

/* Modifier small size */
.navds-toggle-group--small {
  & .navds-toggle-group__button {
    padding: var(--ax-spacing-05) var(--ax-spacing-3);
    min-height: 2rem;
  }

  & .navds-toggle-group__button-inner > svg {
    font-size: var(--ax-font-size-xlarge);
  }
}

/* High contrast */
@media (forced-colors: active) {
  .navds-toggle-group {
    border: 2px solid transparent;
  }

  .navds-toggle-group__button:hover {
    background-color: highlighttext;
    color: highlight;
    outline: 1px solid highlight;
  }

  .navds-toggle-group__button[data-selected="true"] {
    background-color: selecteditem;
    color: selecteditemtext;
    forced-color-adjust: none;
  }

  .navds-toggle-group__button:focus-visible {
    outline-color: highlight;
  }
}
