/* ==========================================================================
   ST Portfolio 作品集 — 前台樣式
   ========================================================================== */

:root {
	--stpf-content-width: 1200px;
	--stpf-line: rgba(0, 0, 0, .12);
	--stpf-muted: #8a8a8a;
	--stpf-ease: cubic-bezier(.22, .61, .36, 1);
}

.stpf-grid, .stpf-grid *,
.stpf-gallery, .stpf-gallery *,
.stpf-info-wrap, .stpf-info-wrap *,
.stpf-single, .stpf-single *,
.stpf-archive, .stpf-archive * { box-sizing: border-box; }

/* --------------------------------------------------------- 作品列表 grid */

.stpf-grid {
	display: grid;
	grid-template-columns: repeat(var(--stpf-columns, 3), minmax(0, 1fr));
	column-gap: var(--stpf-gap-x, var(--stpf-gap, 24px));
	row-gap: var(--stpf-gap-y, var(--stpf-gap, 48px));
}

.stpf-card {
	min-width: 0;
}

.stpf-card__link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.stpf-card__media {
	position: relative;
	overflow: hidden;
	aspect-ratio: var(--stpf-ratio, 4/3);
	background: rgba(0, 0, 0, .04);
}

.stpf-card__media img,
.stpf-card__placeholder {
	display: block;
	/* 固定比例框：圖片一律填滿、超出裁掉（!important 是為了蓋掉部分佈景主題的 img 規則） */
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	object-fit: cover !important;
	object-position: var(--stpf-object-pos, center center);
	transition: transform .9s var(--stpf-ease), opacity .5s ease, filter .5s ease;
}

.stpf-card__placeholder {
	background: repeating-linear-gradient(45deg, rgba(0, 0, 0, .04) 0 10px, rgba(0, 0, 0, .06) 10px 20px);
}

/* hover 效果（克制） */
.stpf-hover-zoom .stpf-card__link:hover .stpf-card__media img {
	transform: scale(var(--stpf-hover-scale, 1.06));
}

.stpf-hover-fade .stpf-card__link:hover .stpf-card__media img {
	opacity: .82;
}

.stpf-hover-lift .stpf-card {
	transition: transform .5s var(--stpf-ease);
}

.stpf-hover-lift .stpf-card:hover {
	transform: translateY(-6px);
}

.stpf-card__body {
	padding-top: 14px;
}

.stpf-card__title {
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.5;
	font-weight: 600;
	transition: color .3s ease;
}

.stpf-card__subtitle {
	margin-top: 6px;
	font-size: .9rem;
	color: var(--stpf-muted);
	line-height: 1.6;
}

.stpf-card__desc {
	margin-top: 10px;
	font-size: .9rem;
	line-height: 1.85;
	color: var(--stpf-muted);
}

/* --------------------------------------------------------- 滑入浮出資訊 */

.stpf-card--overlay .stpf-card__veil {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: grid;
	align-content: var(--stpf-veil-align, center);
	justify-items: var(--stpf-veil-justify, center);
	text-align: var(--stpf-veil-text, center);
	padding: var(--stpf-veil-pad, clamp(14px, 2vw, 28px));
	background: var(--stpf-veil-bg, rgba(255, 255, 255, .82));
	color: var(--stpf-veil-ink, #1a1a1a);
	opacity: 0;
	transition: opacity var(--stpf-veil-dur, 420ms) ease;
	pointer-events: none;
}

.stpf-card--overlay .stpf-card__link:hover .stpf-card__veil,
.stpf-card--overlay .stpf-card__link:focus-visible .stpf-card__veil {
	opacity: 1;
}

.stpf-card--overlay .stpf-card__body {
	padding-top: 0;
	display: grid;
	gap: var(--stpf-veil-gap, 6px);
	justify-items: inherit;
}

.stpf-card--overlay .stpf-card__title,
.stpf-card--overlay .stpf-card__subtitle,
.stpf-card--overlay .stpf-card__meta,
.stpf-card--overlay .stpf-spec__label,
.stpf-card--overlay .stpf-spec__value,
.stpf-card--overlay .stpf-card__term {
	color: inherit;
}

.stpf-card--overlay .stpf-card__specs {
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: inherit;
	gap: 2px 18px;
	row-gap: 2px;
}

.stpf-card--overlay .stpf-spec {
	flex-direction: row;
	align-items: baseline;
	gap: 6px;
}

.stpf-card--overlay .stpf-card__terms {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 4px 12px;
	align-items: center;
}

/* 沒有滑鼠的裝置（手機、平板） */
@media (hover: none) {
	/* 直接顯示在照片下緣 */
	.stpf-card--overlay.stpf-card--m-show .stpf-card__veil {
		opacity: 1;
		align-content: end;
		justify-items: start;
		text-align: left;
		background: var(--stpf-veil-bg-mobile,
			linear-gradient(to top, rgba(12, 11, 10, .62) 0%, rgba(12, 11, 10, .18) 52%, rgba(12, 11, 10, 0) 100%));
		color: var(--stpf-veil-ink-mobile, #fff);
	}

	/* 完全不顯示 */
	.stpf-card--overlay.stpf-card--m-hide .stpf-card__veil { display: none; }

	/* 點一下才顯示，再點一次才進入作品（樣式與電腦版相同） */
	.stpf-card--overlay.stpf-card--m-tap.is-revealed .stpf-card__veil { opacity: 1; }

	/* 觸控裝置上 :hover 有時會殘留，交給 JS 控制就好 */
	.stpf-card--overlay.stpf-card--m-tap .stpf-card__link:hover .stpf-card__veil { opacity: 0; }
	.stpf-card--overlay.stpf-card--m-tap.is-revealed .stpf-card__link:hover .stpf-card__veil { opacity: 1; }
}

/* 資訊列：橫式（名稱｜規模・竣工｜標籤） */
.stpf-card__body--row {
	display: grid;
	grid-template-columns:
		minmax(0, var(--stpf-col-main, 1.6fr))
		minmax(0, var(--stpf-col-specs, 1fr))
		minmax(0, auto);
	column-gap: 32px;
	align-items: start;
}

.stpf-card__body--row .stpf-card__title {
	line-height: 1.4;
}

/* 資訊列：直式 */
.stpf-card__body--stack .stpf-card__specs {
	margin-top: 8px;
}

.stpf-card__body--stack .stpf-card__terms {
	margin-top: 8px;
	flex-direction: row;
	flex-wrap: wrap;
	column-gap: 12px;
	align-items: flex-start !important;
}

/* 規模／竣工 */
.stpf-card__specs {
	display: flex;
	flex-direction: column;
	row-gap: var(--stpf-spec-gap, 10px);
	min-width: 0;
}

.stpf-spec {
	display: flex;
	flex-direction: column;
	line-height: 1.45;
}

.stpf-spec__label {
	font-size: .82rem;
	color: var(--stpf-muted);
	letter-spacing: .04em;
}

.stpf-spec__value {
	font-size: .98rem;
	font-weight: 600;
}

/* 分類標籤 */
.stpf-card__terms {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	row-gap: 6px;
	min-width: 0;
}

.stpf-card__term {
	font-size: .82rem;
	line-height: 1.6;
	white-space: nowrap;
	border-bottom: 1px solid currentColor;
	padding-bottom: 2px;
}

.stpf-empty {
	padding: 40px 20px;
	text-align: center;
	color: var(--stpf-muted);
	border: 1px dashed var(--stpf-line);
}

/* 分頁 */
.stpf-pagination {
	margin-top: 56px;
	display: flex;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
}

.stpf-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	text-decoration: none;
	border: 1px solid var(--stpf-line);
	color: inherit;
	transition: background-color .3s ease, color .3s ease;
}

.stpf-pagination .page-numbers.current,
.stpf-pagination .page-numbers:hover {
	background: currentColor;
	color: #fff;
}

.stpf-pagination .page-numbers.current {
	background: #1a1a1a;
	color: #fff;
	border-color: #1a1a1a;
}

/* --------------------------------------------------------- 作品封面 */

.stpf-cover {
	overflow: hidden;
}

.stpf-cover__img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: var(--stpf-ratio, auto);
	object-fit: cover;
}

/* --------------------------------------------------------- 作品圖文 */

.stpf-gallery {
	display: flex;
	flex-direction: column;
	gap: var(--stpf-block-gap, 80px);
}

.stpf-gallery--two {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--stpf-block-gap, 40px);
}

.stpf-figure {
	margin: 0;
}

.stpf-gallery--stack .stpf-figure {
	margin-inline: auto;
	width: 100%;
}

.stpf-gallery--stack .stpf-figure--large {
	max-width: 84%;
}

.stpf-gallery--stack .stpf-figure--medium {
	max-width: 62%;
}

.stpf-gallery--stack .stpf-figure--small {
	max-width: 42%;
}

.stpf-figure__media {
	overflow: hidden;
}

.stpf-figure__img {
	display: block;
	width: 100%;
	height: auto;
}

.stpf-figure__caption {
	margin-top: var(--stpf-caption-gap, 16px);
	font-size: .92rem;
	line-height: 1.9;
	color: var(--stpf-muted);
}

.stpf-figure__caption p {
	margin: 0 0 .8em;
}

.stpf-figure__caption p:last-child {
	margin-bottom: 0;
}

/* 文字在右側 */
.stpf-gallery--text-side .stpf-figure {
	display: grid;
	grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
	column-gap: 40px;
	align-items: start;
}

.stpf-gallery--text-side .stpf-figure__caption {
	margin-top: 0;
}

/* --------------------------------------------------------- 作品資訊 */

.stpf-info-wrap {
	display: flex;
	flex-direction: column;
	gap: var(--stpf-desc-gap, 32px);
}

.stpf-info__desc {
	line-height: 2;
}

.stpf-info__desc p {
	margin: 0 0 1em;
}

.stpf-info__desc p:last-child {
	margin-bottom: 0;
}

.stpf-info {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: var(--stpf-info-gap, 14px);
}

.stpf-info__row {
	display: grid;
	grid-template-columns: var(--stpf-label-width, 120px) minmax(0, 1fr);
	gap: 12px;
	padding-bottom: var(--stpf-info-gap, 14px);
}

.stpf-info--inline .stpf-info__row {
	grid-template-columns: minmax(0, 1fr);
	gap: 4px;
}

.stpf-info__label {
	margin: 0;
	font-size: .85rem;
	letter-spacing: .08em;
	color: var(--stpf-muted);
	font-weight: 400;
}

.stpf-info__value {
	margin: 0;
	font-size: 1rem;
	line-height: 1.7;
}

/* --------------------------------------------------------- 內建單頁樣板 */

.stpf-single {
	padding-bottom: 100px;
}

.stpf-single__hero {
	width: 100%;
	overflow: hidden;
}

.stpf-single__hero-img {
	display: block;
	width: 100%;
	height: auto;
	animation: stpf-hero 1.4s var(--stpf-ease) both;
}

@keyframes stpf-hero {
	from {
		opacity: 0;
		transform: scale(1.04);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.stpf-single__header,
.stpf-single__intro,
.stpf-single__gallery,
.stpf-single__footer,
.stpf-nav,
.stpf-archive {
	max-width: var(--stpf-content-width, 1200px);
	margin-inline: auto;
	padding-inline: 20px;
}

.stpf-single__header {
	padding-top: 72px;
	padding-bottom: 48px;
}

.stpf-single__cats {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.stpf-single__cats a {
	font-size: .8rem;
	letter-spacing: .1em;
	color: var(--stpf-muted);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color .3s ease, color .3s ease;
}

.stpf-single__cats a:hover {
	border-color: currentColor;
}

.stpf-single__title {
	margin: 0;
	font-size: clamp(1.7rem, 3.4vw, 2.6rem);
	line-height: 1.35;
	font-weight: 500;
	letter-spacing: .02em;
}

.stpf-single__subtitle {
	margin: 14px 0 0;
	color: var(--stpf-muted);
	line-height: 1.9;
}

.stpf-single__intro {
	padding-bottom: 56px;
	line-height: 2;
	max-width: min(var(--stpf-content-width, 1200px), 860px);
}

.stpf-single__footer {
	margin-top: 96px;
	padding-top: 40px;
	border-top: 1px solid var(--stpf-line);
	max-width: min(var(--stpf-content-width, 1200px), 860px);
}

.stpf-single__footer .stpf-info__row {
	border-bottom: 1px solid var(--stpf-line);
}

.stpf-single__footer .stpf-info__row:last-child {
	border-bottom: 0;
}

/* 上下篇 */
.stpf-nav {
	margin-top: 72px;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 20px;
}

.stpf-nav__side--right {
	text-align: right;
}

.stpf-nav__link {
	display: inline-block;
	text-decoration: none;
	color: inherit;
	max-width: 100%;
}

.stpf-nav__label {
	display: block;
	font-size: .75rem;
	letter-spacing: .12em;
	color: var(--stpf-muted);
	margin-bottom: 4px;
}

.stpf-nav__title {
	display: block;
	font-size: .95rem;
	border-bottom: 1px solid transparent;
	transition: border-color .3s ease;
}

.stpf-nav__link:hover .stpf-nav__title {
	border-color: currentColor;
}

.stpf-nav__all {
	font-size: .8rem;
	letter-spacing: .12em;
	text-decoration: none;
	color: inherit;
	border: 1px solid var(--stpf-line);
	padding: 10px 20px;
	transition: background-color .3s ease, color .3s ease;
	white-space: nowrap;
}

.stpf-nav__all:hover {
	background: #1a1a1a;
	color: #fff;
	border-color: #1a1a1a;
}

/* 封存頁 */
.stpf-archive {
	padding-block: 72px 100px;
}

.stpf-archive__header {
	margin-bottom: 48px;
}

.stpf-archive__title {
	margin: 0;
	font-size: clamp(1.6rem, 3vw, 2.2rem);
	font-weight: 500;
	letter-spacing: .06em;
}

/* --------------------------------------------------------- 進場動畫 */

html.stpf-js .stpf-reveal {
	opacity: 0;
	will-change: opacity, transform;
	transition:
		opacity var(--stpf-anim-duration, 700ms) var(--stpf-ease),
		transform var(--stpf-anim-duration, 700ms) var(--stpf-ease);
	transition-delay: var(--stpf-delay, 0ms);
}

html.stpf-js .stpf-reveal--fade-up {
	transform: translateY(18px);
}

html.stpf-js .stpf-reveal.is-visible {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	html.stpf-js .stpf-reveal {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}

	.stpf-single__hero-img {
		animation: none;
	}

	.stpf-card__media img {
		transition: none;
	}
}

/* --------------------------------------------------------- 響應式 */

@media (max-width: 1024px) {
	.stpf-gallery--text-side .stpf-figure {
		column-gap: 28px;
	}
}

@media (max-width: 767px) {
	.stpf-card__body--row {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 10px;
	}

	.stpf-card__body--row .stpf-card__terms {
		flex-direction: row;
		flex-wrap: wrap;
		column-gap: 12px;
		align-items: flex-start !important;
	}

	.stpf-card__specs {
		flex-direction: row;
		flex-wrap: wrap;
		column-gap: 24px;
	}

	.stpf-gallery--stack .stpf-figure--large,
	.stpf-gallery--stack .stpf-figure--medium,
	.stpf-gallery--stack .stpf-figure--small {
		max-width: 100%;
	}

	.stpf-gallery--two {
		grid-template-columns: minmax(0, 1fr);
	}

	.stpf-gallery--text-side .stpf-figure {
		grid-template-columns: minmax(0, 1fr);
	}

	.stpf-gallery--text-side .stpf-figure__caption {
		margin-top: var(--stpf-caption-gap, 16px);
	}

	.stpf-single__header {
		padding-top: 44px;
		padding-bottom: 32px;
	}

	.stpf-info__row {
		grid-template-columns: minmax(0, 1fr);
		gap: 4px;
	}

	.stpf-nav {
		grid-template-columns: minmax(0, 1fr);
		text-align: center;
		gap: 24px;
	}

	.stpf-nav__side--right {
		text-align: center;
	}
}
