/* Base chip styles */
.chips--chip {
  width: fit-content;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--rem-4);
  border-radius: var(--radius-xs);
  box-sizing: border-box;

  /* Size variants, as the design system's Tag: 2px top and bottom at every size. */
  &[data-size="xs"],
  &[data-size="sm"] {
    padding: var(--rem-2) var(--rem-4);
  }

  &[data-size="md"] {
    padding: var(--rem-2) var(--rem-6);
  }

  /* Style variants - Neutral */
  &[data-style="neutral"] {
    background-color: var(--surface-subtle);

    .chips--text {
      color: var(--text-additional);
    }
  }

  /* Style variants - Accent */
  &[data-style="accent"] {
    background-color: var(--primary-50);

    .chips--text {
      color: var(--text-action);
    }
  }

  /* Style variants - Warning */
  &[data-style="warning"] {
    background-color: var(--warning-50);

    /* The Tag's text matches its icon: warning-500, one shade lighter than
       --text-warning. */
    .chips--text {
      color: var(--icon-warning);
    }
  }

  /* Style variants - Error */
  &[data-style="error"] {
    background-color: var(--error-50);

    /* As warning: error-500, the Tag's text and icon colour. */
    .chips--text {
      color: var(--icon-error);
    }
  }
}

/* Keeps the glyph smaller than its box, as the design system's tag does. */
.chips--icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chips--chip[data-size="xs"] > .chips--icon {
  width: var(--rem-10);
  height: var(--rem-10);

  i {
    font-size: var(--rem-9);
  }
}

.chips--chip[data-size="sm"] > .chips--icon,
.chips--chip[data-size="md"] > .chips--icon {
  width: var(--rem-12);
  height: var(--rem-12);

  i {
    font-size: var(--rem-11);
  }
}


/* Text styles */
.chips--text {
  font-variation-settings: "wght" var(--text-medium);
  /* The Tag's label styles (label-xs/sm/md): 1.2 times the font size. */
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

.chips--chip[data-size="xs"] > .chips--text {
  font-size: var(--rem-12);
}

.chips--chip[data-size="sm"] > .chips--text {
  font-size: var(--rem-13);
}

.chips--chip[data-size="md"] > .chips--text {
  font-size: var(--rem-14);
}
