:root {
	--formHeight: calc(100vh - (var(--unit) * 2 + var(--navHeight)));
	--envelopeWidth: 20vw;
}

@supports(width: 1svw) {
	:root {
		--formHeight: calc(100svh - (var(--unit) * 2 + var(--navHeight)));
		--envelopeWidth: 20svw;
		--coverImageWidth: 100svw;
	}
}

form {
	display: grid;
	grid-template-columns: 1.5fr 2fr 2fr;
	grid-template-rows: auto 1fr;
	gap: var(--halfUnit);
	height: var(--formHeight);
	position: relative;
}

.formItem {
	background: var(--containerBg);
	padding: var(--quarterUnit);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	border: 2px dotted var(--color1);
}

.formItem.header {
	grid-column: span 3;
	background: none;
	padding: 0;
	margin-bottom: calc(var(--quarterUnit) * -1.5);
}

.formItem:nth-child(4) {
	grid-column: span 2;
	width: 100%;
}

#envelopeShape {
	width: var(--envelopeWidth);
	height: calc(var(--envelopeWidth) * 0.6);
	transition: transform 0.3s ease;
	background-color: var(--color1);
	margin: auto auto;
}

#envelopeShape:hover {
	transform: translateX(6rem);
	cursor: pointer;
}

.formItem[type="submit"] {
	clip-path: polygon(0% 0%, 50% 40%, 100% 0%, 100% 100%, 0% 100%);
	width: 100%;
	height: 100%;
	padding-top: var(--halfUnit);
	border: none;
}

.formItem[type="submit"]:hover {
	cursor: pointer;
}

label,
input {
	margin-bottom: var(--eighthUnit);
	font-weight: bold;
	font-size: 1.3em;
}

input {
	border: 1px solid var(--color1);
	width: min(100%, 22rem);
	background: transparent;
	height: 2.5rem;
}

textarea {
	width: min(100%, 35rem);
	background: transparent;
	border: 1px solid var(--color1);
	resize: none;
	flex-grow: 1;
}

.contactCloseText.short {
	display: none;
}

.contactCloseText {
	position: absolute;
	bottom: calc(100% + 1rem);
	right: 1rem;
	text-align: right;
}

.contactCloseText,
.contactCloseText * {
	color: var(--color2);
	display: inline-block;
	transition: transform 0.5s ease;
}

.contactCloseText a:hover {
	transform: translateX(-1em);
}

dialog {
	background: var(--color4);
	width: 40%;
	height: 40%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	display: none;
	border: 2px var(--color1) solid;
}

dialog * {
	font-size: 2rem;
	text-align: center;
}

dialog div:first-child {
	margin-bottom: var(--eighthUnit);
}

dialog::backdrop {
	background: rgba(0, 0, 0, 0.5);
}




@media (max-width: 1150px) or (max-aspect-ratio: 1/3) {
	:root {
		--envelopeWidth: 30vw;
	}

	form {
		display: grid;
		grid-template-columns: 1fr 1.5fr;
		grid-template-rows: auto auto 1.8fr 1fr;
		height: auto;
		gap: var(--quarterUnit);
	}

	.formItem:nth-child(3),
	.formItem:nth-child(4) {
		grid-column: span 2;
	}

	#envelopeShape {
		grid-column: span 2;
		margin: var(--halfUnit) auto 0 auto;
	}

	#envelopeShape:hover {
		transform: translateX(4rem);
	}

	input {
		width: min(100%, 35rem);
		height: 2.5rem;
	}

	textarea {
		width: min(100%, 35rem);
	}
}



@media (max-width: 700px) or (max-aspect-ratio: 1/3) {
	form {
		gap: var(--quarterUnit);
	}

	.formItem.header {
		margin-bottom: calc(var(--eighthUnit) * -1);
	}
}



@media (max-width: 575px) or (max-aspect-ratio: 1/3) {
	:root {
		--envelopeWidth: 40vw;
	}

	.contactCloseText.long {
		display: none;
	}

	.contactCloseText.short {
		display: inline-block;
	}

	.contactCloseText.short img {
		display: inline;
		vertical-align: top;
		height: 1.3rem;
		width: 1.3rem;
	}
}


@media (pointer: coarse) and (hover: none) {
	.contactCloseText a {
		animation: shiftleft 5s infinite;
	}

	#envelopeShape:hover,
	.contactCloseText a:hover {
		transform: none;
	}

	#envelopeShape {
		animation: scale 5s ease-in-out infinite;
	}
}



@media (max-width: 1440px) and (min-width: 1024px) {
	form {
		gap: var(--quarterUnit);
	}

	.formItem.header {
		margin-bottom: calc(var(--eighthUnit) * -1.5);
	}
}