@use 'mixins';

*:not(svg *) {
	box-sizing: border-box;
	margin: 0;
	color: inherit;
	font-weight: inherit;
	font-size: inherit;
	font-family: inherit;
	line-height: inherit;
	tab-size: 2;
	outline: none;

	&::-moz-focus-inner,
	&::-moz-focus-outer {
		border: none;
		outline: none;
	}

	&:focus,
	&:focus-within {
		outline: none;
	}
}

html {
	font-size: 14px;
	-webkit-tap-highlight-color: rgb(0 0 0 / 0);
}

body {
	color: var(--theme--foreground);
	font-weight: 500;
	font-size: 14px;
	font-family: var(--theme--fonts--sans--font-family);
	font-style: normal;
	line-height: 22px;
	background-color: var(--theme--background);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	-moz-osx-font-smoothing: grayscale;
}

// Default focus ring
*:not(main):not(div):not(input):not(textarea):not([contenteditable='true']):focus-visible {
	outline: var(--focus-ring-width) solid var(--focus-ring-color);
	outline-offset: var(--focus-ring-offset);
	border-radius: var(--focus-ring-radius);
}

// Applies mainly to scrollable elements
main:not([contenteditable='true']):focus-visible,
div:not([contenteditable='true']):focus-visible {
	--focus-ring-offset: calc(-1 * var(--focus-ring-width));
	--focus-ring-radius: 0;

	outline: var(--focus-ring-width) dotted var(--focus-ring-color);
	outline-offset: var(--focus-ring-offset);
	border-radius: var(--focus-ring-radius);
}

html,
body,
#root {
	inline-size: 100%;
	block-size: 100%;
}

::placeholder {
	opacity: 1;
}

:invalid {
	outline: 0;
	box-shadow: none;
}

button {
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 0;
	cursor: pointer;
}

label {
	display: block;
}

fieldset {
	padding: 10px 0 20px;
	border: 0;

	&.centered {
		border-block-start: 1px solid var(--blue-grey-200);

		legend {
			padding: 10px 20px;
			color: var(--blue-grey-400);
			text-align: center;
		}
	}
}

a {
	text-decoration: none;
}

strong {
	font-weight: 600;
}

code {
	font-family: var(--theme--fonts--monospace--font-family);
}

::selection {
	background: var(--theme--background-accent);
}

dl > div {
	display: flex;
	margin-block-end: 8px;
}

dt,
dd {
	display: inline-block;
}

dt {
	flex-shrink: 0;
	margin-inline-end: 8px;
	font-weight: 600;
}

dd {
	flex-grow: 1;
	overflow: hidden;
	color: var(--theme--foreground-subdued);
	white-space: nowrap;
	text-overflow: ellipsis;
}

dd a {
	color: var(--theme--primary);
}

.form-grid {
	@include mixins.form-grid;
}

input[type='number']::-webkit-inner-spin-button,
input[type='search']::-webkit-search-decoration,
input[type='search']::-webkit-search-cancel-button,
input[type='search']::-webkit-search-results-button,
input[type='search']::-webkit-search-results-decoration {
	-webkit-appearance: none;
}
