/*
 * 一功照片牆 — 前台樣式
 *
 * 色彩依一功營造 CIS:
 *   主金 #C1AC73 / 深棕 #7B3F00 / 深紅 #8B0000 / 米白 #FAF3E0 / 炭黑 #1C1C1C
 * 注意:主金在米白底上的對比僅約 2:1,只用於線條與點綴,不作為文字色;
 *      需要金屬感的文字一律改用深棕(對比約 7:1)。
 */

.ygw-wall {
	--ygw-gold: #c1ac73;
	--ygw-brown: #7b3f00;
	--ygw-cream: #faf3e0;
	--ygw-ink: #1c1c1c;
	--ygw-ink-60: rgba(28, 28, 28, 0.6);
	--ygw-line: rgba(28, 28, 28, 0.12);
	--ygw-gap: 18px;
	--ygw-radius: 2px;
	--ygw-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

	background: var(--ygw-cream);
	padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 40px);
	color: var(--ygw-ink);
	font-family: "Noto Serif TC", "Songti TC", serif;
	box-sizing: border-box;
}

.ygw-wall *,
.ygw-wall *::before,
.ygw-wall *::after {
	box-sizing: inherit;
}

/* 篩選列 */

.ygw-filter {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: clamp(8px, 2vw, 28px);
	align-items: center;
	justify-content: center;
	margin: 0 0 clamp(24px, 4vw, 44px);
	padding-bottom: 14px;
	border-bottom: 1px solid var(--ygw-line);
}

.ygw-wall .ygw-filter__btn {
	appearance: none;
	background: none;
	border: 0;
	margin: 0;
	padding: 10px 6px;
	min-height: 44px;
	font-family: inherit;
	font-size: clamp(15px, 1.1vw, 17px);
	letter-spacing: 0.08em;
	color: var(--ygw-ink-60);
	cursor: pointer;
	transition: color 0.24s var(--ygw-ease);
}

.ygw-wall .ygw-filter__btn:hover,
.ygw-wall .ygw-filter__btn:focus-visible {
	color: var(--ygw-brown);
}

.ygw-wall .ygw-filter__btn.is-active {
	color: var(--ygw-brown);
	font-weight: 600;
}

.ygw-filter__btn:focus-visible,
.ygw-item__btn:focus-visible,
.ygw-more__btn:focus-visible,
.ygw-lb__ctrl:focus-visible {
	outline: 2px solid var(--ygw-brown);
	outline-offset: 3px;
}

/* 滑動的金色底線,位置由 JS 以 transform 驅動 */
.ygw-filter__ink {
	position: absolute;
	left: 0;
	bottom: -1px;
	height: 2px;
	width: 0;
	background: var(--ygw-gold);
	transform-origin: left center;
	pointer-events: none;
}

/* 瀑布流 */

.ygw-grid {
	display: flex;
	align-items: flex-start;
	gap: var(--ygw-gap);
}

.ygw-col {
	display: flex;
	flex-direction: column;
	gap: var(--ygw-gap);
	flex: 1 1 0;
	min-width: 0;
}

.ygw-wall .ygw-item {
	margin: 0;
	padding: 0;
	width: 100%;
	position: relative;
}

.ygw-wall .ygw-item__btn {
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: rgba(28, 28, 28, 0.04);
	border-radius: var(--ygw-radius);
	overflow: hidden;
	cursor: pointer;
	position: relative;
	line-height: 0;
}

.ygw-wall .ygw-item__img {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	border-radius: var(--ygw-radius);
	transform: scale(1);
	transition: transform 0.5s var(--ygw-ease);
}

/* 只縮放圖片本身,容器尺寸不變,不會擠動旁邊的照片 */
.ygw-item__btn:hover .ygw-item__img,
.ygw-item__btn:focus-visible .ygw-item__img {
	transform: scale(1.04);
}

/* 金色細框在 hover 時浮現,克制但有回饋 */
.ygw-item__veil {
	position: absolute;
	inset: 0;
	border: 1px solid transparent;
	border-radius: var(--ygw-radius);
	box-shadow: inset 0 0 0 0 rgba(193, 172, 115, 0);
	transition: border-color 0.3s var(--ygw-ease), box-shadow 0.3s var(--ygw-ease);
	pointer-events: none;
}

.ygw-item__btn:hover .ygw-item__veil,
.ygw-item__btn:focus-visible .ygw-item__veil {
	border-color: var(--ygw-gold);
	box-shadow: inset 0 0 0 3px rgba(250, 243, 224, 0.55);
}

/* 載入更多 */

.ygw-more {
	display: flex;
	justify-content: center;
	margin-top: clamp(28px, 4vw, 48px);
}

.ygw-more[hidden] {
	display: none;
}

.ygw-wall .ygw-more__btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	padding: 12px 40px;
	font-family: inherit;
	font-size: 16px;
	letter-spacing: 0.14em;
	color: var(--ygw-brown);
	background: transparent;
	border: 1px solid var(--ygw-gold);
	border-radius: var(--ygw-radius);
	cursor: pointer;
	transition: background-color 0.28s var(--ygw-ease), color 0.28s var(--ygw-ease);
}

.ygw-wall .ygw-more__btn:hover:not(:disabled) {
	background: var(--ygw-brown);
	border-color: var(--ygw-brown);
	color: var(--ygw-cream);
}

.ygw-wall .ygw-more__btn:disabled {
	opacity: 0.45;
	cursor: default;
}

.ygw-more__spinner {
	display: none;
	width: 15px;
	height: 15px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: ygw-spin 0.7s linear infinite;
}

.ygw-more__btn.is-loading .ygw-more__spinner {
	display: inline-block;
}

@keyframes ygw-spin {
	to { transform: rotate(360deg); }
}

.ygw-status {
	margin-top: 18px;
	text-align: center;
	font-size: 14px;
	letter-spacing: 0.1em;
	color: var(--ygw-ink-60);
	min-height: 1em;
}

.ygw-empty {
	text-align: center;
	color: var(--ygw-ink-60);
	margin: 0;
	padding: 48px 0;
}

/* 燈箱 */

.ygw-lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(20, 18, 15, 0.94);
	opacity: 0;
	visibility: hidden;
	font-family: "Noto Serif TC", "Songti TC", serif;
}

.ygw-lb.is-open {
	visibility: visible;
}

.ygw-lb__stage {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(56px, 8vh, 96px) clamp(16px, 8vw, 110px);
}

.ygw-lb__figure {
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}

.ygw-lb__img {
	max-width: 100%;
	max-height: calc(100vh - 210px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.04);
}

.ygw-lb__caption {
	color: #faf3e0;
	font-size: 15px;
	letter-spacing: 0.06em;
	text-align: center;
	margin: 0;
	max-width: 60ch;
}

.ygw-lb__term {
	display: inline-block;
	margin-right: 12px;
	padding: 3px 12px;
	border: 1px solid #c1ac73;
	border-radius: 999px;
	font-size: 13px;
	color: #c1ac73;
	letter-spacing: 0.1em;
}

.ygw-lb .ygw-lb__ctrl {
	position: absolute;
	appearance: none;
	background: transparent;
	border: 1px solid rgba(193, 172, 115, 0.45);
	color: #faf3e0;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background-color 0.25s cubic-bezier(0.22, 0.61, 0.36, 1), border-color 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.ygw-lb .ygw-lb__ctrl:hover {
	background: rgba(193, 172, 115, 0.18);
	border-color: #c1ac73;
}

.ygw-lb__ctrl svg {
	width: 20px;
	height: 20px;
	stroke: currentColor;
	stroke-width: 1.5;
	fill: none;
}

.ygw-lb__close {
	top: clamp(14px, 3vh, 30px);
	right: clamp(14px, 3vw, 34px);
}

.ygw-lb__prev {
	left: clamp(10px, 2.5vw, 34px);
	top: 50%;
	transform: translateY(-50%);
}

.ygw-lb__next {
	right: clamp(10px, 2.5vw, 34px);
	top: 50%;
	transform: translateY(-50%);
}

.ygw-lb__counter {
	position: absolute;
	bottom: clamp(16px, 3vh, 30px);
	left: 50%;
	transform: translateX(-50%);
	color: rgba(250, 243, 224, 0.72);
	font-size: 13px;
	letter-spacing: 0.18em;
}

body.ygw-lb-open {
	overflow: hidden;
}

/* 響應式 */

@media (max-width: 1024px) {
	.ygw-wall {
		--ygw-gap: 14px;
	}
}

@media (max-width: 600px) {
	.ygw-wall {
		--ygw-gap: 10px;
	}

	.ygw-filter {
		gap: 4px 14px;
		justify-content: flex-start;
	}

	.ygw-lb__prev {
		left: 8px;
	}

	.ygw-lb__next {
		right: 8px;
	}

	.ygw-lb__ctrl {
		width: 46px;
		height: 46px;
	}

	.ygw-lb__img {
		max-height: calc(100vh - 240px);
	}
}

/* 減少動態偏好 */

@media (prefers-reduced-motion: reduce) {
	.ygw-wall *,
	.ygw-lb * {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}

	.ygw-item__btn:hover .ygw-item__img {
		transform: none;
	}
}
