@charset "utf-8";

/* ===================================
   ギャラリーページ専用スタイル（最適化版）
   =================================== */

/* フィルターボタン */
.filter-buttons {
	margin-bottom: 30px;
	text-align: center;
}

.filter-btn {
	padding: 10px 20px;
	margin: 5px;
	border: none;
	cursor: pointer;
	background-color: #475562;
	color: white;
	border-radius: 3px;
	transition: background-color 0.3s;
	font-size: 16px;
}

.filter-btn:hover {
	background-color: #005bb5;
}

.filter-btn.active {
	background-color: #005bb5;
}

/* ギャラリーコンテナ */
.gallery-container {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
}

/* グリッドレイアウト */
.gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 20px;
	padding: 20px;
}

/* ギャラリーアイテム */
.gallery-item {
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	transition: transform 0.3s, box-shadow 0.3s;
	cursor: pointer;
	/* GPU加速 */
	will-change: transform;
}

.gallery-item:hover {
	transform: translateY(-5px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gallery-item.hidden {
	display: none;
}

/* 画像コンテナ */
.gallery-item-images {
	position: relative;
	width: 100%;
	height: 250px;
	background: #f5f5f5;
	overflow: hidden;
	/* 画像読み込み中のちらつき防止 */
	contain: layout style paint;
}

.gallery-item-images img {
	width: 100%;
	height: 250px;
	object-fit: cover;
	display: block;
	/* 画像読み込み中の背景色 */
	background: #e0e0e0;
}

/* 複数画像の場合 */
.gallery-item-images.multiple {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	grid-template-rows: repeat(2, 1fr);
	gap: 2px;
	height: 250px;
}

.gallery-item-images.multiple img {
	height: 124px;
	object-fit: cover;
}

/* 空のプレースホルダー（4枚未満の場合に使用） */
.gallery-placeholder {
	background: #e0e0e0;
	height: 124px;
}

/* 4枚目に「+N枚」のオーバーレイ */
.gallery-item-images .more-overlay {
	position: absolute;
	bottom: 2px;
	right: 2px;
	width: calc(50% - 1px);
	height: 124px;
	background: rgba(0, 0, 0, 0.7);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	font-size: 28px;
	font-weight: 700;
	pointer-events: none;
}

/* テキスト部分 */
.gallery-item-text {
	padding: 15px;
	font-size: 14px;
	color: #333;
	background: #fff;
}

.gallery-item-date {
	font-weight: bold;
	color: #013682;
	margin-bottom: 5px;
}

.gallery-item-title {
	color: #666;
	line-height: 1.5;
}

/* カテゴリバッジ */
.category-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 12px;
	margin-top: 8px;
}

.category-badge.event {
	background: #e3f2fd;
	color: #1976d2;
}

.category-badge.conference {
	background: #fff3e0;
	color: #f57c00;
}

/* ===================================
   ライトボックス（画像拡大表示）
   =================================== */
.lightbox {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.9);
	z-index: 1000;
	justify-content: center;
	align-items: center;
	/* GPU加速 */
	will-change: opacity;
}

.lightbox.active {
	display: flex;
}

.lightbox-content {
	position: relative;
	max-width: 90%;
	max-height: 90%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.lightbox-image {
	max-width: 100%;
	max-height: 90vh;
	object-fit: contain;
	border-radius: 5px;
	/* 画像読み込み中の背景 */
	background: #222;
}

/* 閉じるボタン */
.lightbox-close {
	position: absolute;
	top: 20px;
	right: 30px;
	font-size: 40px;
	color: #fff;
	cursor: pointer;
	background: none;
	border: none;
	z-index: 1001;
	transition: color 0.3s;
}

.lightbox-close:hover {
	color: #bbb;
}

/* 前へ/次へボタン */
.lightbox-prev,
.lightbox-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	font-size: 40px;
	color: #fff;
	cursor: pointer;
	background: rgba(0, 0, 0, 0.5);
	border: none;
	padding: 10px 15px;
	border-radius: 3px;
	transition: background 0.3s;
	z-index: 1001;
}

.lightbox-prev:hover,
.lightbox-next:hover {
	background: rgba(0, 0, 0, 0.8);
}

.lightbox-prev {
	left: 20px;
}

.lightbox-next {
	right: 20px;
}

/* 単一画像の場合は前へ/次へボタンを非表示 */
.lightbox-prev.hidden,
.lightbox-next.hidden {
	display: none;
}

/* 画像情報 */
.lightbox-info {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	color: #fff;
	background: rgba(0, 0, 0, 0.7);
	padding: 10px 20px;
	border-radius: 5px;
	text-align: center;
}

.lightbox-counter {
	font-size: 14px;
	margin-bottom: 5px;
}

.lightbox-title {
	font-size: 16px;
	font-weight: bold;
}

/* ===================================
   レスポンシブ
   =================================== */
@media screen and (max-width: 768px) {
	.gallery-grid {
		grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
		gap: 15px;
		padding: 10px;
	}

	.filter-btn {
		padding: 8px 15px;
		font-size: 14px;
	}

	.gallery-item-images {
		height: 200px;
	}

	.gallery-item-images img {
		height: 200px;
	}

	.gallery-item-images.multiple {
		height: 200px;
	}

	.gallery-item-images.multiple img {
		height: 99px;
	}

	.gallery-item-images .more-overlay {
		height: 99px;
		font-size: 24px;
	}

	.gallery-placeholder {
		height: 99px;
	}

	.lightbox-close {
		top: 10px;
		right: 10px;
		font-size: 30px;
	}

	.lightbox-prev,
	.lightbox-next {
		font-size: 30px;
		padding: 8px 12px;
	}

	.lightbox-prev {
		left: 10px;
	}

	.lightbox-next {
		right: 10px;
	}
}

@media screen and (max-width: 480px) {
	.gallery-grid {
		grid-template-columns: 1fr;
	}
}