/* =========================================================
   Mofli Viewer
   v1.9.0
   ========================================================= */

.mofli-viewer {
	--mofli-viewer-toolbar-height: 56px;
	--mofli-viewer-footer-height: 58px;
	--mofli-viewer-bg: #202020;
	--mofli-viewer-panel: #252525;
	--mofli-viewer-text: #ffffff;
	--mofli-viewer-accent: #ec7f72;

	position: relative;
	width: 100%;
	max-width: 1400px;
	margin: 0 auto;
	overflow: hidden;

	color:
		var(--mofli-viewer-text);

	background:
		var(--mofli-viewer-bg);

	border-radius: 14px;

	box-shadow:
		0 10px 35px
		rgba(0, 0, 0, 0.18);

	outline: none;
}


/* Header */
.mofli-viewer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;

	min-height:
		var(--mofli-viewer-toolbar-height);

	padding:
		8px 14px;

	background:
		var(--mofli-viewer-panel);

	border-bottom:
		1px solid
		rgba(255, 255, 255, 0.08);
}

.mofli-viewer__title {
	min-width: 0;
	flex: 1;
	overflow: hidden;
	color: #fff;
	font-size: 14px;
	font-weight: 700;
}

.mofli-viewer__title span {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mofli-viewer__header-actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.mofli-viewer__icon-button,
.mofli-viewer__zoom-label {
	display: inline-flex;
	align-items: center;
	justify-content: center;

	height: 38px;
	min-width: 38px;

	padding:
		0 9px;

	color: #fff;
	background: #383838;

	border: 0;
	border-radius: 8px;

	font: inherit;
	cursor: pointer;
}

.mofli-viewer__zoom-label {
	min-width: 58px;
	font-size: 12px;
	font-weight: 700;
}

.mofli-viewer__icon-button:hover,
.mofli-viewer__zoom-label:hover {
	background: #4a4a4a;
}


/* Stage */
.mofli-viewer__stage {
	position: relative;
	display: flex;
	width: 100%;
	min-height: 500px;
	background: #151515;
}


/* Viewport */
.mofli-viewer__viewport {
	position: relative;
	flex: 1;
	min-width: 0;
	overflow: hidden;

	overscroll-behavior:
		contain;

	background:
		radial-gradient(
			circle at center,
			#383838 0%,
			#202020 70%,
			#181818 100%
		);

	cursor: pointer;
	touch-action: pan-y;
}


/* =========================================================
   Zoom surface
   ========================================================= */

.mofli-viewer__zoom-surface {
	position: relative;

	width: 100%;
	height: 100%;

	min-width: 100%;
	min-height: 100%;

	margin: 0;

	overflow: visible;
}


/* Canvas */
.mofli-viewer__canvas {
	position: relative;
	display: block;

	width: 100%;

	height:
		min(
			78vh,
			900px
		);

	min-height: 500px;

	margin-left: auto;
	margin-right: auto;

	padding: 0;

	box-sizing:
		border-box;

	perspective:
		1400px;

	transform-origin:
		50% 0;

	transition:
		opacity 0.18s ease;
}


/* Pages */
.mofli-viewer__page {
	display: none;

	position: absolute;

	top: 0;
	bottom: auto;

	width: 50%;
	height: 100%;

	margin: 0;
	padding: 0;

	align-items: center;
	justify-content: center;

	box-sizing:
		border-box;
}

.mofli-viewer__page.is-active {
	display: flex;
}

.mofli-viewer__page.is-left-page {
	left: 0;
	right: auto;
	justify-content: flex-end;
}

.mofli-viewer__page.is-right-page {
	left: 50%;
	right: auto;
	justify-content: flex-start;
}

.mofli-viewer__page.is-single-page {
	left: 25%;
	right: auto;

	width: 50%;

	justify-content: center;
}


/* Images */
.mofli-viewer__image {
	display: block;

	width: auto;
	height: auto;

	max-width: 100%;
	max-height: 100%;

	margin: 0;

	object-fit: contain;

	background: #fff;

	box-shadow:
		0 4px 20px
		rgba(0, 0, 0, 0.35);

	transform: none !important;

	user-select: none;

	-webkit-user-drag:
		none;
}


/* Binding line */
@media (min-width: 901px) {

	.mofli-viewer__canvas::after {
		content: "";

		position: absolute;

		z-index: 10;

		top: 0;
		bottom: 0;
		left: 50%;

		width: 1px;

		background:
			rgba(255, 255, 255, 0.15);

		pointer-events: none;
	}
}


/* Loading */
.mofli-viewer__loading {
	position: absolute;

	z-index: 80;

	top: 50%;
	left: 50%;

	display: flex;
	align-items: center;
	gap: 9px;

	padding:
		10px 15px;

	color: #fff;

	background:
		rgba(0, 0, 0, 0.75);

	border-radius:
		999px;

	font-size: 12px;

	transform:
		translate(
			-50%,
			-50%
		);

	pointer-events: none;
}

.mofli-viewer__loading[hidden] {
	display: none !important;
}

.mofli-viewer__spinner {
	width: 18px;
	height: 18px;

	border:
		2px solid
		rgba(255, 255, 255, 0.25);

	border-top-color: #fff;

	border-radius: 50%;

	animation:
		mofli-viewer-spin
		0.7s linear infinite;
}

@keyframes mofli-viewer-spin {

	to {
		transform:
			rotate(360deg);
	}
}


/* Navigation */
.mofli-viewer__nav {
	position: absolute;

	z-index: 30;

	top: 50%;

	display: flex;
	align-items: center;
	justify-content: center;

	width: 48px;
	height: 72px;

	padding: 0;

	color: #fff;

	background:
		rgba(0, 0, 0, 0.52);

	border: 0;

	font-size: 38px;

	cursor: pointer;

	transform:
		translateY(-50%);
}

.mofli-viewer__nav--prev {
	left: 0;
}

.mofli-viewer__nav--next {
	right: 0;
}

.mofli-viewer__nav:disabled {
	opacity: 0.18;
	pointer-events: none;
}


/* Footer */
.mofli-viewer__footer {
	display: grid;

	grid-template-columns:
		1fr auto 1fr;

	align-items: center;

	gap: 10px;

	min-height:
		var(--mofli-viewer-footer-height);

	padding:
		8px 14px;

	background:
		var(--mofli-viewer-panel);
}

.mofli-viewer__footer-button {
	min-height: 38px;

	padding:
		7px 18px;

	color: #fff;
	background: #3b3b3b;

	border: 0;
	border-radius: 8px;

	font-weight: 700;

	cursor: pointer;
}

.mofli-viewer__footer-button:first-child {
	justify-self: start;
}

.mofli-viewer__footer-button:last-child {
	justify-self: end;
}

.mofli-viewer__footer-button:disabled {
	opacity: 0.28;
	pointer-events: none;
}

.mofli-viewer__counter {
	min-width: 90px;
	text-align: center;
	font-weight: 700;
}


/* Animation */
.mofli-viewer.is-turn-next
.mofli-viewer__canvas {
	opacity: 0.55;
}

.mofli-viewer.is-turn-prev
.mofli-viewer__canvas {
	opacity: 0.55;
}


/* =========================================================
   Zoom
   ========================================================= */

.mofli-viewer.is-zoomed
.mofli-viewer__viewport {
	display: block;
	overflow: auto;

	cursor: grab;

	touch-action:
		none;
}

.mofli-viewer.is-zoomed
.mofli-viewer__viewport.is-dragging {
	cursor: grabbing;
	user-select: none;
}

.mofli-viewer.is-zoomed
.mofli-viewer__zoom-surface {
	position: relative;

	max-width: none;


	overflow: visible;
}

.mofli-viewer.is-zoomed
.mofli-viewer__canvas {
	position: relative;

	max-width: none;

	margin-left: auto;
	margin-right: auto;

	/*
	 * transform はJSで設定する。
	 * transform:none !important は禁止。
	 */
}

.mofli-viewer.is-zoomed
.mofli-viewer__image {
	width: auto;
	height: auto;

	max-width: 100%;

	transform:
		none !important;
}


/* Thumbnail panel */
.mofli-viewer__thumb-panel {
	display: none;

	position: absolute;

	z-index: 100;

	inset:
		var(--mofli-viewer-toolbar-height)
		0
		var(--mofli-viewer-footer-height)
		0;

	background:
		rgba(20, 20, 20, 0.98);

	overflow: hidden;
}

.mofli-viewer__thumb-panel.is-open {
	display: flex;
	flex-direction: column;
}

.mofli-viewer__thumb-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;

	padding:
		12px 16px;

	color: #fff;

	background: #1d1d1d;
}

.mofli-viewer__thumb-close {
	width: 36px;
	height: 36px;

	color: #fff;
	background: #3a3a3a;

	border: 0;
	border-radius: 50%;

	font-size: 24px;

	cursor: pointer;
}

.mofli-viewer__thumb-grid {
	display: grid;

	grid-template-columns:
		repeat(
			auto-fill,
			minmax(110px, 1fr)
		);

	gap: 14px;

	flex: 1;

	padding: 18px;

	overflow-y: auto;
}

.mofli-viewer__thumb {
	display: flex;
	flex-direction: column;

	gap: 7px;

	padding: 8px;

	color: #ddd;
	background: #2d2d2d;

	border:
		2px solid transparent;

	border-radius: 10px;

	cursor: pointer;
}

.mofli-viewer__thumb.is-current {
	border-color:
		var(--mofli-viewer-accent);

	background: #423332;
}

.mofli-viewer__thumb-image-wrap {
	display: flex;
	align-items: center;
	justify-content: center;

	overflow: hidden;

	width: 100%;

	aspect-ratio:
		3 / 4;

	background: #181818;
}

.mofli-viewer__thumb-image {
	display: block;

	width: 100%;
	height: 100%;

	object-fit: contain;
}

.mofli-viewer__thumb-number {
	text-align: center;

	font-size: 12px;
	font-weight: 700;
}


/* Help */
.mofli-viewer__help {
	padding:
		8px 12px;

	color: #777;
	background: #f7f7f7;

	text-align: center;

	font-size: 11px;
}

.mofli-viewer__help-pc {
	display: block;
	margin-top: 4px;
}



/* Fullscreen */
.mofli-viewer:fullscreen {
	width: 100vw;

	max-width: none;

	height: 100vh;

	margin: 0;

	border-radius: 0;

	background: #111;
}

.mofli-viewer:fullscreen
.mofli-viewer__stage {
	height:
		calc(
			100vh -
			var(--mofli-viewer-toolbar-height) -
			var(--mofli-viewer-footer-height)
		);

	min-height: 0;
}

.mofli-viewer:fullscreen
.mofli-viewer__viewport {
	height: 100%;
}

.mofli-viewer:fullscreen
.mofli-viewer__canvas {
	height: 100%;
}


.mofli-viewer:fullscreen.is-zoomed
.mofli-viewer__page {
	align-items:
		flex-start;
}


/* Mobile */
@media (max-width: 900px) {

	.mofli-viewer__help-pc {
		display: none;
	}


	.mofli-viewer {
		--mofli-viewer-toolbar-height: 50px;
		--mofli-viewer-footer-height: 54px;

		border-radius: 10px;
	}

	.mofli-viewer__header {
		min-height: 50px;

		padding:
			6px 8px;
	}

	.mofli-viewer__title {
		font-size: 12px;
	}

	.mofli-viewer__icon-button,
	.mofli-viewer__zoom-label {
		height: 34px;
		min-width: 34px;

		padding:
			0 6px;
	}

	.mofli-viewer__zoom-label {
		min-width: 48px;

		font-size: 11px;
	}

	.mofli-viewer__stage {
		min-height: 440px;
	}

	.mofli-viewer__canvas {
		height:
			min(
				72svh,
				760px
			);

		min-height: 420px;
	}

	.mofli-viewer__page,
	.mofli-viewer__page.is-active,
	.mofli-viewer__page.is-single-page {
		left: 0;
		right: auto;

		width: 100%;
		max-width: 100%;

		height: 100%;

		justify-content: center;
	}

	.mofli-viewer__image {
		max-width: 100%;
		max-height: 100%;
	}

	.mofli-viewer__nav {
		width: 38px;
		height: 60px;

		font-size: 30px;
	}

	.mofli-viewer__footer {
		padding:
			7px 8px;
	}

	.mofli-viewer__footer-button {
		padding:
			6px 12px;

		font-size: 12px;
	}

	.mofli-viewer__counter {
		min-width: 70px;

		font-size: 12px;
	}

	.mofli-viewer__thumb-grid {
		grid-template-columns:
			repeat(
				3,
				minmax(0, 1fr)
			);

		gap: 8px;

		padding: 10px;
	}
}



/* Small mobile */
@media (max-width: 520px) {

	.mofli-viewer__title {
		max-width: 105px;
	}

	.mofli-viewer__icon-button {
		width: 31px;
		min-width: 31px;

		padding: 0;
	}

	.mofli-viewer__zoom-label {
		min-width: 43px;
	}
}


/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

	.mofli-viewer *,
	.mofli-viewer *::before,
	.mofli-viewer *::after {
		animation-duration:
			0.01ms !important;

		transition-duration:
			0.01ms !important;
	}
}