/**
 * お問い合わせフォーム（sumida-cc/contact-form）とフォームの部品。
 *
 * Figma: PC 1244:44424 / SP 1244:44499 / 完了 3190:50567 / form__text 1477:47122 / form__select 1508:54780。
 * 部品のステートは外側の data-state（default|success|error）。focus は :focus-within。
 * 部品（form-field / form-choices / form-choice）はフォームの外でも使える独立した Block。
 * SP/PC 切替は theme.json tablet-small（768px）。
 */

/* -------------------------------------------------------------------------- */
/* contact-form（ブロックの殻）                                                 */
/* -------------------------------------------------------------------------- */

.contact-form {
	font-family: var(--wp--preset--font-family--jp-sans);
	color: var(--wp--preset--color--base-black);
}

.contact-form__inner {
	display: flex;
	flex-direction: column;
	gap: var(--wp--custom--organism--md);
}

.contact-form__lead {
	margin: 0;
	font-size: var(--wp--preset--font-size--text-lg);
	line-height: var(--wp--custom--line-height--x-wide);
}

.contact-form__heading {
	margin: 0;
	font-size: var(--wp--preset--font-size--heading-xs);
	font-weight: var(--wp--custom--font-weight--medium);
	line-height: var(--wp--custom--line-height--narrow);
}

.contact-form__noscript {
	margin: var(--wp--custom--molecule--rg) 0 0;
	color: var(--wp--preset--color--state-alert);
	font-size: var(--wp--preset--font-size--text-sm);
}

.contact-form__form {
	margin-block-start: var(--wp--custom--organism--rg);
}

/* ハニーポット（人には見えない項目）。display:none だと読み飛ばすボットがあるため、画面外に出す */
.contact-form__trap {
	position: absolute;
	inset-inline-start: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* reCAPTCHA のバッジは隠し、ボタンの近くに表記を出す（Google の規約で認められた方法） */
.grecaptcha-badge {
	visibility: hidden;
}

/* --- 定義リストの行（項目名｜必須ラベル｜入力）。core の definition-list の線・余白を外す --- */

.contact-form .contact-form__list {
	max-width: 50rem; /* 800px */
	margin: 0;
	border: 0;
}

.contact-form .contact-form__row {
	padding-block: var(--wp--custom--molecule--lg);
	border: 0;
}

.contact-form .contact-form__row[hidden] {
	display: none;
}

.contact-form .contact-form__term {
	padding: 0;
	border: 0;
	font-size: var(--wp--preset--font-size--text-lg);
	font-weight: var(--wp--custom--font-weight--regular);
	line-height: var(--wp--custom--line-height--regular);
}

.contact-form .contact-form__desc {
	display: grid;
	grid-template-columns: 2.5rem minmax(0, 1fr);
	column-gap: var(--wp--custom--atom--xxl);
	align-items: start;
	padding: 0;
}

/* 必須ラベル。入力欄（48px）の高さの中央に置く */
.contact-form .contact-form__required {
	grid-column: 1;
	margin-block-start: 0.75rem;
	border-color: var(--wp--preset--color--state-alert);
	color: var(--wp--preset--color--state-alert);
}

.contact-form__control {
	grid-column: 2;
	min-width: 0;
}

@media (min-width: 768px) {
	.contact-form .contact-form__row {
		padding-inline: 0;
	}

	.contact-form .contact-form__term {
		flex: 0 0 12.5rem; /* 200px */
		width: 12.5rem;
		/* 1行目を入力欄（48px）の中央にそろえる */
		padding-block-start: calc((3rem - 1em * 1.5) / 2);
		padding-inline-end: var(--wp--custom--atom--xxl);
	}

	.contact-form .contact-form__desc {
		padding-inline-start: var(--wp--custom--atom--xxl);
	}
}

@media (max-width: 767px) {
	.contact-form .contact-form__row {
		padding-block: var(--wp--custom--molecule--xxs);
	}

	.contact-form .contact-form__term {
		padding-block: var(--wp--custom--atom--rg);
	}
}

/* --- 同意・ボタン（__foot） --- */

.contact-form__foot {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--custom--molecule--rg);
}

.contact-form__agreements {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--custom--atom--xxl);
}

.contact-form__hint,
.contact-form__recaptcha {
	margin: 0;
	font-size: var(--wp--preset--font-size--text-xs);
	line-height: var(--wp--custom--line-height--regular);
	text-align: center;
}

.contact-form__hint[hidden],
.contact-form__alert[hidden] {
	display: none;
}

.contact-form__recaptcha {
	max-width: 32rem;
	color: color-mix(in srgb, var(--wp--preset--color--base-black) 60%, transparent);
}

.contact-form__recaptcha a {
	color: inherit;
}

.contact-form__alert {
	margin: 0;
	color: var(--wp--preset--color--state-alert);
	font-size: var(--wp--preset--font-size--text-sm);
	line-height: var(--wp--custom--line-height--regular);
	text-align: center;
}

/*
 * 送信ボタン・完了の HOME（Figma のページのインスタンス 1477:47345 / 3190:50605 に合わせる）。
 * 部品（3199:56246、168×48）より大きい 234×72。色は core の roll=send と同じ（白地・灰の枠）。
 */
.contact-form :is(.contact-form__submit, .contact-form-done__foot) .wp-block-button .btn[data-role] {
	--sumida-btn-pad: var(--wp--custom--atom--xxl);
	--sumida-btn-gap: var(--wp--custom--atom--xxl);
	--wp--custom--icon--size: 1.5rem;
	min-width: 14.625rem; /* 234px */
	min-height: 4.5rem; /* 72px */
	font-size: var(--wp--preset--font-size--text-xl);
}

.contact-form .contact-form-done__foot .wp-block-button .btn[data-role] {
	--hover-invert-border: var(--wp--preset--color--logo-blue);
	border-color: var(--wp--preset--color--line-grey);
	color: var(--wp--preset--color--base-black);
}

@media (max-width: 767px) {
	.contact-form__agreements {
		align-items: stretch;
		width: 100%;
	}
}

/* -------------------------------------------------------------------------- */
/* contact-form-done（完了画面）                                                */
/* -------------------------------------------------------------------------- */

.contact-form-done {
	display: flex;
	flex-direction: column;
	gap: var(--wp--custom--organism--md);
}

.contact-form-done[hidden],
.contact-form :is(.contact-form__head, .contact-form__body, .contact-form__foot)[hidden] {
	display: none;
}

.contact-form-done__heading {
	margin: 0;
	font-size: var(--wp--preset--font-size--heading-md);
	font-weight: var(--wp--custom--font-weight--bold);
	line-height: var(--wp--custom--line-height--regular);
}

.contact-form-done__heading:focus {
	outline: none;
}

.contact-form-done__text {
	margin: 0;
	font-size: var(--wp--preset--font-size--text-xl);
	line-height: var(--wp--custom--line-height--relax);
}

.contact-form-done__foot {
	display: flex;
	justify-content: center;
}

/* -------------------------------------------------------------------------- */
/* form-field（1行のテキスト・メール・セレクト・複数行）                        */
/* -------------------------------------------------------------------------- */

.form-field {
	display: flex;
	flex-direction: column;
	gap: var(--wp--custom--atom--rg);
	width: 100%;
}

.form-field__body {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--wp--custom--atom--rg);
	box-sizing: border-box;
	padding-inline: var(--wp--custom--atom--rg);
	border-bottom: var(--wp--custom--border-width--thin) solid var(--wp--preset--color--line-grey);
	transition: background-color 0.2s, border-color 0.2s;
}

.form-field__input {
	flex: 1 1 auto;
	box-sizing: border-box;
	min-width: 0;
	min-height: 2.9375rem; /* 47px（線と合わせて 48px） */
	margin: 0;
	padding-block: var(--wp--custom--atom--lg);
	padding-inline: var(--wp--custom--atom--xxl) 2.5rem;
	border: 0;
	border-radius: 0;
	background-color: var(--wp--preset--color--base-white);
	color: var(--wp--preset--color--base-black);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--text-lg);
	font-weight: var(--wp--custom--font-weight--medium);
	line-height: var(--wp--custom--line-height--narrow);
	appearance: none;
}

.form-field__input::placeholder {
	color: color-mix(in srgb, var(--wp--preset--color--base-black) 30%, transparent);
	opacity: 1;
}

.form-field__input:focus {
	outline: none;
}

.form-field__prefix,
.form-field__icon {
	display: inline-flex;
	flex-shrink: 0;
	color: var(--wp--preset--color--base-black);
}

.form-field__prefix .icon,
.form-field__icon .icon {
	inline-size: 1.5rem;
	block-size: 1.5rem;
}

/* 状態のアイコン・セレクトの矢印は入力欄の右端に重ねる（矢印を押してもセレクトが開くよう、クリックを通す） */
.form-field__suffix {
	position: absolute;
	inset-block-start: 50%;
	inset-inline-end: var(--wp--custom--atom--rg);
	display: flex;
	translate: 0 -50%;
	pointer-events: none;
}

.form-field__icon {
	display: none;
}

.form-field__icon--caret {
	display: inline-flex;
}

.form-field__foot {
	margin: 0;
	color: var(--wp--preset--color--state-alert);
	font-size: var(--wp--preset--font-size--text-xs);
	line-height: var(--wp--custom--line-height--narrow);
	text-align: end;
}

.form-field__foot[hidden] {
	display: none;
}

/* focus（Figma state=focus）：背景を bg-blue に */
.form-field:focus-within .form-field__body {
	background-color: var(--wp--preset--color--bg-blue);
}

.form-field:focus-within .form-field__input {
	background-color: transparent;
}

/* success */
.form-field[data-state="success"] .form-field__body {
	border-bottom-color: var(--wp--preset--color--state-success);
}

.form-field[data-state="success"] .form-field__icon--success {
	display: inline-flex;
	color: var(--wp--preset--color--state-success);
}

/* error */
.form-field[data-state="error"] .form-field__body {
	background-color: var(--wp--preset--color--bg-yellow);
}

.form-field[data-state="error"] .form-field__input {
	background-color: transparent;
}

.form-field[data-state="error"] .form-field__icon--error {
	display: inline-flex;
	color: var(--wp--preset--color--state-alert);
}

.form-field:is([data-state="success"], [data-state="error"]) .form-field__icon--caret {
	display: none;
}

/* セレクト：ネイティブの select に見た目を当てる */
.form-field--select .form-field__input {
	cursor: pointer;
}

/* 文字色：success は緑・error は赤（1行のテキスト・メール・セレクト。複数行は黒のまま） */
.form-field:not(.form-field--textarea)[data-state="success"] .form-field__input {
	color: var(--wp--preset--color--state-success);
}

.form-field:not(.form-field--textarea)[data-state="error"] .form-field__input {
	color: var(--wp--preset--color--state-alert);
}

/* 複数行：状態のアイコンは右上 */
.form-field--textarea .form-field__body {
	align-items: stretch;
}

.form-field--textarea .form-field__input {
	min-height: 12.5rem; /* 200px */
	line-height: var(--wp--custom--line-height--regular);
	resize: vertical;
}

.form-field--textarea .form-field__suffix {
	inset-block-start: var(--wp--custom--atom--lg);
	translate: none;
}

/* -------------------------------------------------------------------------- */
/* form-choices / form-choice（チェックボックス・ラジオ・同意）                 */
/* -------------------------------------------------------------------------- */

.form-choices {
	display: flex;
	flex-direction: column;
	gap: var(--wp--custom--atom--xxs);
}

.form-choices__list {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--custom--atom--xxs);
}

.form-choices__foot {
	margin: 0;
	color: var(--wp--preset--color--state-alert);
	font-size: var(--wp--preset--font-size--text-xs);
	line-height: var(--wp--custom--line-height--narrow);
}

.form-choices__foot[hidden],
.form-choice__foot[hidden] {
	display: none;
}

/* 「その他」のテキスト */
.form-choices > .form-field {
	margin-block-start: var(--wp--custom--atom--xxl);
}

/*
 * 選択肢 1 つ。Figma form--checkbox 1513:74067 / form--radio 1513:74172（default / hover / checked）。
 * hover・checked は CSS だけで切り替える（JS は使わない）。
 * checked の枠でずれないよう、枠は常に 1px（透明）で持つ。
 */
.form-choice {
	position: relative;
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--wp--custom--atom--xs);
	padding: calc(var(--wp--custom--atom--rg) - 1px) calc(var(--wp--custom--atom--md) - 1px);
	border: var(--wp--custom--border-width--thin) solid transparent;
	background-color: var(--wp--preset--color--base-white);
	color: var(--wp--preset--color--base-black);
	font-size: var(--wp--preset--font-size--text-sm);
	line-height: var(--wp--custom--line-height--narrow);
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.form-choice[hidden] {
	display: none;
}

.form-choice label {
	cursor: pointer;
}

/* ネイティブの input は見えなくして残す（キーボード・読み上げはそのまま） */
.form-choice__input {
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: var(--wp--custom--atom--md);
	width: 1rem;
	height: 1rem;
	margin: 0;
	opacity: 0;
	translate: 0 -50%;
}

/* アイコンの箱は 16px で固定（中の span を inline のままにすると行の高さを持ち、チェックの前後で高さが変わる） */
.form-choice__icon {
	display: inline-flex;
	flex-shrink: 0;
	inline-size: 1rem;
	block-size: 1rem;
}

.form-choice__icon-off,
.form-choice__icon-on {
	display: flex;
}

.form-choice__icon .icon {
	inline-size: 1rem;
	block-size: 1rem;
}

.form-choice__icon-on {
	display: none;
}

.form-choice__input:checked ~ .form-choice__icon .form-choice__icon-off {
	display: none;
}

.form-choice__input:checked ~ .form-choice__icon .form-choice__icon-on {
	display: flex;
}

.form-choice__input:focus-visible ~ .form-choice__icon {
	outline: 1px solid var(--wp--preset--color--logo-blue);
	outline-offset: 2px;
}

.form-choice__label {
	flex: 1 1 0;
	min-width: 0;
}

/* checked：枠・文字・アイコンを state-success、文字は medium */
.form-choice:has(> .form-choice__input:checked) {
	border-color: var(--wp--preset--color--state-success);
	color: var(--wp--preset--color--state-success);
}

.form-choice:has(> .form-choice__input:checked) .form-choice__label {
	font-weight: var(--wp--custom--font-weight--medium);
}

/* hover：未チェックのときだけ背景 bg-blue・文字とアイコン logo-blue */
@media (hover: hover) and (pointer: fine) {
	.form-choice:not(:has(> .form-choice__input:checked)):hover {
		background-color: var(--wp--preset--color--bg-blue);
		color: var(--wp--preset--color--logo-blue);
	}
}

.form-choice__link {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.form-choice__foot {
	flex-basis: 100%;
	margin: 0;
	color: var(--wp--preset--color--state-alert);
	font-size: var(--wp--preset--font-size--text-xs);
	line-height: var(--wp--custom--line-height--narrow);
	text-align: center;
}

@media (hover: hover) and (pointer: fine) {
	.form-choice__link:hover {
		color: var(--wp--preset--color--logo-blue);
	}
}

.form-choice__link:focus-visible {
	outline: 1px solid var(--wp--preset--color--logo-blue);
	outline-offset: 2px;
}

/* error（Figma にバリアントが無いため form-field に合わせ、文字とアイコンを state-alert に） */
.form-choices[data-state="error"] .form-choice,
.form-choice--agree[data-state="error"] {
	color: var(--wp--preset--color--state-alert);
}
