/**
 * Form styling
 */

@use "./variables" as variables;

label {
	// Allow labels to use `margin` for spacing.
	display: inline-block;
	line-height: 1;
	vertical-align: middle;
}

/**
 * 1. Change the font styles in all browsers.
 * 2. Remove the margin in Firefox and Safari.
 */

button,
input,
optgroup,
select,
textarea {
	font-family: inherit; /* 1 */
	font-size: 1rem; /* 1 */
	line-height: 1.5; /* 1 */
	margin: 0; /* 2 */
}

input[type="text"],
input[type="date"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
	width: 100%;
	border: solid 1px variables.$gray;
	border-radius: variables.$border-radius;
	padding: 0.5rem 1rem;
	transition: all .3s;

	&:focus {
		border-color: variables.$gray-dark;
	}
}

/**
 * Show the overflow in IE.
 * 1. Show the overflow in Edge.
 */

button,
input { /* 1 */
	overflow: visible;
}

/**
 * Remove the inheritance of text transform in Edge, Firefox, and IE.
 * 1. Remove the inheritance of text transform in Firefox.
 */

button,
select { /* 1 */
	text-transform: none;
}

/**
 * Correct the inability to style clickable types in iOS and Safari.
 */

button,
[type="button"],
[type="reset"],
[type="submit"] {
	width: auto;
	-webkit-appearance: button;
}

/**
 * Restore the focus styles unset by the previous rule.
 */

button,
[type="submit"],
[type="button"] {
	display: inline-block;
	font-weight: 400;
	color: variables.$primary-color;
	text-align: center;
	white-space: nowrap;
	user-select: none;
	background-color: transparent;
	border: 1px solid variables.$primary-color;
	padding: 0.5rem 1rem;
	font-size: 1rem;
	border-radius: variables.$border-radius;
	transition: all .3s;

	&:focus:not(:focus-visible) {
		outline: none;
	}

	&:hover,
	&:focus {
		color: #ffffff;
		background-color: variables.$primary-color;
		text-decoration: none;
	}

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

/**
 * Correct the padding in Firefox.
 */

fieldset {
	padding: 0.35em 0.75em 0.625em;
}

/**
 * 1. Correct the text wrapping in Edge and IE.
 * 2. Correct the color inheritance from `fieldset` elements in IE.
 * 3. Remove the padding so developers are not caught out when they zero out
 *    `fieldset` elements in all browsers.
 */

legend {
	box-sizing: border-box; /* 1 */
	color: inherit; /* 2 */
	display: table; /* 1 */
	max-width: 100%; /* 1 */
	padding: 0; /* 3 */
	white-space: normal; /* 1 */
}

/**
 * Add the correct vertical alignment in Chrome, Firefox, and Opera.
 */

progress {
	vertical-align: baseline;
}

/**
 * Remove the default vertical scrollbar in IE 10+.
 */

textarea {
	overflow: auto;
	resize: vertical;
}

/**
 * 1. Add the correct box sizing in IE 10.
 * 2. Remove the padding in IE 10.
 */

[type="checkbox"],
[type="radio"] {
	box-sizing: border-box; /* 1 */
	padding: 0; /* 2 */
}

/**
 * Correct the cursor style of increment and decrement buttons in Chrome.
 */

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
	height: auto;
}

/**
 * 1. Correct the odd appearance in Chrome and Safari.
 * 2. Correct the outline style in Safari.
 */

[type="search"] {
	-webkit-appearance: textfield; /* 1 */
	outline-offset: -2px; /* 2 */
}

/**
 * Remove the inner padding in Chrome and Safari on macOS.
 */

[type="search"]::-webkit-search-decoration {
	-webkit-appearance: none;
}

/**
 * 1. Correct the inability to style clickable types in iOS and Safari.
 * 2. Change font properties to `inherit` in Safari.
 */

::-webkit-file-upload-button {
	-webkit-appearance: button; /* 1 */
	font: inherit; /* 2 */
}

select {
	display: block;
}
