/* ==========================================================================
   수상작 갤러리
   ========================================================================== */

.gallery-page {
	padding-bottom: 3.5rem;
}

.gallery-list__header {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 1rem;
	margin-bottom: 2rem;
}

.gallery-card__division {
	display: inline-block;
	font-size: 0.78rem;
	color: var(--primary-color);
	margin-bottom: 0.5rem;
	font-weight: 600;
	padding: 0.2rem 0.55rem;
	border-radius: 999px;
	background: var(--primary-color-bg);
}

.year-selector--single {
	box-shadow: none;
}

.year-selector--single .year-current {
	cursor: default;
	font-size: 1rem;
	font-weight: 700;
	min-width: auto;
	padding: 0.45rem 0.9rem;
}

.year-selector--single .year-current:hover {
	opacity: 1;
}

/* Fancybox */
.fancybox__counter { display: none; }
.fancybox__button--slideshow { display: none; }
.is-prev { display: none; }
.is-next { display: none; }
div.toolbar { display: none; }

/* 연도 선택기 */
.year-selector {
	display: inline-flex;
	align-items: center;
	gap: 0;
	background: #fff;
	border: 1px solid var(--primary-color-border);
	border-radius: 12px;
	padding: 4px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.06);
	position: relative;
	z-index: 50;
	overflow: visible;
}

.year-current {
	font-size: 1.6rem;
	font-weight: 900;
	color: var(--primary-color);
	min-width: 80px;
	text-align: center;
	letter-spacing: -0.02em;
	line-height: 1;
	padding: 6px 8px;
	cursor: pointer;
	user-select: none;
}

.year-current:hover {
	opacity: 0.8;
}

.year-dropdown {
	display: none;
	position: fixed;
	background: #fff;
	border: 1px solid var(--primary-color-border);
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(0,0,0,0.12);
	padding: 6px;
	z-index: 9999;
	min-width: 110px;
}

.year-dropdown a {
	display: block;
	padding: 8px 16px;
	font-size: 0.95rem;
	font-weight: 600;
	color: #555;
	text-decoration: none;
	border-radius: 6px;
	text-align: center;
	transition: all 0.15s ease;
}

.year-dropdown a:hover {
	background: var(--primary-color-bg);
	color: var(--primary-color);
}

.year-dropdown a.active {
	background: var(--primary-color);
	color: #fff;
}

.year-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	color: var(--primary-color);
	font-size: 0.85rem;
	transition: all 0.2s ease;
	text-decoration: none;
}

.year-nav:hover {
	background: var(--primary-color);
	color: #fff;
	text-decoration: none;
}

.year-nav.disabled {
	color: var(--text-light);
	pointer-events: none;
}

/* 수상작 카드 */
.grade-group .row > [class*="col-"] {
	display: flex;
}

.gallery-card {
	border: 1px solid #e3e8ef;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: none;
	transition:
		transform 0.25s ease,
		box-shadow 0.25s ease,
		border-color 0.25s ease;
	background-color: #fff;
	height: 100%;
}

.gallery-card:hover {
	transform: translateY(-4px);
	border-color: rgba(var(--primary-color-rgb), 0.35);
	box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}

.gallery-card .card-img-wrapper {
	overflow: hidden;
	position: relative;
	background: #f3f5f8;
	line-height: 0;
	border-bottom: 1px solid #e8ecf0;
	aspect-ratio: 16 / 9;
	flex-shrink: 0;
}

.gallery-card .card-img-wrapper a {
	display: block;
	width: 100%;
}

.gallery-card .card-img-top {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.gallery-card:hover .card-img-top {
	transform: scale(1.03);
}

.gallery-card__no-image {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-height: 180px;
	color: #b8c0cc;
	font-size: 2.5rem;
}

.gallery-card .card-body {
	padding: 1rem 1.1rem 1.15rem;
	background: #fff;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.gallery-card .card-title {
	font-size: 1.02rem;
	font-weight: 700;
	margin-bottom: 0;
	color: #1f2937;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3em;
	min-height: calc(1.3em * 2);
}

/* 상격 그룹 */
.grade-group {
	background: #fff;
	border-radius: 18px;
	padding: 1.75rem 1.5rem 0.5rem;
	margin-bottom: 2.25rem;
	border: 1px solid #e3e8ef;
	box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.grade-section {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 1.5rem;
	padding-bottom: 16px;
	border-bottom: 2px solid;
}

.grade-icon-wrap {
	position: relative;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: #fff;
}

.grade-icon-wrap i {
	font-size: 1.3rem;
	position: relative;
	z-index: 1;
}

.grade-info {
	display: flex;
	align-items: baseline;
	gap: 10px;
}

.grade-info .grade-name {
	font-size: 1.25rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.02em;
}

.grade-info .grade-count {
	font-size: 0.8rem;
	color: #aaa;
	font-weight: 400;
}

.grade-1 .grade-section { border-bottom-color: #d4a017; }
.grade-1 .grade-icon-wrap { background: linear-gradient(135deg, #c9a020, #e8c840); }
.grade-1 .grade-name { color: #9a7a0a; }

.grade-2 .grade-section { border-bottom-color: #8a9bae; }
.grade-2 .grade-icon-wrap { background: linear-gradient(135deg, #7a8a9e, #a8b8c8); }
.grade-2 .grade-name { color: #5a6a7a; }

.grade-3 .grade-section { border-bottom-color: #b07840; }
.grade-3 .grade-icon-wrap { background: linear-gradient(135deg, #a06830, #c89060); }
.grade-3 .grade-name { color: #7a5020; }

.grade-4 .grade-section { border-bottom-color: #0078d4; }
.grade-4 .grade-icon-wrap { background: linear-gradient(135deg, #0070c4, #2b88d8); }
.grade-4 .grade-name { color: #0060aa; }

/* 연도 탭 */
.gallery-year-selector {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 2rem;
	padding: 0.35rem;
	background: #f8fafc;
	border: 1px solid #e3e8ef;
	border-radius: 14px;
}

.gallery-year-tab {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 4.25rem;
	padding: 0.55rem 0.85rem;
	border-radius: 10px;
	font-size: 0.92rem;
	font-weight: 700;
	color: #64748b;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

.gallery-year-tab:hover {
	background: var(--primary-color-bg);
	color: var(--primary-color);
	text-decoration: none;
}

.gallery-year-tab.is-active {
	background: var(--primary-color);
	color: #fff;
}

/* 카드 버튼 */
button.gallery-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 1px solid #e3e8ef;
	text-align: left;
	cursor: pointer;
}

button.gallery-card:focus-visible {
	outline: 2px solid var(--primary-color);
	outline-offset: 2px;
}

.gallery-card__hover {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	background: rgba(15, 23, 42, 0.55);
	color: #fff;
	font-size: 0.85rem;
	font-weight: 600;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.gallery-card__hover i {
	font-size: 1.4rem;
}

.gallery-card:hover .gallery-card__hover {
	opacity: 1;
}

.gallery-card__grade {
	display: inline-block;
	font-size: 0.78rem;
	font-weight: 700;
	color: var(--primary-color);
	margin-bottom: 0.45rem;
}

.gallery-card__author {
	margin: auto 0 0;
	padding-top: 0.45rem;
	font-size: 0.85rem;
	color: #64748b;
}

/* 상격 키별 색상 */
.grade-GRAND .grade-section { border-bottom-color: #d4a017; }
.grade-GRAND .grade-icon-wrap { background: linear-gradient(135deg, #c9a020, #e8c840); }
.grade-GRAND .grade-name { color: #9a7a0a; }

.grade-BEST .grade-section { border-bottom-color: #8a9bae; }
.grade-BEST .grade-icon-wrap { background: linear-gradient(135deg, #7a8a9e, #a8b8c8); }
.grade-BEST .grade-name { color: #5a6a7a; }

.grade-EXCELLENCE .grade-section { border-bottom-color: #b07840; }
.grade-EXCELLENCE .grade-icon-wrap { background: linear-gradient(135deg, #a06830, #c89060); }
.grade-EXCELLENCE .grade-name { color: #7a5020; }

.grade-ENCOURAGEMENT .grade-section { border-bottom-color: #0078d4; }
.grade-ENCOURAGEMENT .grade-icon-wrap { background: linear-gradient(135deg, #0070c4, #2b88d8); }
.grade-ENCOURAGEMENT .grade-name { color: #0060aa; }

/* 상세 모달 */
body.gallery-modal-open {
	overflow: hidden;
}

.gallery-modal[hidden] {
	display: none !important;
}

.gallery-modal {
	position: fixed;
	inset: 0;
	z-index: 1050;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.gallery-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.72);
}

.gallery-modal__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(1200px, 96vw);
	max-height: min(92vh, 920px);
	background: #fff;
	border-radius: 18px;
	overflow: hidden;
	box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}

.gallery-modal__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	z-index: 2;
	width: 2.25rem;
	height: 2.25rem;
	border: 0;
	border-radius: 999px;
	background: rgba(15, 23, 42, 0.65);
	color: #fff;
	cursor: pointer;
}

.gallery-modal__media {
	background: #0f172a;
	min-height: 220px;
	max-height: 58vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gallery-modal__image {
	max-width: 100%;
	max-height: 58vh;
	object-fit: contain;
}

.gallery-modal__frame {
	width: 100%;
	height: 58vh;
	border: 0;
	background: #fff;
}

.gallery-modal__info {
	padding: 1.25rem 1.5rem 1.5rem;
}

.gallery-modal__grade {
	display: inline-block;
	margin-bottom: 0.5rem;
	padding: 0.25rem 0.65rem;
	border-radius: 999px;
	background: var(--primary-color-bg);
	color: var(--primary-color);
	font-size: 0.82rem;
	font-weight: 700;
}

.gallery-modal__title {
	margin: 0 0 0.75rem;
	font-size: 1.25rem;
	font-weight: 800;
	color: #1f2937;
	line-height: 1.35;
}

.gallery-modal__meta,
.gallery-modal__desc {
	margin: 0 0 0.45rem;
	font-size: 0.92rem;
	color: #475569;
	line-height: 1.5;
}

.gallery-modal__file {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin-top: 0.75rem;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--primary-color);
	text-decoration: none;
}

.gallery-modal__file:hover {
	text-decoration: underline;
}

@media (max-width: 767px) {
	.gallery-list__header {
		justify-content: flex-end;
	}

	.gallery-modal {
		padding: 0.5rem;
	}

	.gallery-modal__dialog {
		max-height: 96vh;
	}

	.gallery-modal__frame {
		height: 45vh;
	}
}
