/* ════════════════════════════════════════════════════════════════
 * Exit Popup（離脱POP）
 * ────────────────────────────────────────────────────────────────
 *  - PC（≥1024px）：画面右下スライドイン（カード型、背景遮蔽なし）
 *  - SP（≤1023px）：画面下端からシートアップ（背景に半透明バックドロップ）
 *  - 1セッション1回（JS 側で sessionStorage 制御）
 * ════════════════════════════════════════════════════════════════ */

/* 基本：HTMLに hidden 属性がある間は非表示 */
.exit-popup[hidden] {
	display: none !important;
}

/* SP（モバイル基準）：シート型 */
.exit-popup {
	position: fixed;
	inset: 0;
	z-index: 9000;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	pointer-events: none;
}

.exit-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 20, 20, 0.55);
	opacity: 0;
	transition: opacity 320ms cubic-bezier(0.16, 1, 0.3, 1);
	pointer-events: auto;
}

.exit-popup__card {
	position: relative;
	width: 100%;
	max-height: 88vh;
	overflow-y: auto;
	background: var(--color-bg-surface);
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
	box-shadow: none;
	transform: translateY(100%);
	transition: transform 380ms cubic-bezier(0.16, 1, 0.3, 1);
	pointer-events: auto;
	padding-bottom: env(safe-area-inset-bottom);
}

/* JS で .is-open を付ける */
.exit-popup.is-open .exit-popup__backdrop {
	opacity: 1;
}
.exit-popup.is-open .exit-popup__card {
	transform: translateY(0);
}

/* 閉じる × ボタン（画像上に重なるので、視認性のため明るい半透明＋暗アイコン） */
.exit-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(250, 249, 247, 0.92);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	border: 1px solid rgba(10, 20, 20, 0.08);
	border-radius: var(--radius-sm);
	cursor: pointer;
	color: #0A1414;
	transition: background 180ms ease, transform 180ms ease;
	z-index: 2;
	box-shadow: none;
}
.exit-popup__close:hover {
	background: rgba(250, 249, 247, 1);
}
.exit-popup__close:focus-visible {
	outline: 2px solid var(--color-brand, #067B7B);
	outline-offset: 2px;
}
.exit-popup__close svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

/* メディア（POP画像） */
.exit-popup__media {
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #0A1414;
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.exit-popup__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* 本文 */
.exit-popup__body {
	padding: 20px 22px 22px;
}

.exit-popup__label {
	margin: 0 0 8px;
	font-family: var(--font-mono, "JetBrains Mono", monospace);
	font-size: 12px; /* 11px→12px：ポップアップ内ラベル。最低フォントサイズ確保 */
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--color-brand, #067B7B);
}

.exit-popup__title {
	margin: 0 0 10px;
	font-size: 18px;
	line-height: 1.5;
	font-weight: 700;
	color: #0A1414;
	letter-spacing: -0.01em;
}

.exit-popup__desc {
	margin: 0 0 18px;
	font-size: 13.5px;
	line-height: 1.7;
	color: #3A4848;
}

/* CTA ボタン（フル幅・SP） */
.exit-popup__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 50px;
	padding: 12px 20px;
	background: var(--color-brand, #067B7B);
	color: var(--color-text-on-brand, #FFFFFF);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-decoration: none;
	border-radius: var(--radius-sm);
	transition: background 200ms ease, transform 200ms ease;
}
.exit-popup__cta:hover {
	background: #054F4F;
	color: var(--color-text-on-brand, #FFFFFF);
}
.exit-popup__cta:focus-visible {
	outline: 2px solid var(--color-brand);
	outline-offset: 3px;
}
.exit-popup__cta svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
	transition: transform 200ms ease;
}
.exit-popup__cta:hover svg {
	transform: translateX(3px);
}

/* 「30日間表示しない」リンク */
.exit-popup__dismiss-forever {
	display: block;
	margin: 12px auto 0;
	padding: 8px;
	background: transparent;
	border: none;
	color: #5A6868;
	font-size: 12px;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.exit-popup__dismiss-forever:hover {
	color: #0A1414;
}
.exit-popup__dismiss-forever:focus-visible {
	outline: 2px solid var(--color-brand, #067B7B);
	outline-offset: 2px;
	border-radius: 4px;
}

/* タッチ端末では hover transform を抑制（CLAUDE.md モバイル基準） */
@media (hover: none) {
	.exit-popup__cta:hover svg {
		transform: none;
	}
	.exit-popup__cta:hover {
		background: var(--color-brand, #067B7B);
	}
}

/* prefers-reduced-motion：トランジション無効化 */
@media (prefers-reduced-motion: reduce) {
	.exit-popup__backdrop,
	.exit-popup__card,
	.exit-popup__cta,
	.exit-popup__cta svg {
		transition: none !important;
	}
}

/* ════════════════════════════════════════════════════════════════
 * PC（≥1024px）：右下スライドイン
 * ────────────────────────────────────────────────────────────────
 *  - バックドロップなし（本文を遮らない）
 *  - 幅 380px、画面右下から slide-in
 * ════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
	.exit-popup {
		align-items: flex-end;
		justify-content: flex-end;
		padding: 24px;
	}

	/* PC ではバックドロップを描画しない */
	.exit-popup__backdrop {
		display: none;
	}

	.exit-popup__card {
		width: 380px;
		max-width: calc(100vw - 48px);
		max-height: calc(100vh - 48px);
		border-radius: var(--radius-sm);
		box-shadow: none;
		transform: translateY(20px) translateX(20px);
		opacity: 0;
		transition: transform 380ms cubic-bezier(0.16, 1, 0.3, 1), opacity 320ms ease;
	}

	.exit-popup.is-open .exit-popup__card {
		transform: translateY(0) translateX(0);
		opacity: 1;
	}

	.exit-popup__media {
		border-radius: var(--radius-sm) var(--radius-sm) 0 0;
		aspect-ratio: 16 / 9;
	}

	.exit-popup__body {
		padding: 18px 20px 20px;
	}

	.exit-popup__title {
		font-size: 17px;
	}

	.exit-popup__desc {
		font-size: 13px;
	}

	.exit-popup__cta {
		min-height: 46px;
		font-size: 14px;
	}
}
