// ServiceNow Now Design System

// Globals / Buttons

// DO NOT USE $now-button variables.
// These variables are for NDS internal use only

@function p($customProperty) {
	$basekey: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
	$targetkey: 'K73dDGhN4YbH5yec6RxQanowLIFMql0BE2igrkJptPf8AVUjTmvXSZ1zWs9uOC';
	$result: '';
	@for $i from 1 through str-length($customProperty) {
		$char: str-slice($customProperty, $i, $i);
		$idx: str-index($basekey, $char);
		@if $idx != null {
			$newchar: str-slice($targetkey, $idx, $idx);
			$result: $result + $newchar;
		} @else {
			$result: $result + $char;
		}
	}
	@return unquote($result);
}

@import 'colors/alert';
@import 'colors/base';
@import 'colors/derived';
@import 'categories/actionable';

$now-button--width-scale: var(p(--now-button--width-scale), 1);
$now-button--height-scale: var(p(--now-button--height-scale), 1);
$now-button--constrain-scale: var(p(--now-button--constrain-scale), 1);

$now-button--border-width: var(
	p(--now-button--border-width),
	$now-actionable--border-width
);
$now-button--border-radius: var(
	p(--now-button--border-radius),
	$now-actionable--border-radius
);

$now-button--font-style: var(
	p(--now-button--font-style),
	$now-actionable--font-style
);
$now-button--font-weight: var(
	p(--now-button--font-weight),
	$now-actionable--font-weight
);
$now-button--font-family: var(
	p(--now-button--font-family),
	$now-actionable--font-family
);
$now-button--text-transform: var(
	p(--now-button--text-transform),
	$now-actionable--text-transform
);
$now-button--text-wrap: var(p(--now-button--text-wrap), nowrap);

$now-button--bare--font-style: var(p(--now-button--bare--font-style), normal);
$now-button--bare--font-weight: var(p(--now-button--bare--font-weight), normal);
$now-button--bare--font-family: var(
	p(--now-button--bare--font-family),
	$now-font-family
);
$now-button--bare--text-transform: var(
	p(--now-button--bare--text-transform),
	none
);
$now-button--bare--text-wrap: var(p(--now-button--bare--text-wrap), nowrap);

$now-button--iconic--border-radius: var(
	p(--now-button--iconic--border-radius),
	$now-button--border-radius
);

// Primary

$now-button--primary--border-width: var(
	p(--now-button--primary--border-width),
	$now-button--border-width
);
$now-button--primary--border-color: var(
	p(--now-button--primary--border-color),
	$now-color--primary-3
);
$now-button--primary--border-color--hover: var(
	p(--now-button--primary--border-color--hover),
	$now-color--primary-3
);
$now-button--primary--border-color--active: var(
	p(--now-button--primary--border-color--active),
	$now-color--primary-3
);
$now-button--primary--color: var(
	p(--now-button--primary--color),
	$now-color--neutral-0
);
$now-button--primary--color--hover: var(
	p(--now-button--primary--color--hover),
	$now-color--neutral-0
);
$now-button--primary--color--active: var(
	p(--now-button--primary--color--active),
	$now-color--neutral-0
);
$now-button--primary--background-color: var(
	p(--now-button--primary--background-color),
	$now-color--primary-1
);
$now-button--primary--background-color--hover: var(
	p(--now-button--primary--background-color--hover),
	$now-color--primary-2
);
$now-button--primary--background-color--active: var(
	p(--now-button--primary--background-color--active),
	$now-color--primary-3
);

$now-button--primary-positive--border-width: var(
	p(--now-button--primary-positive--border-width),
	$now-button--border-width
);
$now-button--primary-positive--border-color: var(
	p(--now-button--primary-positive--border-color),
	$now-color_alert--positive-4
);
$now-button--primary-positive--border-color--hover: var(
	p(--now-button--primary-positive--border-color--hover),
	$now-color_alert--positive-4
);
$now-button--primary-positive--border-color--active: var(
	p(--now-button--primary-positive--border-color--active),
	$now-color_alert--positive-4
);
$now-button--primary-positive--color: var(
	p(--now-button--primary-positive--color),
	$now-color--neutral-0
);
$now-button--primary-positive--color--hover: var(
	p(--now-button--primary-positive--color--hover),
	$now-color--neutral-0
);
$now-button--primary-positive--color--active: var(
	p(--now-button--primary-positive--color--active),
	$now-color--neutral-0
);
$now-button--primary-positive--background-color: var(
	p(--now-button--primary-positive--background-color),
	$now-color_alert--positive-2
);
$now-button--primary-positive--background-color--hover: var(
	p(--now-button--primary-positive--background-color--hover),
	$now-color_alert--positive-3
);
$now-button--primary-positive--background-color--active: var(
	p(--now-button--primary-positive--background-color--active),
	$now-color_alert--positive-4
);

$now-button--primary-negative--border-width: var(
	p(--now-button--primary-negative--border-width),
	$now-button--border-width
);
$now-button--primary-negative--border-color: var(
	p(--now-button--primary-negative--border-color),
	$now-color_alert--critical-4
);
$now-button--primary-negative--border-color--hover: var(
	p(--now-button--primary-negative--border-color--hover),
	$now-color_alert--critical-4
);
$now-button--primary-negative--border-color--active: var(
	p(--now-button--primary-negative--border-color--active),
	$now-color_alert--critical-4
);
$now-button--primary-negative--color: var(
	p(--now-button--primary-negative--color),
	$now-color--neutral-0
);
$now-button--primary-negative--color--hover: var(
	p(--now-button--primary-negative--color--hover),
	$now-color--neutral-0
);
$now-button--primary-negative--color--active: var(
	p(--now-button--primary-negative--color--active),
	$now-color--neutral-0
);
$now-button--primary-negative--background-color: var(
	p(--now-button--primary-negative--background-color),
	$now-color_alert--critical-2
);
$now-button--primary-negative--background-color--hover: var(
	p(--now-button--primary-negative--background-color--hover),
	$now-color_alert--critical-3
);
$now-button--primary-negative--background-color--active: var(
	p(--now-button--primary-negative--background-color--active),
	$now-color_alert--critical-4
);

$now-button--bare_primary--color: var(
	p(--now-button--bare_primary--color),
	$now-color--primary-1
);
$now-button--bare_primary--color--hover: var(
	p(--now-button--bare_primary--color--hover),
	$now-color--primary-2
);
$now-button--bare_primary--color--active: var(
	p(--now-button--bare_primary--color--active),
	$now-color--primary-3
);
$now-button--bare_primary--background-color--hover: var(
	p(--now-button--bare_primary--background-color--hover),
	$now-color--primary-2
);
$now-button--bare_primary--background-color--active: var(
	p(--now-button--bare_primary--background-color--active),
	$now-color--primary-2
);

$now-button--primary_high-contrast--color: var(
	p(--now-button--primary_high-contrast--color),
	$now-color--primary-2
);
$now-button--primary_high-contrast--color--hover: var(
	p(--now-button--primary_high-contrast--color--hover),
	$now-color--primary-3
);
$now-button--primary_high-contrast--color--active: var(
	p(--now-button--primary_high-contrast--color--active),
	$now-color--neutral-18
);
$now-button--primary_high-contrast--background-color--hover: var(
	p(--now-button--primary_high-contrast--background-color--hover),
	$now-button--bare_primary--background-color--hover
);
$now-button--primary_high-contrast--background-color--active: var(
	p(--now-button--primary_high-contrast--background-color--active),
	$now-button--bare_primary--background-color--active
);

$now-button--primary-highlighted--color: var(
	p(--now-button--primary-highlighted--color),
	$now-button--bare_primary--color
);
$now-button--primary-highlighted--color--hover: var(
	p(--now-button--primary-highlighted--color--hover),
	$now-button--bare_primary--color--hover
);
$now-button--primary-highlighted--color--active: var(
	p(--now-button--primary-highlighted--color--active),
	$now-button--bare_primary--color--active
);
$now-button--primary-highlighted--background-color--hover: var(
	p(--now-button--primary-highlighted--background-color--hover),
	$now-button--bare_primary--background-color--hover
);
$now-button--primary-highlighted--background-color--active: var(
	p(--now-button--primary-highlighted--background-color--active),
	$now-button--bare_primary--background-color--active
);

$now-button--primary-highlighted--color--selected: var(
	p(--now-button--primary-highlighted--color--selected),
	$now-color--primary-2
);
$now-button--primary-highlighted--color--selected_hover: var(
	p(--now-button--primary-highlighted--color--selected_hover),
	$now-button--primary-highlighted--color--hover
);
$now-button--primary-highlighted--color--selected_active: var(
	p(--now-button--primary-highlighted--color--selected_active),
	$now-button--primary-highlighted--color--active
);
$now-button--primary-highlighted--background-color--selected: var(
	p(--now-button--primary-highlighted--background-color--selected),
	$now-color--primary-2
);
$now-button--primary-highlighted--background-color--selected_hover: var(
	p(--now-button--primary-highlighted--background-color--selected_hover),
	$now-button--primary-highlighted--background-color--hover
);
$now-button--primary-highlighted--background-color--selected_active: var(
	p(--now-button--primary-highlighted--background-color--selected_active),
	$now-button--primary-highlighted--background-color--active
);

$now-button--primary-highlighted_high-contrast--color: var(
	p(--now-button--primary-highlighted_high-contrast--color),
	$now-button--primary_high-contrast--color
);
$now-button--primary-highlighted_high-contrast--color--hover: var(
	p(--now-button--primary-highlighted_high-contrast--color--hover),
	$now-button--primary_high-contrast--color--hover
);
$now-button--primary-highlighted_high-contrast--color--active: var(
	p(--now-button--primary-highlighted_high-contrast--color--active),
	$now-button--primary_high-contrast--color--active
);
$now-button--primary-highlighted_high-contrast--background-color--hover: var(
	p(--now-button--primary-highlighted_high-contrast--background-color--hover),
	$now-button--primary-highlighted--background-color--hover
);
$now-button--primary-highlighted_high-contrast--background-color--active: var(
	p(--now-button--primary-highlighted_high-contrast--background-color--active),
	$now-button--primary-highlighted--background-color--active
);

$now-button--primary-highlighted_high-contrast--color--selected: var(
	p(--now-button--primary-highlighted_high-contrast--color--selected),
	$now-color--primary-3
);
$now-button--primary-highlighted_high-contrast--color--selected_hover: var(
	p(--now-button--primary-highlighted_high-contrast--color--selected_hover),
	$now-button--primary-highlighted_high-contrast--color--hover
);
$now-button--primary-highlighted_high-contrast--color--selected_active: var(
	p(--now-button--primary-highlighted_high-contrast--color--selected_active),
	$now-button--primary-highlighted_high-contrast--color--active
);
$now-button--primary-highlighted_high-contrast--background-color--selected: var(
	p(
		--now-button--primary-highlighted_high-contrast--background-color--selected
	),
	$now-button--primary-highlighted--background-color--selected
);
$now-button--primary-highlighted_high-contrast--background-color--selected_hover: var(
	p(
		--now-button--primary-highlighted_high-contrast--background-color--selected_hover
	),
	$now-button--primary-highlighted_high-contrast--background-color--hover
);
$now-button--primary-highlighted_high-contrast--background-color--selected_active: var(
	p(
		--now-button--primary-highlighted_high-contrast--background-color--selected_active
	),
	$now-button--primary-highlighted_high-contrast--background-color--active
);

// Secondary

$now-button--secondary--border-width: var(
	p(--now-button--secondary--border-width),
	$now-button--border-width
);
$now-button--secondary--border-color: var(
	p(--now-button--secondary--border-color),
	$now-color--neutral-5
);
$now-button--secondary--border-color--hover: var(
	p(--now-button--secondary--border-color--hover),
	$now-color--neutral-5
);
$now-button--secondary--border-color--active: var(
	p(--now-button--secondary--border-color--active),
	$now-color--neutral-5
);
$now-button--secondary--color: var(
	p(--now-button--secondary--color),
	$now-color--neutral-18
);
$now-button--secondary--color--hover: var(
	p(--now-button--secondary--color--hover),
	$now-color--secondary-2
);
$now-button--secondary--color--active: var(
	p(--now-button--secondary--color--active),
	$now-color--secondary-3
);
$now-button--secondary--background-color: var(
	p(--now-button--secondary--background-color),
	$now-color--neutral-2
);
$now-button--secondary--background-color--hover: var(
	p(--now-button--secondary--background-color--hover),
	$now-color--neutral-3
);
$now-button--secondary--background-color--active: var(
	p(--now-button--secondary--background-color--active),
	$now-color--neutral-5
);

$now-button--secondary-positive--border-width: var(
	p(--now-button--secondary-positive--border-width),
	$now-button--border-width
);
$now-button--secondary-positive--border-color: var(
	p(--now-button--secondary-positive--border-color),
	$now-color_alert--positive-2
);
$now-button--secondary-positive--border-color--hover: var(
	p(--now-button--secondary-positive--border-color--hover),
	$now-color_alert--positive-2
);
$now-button--secondary-positive--border-color--active: var(
	p(--now-button--secondary-positive--border-color--active),
	$now-color_alert--positive-2
);
$now-button--secondary-positive--color: var(
	p(--now-button--secondary-positive--color),
	$now-color_alert--positive-4
);
$now-button--secondary-positive--color--hover: var(
	p(--now-button--secondary-positive--color--hover),
	$now-color_alert--positive-5
);
$now-button--secondary-positive--color--active: var(
	p(--now-button--secondary-positive--color--active),
	$now-color--neutral-0
);
$now-button--secondary-positive--background-color: var(
	p(--now-button--secondary-positive--background-color),
	$now-color_alert--positive-0
);
$now-button--secondary-positive--background-color--hover: var(
	p(--now-button--secondary-positive--background-color--hover),
	$now-color_alert--positive-1
);
$now-button--secondary-positive--background-color--active: var(
	p(--now-button--secondary-positive--background-color--active),
	$now-color_alert--positive-2
);

$now-button--secondary-negative--border-width: var(
	p(--now-button--secondary-negative--border-width),
	$now-button--border-width
);
$now-button--secondary-negative--border-color: var(
	p(--now-button--secondary-negative--border-color),
	$now-color_alert--critical-2
);
$now-button--secondary-negative--border-color--hover: var(
	p(--now-button--secondary-negative--border-color--hover),
	$now-color_alert--critical-2
);
$now-button--secondary-negative--border-color--active: var(
	p(--now-button--secondary-negative--border-color--active),
	$now-color_alert--critical-2
);
$now-button--secondary-negative--color: var(
	p(--now-button--secondary-negative--color),
	$now-color_alert--critical-4
);
$now-button--secondary-negative--color--hover: var(
	p(--now-button--secondary-negative--color--hover),
	$now-color_alert--critical-5
);
$now-button--secondary-negative--color--active: var(
	p(--now-button--secondary-negative--color--active),
	$now-color--neutral-0
);
$now-button--secondary-negative--background-color: var(
	p(--now-button--secondary-negative--background-color),
	$now-color_alert--critical-0
);
$now-button--secondary-negative--background-color--hover: var(
	p(--now-button--secondary-negative--background-color--hover),
	$now-color_alert--critical-1
);
$now-button--secondary-negative--background-color--active: var(
	p(--now-button--secondary-negative--background-color--active),
	$now-color_alert--critical-2
);

$now-button--bare_secondary--color: var(
	p(--now-button--bare_secondary--color),
	$now-color--secondary-1
);
$now-button--bare_secondary--color--hover: var(
	p(--now-button--bare_secondary--color--hover),
	$now-color--secondary-2
);
$now-button--bare_secondary--color--active: var(
	p(--now-button--bare_secondary--color--active),
	$now-color--secondary-3
);
$now-button--bare_secondary--background-color--hover: var(
	p(--now-button--bare_secondary--background-color--hover),
	$now-color--secondary-2
);
$now-button--bare_secondary--background-color--active: var(
	p(--now-button--bare_secondary--background-color--active),
	$now-color--secondary-2
);

$now-button--secondary_high-contrast--color: var(
	p(--now-button--secondary_high-contrast--color),
	$now-color--secondary-2
);
$now-button--secondary_high-contrast--color--hover: var(
	p(--now-button--secondary_high-contrast--color--hover),
	$now-color--secondary-3
);
$now-button--secondary_high-contrast--color--active: var(
	p(--now-button--secondary_high-contrast--color--active),
	$now-color--neutral-18
);
$now-button--secondary_high-contrast--background-color--hover: var(
	p(--now-button--secondary_high-contrast--background-color--hover),
	$now-button--bare_secondary--background-color--hover
);
$now-button--secondary_high-contrast--background-color--active: var(
	p(--now-button--secondary_high-contrast--background-color--active),
	$now-button--bare_secondary--background-color--active
);

$now-button--secondary-highlighted--color: var(
	p(--now-button--secondary-highlighted--color),
	$now-button--secondary--color
);
$now-button--secondary-highlighted--color--hover: var(
	p(--now-button--secondary-highlighted--color--hover),
	$now-button--secondary--color--hover
);
$now-button--secondary-highlighted--color--active: var(
	p(--now-button--secondary-highlighted--color--active),
	$now-button--secondary--color--active
);
$now-button--secondary-highlighted--background-color--hover: var(
	p(--now-button--secondary-highlighted--background-color--hover),
	$now-button--bare_secondary--background-color--hover
);
$now-button--secondary-highlighted--background-color--active: var(
	p(--now-button--secondary-highlighted--background-color--active),
	$now-button--bare_secondary--background-color--active
);

$now-button--secondary-highlighted--color--selected: var(
	p(--now-button--secondary-highlighted--color--selected),
	$now-color--primary-2
);
$now-button--secondary-highlighted--color--selected_hover: var(
	p(--now-button--secondary-highlighted--color--selected_hover),
	$now-button--secondary-highlighted--color--hover
);
$now-button--secondary-highlighted--color--selected_active: var(
	p(--now-button--secondary-highlighted--color--selected_active),
	$now-button--secondary-highlighted--color--active
);
$now-button--secondary-highlighted--background-color--selected: var(
	p(--now-button--secondary-highlighted--background-color--selected),
	$now-color--primary-2
);
$now-button--secondary-highlighted--background-color--selected_hover: var(
	p(--now-button--secondary-highlighted--background-color--selected_hover),
	$now-button--secondary-highlighted--background-color--hover
);
$now-button--secondary-highlighted--background-color--selected_active: var(
	p(--now-button--secondary-highlighted--background-color--selected_active),
	$now-button--secondary-highlighted--background-color--active
);

$now-button--secondary-highlighted_high-contrast--color: var(
	p(--now-button--secondary-highlighted_high-contrast--color),
	$now-button--secondary-highlighted--color
);
$now-button--secondary-highlighted_high-contrast--color--hover: var(
	p(--now-button--secondary-highlighted_high-contrast--color--hover),
	$now-color--primary-3
);
$now-button--secondary-highlighted_high-contrast--color--active: var(
	p(--now-button--secondary-highlighted_high-contrast--color--active),
	$now-color--neutral-18
);
$now-button--secondary-highlighted_high-contrast--background-color--hover: var(
	p(--now-button--secondary-highlighted_high-contrast--background-color--hover),
	$now-button--secondary-highlighted--background-color--hover
);
$now-button--secondary-highlighted_high-contrast--background-color--active: var(
	p(
		--now-button--secondary-highlighted_high-contrast--background-color--active
	),
	$now-button--secondary-highlighted--background-color--active
);

$now-button--secondary-highlighted_high-contrast--color--selected: var(
	p(--now-button--secondary-highlighted_high-contrast--color--selected),
	$now-color--primary-3
);
$now-button--secondary-highlighted_high-contrast--color--selected_hover: var(
	p(--now-button--secondary-highlighted_high-contrast--color--selected_hover),
	$now-button--secondary-highlighted_high-contrast--color--hover
);
$now-button--secondary-highlighted_high-contrast--color--selected_active: var(
	p(--now-button--secondary-highlighted_high-contrast--color--selected_active),
	$now-button--secondary-highlighted_high-contrast--color--active
);
$now-button--secondary-highlighted_high-contrast--background-color--selected: var(
	p(
		--now-button--secondary-highlighted_high-contrast--background-color--selected
	),
	$now-button--secondary-highlighted--background-color--selected
);
$now-button--secondary-highlighted_high-contrast--background-color--selected_hover: var(
	p(
		--now-button--secondary-highlighted_high-contrast--background-color--selected_hover
	),
	$now-button--secondary-highlighted--background-color--selected_hover
);
$now-button--secondary-highlighted_high-contrast--background-color--selected_active: var(
	p(
		--now-button--secondary-highlighted_high-contrast--background-color--selected_active
	),
	$now-button--secondary-highlighted--background-color--selected_active
);

// Tertiary

$now-button--tertiary--border-width: var(
	p(--now-button--tertiary--border-width),
	$now-button--border-width
);
$now-button--tertiary--border-color: var(
	p(--now-button--tertiary--border-color),
	$now-color--neutral-5
);
$now-button--tertiary--border-color-alpha: var(
	p(--now-button--tertiary--border-color-alpha),
	1
);
$now-button--tertiary--border-color--hover: var(
	p(--now-button--tertiary--border-color--hover),
	$now-button--tertiary--border-color
);
$now-button--tertiary--border-color-alpha--hover: var(
	p(--now-button--tertiary--border-color-alpha--hover),
	$now-button--tertiary--border-color-alpha
);
$now-button--tertiary--border-color--active: var(
	p(--now-button--tertiary--border-color--active),
	$now-button--tertiary--border-color
);
$now-button--tertiary--border-color-alpha--active: var(
	p(--now-button--tertiary--border-color-alpha--active),
	$now-button--tertiary--border-color-alpha
);
$now-button--tertiary--color: var(
	p(--now-button--tertiary--color),
	$now-color--neutral-18
);
$now-button--tertiary--color-alpha: var(
	p(--now-button--tertiary--color-alpha),
	1
);
$now-button--tertiary--color--hover: var(
	p(--now-button--tertiary--color--hover),
	$now-color--secondary-2
);
$now-button--tertiary--color-alpha--hover: var(
	p(--now-button--tertiary--color-alpha--hover),
	$now-button--tertiary--color-alpha
);
$now-button--tertiary--color--active: var(
	p(--now-button--tertiary--color--active),
	$now-color--secondary-3
);
$now-button--tertiary--color-alpha--active: var(
	p(--now-button--tertiary--color-alpha--active),
	$now-button--tertiary--color-alpha
);
$now-button--tertiary--background-color: var(
	p(--now-button--tertiary--background-color),
	$now-color--neutral-0
);
$now-button--tertiary--background-color-alpha: var(
	p(--now-button--tertiary--background-color-alpha),
	0
);
$now-button--tertiary--background-color--hover: var(
	p(--now-button--tertiary--background-color--hover),
	$now-color--neutral-2
);
$now-button--tertiary--background-color-alpha--hover: var(
	p(--now-button--tertiary--background-color-alpha--hover),
	1
);
$now-button--tertiary--background-color--active: var(
	p(--now-button--tertiary--background-color--active),
	$now-color--neutral-5
);
$now-button--tertiary--background-color-alpha--active: var(
	p(--now-button--tertiary--background-color-alpha--active),
	1
);

$now-button--bare_tertiary--background-color--hover: var(
	p(--now-button--bare_tertiary--background-color--hover),
	$now-color--secondary-2
);
$now-button--bare_tertiary--background-color-alpha--hover: var(
	p(--now-button--bare_tertiary--background-color-alpha--hover),
	$now-global-opacity--less
);
$now-button--bare_tertiary--background-color--active: var(
	p(--now-button--bare_tertiary--background-color--active),
	$now-color--secondary-2
);
$now-button--bare_tertiary--background-color-alpha--active: var(
	p(--now-button--bare_tertiary--background-color-alpha--active),
	$now-global-opacity--mid
);

$now-button--tertiary_high-contrast--color: var(
	p(--now-button--tertiary_high-contrast--color),
	$now-button--tertiary--color
);
$now-button--tertiary_high-contrast--color-alpha: var(
	p(--now-button--tertiary_high-contrast--color-alpha),
	1
);
$now-button--tertiary_high-contrast--color--hover: var(
	p(--now-button--tertiary_high-contrast--color--hover),
	$now-color--secondary-3
);
$now-button--tertiary_high-contrast--color-alpha--hover: var(
	p(--now-button--tertiary_high-contrast--color-alpha--hover),
	$now-button--tertiary_high-contrast--color-alpha
);
$now-button--tertiary_high-contrast--color--active: var(
	p(--now-button--tertiary_high-contrast--color--active),
	$now-color--neutral-18
);
$now-button--tertiary_high-contrast--color-alpha--active: var(
	p(--now-button--tertiary_high-contrast--color-alpha--active),
	$now-button--tertiary_high-contrast--color-alpha
);
$now-button--tertiary_high-contrast--background-color--hover: var(
	p(--now-button--tertiary_high-contrast--background-color--hover),
	$now-button--bare_tertiary--background-color--hover
);
$now-button--tertiary_high-contrast--background-color-alpha--hover: var(
	p(--now-button--tertiary_high-contrast--background-color-alpha--hover),
	$now-global-opacity--less
);
$now-button--tertiary_high-contrast--background-color--active: var(
	p(--now-button--tertiary_high-contrast--background-color--active),
	$now-button--bare_tertiary--background-color--active
);
$now-button--tertiary_high-contrast--background-color-alpha--active: var(
	p(--now-button--tertiary_high-contrast--background-color-alpha--active),
	$now-global-opacity--mid
);

$now-button--tertiary--color--selected: var(
	p(--now-button--tertiary--color--selected),
	$now-color--secondary-1
);
$now-button--tertiary--color--selected_hover: var(
	p(--now-button--tertiary--color--selected_hover),
	$now-color--secondary-2
);
$now-button--tertiary--color--selected_active: var(
	p(--now-button--tertiary--color--selected_active),
	$now-color--secondary-3
);
$now-button--tertiary--background-color--selected_hover: var(
	p(--now-button--tertiary--background-color--selected_hover),
	$now-button--bare_tertiary--background-color--hover
);
$now-button--tertiary--background-color--selected_active: var(
	p(--now-button--tertiary--background-color--selected_active),
	$now-button--bare_tertiary--background-color--active
);

$now-button--tertiary_high-contrast--color--selected: var(
	p(--now-button--tertiary_high-contrast--color--selected),
	$now-color--secondary-2
);
$now-button--tertiary_high-contrast--color--selected_hover: var(
	p(--now-button--tertiary_high-contrast--color--selected_hover),
	$now-button--tertiary_high-contrast--color--hover
);
$now-button--tertiary_high-contrast--color--selected_active: var(
	p(--now-button--tertiary_high-contrast--color--selected_active),
	$now-button--tertiary_high-contrast--color--active
);
$now-button--tertiary_high-contrast--background-color--selected_hover: var(
	p(--now-button--tertiary_high-contrast--background-color--selected_hover),
	$now-button--tertiary--background-color--selected_hover
);
$now-button--tertiary_high-contrast--background-color--selected_active: var(
	p(--now-button--tertiary_high-contrast--background-color--selected_active),
	$now-button--tertiary--background-color--selected_active
);

$now-button--border-width--disabled: var(
	p(--now-button--border-width--disabled),
	$now-button--border-width
);
$now-button--border-color--disabled: var(
	p(--now-button--border-color--disabled),
	$now-color--neutral-18
);
$now-button--color--disabled: var(
	p(--now-button--color--disabled),
	$now-color_text--primary
);
$now-button--background-color--disabled: var(
	p(--now-button--background-color--disabled),
	$now-color_background--primary
);

$now-button-circular--border-width: var(
	p(--now-button-circular--border-width),
	0
);
$now-button-circular--border-color: var(
	p(--now-button-circular--border-color),
	$now-button--primary--border-color
);
$now-button-circular--border-color--hover: var(
	p(--now-button-circular--border-color--hover),
	$now-button--primary--border-color--hover
);
$now-button-circular--border-color--active: var(
	p(--now-button-circular--border-color--active),
	$now-button--primary--border-color--active
);
$now-button-circular--color: var(
	p(--now-button-circular--color),
	$now-button--primary--color
);
$now-button-circular--color--hover: var(
	p(--now-button-circular--color--hover),
	$now-button--primary--color--hover
);
$now-button-circular--color--active: var(
	p(--now-button-circular--color--active),
	$now-color--neutral-0
);
$now-button-circular--background-color: var(
	p(--now-button-circular--background-color),
	$now-button--primary--background-color
);
$now-button-circular--background-color--hover: var(
	p(--now-button-circular--background-color--hover),
	$now-button--primary--background-color--hover
);
$now-button-circular--background-color--active: var(
	p(--now-button-circular--background-color--active),
	$now-button--primary--background-color--active
);

$now-button-circular--color--disabled: var(
	p(--now-button-circular--color--disabled),
	$now-color--neutral-0
);
$now-button-circular--background-color--disabled: var(
	p(--now-button-circular--background-color--disabled),
	$now-color--neutral-3
);

/// Outputs initial CSS for `<button>`s
///
/// @group Buttons
///
@mixin now-mx-button {
	display: flex;
	justify-content: center;
	align-items: center;
	width: inherit;
	cursor: pointer;

	&:active {
		color: currentColor;
	}
}

/// Outputs CSS for small sized `<button>`s.
///
/// @group Buttons
///
@mixin now-mx-button-sm {
	min-height: calc(
		#{$now-global-font-size--sm} * 2 * #{$now-button--height-scale}
	);
	padding-block-start: now-fn-px2rem(4px);
	padding-block-end: now-fn-px2rem(4px);
	font-size: $now-global-font-size--sm;
	line-height: $now-global-line-height--sm;
}

/// Outputs CSS for medium sized `<button>`s.
///
/// @group Buttons
///
@mixin now-mx-button-md {
	min-height: calc(
		#{$now-global-font-size--md} * 2 * #{$now-button--height-scale}
	);
	padding-block-start: now-fn-px2rem(6px);
	padding-block-end: now-fn-px2rem(6px);
	font-size: $now-global-font-size--md;
	line-height: $now-global-line-height;
}

/// Outputs CSS for large sized `<button>`s.
///
/// @group Buttons
///
@mixin now-mx-button-lg {
	min-height: calc(
		#{$now-global-font-size--xl} * 2 * #{$now-button--height-scale}
	);
	padding-block-start: now-fn-px2rem(6px);
	padding-block-end: now-fn-px2rem(6px);
	font-size: $now-global-font-size--xl;
	line-height: $now-global-line-height;
}

/// Outputs CSS for small sized iconic `<button>`s.
///
/// @group Buttons
///
@mixin now-mx-button-iconic-sm {
	width: calc(
		#{$now-global-font-size--sm} * 2 * #{$now-button--constrain-scale}
	);
	height: calc(
		#{$now-global-font-size--sm} * 2 * #{$now-button--constrain-scale}
	);
}

/// Outputs CSS for medium sized iconic `<button>`s.
///
/// @group Buttons
///
@mixin now-mx-button-iconic-md {
	width: calc(
		#{$now-global-font-size--md} * 2 * #{$now-button--constrain-scale}
	);
	height: calc(
		#{$now-global-font-size--md} * 2 * #{$now-button--constrain-scale}
	);
}

/// Outputs CSS for large sized iconic `<button>`s.
///
/// @group Buttons
///
@mixin now-mx-button-iconic-lg {
	width: calc(
		#{$now-global-font-size--xl} * 2 * #{$now-button--constrain-scale}
	);
	height: calc(
		#{$now-global-font-size--xl} * 2 * #{$now-button--constrain-scale}
	);
}

/// Outputs CSS for `<button>`s using `primary` variant.
///
/// @group Buttons
///
@mixin now-mx-button-primary {
	border-width: $now-button--primary--border-width;
	border-color: RGB($now-button--primary--border-color);
	color: RGB($now-button--primary--color);
	background-color: RGB($now-button--primary--background-color);

	&:hover {
		border-color: RGB($now-button--primary--border-color--hover);
		color: RGB($now-button--primary--color--hover);
		background-color: RGB($now-button--primary--background-color--hover);
	}

	&:active {
		border-color: RGB($now-button--primary--border-color--active);
		color: RGB($now-button--primary--color--active);
		background-color: RGB($now-button--primary--background-color--active);
	}
}

/// Outputs CSS for `<button>`s using `primary-positive` variant.
///
/// @group Buttons
///
@mixin now-mx-button-primary-positive {
	border-width: $now-button--primary-positive--border-width;
	border-color: RGB($now-button--primary-positive--border-color);
	color: RGB($now-button--primary-positive--color);
	background-color: RGB($now-button--primary-positive--background-color);

	&:hover {
		border-color: RGB($now-button--primary-positive--border-color--hover);
		color: RGB($now-button--primary-positive--color--hover);
		background-color: RGB(
			$now-button--primary-positive--background-color--hover
		);
	}

	&:active {
		border-color: RGB($now-button--primary-positive--border-color--active);
		color: RGB($now-button--primary-positive--color--active);
		background-color: RGB(
			$now-button--primary-positive--background-color--active
		);
	}
}

/// Outputs CSS for `<button>`s using `primary-negative` variant.
///
/// @group Buttons
///
@mixin now-mx-button-primary-negative {
	border-width: $now-button--primary-negative--border-width;
	border-color: RGB($now-button--primary-negative--border-color);
	color: RGB($now-button--primary-negative--color);
	background-color: RGB($now-button--primary-negative--background-color);

	&:hover {
		border-color: RGB($now-button--primary-negative--border-color--hover);
		color: RGB($now-button--primary-negative--color--hover);
		background-color: RGB(
			$now-button--primary-negative--background-color--hover
		);
	}

	&:active {
		border-color: RGB($now-button--primary-negative--border-color--active);
		color: RGB($now-button--primary-negative--color--active);
		background-color: RGB(
			$now-button--primary-negative--background-color--active
		);
	}
}

/// Outputs CSS for `<button>`s using `secondary` variant.
///
/// @group Buttons
///
@mixin now-mx-button-secondary {
	border-width: $now-button--secondary--border-width;
	border-color: RGB($now-button--secondary--border-color);
	color: RGB($now-button--secondary--color);
	background-color: RGB($now-button--secondary--background-color);

	&:hover {
		border-color: RGB($now-button--secondary--border-color--hover);
		color: RGB($now-button--secondary--color--hover);
		background-color: RGB($now-button--secondary--background-color--hover);
	}

	&:active {
		border-color: RGB($now-button--secondary--border-color--active);
		color: RGB($now-button--secondary--color--active);
		background-color: RGB($now-button--secondary--background-color--active);
	}
}

/// Outputs CSS for `<button>`s using `secondary-positive` variant.
///
/// @group Buttons
///
@mixin now-mx-button-secondary-positive {
	border-width: $now-button--secondary-positive--border-width;
	border-color: RGB($now-button--secondary-positive--border-color);
	color: RGB($now-button--secondary-positive--color);
	background-color: RGB($now-button--secondary-positive--background-color);

	&:hover {
		border-color: RGB($now-button--secondary-positive--border-color--hover);
		color: RGB($now-button--secondary-positive--color--hover);
		background-color: RGB(
			$now-button--secondary-positive--background-color--hover
		);
	}

	&:active {
		border-color: RGB($now-button--secondary-positive--border-color--active);
		color: RGB($now-button--secondary-positive--color--active);
		background-color: RGB(
			$now-button--secondary-positive--background-color--active
		);
	}
}

/// Outputs CSS for `<button>`s using `secondary-negative` variant.
///
/// @group Buttons
///
@mixin now-mx-button-secondary-negative {
	border-width: $now-button--secondary-negative--border-width;
	border-color: RGB($now-button--secondary-negative--border-color);
	color: RGB($now-button--secondary-negative--color);
	background-color: RGB($now-button--secondary-negative--background-color);

	&:hover {
		border-color: RGB($now-button--secondary-negative--border-color--hover);
		color: RGB($now-button--secondary-negative--color--hover);
		background-color: RGB(
			$now-button--secondary-negative--background-color--hover
		);
	}

	&:active {
		border-color: RGB($now-button--secondary-negative--border-color--active);
		color: RGB($now-button--secondary-negative--color--active);
		background-color: RGB(
			$now-button--secondary-negative--background-color--active
		);
	}
}

/// Outputs CSS for `<button>`s using `tertiary` variant.
///
/// @group Buttons
///
@mixin now-mx-button-tertiary {
	border-width: $now-button--tertiary--border-width;
	border-color: RGBA(
		$now-button--tertiary--border-color,
		$now-button--tertiary--border-color-alpha
	);
	color: RGBA($now-button--tertiary--color, $now-button--tertiary--color-alpha);
	background-color: RGBA(
		$now-button--tertiary--background-color,
		$now-button--tertiary--background-color-alpha
	);

	&:hover {
		border-color: RGBA(
			$now-button--tertiary--border-color--hover,
			$now-button--tertiary--border-color-alpha--hover
		);
		color: RGBA(
			$now-button--tertiary--color--hover,
			$now-button--tertiary--color-alpha--hover
		);
		background-color: RGBA(
			$now-button--tertiary--background-color--hover,
			$now-button--tertiary--background-color-alpha--hover
		);
	}

	&:active {
		border-color: RGBA(
			$now-button--tertiary--border-color--active,
			$now-button--tertiary--border-color-alpha--active
		);
		color: RGBA(
			$now-button--tertiary--color--active,
			$now-button--tertiary--color-alpha--active
		);
		background-color: RGBA(
			$now-button--tertiary--background-color--active,
			$now-button--tertiary--background-color-alpha--active
		);
	}
}

/// Outputs CSS for `<button>`s using `bare` property.
///
/// @group Buttons
///
@mixin now-mx-button-is-bare {
	&,
	&:hover,
	&:active {
		border: none;
		background-color: transparent;
	}
}

/// Outputs CSS for `<button-bare>`s using `primary` variant.
///
/// @group Buttons
///
@mixin now-mx-button-bare-primary {
	color: RGB($now-button--bare_primary--color);

	&:hover {
		color: RGB($now-button--bare_primary--color--hover);
	}

	&:active {
		color: RGB($now-button--bare_primary--color--active);
	}
}

/// Outputs CSS for `<button-bare>`s using `primary` variant plus
/// `highContrast`.
///
/// @group Buttons
///
@mixin now-mx-button-bare-primary-high-contrast {
	color: RGB($now-button--primary_high-contrast--color);

	&:hover {
		color: RGB($now-button--primary_high-contrast--color--hover);
	}

	&:active {
		color: RGB($now-button--primary_high-contrast--color--active);
	}
}

/// Outputs CSS for `<button-bare>`s using `secondary` variant.
///
/// @group Buttons
///
@mixin now-mx-button-bare-secondary {
	color: RGB($now-button--bare_secondary--color);

	&:hover {
		color: RGB($now-button--bare_secondary--color--hover);
	}

	&:active {
		color: RGB($now-button--bare_secondary--color--active);
	}
}

/// Outputs CSS for `<button-bare>`s using `secondary` variant plus
/// `highContrast`.
///
/// @group Buttons
///
@mixin now-mx-button-bare-secondary-high-contrast {
	color: RGB($now-button--secondary_high-contrast--color);

	&:hover {
		color: RGB($now-button--secondary_high-contrast--color--hover);
	}

	&:active {
		color: RGB($now-button--secondary_high-contrast--color--active);
	}
}

/// Outputs CSS for `disabled` `<button>`s.
///
/// @group Buttons
///
@mixin now-mx-button-is-disabled {
	border-color: RGBA(
		$now-button--border-color--disabled,
		$now-global-opacity--less
	);
	cursor: not-allowed;
	color: RGBA($now-button--color--disabled, $now-global-opacity--less);
	background-color: RGBA(
		$now-button--background-color--disabled,
		$now-global-opacity--less
	);
}

/// Outputs CSS for `disabled` `<button>`s using `bare` property.
///
/// @group Buttons
///
@mixin now-mx-button-is-bare-is-disabled {
	&.is-disabled,
	&.is-disabled:hover {
		border-color: transparent;
		background-color: transparent;
	}
}

/// Outputs CSS for `<button>`s containing only icons.
///
/// @group Buttons
///
@mixin now-mx-button-only-icon {
	padding-inline-start: 0;
	padding-inline-end: 0;

	&.-sm {
		width: calc(#{$now-global-font-size--sm} * 2 * #{$now-button--width-scale});
	}

	&.-md {
		width: calc(#{$now-global-font-size--md} * 2 * #{$now-button--width-scale});
	}

	&.-lg {
		width: calc(#{$now-global-font-size--xl} * 2 * #{$now-button--width-scale});
	}
}

// DO NOT USE keeping for backwards compatibility
$now-button--sm: now-fn-px2rem(24px);
$now-button--md: now-fn-px2rem(32px);
$now-button--lg: now-fn-px2rem(48px);
