figure{
	margin: 0;
	display: none;
}

figure:target{
	display: block;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	min-height: 100dvh;
	z-index: 9999;
	background: rgba(0,0,0,0.6);
	overflow-y: auto;
}

figure:target .overlay{
	position: absolute; 
	top: 0;   
	left: 0;
	width: 100%;
	min-height: 100dvh;
	height: auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-decoration: none;
	color: #fff;
	animation: zoom .0s;
}

@media screen and (min-width: 769px) {
	@-moz-document url-prefix() {
		figure:target{
			width: calc(100% - 1.7rem);
		}
	}
}

@keyframes zoom{
	0%{
		transform: scale(0.2);
		opacity: 0.2;
	}
	100%{
		transform: scale(1);
	opacity: 1;
	}
}

#close{
	position: fixed;
	top: 0;
	left: 0;
	width: 1px;
	height: 1px;
}

figure:target div.img{
	max-height: calc(100dvh - 1rem);
	max-width: calc(100vw - 1rem);
}

figure:target .overlay > *{
	margin: 0.5rem 0.5rem 0;
}

figure:target .overlay > *:last-child{
	margin-bottom: 0.5rem;
}

body:has(figure:target){
	overflow: hidden;
}

figure:target::-webkit-scrollbar {
   width: 1rem;
}



/*スクロールバー*/

figure:target::-webkit-scrollbar-track {
	background-color: rgb(179, 179, 179);
}

figure:target::-webkit-scrollbar-thumb {
  background-color: #000;
}



/* 漫画表示 */

.comic{
	width: fit-content;
	margin: 1rem auto 0 !important;
	display: flex;
	flex-direction: row-reverse;
	flex-wrap: wrap;
	justify-content: flex-start;
	width: 100% !important;
	max-width: 1200px !important;
}

.comic div.img {
	width:100% !important;
	max-width: 600px !important;
	margin-bottom:3rem;
	height:auto !important;
}

.comic::after{
	content: "";
	display: block;
	height: 0;
	width:100% !important;
	max-width: 600px !important;
}

.comic.hidari::before{
	content: '';
	display: block;
	height: 0;
	width:100% !important;
	max-width: 600px !important;
}

figure.cap{
	display: table;
}

figure:target figure.cap div.img{
	max-height: calc(100vh - 1rem);
}

figcaption {
	color: #fff;
	caption-side: bottom;
	display: table-caption;
	padding: 1rem 1rem;
	font-size:1.3rem;
	line-height: 1.2;
}



/* スマホ用サイズ調整 */

@media screen and (max-width: 768px) {

	figure:target div.img{
		max-height: calc(100dvh - 0.5rem);
		max-width: calc(100dvw - 0.5rem);
	}

	figure:target .overlay > *{
		margin: 0.5rem 0.5rem 0;
	}

	figure:target .overlay > *:last-child{
		margin-bottom: 0.5rem;
	}

	.comic{
		margin: 0.5rem auto 0 !important;
	}

	.comic div.img {
		width: calc(100vw - 3rem) !important;
		margin-bottom:0.5rem;
	}

	figcaption {
		padding: 0.6rem 1rem;
		font-size: 1.3rem;
		line-height: 1.2;
	}

}



/* ↓折り畳み */

summary{
	display: block;
	text-align: center;
	cursor: pointer;
}

summary::-webkit-details-marker {
	display: none;
}

details[open] > * {
	animation: fade 0.5s ease;
}

details[open] > summary {
	display: none;
}


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