/**
 * 予約フォームの補いの見た目（form.js が作る部品だけ）。予約ページだけで読む。
 * 色と文字の大きさは、テーマ（theme.json）のプリセットの変数を使う。切り替えの幅は 782px。
 */

/* 時間帯：タップで選べるボタン。元の選択欄は送る値のために残し、画面には出さない */
.im-booking .im-time-native {
	display: none !important;
}

.im-form__datetime.is-chips {
	display: block;
}

.im-form__datetime.is-chips > .im-form__sub:first-child {
	display: block;
	max-width: 280px;
}

.im-time-chips {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 8px;
	margin-top: 12px;
}

.im-time-chip {
	box-sizing: border-box;
	min-height: 48px;
	margin: 0;
	padding: 8px 4px;
	border: 1px solid var(--wp--custom--color--line-field);
	border-radius: 4px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium);
	font-variant-numeric: tabular-nums;
	line-height: 1.4;
	cursor: pointer;
}

.im-time-chip:hover {
	border-color: var(--wp--preset--color--navy);
}

/* 選んだボタン：塗りと太字（色だけで伝えない） */
.im-time-chip[aria-pressed="true"] {
	border-color: var(--wp--preset--color--navy);
	background: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--white);
	font-weight: 700;
}

.im-time-chip:focus-visible {
	outline: 3px solid var(--wp--custom--color--link);
	outline-offset: 2px;
}

/* エラーのとき：枠を太く、背景を淡く（テーマの入力欄のエラーと同じ） */
.im-time-chips.is-invalid .im-time-chip:not([aria-pressed="true"]) {
	border: 2px solid var(--wp--custom--color--error);
	background: var(--wp--custom--color--error-bg);
}

/* 時間帯のエラー文は、ボタンの下に出る */
.im-time-chips + .im-form__sub {
	display: block;
}

/* メールアドレスの打ち間違いのお知らせ */
.im-email-suggest {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin: 8px 0 0 !important;
	padding: 10px 12px;
	border-left: 3px solid var(--wp--preset--color--gold);
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.6;
	word-break: break-all;
}

.im-email-suggest[hidden] {
	display: none;
}

.im-email-suggest__button {
	min-height: 44px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid var(--wp--preset--color--navy);
	border-radius: 4px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--navy);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	cursor: pointer;
}

.im-email-suggest__button:focus-visible {
	outline: 3px solid var(--wp--custom--color--link);
	outline-offset: 2px;
}

/* 送信ボタンのすぐ上：安心していただくための3点（予約フォームの中身に書いた一覧） */
.im-form__assure {
	margin: 0 0 24px !important;
	padding: 16px 20px !important;
	border-radius: 4px;
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.7;
	list-style: none;
}

.im-form__assure li {
	position: relative;
	margin: 0;
	padding-left: 28px;
	/* 日本語を文節で折り返し、最後の1～2文字だけが次の行に残らないようにする（対応していないブラウザでは今までどおり） */
	word-break: auto-phrase;
	text-wrap: pretty;
}

.im-form__assure li + li {
	margin-top: 6px;
}

.im-form__assure li::before {
	content: "";
	position: absolute;
	top: 0.3em;
	left: 0;
	width: 18px;
	height: 18px;
	background: var(--wp--preset--color--navy);
	-webkit-mask: var(--im-icon-check) center / contain no-repeat;
	mask: var(--im-icon-check) center / contain no-repeat;
}

@media (max-width: 782px) {
	.im-form__assure {
		padding: 14px 16px !important;
	}


	.im-form__datetime.is-chips > .im-form__sub:first-child {
		max-width: none;
	}

	.im-time-chips {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}
