:root {
	/* Colors */
	--clr-lime: #d8db2f;
	--clr-red: #d73328;

	--clr-slate-900: #133041;
	--clr-slate-700: #4e6e7e;
	--clr-slate-500: #6b94a8;
	--clr-slate-300: #9abed5;
	--clr-slate-100: #e4f4fd;

	--clr-white: #ffffff;

	/* Typography */
	--ff-primary: 'Plus Jakarta Sans', sans-serif;

	--fw-bold: 700;
	--fw-normal: 500;

	--fs-bigger: 56px;
	--fs-big: 24px;
	--fs-normal: 18px;
	--fs-small: 16px;
	--fs-smaller: 14px;

	--lh-normal: 125%;
	--lh-small: 150%;

	--ls-normal: -1px;
	--ls-small: 0px;
}

/* CSS RESET */

/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
	box-sizing: border-box;
}

/* 2. Remove default margin */
* {
	margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
	html {
		interpolate-size: allow-keywords;
	}
}

body {
	/* 4. Add accessible line-height */
	line-height: 1.5;
	/* 5. Improve text rendering */
	-webkit-font-smoothing: antialiased;
}

/* 6. Improve media defaults */
img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input,
button,
textarea,
select {
	font: inherit;
}

/* 8. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
	text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
	text-wrap: balance;
}

/*
  10. Create a root stacking context
*/
#root,
#__next {
	isolation: isolate;
}

/* general styling */

body {
	font-family: var(--ff-primary);
}

.calculator {
	background-color: var(--clr-white);
}

.calculator__header {
	padding: 1.5rem 1.35rem;
}

.header__title {
	color: var(--clr-slate-900);
	margin-bottom: 0.5rem;
}

.header__btn {
	color: var(--clr-slate-700);
	border-bottom: 1px solid var(--clr-slate-700);
	width: 3.85rem;
}

.header__btn:hover {
	cursor: pointer;
	opacity: 0.65;
}

.form__container {
	padding: 0rem 1.35rem 2rem;
}

.form-control {
	position: relative;
}

label {
	color: var(--clr-slate-700);
	display: block;
	margin-bottom: 0.65rem;
}

input {
	border: none;
	outline: 1px solid var(--clr-slate-700);
	border-radius: 6px;
	height: 2.5rem;
	width: 100%;
	margin-bottom: 1.4rem;
}

input:hover {
	cursor: pointer;
}

.form-control small {
	visibility: hidden;
	position: absolute;
	bottom: 0;
	left: 0;
}

/* ERROR INPUTS */

.form-control.error input {
	outline-color: var(--clr-red);
}

.form-control.error .mortgage__amount-symbol,
.form-control.error .mortgage__term-symbol,
.form-control.error .interest__rate-symbol {
	background-color: var(--clr-red);
	color: var(--clr-white);
}

.form-control.error small {
	color: var(--clr-red);
	visibility: visible;
	font-weight: 600;
}

.radio__btn-small {
	transform: translateY(1.3rem);
}

.mortgage__amount-symbol {
	position: absolute;
	top: 2.1rem;
	background-color: var(--clr-slate-100);
	border-top-left-radius: 6px;
	border-bottom-left-radius: 6px;
	width: 2.6rem;
	height: 2.5rem;
	text-align: center;
	display: flex;
	justify-content: center;
	align-items: center;
	color: var(--clr-slate-700);
	cursor: pointer;
	transition: background-color 0.25s ease-in-out;
}

#mortgage__amount {
	padding-left: 3.3rem;
	transition: ouline-color 0.25s ease-in-out;
}

#mortgage__amount:focus {
	outline-color: var(--clr-lime);
}

#mortgage__amount:focus ~ .mortgage__amount-symbol {
	background-color: var(--clr-lime);
}

.mortgage__term-symbol {
	position: absolute;
	top: 2.15rem;
	right: 0;
	background-color: var(--clr-slate-100);
	border-top-right-radius: 6px;
	border-bottom-right-radius: 6px;
	width: 4.3rem;
	height: 2.5rem;
	text-align: center;
	display: flex;
	justify-content: center;
	align-items: center;
	color: var(--clr-slate-700);
	font-weight: var(--fw-bold);
	cursor: pointer;
	transition: background-color 0.25s ease-in-out;
}

#mortgage__term {
	padding-left: 1rem;
	transition: ouline-color 0.25s ease-in-out;
}

#mortgage__term:focus {
	outline-color: var(--clr-lime);
}

#mortgage__term:focus ~ .mortgage__term-symbol {
	background-color: var(--clr-lime);
}

.interest__rate-symbol {
	position: absolute;
	top: 2.15rem;
	right: 0;
	background-color: var(--clr-slate-100);
	border-top-right-radius: 6px;
	border-bottom-right-radius: 6px;
	width: 3rem;
	height: 2.5rem;
	text-align: center;
	display: flex;
	justify-content: center;
	align-items: center;
	color: var(--clr-slate-700);
	font-weight: var(--fw-bold);
	cursor: pointer;
	transition: background-color 0.25s ease-in-out;
}

#interest__rate {
	padding-left: 1rem;
	transition: ouline-color 0.25s ease-in-out;
}

#interest__rate:focus {
	outline-color: var(--clr-lime);
}

#interest__rate:focus ~ .interest__rate-symbol {
	background-color: var(--clr-lime);
}

.type__title {
	color: var(--clr-slate-700);
	margin-bottom: 0.65rem;
}

.radio__btn-container {
	position: relative;
	margin-bottom: 1.5rem;
}

.radio__btn {
	outline: none;
	position: absolute;
	height: 1.3rem;
	top: 2.95rem;
	left: -8.5rem;
}

.radio__btn:nth-of-type(2) {
	top: 6.5rem;
}

.radio__btn {
	accent-color: var(--clr-lime);
}

.radio__btn-label {
	border: 1px solid var(--clr-slate-700);
	padding: 0.6rem 0 0.6rem 3.4rem;
	border-radius: 6px;
	font-weight: var(--fw-bold);
	color: var(--clr-slate-900);
}

.radio__btn:hover + .radio__btn-label {
	background-color: transparent;
	border: 1px solid var(--clr-lime);
	cursor: pointer;
}

.radio__btn:checked + .radio__btn-label {
	border: 1px solid var(--clr-lime);
	background-color: #f9fae0;
}

.btn__submit {
	width: 100%;
	border-radius: 2rem;
	border: none;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 0.7rem;
	background-color: var(--clr-lime);
	padding: 0.85rem 0;
	font-weight: var(--fw-bold);
	color: var(--clr-slate-900);
}

.btn__submit:hover {
	cursor: pointer;
	opacity: 0.75;
}

.btn__submit:focus {
	opacity: 0.65;
}

.results__container {
	text-align: center;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	background-color: var(--clr-slate-900);
	gap: 0.8rem;
	padding: 1.75rem;
}

.results__title {
	color: var(--clr-white);
	font-weight: var(--fw-bold);
	font-size: var(--fs-big);
}

.results__description {
	color: var(--clr-slate-300);
}

@media (min-width: 770px) {
	main {
		padding: 2.5rem;
		background-color: var(--clr-slate-100);
	}

	.calculator {
		border-radius: 1.5rem;
		overflow: hidden;
	}

	.calculator__header {
		padding: 1.8rem 2.2rem;
		display: flex;
		justify-content: space-between;
	}

	.header__title {
		font-size: var(--fs-big);
	}

	.header__btn {
		align-self: baseline;
		transform: translateY(0.4rem);
	}

	.form__container {
		padding: 0rem 2.3rem 2rem;
	}

	.mortgage__amount-symbol {
		position: absolute;
		top: 2.15rem;
	}

	.form__secondary__container {
		display: flex;
		justify-content: space-between;
	}

	.form__secondary__container input {
		width: 300px;
	}

	.radio__btn {
		left: -17.5rem;
	}

	.radio__btn:nth-of-type(2) {
		top: 6.45rem;
	}

	.btn__submit {
		width: 50%;
	}
}

@media (min-width: 1440px) {
	main {
		display: flex;
		justify-content: center;
		align-items: center;
		min-height: 100vh;
	}

	.calculator {
		max-width: 1008px;
		max-height: 606px;
		display: grid;
		grid-template-columns: 50% 50%;
		box-shadow: 0px 2px 35px -5px rgba(158, 154, 154, 0.288);
	}

	.calculator__header {
		grid-column: 1;
	}

	.form__container {
		grid-column: 1;
	}

	.form__secondary__container input {
		width: 204px;
	}

	.radio__btn {
		left: -11.5rem;
	}

	.results__container {
		grid-column: 2;
		grid-row: 1/3;
		border-bottom-left-radius: 5rem;
	}

	.btn__submit {
		width: 67%;
	}
}
