@use "styleboost" with (
	// If you want to add or override existing colors, use $extra-colors.
	// If you want to replace all colors, use $colors.
	// The values have to be valid color values or maps, not strings.
	// Honor the color names: do not turn "red" into blue eg.
	$extra-colors: (
		"purplish": #100099,

		// Colors with dashes in them are allowed,
		// but they will not be added to the "numbered" list
		"main-bg": #0F1014,
		"main-color": #f5f5f5,
		"comp-bg": #151713,
	),
	// If you want to add or override existing themes, use $extra-themes.
	// If you want to replace all themes, use $themes.
	// The values should be strings that match the color names.
	// Do not use color names as theme names.
	$extra-themes: (
		"passion": (
			"base": "red",
			"default-properties": (
				"size-border-inner": 0,
			),
		),
		"app": (
			"base": "main-color",

			"modes": (
				"light": (
					"bg": "gray-100",
				),
				"dark": (
					"bg": "main-bg",
				),
				"pastel": (
					"bg": "indigo-100",
				)
			),
		),
	),
	// You can also add or override the "modes":
	// These define how the themes are generated.
	// By default there are only 2 modes: light and dark.
	// If you want to add or override existing modes, use $extra-modes.
	// If you want to replace all modes, use $modes.
	$extra-modes: (
		"pastel": (
			"base": (
				"suffix": "300",
				"action": false,
			),
			"core": (
				"action": false,
			),
			"bg": (
				"action": "tint",
				"args"  : 80%,
			),
			"accent": (
				"action": "tint",
				"args"  : 60%,
			),
			"emphasis": (
				"action": "shade",
				"args"  : 20%,
			),
		),
	),

	// Specific themes to use per mode & component
	$components: (
		// Enable this to make the "passion" theme the default for the "card" component
		// It will force cards to use this theme by default,
		// and prefer the default properties of this theme too.
		//"card": "passion",
		"body": "app",
	),
);
@use "alchemy";

$themes: 
	core,
	bg,
	accent,
	runner,
	emphasis,
	subtle,
	text-muted,
	text-hover,
	bg-subtle,
	bg-hover,
	bg-active,
	surface,
	surface-hover,
	border,
	border-hover,
	border-focus,
	border-flashy,
	divider;

.color-showcase {
	display: grid;
	grid-template-columns: repeat(9, 1fr);
	width: 100%;
	grid-column-gap: 4px;
	grid-row-gap: 4px;
	padding: 1.5rem;
	border-radius: 5px;
	color: #495057;

	.color-group {
		display: grid;
		grid-template-columns: repeat(9, 1fr);
		grid-column: span 9;
		grid-column-gap: 6px;
		grid-row-gap: 6px;

		.color-entry {
			.color-value {
				min-height: 30px;
				border-radius: 5px;
			}
			display: flex;
			flex-flow: column;
		}
	}

	.color-info {
		margin: 0.2rem 0 0.75rem;
		font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
		display: flex;
		flex-flow: column;
	}

	.color-name {
		text-transform: uppercase;
		font-weight: bold;
	}

	.color-hex {
		color: #868e96;
	}
}

.theme-showcase {
	display: flex;
	flex-flow: column;
	padding: 1rem;

	.theme-extrainfo {
		display: flex;
		justify-content: center;
		align-items: left;
		flex-flow: column;
		gap: 7px;
	}

	.theme-rectangle {
		font-size: 2rem;
		font-weight: bold;
	}

	@each $theme in $themes {
		.theme-#{$theme} .theme-rectangle {
			background-color: var(--color-t-current-#{$theme});
			color: var(--color-t-current-#{$theme}-text);
		}
	}

	.theme-runner .theme-rectangle span {
		background-color: var(--color-t-current-runner);
		border-radius: 4px;
		padding: 2px;
	}

	.theme-group {
		display: flex;
		margin-bottom: 2rem;

		.theme-examples {
			display: flex;
			flex-flow: column;
			gap: 10px;

			> * {
				display: flex;
				gap: 10px;
			}

			.theme-rectangle {
				border-radius: 5px;
				width: 10rem;
				height: 6rem;
				display: flex;
				justify-content: center;
				align-items: center;
			}
		}
	}
}

.theme-name {
	min-width: 250px;
	text-transform: uppercase;
	font-size: 1.5rem;
	font-weight: bold;
	margin-right: 1rem;
	margin-bottom: 1rem;
	display: block;
}

.table-group {
	padding: 2rem;

	table {
		margin-bottom: 2rem;
	}
}

.select-mode-label {
	user-select: none;
}

header {
	background-color: var(--color-t-current-bg);
	color: var(--color-t-current-bg-text);
	border-radius: 5px;
	border: 2px solid var(--color-t-current-runner);
	position: sticky;
	top: 10px;
	margin: 2rem;
	padding: 1rem;

	h1 {
		margin-top: 0;
	}
}

@each $name, $mode in styleboost.$modes {
	body:has(.select-mode-label option[value="#{$name}"]:checked) {
		@extend .use-#{$name}-mode;
	}
}

@each $name, $theme in styleboost.$themes {
	body:has(.select-theme-label option[value="#{$name}"]:checked) {
		@extend .use-#{$name}-theme;
	}
}

main {
	padding-bottom: 3rem;
}

$counter: 0;

// Make sure all these colors are not pruned
@each $color, $value in styleboost.$colors {

	// Iterate for 1 to 9
	@for $index from 1 through 9 {
		$counter: $counter + 1;
		$variant: $index * 100;

		[data-keep="#{$counter}"] {
			background-color: var(--color-#{$color}-#{$variant});
		}
	}
}

@each $color, $value in styleboost.$shades {

	// Iterate for 1 to 9
	@for $index from 1 through 9 {
		$counter: $counter + 1;
		$variant: $index * 100;

		[data-keep-shade="#{$counter}"] {
			background-color: var(--color-#{$color}-#{$variant});
		}
	}
}