/*!
 * Hard Piston Toolkit - 共通Lightbox（HPT.Lightbox）
 * 単一画像・グループ画像の拡大表示、前後移動、ズームに共通利用する。
 */

.hpt-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

.hpt-lightbox.is-open {
	display: flex;
}

.hpt-lightbox *,
.hpt-lightbox *::before,
.hpt-lightbox *::after {
	box-sizing: border-box;
}

.hpt-lightbox [hidden] {
	display: none !important;
}

.hpt-lightbox__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.88);
	border: 0;
	padding: 0;
	cursor: zoom-out;
}

.hpt-lightbox__dialog {
	position: relative;
	z-index: 1;
	width: 90vw;
	height: 90vh;
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hpt-lightbox__stage {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	touch-action: none;
}

.hpt-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
	filter: none;
	mix-blend-mode: normal;
	transform-origin: center center;
	transition: transform 0.18s ease-out, opacity 0.16s ease-out;
	will-change: transform, opacity;
	user-select: none;
	-webkit-user-drag: none;
}

.hpt-lightbox__image.is-loading {
	opacity: 0.42;
}

.hpt-lightbox__close,
.hpt-lightbox__nav,
.hpt-lightbox__zoom {
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ececec;
	background: rgba(20, 20, 20, 0.78);
	border: 1px solid rgba(255, 255, 255, 0.28);
	cursor: pointer;
	transition: background 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
}

.hpt-lightbox__close:hover,
.hpt-lightbox__close:focus-visible,
.hpt-lightbox__nav:hover,
.hpt-lightbox__nav:focus-visible,
.hpt-lightbox__zoom:hover,
.hpt-lightbox__zoom:focus-visible {
	background: #ff1493;
	border-color: #ff1493;
	color: #fff;
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.hpt-lightbox__close {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 4;
	width: 42px;
	height: 42px;
	padding: 0;
	font-size: 26px;
	line-height: 1;
	border-radius: 50%;
}

.hpt-lightbox__nav {
	position: fixed;
	top: 50%;
	z-index: 3;
	width: 52px;
	height: 64px;
	padding: 0;
	font-size: 46px;
	line-height: 1;
	border-radius: 10px;
	transform: translateY(-50%);
}

.hpt-lightbox__nav--prev {
	left: 20px;
}

.hpt-lightbox__nav--next {
	right: 20px;
}

.hpt-lightbox__nav:disabled,
.hpt-lightbox__zoom:disabled {
	opacity: 0.32;
	cursor: default;
}

.hpt-lightbox__counter {
	position: fixed;
	top: 22px;
	left: 50%;
	z-index: 3;
	min-width: 72px;
	padding: 7px 12px;
	color: #fff;
	background: rgba(20, 20, 20, 0.78);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 999px;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	text-align: center;
	transform: translateX(-50%);
}

.hpt-lightbox__zoom-controls {
	position: fixed;
	left: 50%;
	bottom: 20px;
	z-index: 3;
	display: flex;
	overflow: hidden;
	border-radius: 999px;
	transform: translateX(-50%);
}

.hpt-lightbox__zoom {
	min-width: 42px;
	height: 38px;
	padding: 0 12px;
	border-radius: 0;
	font-size: 20px;
	line-height: 1;
}

.hpt-lightbox__zoom + .hpt-lightbox__zoom {
	border-left: 0;
}

.hpt-lightbox__zoom--reset {
	min-width: 64px;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

body.hpt-lightbox-open {
	overflow: hidden;
}

@media (max-width: 782px) {
	.hpt-lightbox {
		padding: 16px;
	}

	.hpt-lightbox__dialog {
		width: calc(100vw - 32px);
		height: calc(100vh - 32px);
		max-width: calc(100vw - 32px);
		max-height: calc(100vh - 32px);
	}

	.hpt-lightbox__nav {
		width: 44px;
		height: 56px;
		font-size: 38px;
	}

	.hpt-lightbox__nav--prev {
		left: 10px;
	}

	.hpt-lightbox__nav--next {
		right: 10px;
	}
}

@media (max-width: 480px) {
	.hpt-lightbox {
		padding: 8px;
	}

	.hpt-lightbox__dialog {
		width: calc(100vw - 16px);
		height: calc(100vh - 16px);
		max-width: calc(100vw - 16px);
		max-height: calc(100vh - 16px);
	}

	.hpt-lightbox__close {
		top: 10px;
		right: 10px;
		width: 38px;
		height: 38px;
		font-size: 22px;
	}

	.hpt-lightbox__counter {
		top: 12px;
	}

	.hpt-lightbox__nav {
		width: 40px;
		height: 52px;
		font-size: 34px;
		background: rgba(20, 20, 20, 0.7);
	}

	.hpt-lightbox__nav--prev {
		left: 6px;
	}

	.hpt-lightbox__nav--next {
		right: 6px;
	}

	.hpt-lightbox__zoom-controls {
		bottom: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hpt-lightbox__image,
	.hpt-lightbox__close,
	.hpt-lightbox__nav,
	.hpt-lightbox__zoom {
		transition: none;
	}
}
