/**
 * Portfolio Frontend Stylesheet (assets/css/portfolio.css)
 * BEM 규칙 기반 그리드, 카드, 필터 탭, 상세 갤러리 및 라이트박스 디자인
 */

/* ── 그리드 레이아웃 ── */
.pf-grid {
	display: grid;
	grid-template-columns: repeat(var(--pf-grid-cols, 3), 1fr);
	gap: var(--pf-grid-gap, 24px);
	width: 100%;
}

/* ── 카드 기본 디자인 ── */
.archf-pf-card {
	position: relative;
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	display: flex;
	flex-direction: column;
}

.archf-pf-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

/* ── 카드 썸네일 및 오버레이 ── */
.archf-pf-card-thumb {
	position: relative;
	overflow: hidden;
	width: 100%;
	aspect-ratio: var(--pf-card-ratio, 4/3);
	margin: 0;
}

.archf-pf-card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.archf-pf-card:hover .archf-pf-card-thumb img {
	transform: scale(1.08);
}

.archf-pf-card-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(30, 58, 95, 0.85); /* 브랜드 주색상(다크 네이비) 반영 */
	opacity: 0;
	visibility: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.35s ease, visibility 0.35s ease;
}

.archf-pf-card:hover .archf-pf-card-overlay {
	opacity: 1;
	visibility: visible;
}

.archf-pf-card-overlay-content {
	text-align: center;
	color: #fff;
	transform: translateY(15px);
	transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.archf-pf-card:hover .archf-pf-card-overlay-content {
	transform: translateY(0);
}

.archf-pf-card-zoom-icon {
	display: inline-block;
	width: 44px;
	height: 44px;
	line-height: 44px;
	background: rgba(255, 255, 255, 0.15);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	font-size: 18px;
	margin-bottom: 8px;
	color: #fff;
}

.archf-pf-card-overlay-meta {
	display: block;
	font-size: 13px;
	letter-spacing: 0.05em;
	opacity: 0.85;
}

/* ── 카드 정보 텍스트 ── */
.archf-pf-card-info {
	padding: 20px;
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	border-top: 1px solid #f0f0f0;
}

.archf-pf-card-category {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	color: var(--color-accent, #2e86ab);
	font-weight: 700;
	margin-bottom: 6px;
	letter-spacing: 0.05em;
}

.archf-pf-card-title {
	font-size: 18px;
	font-weight: 600;
	margin: 0 0 10px 0;
	line-height: 1.4;
}

.archf-pf-card-title a {
	color: #333;
	text-decoration: none;
	transition: color 0.2s ease;
}

.archf-pf-card-title a:hover {
	color: var(--color-primary, #1e3a5f);
}

.archf-pf-card-meta-desc {
	margin-top: auto;
	font-size: 13px;
	color: #666;
}

.archf-pf-meta-label {
	color: #999;
	margin-right: 4px;
}

/* ── 카테고리 필터 탭 ── */
.archf-pf-filter-btn {
	background: #f5f5f5;
	border: 1px solid #e5e5e5;
	color: #666;
	padding: 8px 20px;
	font-size: 14px;
	font-weight: 500;
	border-radius: 30px;
	cursor: pointer;
	transition: all 0.25s ease;
}

.archf-pf-filter-btn:hover,
.archf-pf-filter-btn.active {
	background: var(--color-primary, #1e3a5f);
	border-color: var(--color-primary, #1e3a5f);
	color: #fff;
	box-shadow: 0 4px 10px rgba(30, 58, 95, 0.15);
}

/* ── 라이트박스 모달 ── */
.archf-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.95);
	z-index: 9999;
	display: none;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.archf-lightbox.active {
	display: flex;
	opacity: 1;
}

.archf-lightbox__content {
	position: relative;
	max-width: 85%;
	max-height: 85%;
}

.archf-lightbox__content img {
	max-width: 100%;
	max-height: 85vh;
	object-fit: contain;
	box-shadow: 0 5px 25px rgba(0,0,0,0.5);
	border-radius: 4px;
}

.archf-lightbox__close {
	position: absolute;
	top: -40px;
	right: 0;
	color: #fff;
	font-size: 32px;
	background: none;
	border: none;
	cursor: pointer;
	transition: transform 0.2s ease;
}

.archf-lightbox__close:hover {
	transform: scale(1.1);
}

.archf-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: #fff;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	font-size: 20px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
}

.archf-lightbox__nav:hover {
	background: rgba(255, 255, 255, 0.25);
}

.archf-lightbox__prev { left: -60px; }
.archf-lightbox__next { right: -60px; }

@media (max-width: 767px) {
	.archf-lightbox__nav {
		width: 36px;
		height: 36px;
		font-size: 16px;
	}
	.archf-lightbox__prev { left: -45px; }
	.archf-lightbox__next { right: -45px; }
}

/* ============================================================
 * 시공 사례 — 카드 위치 · 요약
 * ============================================================ */

.archf-pf-card-location {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
	overflow: hidden;
	color: var(--color-text-muted, #6C7A89);
	font-size: 13.5px;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.archf-pf-card-location i {
	flex-shrink: 0;
	color: var(--color-accent, #2E86AB);
	font-size: 12px;
}

.archf-pf-card-facts {
	margin: 8px 0 0;
	color: var(--color-text, #1A1A2E);
	font-size: 13px;
	opacity: 0.75;
}

/* ============================================================
 * 시공 사례 상세 — 제목 → 메인 사진 → 소개 · 건축 개요 → 비정형 갤러리
 * ============================================================ */

.archf-pf-detail {
	--pf-detail-top: clamp(32px, 4vw, 64px);
	--pf-spec-line: #1a1a1a;
	padding-top: var(--pf-detail-top);
	padding-bottom: clamp(80px, 10vw, 160px);
}

/* 투명 헤더(C · D)는 본문이 헤더 밑까지 올라오므로 헤더 높이만큼 더 내린다 */
body.has-header-c .archf-pf-detail,
body.has-header-d .archf-pf-detail {
	padding-top: calc(var(--pf-detail-top) + var(--header-height, 80px));
}

.archf-pf-detail__title {
	margin: 0 0 clamp(24px, 3vw, 48px);
	color: var(--color-text, #1A1A2E);
	font-size: clamp(34px, 4.4vw, 84px);
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: -0.02em;
	word-break: keep-all;
}

.archf-pf-detail__cursor {
	display: inline-block;
	width: 0.36em;
	height: max(2px, 0.04em);
	margin-left: 0.22em;
	background: currentColor;
	animation: archf-pf-cursor 1.1s steps(1) infinite;
}

@keyframes archf-pf-cursor {
	50% { opacity: 0; }
}

/* 메인 사진 */
.archf-pf-detail__hero {
	margin: 0;
	cursor: zoom-in;
}

.archf-pf-detail__hero img {
	display: block;
	width: 100%;
	height: auto;
}

/* ── 마우스 스크롤 안내 (메인 사진 하단 가운데 겹침) ──
   --pf-scroll-lift: 사진 아래쪽이 화면 밖으로 넘칠 때 그만큼 끌어올리는 값 (portfolio.js 가 계산) */
.archf-pf-detail__hero-wrap {
	position: relative;
}

.archf-pf-scroll {
	--pf-scroll-gap: clamp(16px, 3.2vw, 44px);
	position: absolute;
	left: 50%;
	bottom: calc(var(--pf-scroll-gap) + var(--pf-scroll-lift, 0px));
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 6px;
	color: #ffffff;
	text-decoration: none;
	filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.45));
	transform: translateX(-50%);
	transition: opacity 0.4s ease, visibility 0.4s ease;
}

.archf-pf-scroll:hover,
.archf-pf-scroll:focus-visible {
	color: #ffffff;
}

.archf-pf-scroll:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 4px;
	border-radius: 6px;
}

.archf-pf-scroll.is-hidden {
	opacity: 0;
	visibility: hidden;
}

.archf-pf-scroll__icon {
	display: block;
	width: clamp(24px, 2vw, 30px);
	height: auto;
	overflow: visible;
}

.archf-pf-scroll__label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.28em;
	line-height: 1;
	text-indent: 0.28em; /* 자간 때문에 생기는 오른쪽 쏠림 보정 */
}

/* 휠: 위에서 아래로 굴러 내려가며 사라짐 */
.archf-pf-scroll__wheel {
	transform-box: fill-box;
	animation: archf-pf-scroll-wheel 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes archf-pf-scroll-wheel {
	0%   { opacity: 0; transform: translateY(-3px); }
	20%  { opacity: 1; transform: translateY(0); }
	75%  { opacity: 0; transform: translateY(13px); }
	100% { opacity: 0; transform: translateY(13px); }
}

/* 화살표: 위 → 아래 순서로 깜빡이며 흐름 */
.archf-pf-scroll__chev {
	opacity: 0.25;
	animation: archf-pf-scroll-chev 1.8s ease-in-out infinite;
}

.archf-pf-scroll__chev--2 {
	animation-delay: 0.22s;
}

@keyframes archf-pf-scroll-chev {
	0%, 100% { opacity: 0.25; }
	40%      { opacity: 1; }
}

.archf-pf-scroll:hover .archf-pf-scroll__icon {
	transform: translateY(3px);
	transition: transform 0.3s ease;
}

@media (max-width: 767px) {
	.archf-pf-scroll__label {
		display: none;
	}
}

/* 소개 · 건축 개요 */
.archf-pf-detail__overview {
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
	align-items: start;
	gap: clamp(32px, 6vw, 120px);
	margin-top: clamp(40px, 5vw, 80px);
}

.archf-pf-detail__headline {
	margin: 0 0 20px;
	color: var(--color-text, #1A1A2E);
	font-size: clamp(22px, 2.2vw, 40px);
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: -0.01em;
	word-break: keep-all;
}

.archf-pf-detail__summary {
	margin: 0;
	color: var(--color-text, #1A1A2E);
	font-size: 15.5px;
	line-height: 1.9;
	opacity: 0.78;
	word-break: keep-all;
}

.archf-pf-detail__features {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 24px 0 0;
	padding: 0;
	list-style: none;
}

.archf-pf-detail__features li {
	padding: 6px 14px;
	border: 1px solid var(--color-border, #E0E0E0);
	border-radius: 999px;
	color: var(--color-text, #1A1A2E);
	font-size: 13.5px;
	line-height: 1.4;
}

.archf-pf-spec {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	border-top: 1px solid var(--pf-spec-line);
	color: var(--color-text, #1A1A2E);
	font-size: 14.5px;
	line-height: 1.7;
}

.archf-pf-spec th,
.archf-pf-spec td {
	padding: 14px 28px;
	border-bottom: 1px solid var(--pf-spec-line);
	text-align: left;
	vertical-align: top;
}

.archf-pf-spec th {
	width: 34%;
	border-right: 1px solid var(--pf-spec-line);
	font-weight: 700;
	white-space: nowrap;
}

.archf-pf-spec td {
	word-break: keep-all;
	opacity: 0.85;
}

/* 비정형 갤러리 — 왼쪽 좁게 → 오른쪽 넓게 → 꽉 차게 (세로형은 좁게, 좌우 번갈아) */
.archf-pf-flow {
	display: flex;
	flex-direction: column;
	gap: clamp(40px, 6vw, 110px);
	margin-top: clamp(64px, 9vw, 160px);
}

.archf-pf-flow__item {
	margin: 0;
	overflow: hidden;
	cursor: zoom-in;
}

.archf-pf-flow__item img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.archf-pf-flow__item:hover img {
	transform: scale(1.025);
}

.archf-pf-flow__item.is-full {
	width: 100%;
}

.archf-pf-flow__item.is-left {
	width: 58%;
	margin-right: auto;
}

.archf-pf-flow__item.is-right {
	width: 72%;
	margin-left: auto;
}

.archf-pf-flow__item.is-portrait.is-left,
.archf-pf-flow__item.is-portrait.is-right {
	width: 40%;
}

.archf-pf-flow__item.is-square.is-left,
.archf-pf-flow__item.is-square.is-right {
	width: 46%;
}

@media (max-width: 900px) {
	.archf-pf-detail__overview {
		grid-template-columns: 1fr;
	}

	.archf-pf-spec th,
	.archf-pf-spec td {
		padding: 12px 16px;
	}
}

@media (max-width: 767px) {
	.archf-pf-flow {
		gap: 28px;
	}

	.archf-pf-flow__item.is-left,
	.archf-pf-flow__item.is-right {
		width: 88%;
	}

	.archf-pf-flow__item.is-portrait.is-left,
	.archf-pf-flow__item.is-portrait.is-right,
	.archf-pf-flow__item.is-square.is-left,
	.archf-pf-flow__item.is-square.is-right {
		width: 72%;
	}

	.archf-pf-spec {
		font-size: 14px;
	}

	.archf-pf-spec th {
		width: 30%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.archf-pf-detail__cursor,
	.archf-pf-scroll__wheel,
	.archf-pf-scroll__chev {
		animation: none;
	}

	.archf-pf-scroll__chev {
		opacity: 1;
	}

	.archf-pf-flow__item img {
		transition: none;
	}
}

/* ============================================================
 * 「프로젝트 전체」 템플릿 — 큰 제목 · 설명 → 사진 타일 그리드 (templates/template-portfolio.php)
 * ============================================================ */

.archf-pl {
	--pl-top: clamp(40px, 5vw, 80px);
	padding-top: var(--pl-top);
	padding-bottom: clamp(80px, 10vw, 160px);
}

/* 투명 헤더(C · D)는 본문이 헤더 밑까지 올라오므로 헤더 높이만큼 더 내린다 */
body.has-header-c .archf-pl,
body.has-header-d .archf-pl {
	padding-top: calc(var(--pl-top) + var(--header-height, 80px));
}

.archf-pl__head {
	margin-bottom: clamp(48px, 6vw, 96px);
}

.archf-pl__title {
	margin: 0;
	color: var(--color-text, #1A1A2E);
	font-size: clamp(34px, 3.2vw, 56px);
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.archf-pl__desc,
.archf-pl__content {
	margin: 18px 0 0;
	color: var(--color-text, #1A1A2E);
	font-size: 15px;
	line-height: 1.7;
	word-break: keep-all;
}

.archf-pl__grid {
	display: grid;
	grid-template-columns: repeat(var(--pl-cols, 2), minmax(0, 1fr));
	gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.archf-pl__item {
	margin: 0;
}

.archf-pl__link {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 3 / 2;
	border-radius: 0; /* 모서리 둥글림 없음 */
	background: #f2f2f2;
	color: #fff;
	text-decoration: none;
}

.archf-pl__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.archf-pl__caption {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 4px;
	padding: clamp(18px, 2.4vw, 36px);
	background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) 55%);
	opacity: 0;
	transition: opacity 0.35s ease;
}

/* 마우스 오버 글씨 — 값은 「외모 › 사용자 정의 › 포트폴리오 설정」 (inc/portfolio-project-list.php 가 변수로 넣음) */
.archf-pl__name {
	color: var(--pl-name-color, #ffffff);
	font-family: var(--pl-name-font, inherit);
	font-size: var(--pl-name-size, 24px);
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: var(--pl-name-ls, -0.02em);
	transform: translateY(10px);
	transition: transform 0.35s ease;
}

.archf-pl__loc {
	color: var(--pl-desc-color, #ffffff);
	font-family: var(--pl-desc-font, inherit);
	font-size: var(--pl-desc-size, 14px);
	letter-spacing: var(--pl-desc-ls, -0.02em);
}

.archf-pl__link:hover .archf-pl__img,
.archf-pl__link:focus-visible .archf-pl__img {
	transform: scale(1.04);
}

.archf-pl__link:hover .archf-pl__caption,
.archf-pl__link:focus-visible .archf-pl__caption {
	opacity: 1;
}

.archf-pl__link:hover .archf-pl__name,
.archf-pl__link:focus-visible .archf-pl__name {
	transform: none;
}

.archf-pl__empty {
	color: var(--color-text-muted, #6C7A89);
}

/* 터치 기기는 마우스를 올릴 수 없으므로 이름을 늘 보인다 */
@media (hover: none) {
	.archf-pl__caption {
		opacity: 1;
	}

	.archf-pl__name {
		transform: none;
	}
}

@media (max-width: 1024px) {
	.archf-pl__grid {
		--pl-cols: 2 !important;
	}
}

@media (max-width: 767px) {
	.archf-pl__grid {
		--pl-cols: 1 !important;
	}

	/* 모바일은 설정 크기의 85% */
	.archf-pl__name {
		font-size: calc(var(--pl-name-size, 24px) * 0.85);
	}

	.archf-pl__loc {
		font-size: calc(var(--pl-desc-size, 14px) * 0.85);
	}
}

@media (prefers-reduced-motion: reduce) {
	.archf-pl__img,
	.archf-pl__caption,
	.archf-pl__name {
		transition: none;
	}
}
