/* 汎用モーダル（module/modal.php / js/modal.js） */

.c-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;
}

.c-modal[hidden] {
	display: none;
}

body.is-modal-open {
	overflow: hidden;
}

/* body が overflow:hidden になってもスクロールバー分の幅を保ち、背景がずれないようにする */
html {
	scrollbar-gutter: stable;
}

.c-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

/* 閉じるボタン＋カード（ボタンはカードの上に右寄せ） */
.c-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	width: 600px;
	max-width: 100%;
}

.c-modal__card {
	box-sizing: border-box;
	width: 100%;
	/* 上下の余白16px×2 + 閉じるボタン32px + 間隔4px */
	max-height: calc(100vh - 68px);
	max-height: calc(100dvh - 68px);
	overflow-y: auto;
	padding: 24px;
	background: #fff;
	border-radius: 12px;
	color: #333;
}

.c-modal__close {
	display: block;
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
}

.c-modal__close img {
	display: block;
}

/* ---------- SP ---------- */
@media (max-width: 768px) {
	.c-modal__dialog {
		width: 100%;
	}

	.c-modal__card {
		padding: 16px 20px;
	}
}
