
/* ギャラリーコンテナ */
.sub-gallery-container {
	position: relative;
	max-width: 1400px;
	margin: 0 auto;
}

/* ギャラリーグリッド */
.sub-gallery-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 2rem;
}

/* ギャラリーアイテム */
.sub-gallery-item {
	position: relative;
	overflow: hidden;
	border-radius: 15px;
	background: rgba(255, 255, 255, 0.05);
	cursor: pointer;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	backdrop-filter: blur(10px);
	opacity: 0;
	transform: translateY(40px) scale(0.95);
	aspect-ratio: 1 / 1;
}

.sub-gallery-item.animated {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.sub-gallery-item:nth-child(1) { animation-delay: 0.1s; }
.sub-gallery-item:nth-child(2) { animation-delay: 0.2s; }
.sub-gallery-item:nth-child(3) { animation-delay: 0.3s; }
.sub-gallery-item:nth-child(4) { animation-delay: 0.4s; }
.sub-gallery-item:nth-child(5) { animation-delay: 0.5s; }
.sub-gallery-item:nth-child(6) { animation-delay: 0.6s; }
.sub-gallery-item:nth-child(7) { animation-delay: 0.7s; }
.sub-gallery-item:nth-child(8) { animation-delay: 0.8s; }

.sub-gallery-item:hover {
	transform: scale(1.02);
}

/* 画像ラッパー */
.sub-gallery-image-wrapper {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

.sub-gallery-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	filter: brightness(0.95) contrast(1.05);
}

.sub-gallery-item:hover .sub-gallery-image {
	transform: scale(1.1);
	filter: brightness(1) contrast(1.1);
}

/* オーバーレイ */
.sub-gallery-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(45deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(212, 175, 55, 0.1) 100%);
	opacity: 0;
	transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.sub-gallery-item:hover .sub-gallery-overlay {
	opacity: 1;
}

/* 拡大アイコン */
.sub-gallery-zoom-icon {
	width: 3rem;
	height: 3rem;
	background: rgba(212, 175, 55, 0.9);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	transform: scale(0.8);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	backdrop-filter: blur(10px);
	border: 2px solid rgba(255, 255, 255, 0.8);
}

.sub-gallery-item:hover .sub-gallery-zoom-icon {
	transform: scale(1);
	background: rgba(212, 175, 55, 1);
}

/* 画像番号 */
.sub-gallery-number {
		position: absolute;
		bottom: 0.5rem;
		left: 0.5rem;
		background: rgba(0, 0, 0, 0.7);
		color: white;
		padding: 0.4rem 0.8rem 0.5rem;
		border-radius: 2rem;
		font-family: serif;
		font-weight: 600;
		font-size: 1rem;
		line-height: 1.2;
		backdrop-filter: blur(10px);
		max-width: calc(100% - 1rem);
}

.sub-gallery-item:hover .sub-gallery-number {
	opacity: 1;
	transform: translateY(0);
}

/* Viewer.jsのカスタマイズ */
.viewer-backdrop {
	background-color: rgba(0, 0, 0, 0.95) !important;
}

.viewer-title {
	color: var(--gold) !important;
	font-family: 'Noto Serif JP', serif !important;
	font-size: 16px;
}

.viewer-toolbar {
	background-color: rgba(0, 0, 0, 0.8) !important;
	backdrop-filter: blur(20px) !important;
}

.viewer-button {
	color: white !important;
	border: 1px solid rgba(212, 175, 55, 0.3) !important;
	transition: all 0.3s ease !important;
}

.viewer-button:hover {
	background-color: rgba(212, 175, 55, 0.2) !important;
	border-color: var(--gold) !important;
}

/* Masonry対応のための基底クラス */
.sub-gallery-masonry .sub-gallery-item {
	break-inside: avoid;
	margin-bottom: 2rem;
}

/* レスポンシブデザイン */
@media (max-width: 980px) {
	.sub-gallery-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 1.5rem;
	}
	
	.sub-gallery-zoom-icon {
		width: 2.5rem;
		height: 2.5rem;
	}
}

@media (max-width: 820px) {
	
	.sub-gallery-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 30px;;
	}
	
	.sub-gallery-item {
		border-radius: 0.8rem;
	}
	
	.sub-gallery-number {
		font-size: 0.8rem;
		padding: 0.4rem 0.6rem;
	}
}

@media (max-width: 500px) {
	.sub-gallery-grid {
		gap: 1rem;
	}
	
	.sub-gallery-item {
		border-radius: 0.6rem;
	}
	
	.sub-gallery-zoom-icon {
		width: 2rem;
		height: 2rem;
	}
}

/* ダークモード対応の追加調整 */
@media (prefers-color-scheme: dark) {
	.sub-gallery-item {
		background: rgba(255, 255, 255, 0.08);
	}
	
	.sub-gallery-overlay {
		background: linear-gradient(
			45deg, 
			rgba(0, 0, 0, 0.8) 0%, 
			rgba(0, 0, 0, 0.4) 50%, 
			rgba(212, 175, 55, 0.15) 100%
		);
	}
}

/* 高解像度ディスプレイ対応 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
	.sub-gallery-image {
		image-rendering: -webkit-optimize-contrast;
		image-rendering: crisp-edges;
	}
}