/*
 * Copyright (c) 2026, Salesforce, Inc.,
 * All rights reserved.
 * For full license text, see the LICENSE.txt file
 */

/*
 * `icon.type.css` is the canonical icon-name palette: ~970 rules of the
 * form `.slds-icon-standard-foo { --slds-c-icon-color-background: ... }`,
 * one per named SVG. We import it into `@layer theme` so customer
 * overrides in `@layer customization` can win against the defaults.
 * Inlining unlayered would put the palette ahead of any customer
 * override (unlayered rules outrank every layer), silently breaking
 * the per-icon customization promise.
 */

/* stylelint-disable-next-line import-notation */
@import '../icon.type.css' layer(theme);

.slds-icon_container {
  padding-block-start: var(--slds-c-icon-spacing-block-start, var(--slds-c-icon-spacing-block));
  padding-block-end: var(--slds-c-icon-spacing-block-end, var(--slds-c-icon-spacing-block));
  padding-inline-start: var(--slds-c-icon-spacing-inline-start, var(--slds-c-icon-spacing-inline));
  padding-inline-end: var(--slds-c-icon-spacing-inline-end, var(--slds-c-icon-spacing-inline));
  border-radius: var(--slds-c-icon-radius-border);
  background-color: var(--slds-c-icon-color-background);
  display: inline-block;
  /* Collapse the inline line-box so the container hugs the SVG. With
     `line-height: 1` the container inherits its parent's font-size (e.g.
     a badge's 13.34px) and stretches the bounding box vertically.
     vertical-align: middle keeps the icon centered with adjacent text. */
  line-height: 0;
  vertical-align: middle;
}

/**
 * Horizontally flip icons
 */
[dir='rtl'] .slds-icon_flip {
  transform: scaleX(-1);
}

.slds-icon {
  height: var(--slds-c-icon-size);
  width: var(--slds-c-icon-size);
  display: inline-flex;
  fill: var(--slds-c-icon-color-foreground);

  /* Disabled state */
  &.slds-icon_disabled {
    background-color: currentcolor;
  }
}

/*
 * Current-color override
 */
.slds-current-color .slds-icon {
  fill: currentColor;
}
