@use "../base/color";
@use "../base/var";

[part~="wy-icon-wrapper"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: relative;
}

[part~="wy-icon"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: relative;

  width: var(--wy-component-icon-width);
  height: var(--wy-component-icon-height);

  &[width="24"] {
    width: var(--wy-component-icon-width, var.wy-rem(1.5));
  }

  &[height="24"] {
    height: var(--wy-component-icon-height, var.wy-rem(1.5));
  }
}

// For being first element in buttons etc
[part~="wy-icon-first"] {
  margin-left: var.wy-rem(-0.5);
}

// For being last element in buttons etc
[part~="wy-icon-last"] {
  margin-right: var.wy-rem(-0.5);
}

[part~="wy-icon-inline"] {
  vertical-align: -0.375lh;
  --wy-component-icon-width: 1.25lh;
  --wy-component-icon-height: 1.25lh;
}

[part~="wy-icon-overlay"] {
  position: absolute;
  bottom: 0;
  right: 0;
  //background: var(--wy-component-background-color, #{color.token(--wy-background)});
  border-radius: 50%;
  //border: 1px solid var(--wy-component-background-color, #{color.token(--wy-background)});
}

// stacked icons (icon+overlay icon)
:host(wy-icon-stack),
[part~="wy-icon-stack"] {
  display: inline-flex;
  position: relative;
  line-height: 1;
}

[part~="wy-icon-stack-layer"] {
  position: absolute;
}

[part~="wy-icon-stack-overlay"] {
  position: absolute;
  bottom: 0;
  right: 0;
  //background-color: var(--wy-component-background-color, #{color.token(--wy-background)});
  border-radius: 50%;
  width: calc(var(--wy-component-icon-width) / 2);
  height: calc(var(--wy-component-icon-height) / 2);
}

// icons normally inherit the text color of its parent
[part~="wy-icon-current-color"] {
  fill: currentColor;
}

// stacked icons (icon+active icon)
[part~="wy-icon-state"] {
  transition: opacity var.default(--wy-transition);
  align-self: center;
  justify-self: center;
  margin: auto;
  //display: inline-flex;
  opacity: 0;
}

[part~="wy-icon-state"][part~="wy-active"] {
  opacity: 1;
}

// big file type icon
[part~="wy-icon-display"] {
  color: color.token(--wy-on-surface-variant); // Default currentColor
  border-radius: var(--wy-component-border-radius, var.default(--wy-border-radius));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: var.wy-rem(1) var.wy-rem(2);
  //margin: auto;
}

[part~="wy-icon-display-fill"] {
  flex: 1 0 auto;
}

[part~="wy-icon-display-icon"] {
  color: var(--wy-component-color);
  --wy-component-icon-width: #{var.wy-rem(4)};
  --wy-component-icon-height: #{var.wy-rem(4)};
  padding: var.wy-rem(1) var.wy-rem(2);
}

// Name after content icon
[part~="wy-icon-display-text"],
[part~="wy-icon-display-meta"] {
  color: var(--wy-component-color);
  padding: var.wy-rem(1) var.wy-rem(2);
  text-align: center;
  line-height: var.default(--wy-line-height);
}

// theme icons
@each $name in color.$all-color-names {
  [part~="wy-icon-color-#{$name}"] {
    fill: color.token(--wy-#{$name});
  }
}

// file type icons
[part*="wy-kind-"] {
  fill: color.token(--wy-gray);
}

[part~="wy-kind-archive"] {
  fill: color.token(--wy-orange);
}

[part~="wy-kind-audio"] {
  fill: color.token(--wy-teal);
}

[part~="wy-kind-code"] {
  fill: color.token(--wy-green);
}

[part~="wy-kind-document"] {
  fill: color.token(--wy-blue);
}

[part~="wy-kind-email"] {
  fill: color.token(--wy-red);
}

[part~="wy-kind-presentation"] {
  fill: color.token(--wy-orange);
}

[part~="wy-kind-spreadsheet"] {
  fill: color.token(--wy-green);
}

[part~="wy-kind-image"] {
  fill: color.token(--wy-pink);
}

[part~="wy-kind-text"] {
  fill: color.token(--wy-cyan);
}

[part~="wy-kind-video"] {
  fill: color.token(--wy-purple);
}

[part~="wy-ext-pdf"] {
  fill: color.token(--wy-red);
}

[part~="wy-kind-text-icon"] {
  width: var.wy-rem(1.25);
  height: var.wy-rem(1.25);

  &[width="24"] {
    width: var(--wy-component-icon-width, var.wy-rem(1.25));
  }

  &[height="24"] {
    height: var(--wy-component-icon-height, var.wy-rem(1.25));
  }

}
