/**
* @Prop --vlt-color__pale: pale theme main color;
* @Prop --vlt-color__pale-contrast: pale theme contrast color;
* @Prop --vlt-color__primary: primary theme main color;
* @Prop --vlt-color__primary-contrast: primary theme contrast color;
* @Prop --vlt-color__secondary: secondary theme main color;
* @Prop --vlt-color__secondary-contrast: secondary theme contrast color;
* @Prop --vlt-color__warn: warn theme main color;
* @Prop --vlt-color__warn-contrast: warn theme contrast color;
*/
/**
* @prop --theme: Theme color of the button
* @prop --contrast: Contrast (usually text) color of the button
*/
/**
 * @prop --button__size-block: Height of the button host. defaults to vlt global size block and can be customed by context such as toolbar / form field
 * @prop --button__margin: margin of the button host. can be customed by context such as toolbar / form field
 * @prop --button__padding-inline-size: Padding inline size of the button. can be customed by context such as toolbar / form field
 */
:host {
  --button-margin: 4px 2px;
  --button-padding-inline-size: 2.5rem;
  --button-block-size: var(--block-size);
  --button-border-radius: var(--border-radius);
}

:host([color=primary i]) {
  --color--base-h: var(--vlt-theme-primary-h);
  --color--base-s: var(--vlt-theme-primary-s);
  --color--base-l: var(--vlt-theme-primary-l);
  --color--on: var(--vlt-theme-on-primary);
}

:host([color=secondary i]) {
  --color--base-h: var(--vlt-theme-secondary-h);
  --color--base-s: var(--vlt-theme-secondary-s);
  --color--base-l: var(--vlt-theme-secondary-l);
  --color--on: var(--vlt-theme-on-secondary);
}

:host([color=tertiary i]) {
  --color--base-h: var(--vlt-theme-tertiary-h);
  --color--base-s: var(--vlt-theme-tertiary-s);
  --color--base-l: var(--vlt-theme-tertiary-l);
  --color--on: var(--vlt-theme-on-tertiary);
}

:host([color=quaternary i]) {
  --color--base-h: var(--vlt-theme-quaternary-h);
  --color--base-s: var(--vlt-theme-quaternary-s);
  --color--base-l: var(--vlt-theme-quaternary-l);
  --color--on: var(--vlt-theme-on-quaternary);
}

:host([color=success i]) {
  --color--base-h: var(--vlt-theme-success-h);
  --color--base-s: var(--vlt-theme-success-s);
  --color--base-l: var(--vlt-theme-success-l);
  --color--on: var(--vlt-theme-on-success);
}

:host([color=error i]) {
  --color--base-h: var(--vlt-theme-error-h);
  --color--base-s: var(--vlt-theme-error-s);
  --color--base-l: var(--vlt-theme-error-l);
  --color--on: var(--vlt-theme-on-error);
}

:host([color=warn i]) {
  --color--base-h: var(--vlt-theme-warn-h);
  --color--base-s: var(--vlt-theme-warn-s);
  --color--base-l: var(--vlt-theme-warn-l);
  --color--on: var(--vlt-theme-on-warn);
}

:host([color=medium i]) {
  --color--base-h: var(--vlt-theme-medium-h);
  --color--base-s: var(--vlt-theme-medium-s);
  --color--base-l: var(--vlt-theme-medium-l);
  --color--on: var(--vlt-theme-on-medium);
}

:host([color=invert i]) {
  --color--base-h: var(--vlt-theme-invert-h);
  --color--base-s: var(--vlt-theme-invert-s);
  --color--base-l: var(--vlt-theme-invert-l);
  --color--on: var(--vlt-theme-on-invert);
}

:host {
  --color--base: hsl(var(--color--base-h), var(--color--base-s), var(--color--base-l));
  --color--alpha: hsla(var(--color--base-h), var(--color--base-s), var(--color--base-l), 0.2);
  --color--alpha-light: hsla(var(--color--base-h), var(--color--base-s), var(--color--base-l), 0.1);
  --color--mod-1: hsl(var(--color--base-h), var(--color--base-s), calc(var(--color--base-l) + var(--vlt-theme--mod-1-p)));
  --color--mod-2: hsl(var(--color--base-h), var(--color--base-s), calc(var(--color--base-l) + var(--vlt-theme--mod-2-p)));
}

:host {
  display: contents;
}

button,
a {
  appearance: none;
  font: var(--vlt-typography--button, bold 16px/1 arial);
  display: inline-block;
  position: relative;
  block-size: var(--button-block-size);
  border-radius: var(--button-border-radius);
  margin: var(--button-margin);
  padding-inline-start: var(--button-padding-inline-size);
  padding-inline-end: var(--button-padding-inline-size);
  contain: content;
  font-kerning: none;
  user-select: none;
  font-kerning: none;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.button-inner {
  display: flex;
  flex-flow: row nowrap;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  inline-size: 100%;
  block-size: 100%;
}

:any-link {
  text-decoration: none;
}

/**
 * @prop --button-size-inline: Minimum inline size (width) of the button
 */
:host([expand=xs i]) {
  --button-size-inline: 10rem;
}

:host([expand=sm i]) {
  --button-size-inline: 14rem;
}

:host([expand=lg i]) {
  --button-size-inline: 20rem;
}

:host([expand=xl i]) {
  --button-size-inline: 25rem;
}

:host([expand=block i]) {
  --button-size-inline: 100%;
}

:host([fill=solid i]) button,
:host([fill=solid i]) a {
  border: 0 none;
  background-color: var(--color--base, #366bce);
  color: var(--color--on, white);
  transition: background-color 0.2s;
  will-change: background-color;
}
:host([fill=solid i]) button:not(:disabled):not(:active):focus, :host([fill=solid i]) button:not(:disabled):not(:active):hover,
:host([fill=solid i]) a:not(:disabled):not(:active):focus,
:host([fill=solid i]) a:not(:disabled):not(:active):hover {
  background-color: var(--color--mod-1, #5483da);
}
:host([fill=solid i]) button:not(:disabled):active,
:host([fill=solid i]) a:not(:disabled):active {
  background-color: var(--color--mod-2, #afc3e8);
}
:host([fill=solid i]) button:disabled,
:host([fill=solid i]) a:disabled {
  background-color: lightgray;
}
:host([fill=outline i]) button,
:host([fill=outline i]) a {
  color: var(--color--base, #366bce);
  background-color: transparent;
  border-color: currentColor;
  border-style: solid;
  border-width: 1px;
  transition: background-color 0.2s, color 0.2s;
  will-change: background-color, color;
}
:host([fill=outline i]) button:not(:disabled):not(:active):focus, :host([fill=outline i]) button:not(:disabled):not(:active):hover,
:host([fill=outline i]) a:not(:disabled):not(:active):focus,
:host([fill=outline i]) a:not(:disabled):not(:active):hover {
  background-color: var(--color--alpha-light, rgba(54, 107, 206, 0.1));
}
:host([fill=outline i]) button:not(:disabled):active,
:host([fill=outline i]) a:not(:disabled):active {
  background-color: var(--color--alpha, rgba(54, 107, 206, 0.2));
}
:host([fill=outline i]) button:disabled,
:host([fill=outline i]) a:disabled {
  color: lightgray;
}
:host([fill=clear i]) button, :host(:not([fill=solid i]):not([fill=outline i])) button,
:host([fill=clear i]) a,
:host(:not([fill=solid i]):not([fill=outline i])) a {
  color: var(--color--base, #366bce);
  background-color: transparent;
  border: 0 none;
  transition: background-color 0.2s;
  will-change: background-color;
}
:host([fill=clear i]) button:not(:disabled):not(:hover):not(:focus), :host(:not([fill=solid i]):not([fill=outline i])) button:not(:disabled):not(:hover):not(:focus),
:host([fill=clear i]) a:not(:disabled):not(:hover):not(:focus),
:host(:not([fill=solid i]):not([fill=outline i])) a:not(:disabled):not(:hover):not(:focus) {
  text-decoration: underline;
}
:host([fill=clear i]) button:not(:disabled):not(:active):focus, :host([fill=clear i]) button:not(:disabled):not(:active):hover, :host(:not([fill=solid i]):not([fill=outline i])) button:not(:disabled):not(:active):focus, :host(:not([fill=solid i]):not([fill=outline i])) button:not(:disabled):not(:active):hover,
:host([fill=clear i]) a:not(:disabled):not(:active):focus,
:host([fill=clear i]) a:not(:disabled):not(:active):hover,
:host(:not([fill=solid i]):not([fill=outline i])) a:not(:disabled):not(:active):focus,
:host(:not([fill=solid i]):not([fill=outline i])) a:not(:disabled):not(:active):hover {
  background-color: var(--color--alpha-light, rgba(54, 107, 206, 0.1));
}
:host([fill=clear i]) button:not(:disabled):active, :host(:not([fill=solid i]):not([fill=outline i])) button:not(:disabled):active,
:host([fill=clear i]) a:not(:disabled):active,
:host(:not([fill=solid i]):not([fill=outline i])) a:not(:disabled):active {
  background-color: var(--color--alpha, rgba(54, 107, 206, 0.2));
}
:host([fill=clear i]) button:disabled, :host(:not([fill=solid i]):not([fill=outline i])) button:disabled,
:host([fill=clear i]) a:disabled,
:host(:not([fill=solid i]):not([fill=outline i])) a:disabled {
  color: lightgray;
}
button:enabled,
a:enabled {
  --ripple-x: 0;
  --ripple-y: 0;
  --ripple-color: var(--color--on, white);
  --animation-tick: 0;
}
button:enabled.animating,
a:enabled.animating {
  background-image: paint(ripple);
}

:host([shape=pill i]) {
  --border-radius: var(--vlt-border-radius-pill, 10px);
}

:host([shape=rounded i]) {
  --border-radius: var(--vlt-border-radius-rounded, 4px);
}

:host(:not([shape=pill i]):not([shape=rounded i])) {
  --border-radius: var(--vlt-border-radius-rounded, 4px);
}

:host([block-size=sm i]) {
  --block-size: var(--vlt-block-size-sm, 32px);
}

:host([block-size=md i]) {
  --block-size: var(--vlt-block-size-md, 40px);
}

:host([block-size=lg i]) {
  --block-size: var(--vlt-block-size-lg, 48px);
}

:host(:not([block-size=sm i]):not([block-size=md i]):not([block-size=lg i])) {
  --block-size: var(--vlt-block-size-md, 40px);
}