@use './styles/scrollbars';
@use './styles/tokens';
@use './styles/utils';

html {
	box-sizing: border-box;
	height: 100%;
	font-size: 62.5%;
}

body {
	height: 100%;
	line-height: 1.4;
	color: var(--color-foreground);
	background-color: var(--color-background);
}

@include scrollbars.scrollableBase;

a {
	font-weight: 400;
	color: var(--color-link-foreground);
	text-decoration: none;
	outline: none;
	border: 0;

	&:not([href], [tabindex]):focus,
	&:not([href], [tabindex]):hover {
		color: inherit;
		text-decoration: none;
	}

	&:focus {
		outline-color: var(--color-focus-border);
	}
}

b {
	font-weight: 600;
}

h1 {
	padding: 0;
	margin: 0;
	font-size: 4rem;
	font-weight: 400;
	white-space: nowrap;
	border: none;
}

h2 {
	margin: 1em 0 0.3em;
	font-size: 2.2rem;
	font-weight: 200;
	line-height: normal;
	white-space: nowrap;
}

h3 {
	margin: 1em 0 0.3em;
	font-size: 1.8rem;
	font-weight: 200;
	line-height: normal;
	white-space: nowrap;
}

h4 {
	margin: 1em 0 0.3em;
	font-size: var(--gl-font-micro);
	font-weight: 200;
	line-height: normal;
	white-space: nowrap;
}

button,
input,
select,
textarea {
	margin: 0;
	font-family: var(--font-family);
	font-size: inherit;
}

button:not(:disabled) {
	cursor: pointer;
}

input[type='checkbox'] {
	padding: 0 var(--gl-space-10);
	margin: 0;
	accent-color: var(--color-background--lighten-30);
	cursor: pointer;
	background: none;
	border: none;

	&:focus {
		outline: var(--gl-border-width) solid var(--vscode-focusBorder);
		outline-offset: -1px;
		background: rgb(0 0 0 / 10%);
		border-radius: 3px;
	}

	&[disabled] {
		color: var(--color-foreground--75);
		cursor: default;
	}

	@include utils.light-theme($selectorPostfix: ' &') {
		accent-color: var(--color-background--darken-50);
	}
}

input[type='number'],
input[type='text'],
input:not([type]),
textarea {
	width: 100%;
	max-width: 300px;
	padding: var(--gl-space-4);
	margin: 0 var(--gl-space-10);
	color: var(--color-foreground);
	background: none;

	@include utils.dark-theme($selectorPostfix: ' &') {
		border: var(--gl-border-width) solid rgb(255 255 255 / 30%);
	}

	@include utils.light-theme($selectorPostfix: ' &') {
		border: var(--gl-border-width) solid rgb(0 0 0 / 30%);
	}

	&:focus {
		outline-color: var(--color-focus-border);

		@include utils.light-theme($selectorPostfix: ' &') {
			background-color: rgb(255 255 255 / 40%);
		}

		@include utils.dark-theme($selectorPostfix: ' &') {
			background-color: rgb(0 0 0 / 20%);
		}
	}

	&[disabled] {
		color: var(--color-foreground--75);
		cursor: default;
	}

	&::placeholder {
		color: var(--vscode-input-placeholderForeground);
	}
}

input[type='number'] {
	max-width: 100px;
	text-align: center;
}

kbd {
	display: inline-block;
	padding: 3px 5px;
	margin: 0 var(--gl-space-2);
	font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
	font-size: var(--gl-font-sm);
	line-height: 11px;
	vertical-align: baseline;
}

label {
	cursor: pointer;
}

select {
	min-width: 5em;
	padding: 2px 23px 2px 8px;
	color: var(--color-foreground);
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	background: none;

	@include utils.light-theme($selectorPostfix: ' &') {
		border: var(--gl-border-width) solid rgb(0 0 0 / 30%);
	}

	@include utils.dark-theme($selectorPostfix: ' &') {
		border: var(--gl-border-width) solid rgb(255 255 255 / 30%);
	}

	&:focus {
		outline-color: var(--color-focus-border);

		@include utils.light-theme($selectorPostfix: ' &') {
			background-color: rgb(255 255 255 / 40%);
		}

		@include utils.dark-theme($selectorPostfix: ' &') {
			background-color: rgb(0 0 0 / 20%);
		}
	}

	&[disabled] {
		color: var(--color-foreground--75);
		cursor: default;
	}

	& option {
		@include utils.light-theme($selectorPostfix: ' &') {
			background-color: var(--color-background--darken-05);
		}

		@include utils.dark-theme($selectorPostfix: ' &') {
			background-color: var(--color-background--lighten-05);
		}

		&:focus {
			outline-color: var(--color-focus-border);

			@include utils.light-theme($selectorPostfix: ' &') {
				background-color: rgb(255 255 255 / 40%);
			}

			@include utils.dark-theme($selectorPostfix: ' &') {
				background-color: rgb(0 0 0 / 20%);
			}
		}
	}
}

.select-container {
	position: relative;
	display: inline-block;
	margin: 0 0.75em;

	&::after {
		position: absolute;
		top: 0;
		right: 6px;
		bottom: 0;
		width: 14px;
		height: 14px;
		margin: auto;
		font-family: codicon;
		font-size: var(--gl-font-lg);
		line-height: 14px;
		pointer-events: none;
		content: '\eab4';
	}
}

ul {
	padding: 0;
	margin: 0;
	list-style: none;
}

::-webkit-scrollbar-corner {
	background-color: transparent !important;
}

code {
	padding: 0 var(--gl-space-4) var(--gl-space-2);
	color: var(--color-foreground--75);
	background: var(--vscode-textCodeBlock-background);
	border-radius: var(--gl-radius-sm);
}
