/*
 * Rectus form pages (page-contact-form.php, page-quotation.php).
 * The form markup comes from Rectus (ef.js renders it into #recef, classes rectusenq_*);
 * Rectus' own enqform_rp.css is not loaded, so everything the form needs is styled here.
 * Rectus also injects a <style> with background/text colours for .rectusenq_q / .rectusenq_a,
 * which the #recef-scoped rules below override.
 */

.contact-page {
	color: var(--main-navy);
	background: var(--background-white);
}

.contact-page__inner {
	width: min(100%, 1060px);
	margin: 0 auto;
	padding: 100px 80px 120px;
}

.contact-page__intro p {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.45;
	letter-spacing: 0.08em;
}

.contact-page__intro p + p {
	margin-top: 20px;
}

.contact-page__intro a {
	color: #2b46c8;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.contact-form {
	margin-top: 76px;
}

.contact-form__title {
	margin-bottom: 30px;
}

/* ---------- Rectus form: base ---------- */

#recef {
	color: var(--main-navy);
	font-family: var(--font-sans);
	text-align: left;
}

#recef form {
	margin: 0;
}

/* Question numbers ("1. ") appear on forms without Rectus' 質問番号を表示しない setting (e.g. No.3). */
#recef .rectusenq_necessary,
#recef .rectusenq_red,
#recef .rectusenq_number {
	display: none;
}

#recef .rectusenq_br {
	clear: both;
}

#recef input,
#recef textarea,
#recef select,
#recef button {
	font-family: var(--font-sans);
}

#recef .contact-required {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 4px 2px;
	color: var(--background-white);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.05em;
	vertical-align: 0.25em;
	background: var(--main-red);
	border-radius: 2px;
}

/* ---------- Questions ---------- */

/* Choice lists already end with a 14px label margin, hence less than the 50px in the design. */
#recef .rectusenq_question + .rectusenq_question {
	margin-top: 38px;
}

#recef .rectusenq_qa {
	margin: 0;
	padding: 0;
	border: 0;
}

#recef .rectusenq_q,
#recef .rectusenq_a,
#recef .rectusenq_a label:not(.contact-file__button) {
	color: var(--main-navy);
	background: transparent;
}

#recef .rectusenq_q {
	padding: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.12em;
	border: 0;
}

#recef .contact-question-note {
	display: block;
	margin-top: 6px;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.08em;
}

#recef .contact-question-note a {
	color: #2b46c8;
	text-decoration: underline;
	text-underline-offset: 3px;
}

#recef .rectusenq_a {
	margin-top: 14px;
	padding: 0;
}

/* Text set after a field in Rectus (e.g. 型式's "※製品銘板をご確認ください"), shown under it by contact.js. */
#recef .contact-answer-note {
	display: block;
	margin-top: 8px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.5;
	letter-spacing: 0.08em;
}

/*
 * Rectus separates choices with &nbsp; text nodes. font-size: 0 collapses them, and spacing comes
 * from label margins rather than flex gap (gap would also apply around those empty text items).
 */
#recef .contact-choices {
	display: flex;
	flex-wrap: wrap;
	margin-right: -22px;
	font-size: 0;
}

#recef .contact-choices label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0 22px 14px 0;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
	letter-spacing: 0.08em;
	cursor: pointer;
}

#recef .contact-choices .rectusenq_check {
	display: inline-flex;
	width: auto;
	height: auto;
}

#recef input[type="checkbox"],
#recef input[type="radio"] {
	flex: 0 0 auto;
	display: inline-grid;
	place-content: center;
	width: 16px;
	height: 16px;
	margin: 0;
	background: var(--background-white);
	border: 1px solid var(--border-gray);
	border-radius: 2px;
	cursor: pointer;
	appearance: none;
}

#recef input[type="radio"] {
	border-radius: 50%;
}

#recef input[type="checkbox"]::before {
	width: 9px;
	height: 5px;
	margin-top: -2px;
	content: "";
	border-bottom: 2px solid var(--background-white);
	border-left: 2px solid var(--background-white);
	transform: rotate(-45deg) scale(0);
	transition: transform var(--duration-fast) var(--ease-standard);
}

#recef input[type="radio"]::before {
	width: 6px;
	height: 6px;
	content: "";
	background: var(--background-white);
	border-radius: 50%;
	transform: scale(0);
	transition: transform var(--duration-fast) var(--ease-standard);
}

#recef input[type="checkbox"]:checked,
#recef input[type="radio"]:checked {
	background: var(--main-red);
	border-color: var(--main-red);
}

#recef input[type="checkbox"]:checked::before {
	transform: rotate(-45deg) scale(1);
}

#recef input[type="radio"]:checked::before {
	transform: scale(1);
}

#recef input[type="checkbox"]:focus-visible,
#recef input[type="radio"]:focus-visible {
	outline: 2px solid var(--main-red);
	outline-offset: 2px;
}

/* ---------- Text inputs ---------- */

#recef input[type="text"],
#recef input[type="email"],
#recef input[type="tel"],
#recef textarea,
#recef select {
	display: block;
	width: 100%;
	max-width: none;
	height: 44px;
	margin: 0;
	padding: 0 15px;
	color: var(--main-navy);
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.06em;
	background: var(--background-white);
	border: 1px solid var(--border-gray);
	border-radius: 0;
	box-shadow: none;
	appearance: none;
}

#recef textarea {
	height: 260px;
	padding: 12px 15px;
	line-height: 1.7;
	resize: vertical;
}

#recef select {
	padding-right: 48px;
	cursor: pointer;
	background: var(--background-white)
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M1 1l7 7 7-7' fill='none' stroke='%23b93753' stroke-width='2'/%3E%3C/svg%3E")
		no-repeat right 16px center / 16px 10px;
}

#recef input::placeholder,
#recef textarea::placeholder {
	color: var(--text-gray);
	opacity: 1;
}

#recef input[type="text"]:focus,
#recef input[type="email"]:focus,
#recef input[type="tel"]:focus,
#recef textarea:focus,
#recef select:focus {
	background-color: var(--background-white);
	border-color: var(--main-navy);
	outline: 2px solid rgba(0, 32, 65, 0.15);
	outline-offset: 0;
	box-shadow: none;
}

/* ---------- File attachment ---------- */

#recef .contact-file {
	position: relative;
	display: flex;
	align-items: center;
	gap: 28px;
	margin-top: 4px;
}

#recef .contact-file input[type="file"] {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
}

#recef .contact-file__button {
	display: inline-grid;
	place-items: center;
	min-width: 183px;
	min-height: 44px;
	margin: 0;
	padding: 0 20px;
	color: var(--background-white);
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.08em;
	background: var(--main-red);
	border: 1px solid var(--main-red);
	cursor: pointer;
	transition:
		color var(--duration-fast) var(--ease-standard),
		background-color var(--duration-fast) var(--ease-standard);
}

#recef .contact-file input[type="file"]:focus-visible + .contact-file__button {
	outline: 2px solid var(--main-navy);
	outline-offset: 3px;
}

#recef .contact-file__name {
	min-width: 0;
	overflow: hidden;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------- Customer information ---------- */

#recef .rectusenq_cusinfo {
	margin-top: 100px;
	font-size: 16px;
}

#recef .rectusenq_cusinfo_warn:empty {
	display: none;
}

.contact-form__title,
#recef .rectusenq_cusinfo_subj {
	position: relative;
	margin: 0 0 30px;
	padding: 0 0 12px;
	font-size: 30px;
	font-weight: 500;
	line-height: 1.5;
	letter-spacing: 0.08em;
	border: 0;
	border-bottom: 2px solid #e0e0e0;
}

.contact-form__title::after,
#recef .rectusenq_cusinfo_subj::after {
	position: absolute;
	bottom: -2px;
	left: 0;
	width: 52px;
	height: 2px;
	content: "";
	background: var(--main-red);
}

/* The first .rectusenq_cusinfo_fm right after the heading is an empty spacer. */
#recef .rectusenq_cusinfo_subj + .rectusenq_cusinfo_fm:empty {
	display: none;
}

#recef .rectusenq_cusinfo_item {
	float: none;
	width: auto;
	margin: 0 0 8px;
	padding: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.1em;
	border: 0;
}

#recef .rectusenq_cusinfo_fm {
	float: none;
	width: auto;
	padding: 0;
	border: 0;
}

#recef .rectusenq_cusinfo_fm + .rectusenq_br + .rectusenq_cusinfo_item {
	margin-top: 26px;
}

#recef .rectusenq_cusinfo_msg {
	display: block;
	margin-top: 8px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.5;
	letter-spacing: 0.08em;
}

/* The 〒 field cell: input and 自動入力 button side by side, the help line below them. */
#recef .contact-zip {
	display: grid;
	grid-template-columns: minmax(0, 280px) auto;
	gap: 8px 12px;
	justify-content: start;
}

#recef .contact-zip > .rectusenq_cusinfo_msg {
	grid-column: 1 / -1;
	margin-top: 0;
}

#recef .contact-zip input[type="text"] {
	width: 100%;
}

#recef .contact-zip__button {
	min-width: 100px;
	padding: 0 16px;
	color: var(--main-navy);
	font-size: 15px;
	font-weight: 500;
	letter-spacing: 0.08em;
	background: var(--light-blue);
	border: 1px solid var(--main-navy);
	border-radius: 2px;
	cursor: pointer;
	transition: background-color var(--duration-fast) var(--ease-standard);
}

#recef .contact-zip__button:focus-visible {
	outline: 2px solid var(--main-red);
	outline-offset: 2px;
}

#recef .rectusenq_cusinfo > .rectusenq_cusinfo_exp {
	margin: 50px 0 0;
}

#recef .contact-memorize {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0.1em;
	cursor: pointer;
}

#recef .contact-memorize input[type="checkbox"] {
	margin-top: 3px;
}

/* Questions placed after the customer information by contact.js (e.g. お問い合わせ・ご依頼内容). */
#recef .contact-after-customer {
	margin-top: 40px;
}

/* Privacy-policy consent (moved after the customer information by contact.js). */
#recef .contact-consent {
	margin-top: 40px;
}

#recef .contact-consent .rectusenq_q {
	display: none;
}

#recef .contact-consent .rectusenq_a {
	margin-top: 0;
}

#recef .contact-consent label {
	font-size: 16px;
	letter-spacing: 0.1em;
}

#recef .contact-consent a {
	color: var(--main-red);
	text-decoration: underline;
	text-underline-offset: 4px;
}

/* ---------- Buttons ---------- */

#recef .rectusenq_c {
	margin-top: 110px;
	text-align: center;
}

#recef .rectusenq_c .rectusenq_cusinfo_exp {
	margin: 0;
}

#recef .rectusenq_bt_set {
	display: flex;
	flex-wrap: wrap;
	gap: 20px 44px;
	justify-content: center;
}

#recef .rectusenq_bt_send,
#recef .rectusenq_bt_back {
	display: block;
	width: auto;
	margin: 0;
}

#recef .rectusenq_bt_set button {
	position: static;
	top: auto;
	width: 216px;
	height: 56px;
	margin: 0;
	padding: 0 20px;
	font-size: 18px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.12em;
	text-transform: none;
	border-radius: 2px;
	box-shadow: none;
	cursor: pointer;
	transition:
		color var(--duration-fast) var(--ease-standard),
		background-color var(--duration-fast) var(--ease-standard),
		border-color var(--duration-fast) var(--ease-standard);
}

#recef .rectusenq_bt_send button {
	color: var(--background-white);
	background: var(--main-red);
	border: 1px solid var(--main-red);
}

#recef .rectusenq_bt_back button {
	color: var(--main-navy);
	background: #e0e0e0;
	border: 1px solid #e0e0e0;
}

#recef .rectusenq_bt_set button::after {
	content: none;
}

#recef .rectusenq_bt_set button:focus-visible {
	outline: 2px solid var(--main-navy);
	outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
	#recef .contact-file__button:hover {
		color: var(--main-red);
		background: var(--background-white);
	}

	#recef .contact-zip__button:hover {
		background: var(--background-white);
	}

	#recef .rectusenq_bt_send button:hover {
		color: var(--main-red);
		background: var(--background-white);
	}

	#recef .rectusenq_bt_back button:hover {
		background: var(--background-white);
		border-color: var(--border-gray);
	}
}

/* ---------- Confirmation popup (added to <body> by ef.js; its inside is a Rectus-hosted iframe) ---------- */

.rectusenq_grayout {
	z-index: 1100 !important;
	background: rgba(0, 32, 65, 0.5);
}

/* ef.js positions the popup wrapper with inline styles (z-index 10000) around the title and #rectusenq_confirm. */
.rectusenq_popup_title {
	padding: 16px 24px;
	color: var(--background-white);
	font-family: var(--font-sans);
	font-size: 18px;
	font-weight: 700;
	letter-spacing: 0.1em;
	background: var(--main-navy);
}

.rectusenq_popup {
	text-align: center;
	background: var(--background-white);
	box-shadow: 0 12px 32px rgba(0, 32, 65, 0.25);
}

/*
 * ef.js centres the popup from its width when it opens, so the iframe sets the width: the screen width less
 * a 20px margin each side (room for a desktop scrollbar too), up to 680px.
 * The confirmation itself is a Rectus page inside the iframe, which this stylesheet cannot reach.
 */
#rectusenq_confirm iframe {
	display: block;
	width: min(680px, calc(100vw - 40px));
	height: 385px;
	overflow: hidden;
	border: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
	.contact-page__inner {
		padding-right: 40px;
		padding-left: 40px;
	}
}

@media (max-width: 820px) {
	.contact-page__inner {
		padding: 12.82vw min(20px, 5.13vw) 20.51vw;
	}

	.contact-page__intro br {
		display: none;
	}

	.contact-form {
		margin-top: 50px;
	}

	#recef .rectusenq_question + .rectusenq_question {
		margin-top: 40px;
	}

	#recef .rectusenq_q {
		font-size: 17px;
		letter-spacing: 0.08em;
	}

	#recef .contact-choices {
		margin-right: -18px;
	}

	#recef .contact-choices label {
		margin: 0 18px 12px 0;
	}

	#recef .contact-file {
		gap: 16px;
	}

	#recef .contact-file__button {
		min-width: 150px;
	}

	#recef .rectusenq_cusinfo {
		margin-top: 70px;
	}

	#recef .rectusenq_cusinfo_subj {
		font-size: 24px;
	}

	#recef .contact-memorize {
		font-size: 14px;
		letter-spacing: 0.06em;
	}

	#recef .rectusenq_c {
		margin-top: 60px;
	}

	#recef .rectusenq_bt_set {
		flex-direction: column;
		align-items: center;
	}

	#recef .rectusenq_bt_set button {
		width: min(280px, 100%);
	}
}
