@charset "utf-8";

/* カスタムモーダルスタイル */
.custom-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.custom-modal.active {
	opacity: 1;
}

/* アニメーション用クラス */
.anim-fade-out {
	animation: fadeOut 0.2s ease forwards;
}

.anim-fade-in-right {
	animation: fadeInRight 0.4s cubic-bezier(0.215, 0.610, 0.355, 1.000) forwards;
}

.anim-fade-in-left {
	animation: fadeInLeft 0.4s cubic-bezier(0.215, 0.610, 0.355, 1.000) forwards;
}

@keyframes fadeOut {
	0% { opacity: 1; }
	100% { opacity: 0; }
}

@keyframes fadeInRight {
	0% {
		opacity: 0;
		transform: translateX(30px);
	}
	100% {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes fadeInLeft {
	0% {
		opacity: 0;
		transform: translateX(-30px);
	}
	100% {
		opacity: 1;
		transform: translateX(0);
	}
}
.custom-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.9);
}

.custom-modal-container {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	pointer-events: none;
}

.custom-modal-content {
	position: relative;
	width: 100%;
	max-width: 900px;
	max-height: 90vh;
	padding: 20px;
	text-align: center;
	pointer-events: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.custom-modal-image-box {
	position: relative;
	display: inline-block;
	max-width: 100%;
/* ズーム機能のための初期設定 */
	/* overflow: hidden;  <-- これがあると画像がBoxの外にはみ出た時に切れるので削除、またはvisibleにする */
	overflow: visible;
}

.custom-modal-image {
	max-width: 100%;
	max-height: 70vh;
	object-fit: contain;
	cursor: zoom-in;
	transition: transform 0.3s ease; /* ズーム時のスムーズなアニメーション */
	transform-origin: center center;
	position: relative;
	z-index: 1; /* 画像は奥 */
}

/* ズーム状態 */
.custom-modal-image.is-zoomed {
	cursor: grab;
	z-index: 10; /* 少し上げるがUIよりは下 */
}

.custom-modal-image.is-dragging {
	cursor: grabbing;
	transition: none; /* ドラッグ中は遅延なしで追従 */
}

.custom-modal-caption {
	color: #fff;
	margin-top: 15px;
	font-size: 14px;
	width: 100%;
	text-align: center;
	order: 2;
	position: relative;
	z-index: 100; /* 画像より前 */
	text-shadow: 0 1px 3px rgba(0,0,0,0.8); /* 画像と重なっても読めるように */
	pointer-events: none; /* 文字の上でもドラッグできるようにイベントを透過させる */
}

/* ナビゲーション */
.custom-modal-nav {
	position: fixed; /* 画面固定 */
	top: 50%;
	left: 0;
	width: 100%;
	height: 0; /* 高さは持たせない */
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 20px; /* 画面端からの余白 */
	z-index: 120; /* 最前面 */
	transform: translateY(-50%);
	pointer-events: none; /* エリア自体はクリック透過 */
}

/* スマホサイズのときだけ順序を明示（削除：固定配置になったため不要） */
/* @media (max-width: 767px) { ... } */

.nav-btn {
	width: 50px;
	height: 50px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.8); /* 少し透過させる */
	border: none;
	display: flex;
	justify-content: center;
	align-items: center;
	cursor: pointer;
	transition: all 0.2s;
	box-shadow: 0 2px 8px rgba(0,0,0,0.3);
	pointer-events: auto; /* ボタン自体は押せるように */
	z-index: 101;
}

.nav-btn:hover {
	background: #e0e0e0;
	transform: scale(1.05);
}

.nav-btn svg {
	width: 28px;
	height: 28px;
	fill: #333;
}

/* モバイル調整：矢印を端に寄せ、少し小さくする */
@media (max-width: 767px) {
	.custom-modal-nav {
		padding: 0 5px; /* 端に寄せる */
	}
	.nav-btn {
		width: 40px;
		height: 40px;
		background: rgba(255, 255, 255, 0.6); /* モバイルは更に薄く */
	}
	.nav-btn svg {
		width: 24px;
		height: 24px;
	}
}

/* 閉じるボタン */
.custom-modal-close {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 44px;
	height: 44px;
	background: rgba(255,255,255,0.2);
	border: none;
	border-radius: 50%;
	color: #fff;
	font-size: 28px;
	line-height: 44px;
	cursor: pointer;
	z-index: 200;
	transition: background 0.2s;
}

.custom-modal-close:hover {
	background: rgba(255,255,255,0.4);
}

/* PC表示の調整 */
@media (min-width: 768px) {
	/* PCでは矢印を画像の両横に配置することも可能ですが、
	   今回は「写真→矢印→キャプション」の要望なので中央配置のままにするか、
	   あるいはPCだけ変えるか。要望通り一貫させるならこのまま。
	   もしPCでは従来通り画像横が良いなら以下を有効化 */
	   
	/*
	.custom-modal-nav {
		position: absolute;
		top: 50%;
		left: 0;
		width: 100%;
		justify-content: space-between;
		pointer-events: none;
		margin-top: 0;
		padding: 0 20px;
		transform: translateY(-50%);
	}
	.nav-btn {
		pointer-events: auto;
	}
	*/
}
