*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Manrope', sans-serif;
  background: #ffffff;
  color: #111;
  padding: 0 30px;
}

.portfolio {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 900px;
}

/* ── Nav ── */
/* ── 데스크탑 Nav (12컬럼 그리드 적용) ── */
.nav {
  display: flex;
  align-items: center;
  height: 42px;
  flex-shrink: 0;
  border-bottom: 1px solid #111;
  background: #ffffff; /* Pieces 페이지 전용 배경색 */
  padding: 0;
}

/* 1~2컬럼: 로고 */
.nav-left-logo {
  flex: 0 0 calc(((100% - (11 * 30px)) / 12) * 2 + (1 * 30px));
}

.nav-left-logo a {
  font-size: 24px;
  font-weight: 400;
  color: #111;
  text-decoration: none;
}

/* 3~6컬럼: 메뉴 */
.nav-center-menu {
  flex: 0 0 calc(((100% - (11 * 30px)) / 12) * 4 + (3 * 30px));
  display: flex;
  gap: 40px;
}

/* 7~11컬럼: 정보 */
.nav-right-info {
  flex: 0 0 calc(((100% - (11 * 30px)) / 12) * 5 + (4 * 30px));
  display: flex;
  justify-content: flex-end;
  gap: 40px;
}

/* 12컬럼: 언어 */
.nav-lang {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.nav a {
  font-size: 18px;
  color: #313131;
  text-decoration: none;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}

.nav a:hover { color: #111; }
.nav a.active {
  color: #111;
  font-weight: 600;
}
/* ── Pieces 그리드 ── */
.pieces-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 30px 0 60px;
}

.piece-item {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  padding: 10px 0 0;
  border-bottom: 1px solid #111;
  transition: opacity 0.15s;
}

.piece-item:hover { opacity: 0.6; }

.piece-thumb {
  width: 200px;
  height: 200px;
  overflow: hidden;
  margin: 0 auto 16px;
}

.piece-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.piece-title {
  font-size: 14px;
  font-weight: 400;
  color: #313131;
  text-align: center;
  padding-bottom: 16px;
}

/* ── 팝업 오버레이 ── */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.popup-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── 팝업 ── */
.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: 480px;
  max-height: 80vh;
  background: #fff;
  border: 1px solid #111;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 101;
}

.popup.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.popup-title {
  font-size: 15px;
  font-weight: 500;
  color: #111;
}

.popup-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: #111;
  line-height: 1;
  padding: 0;
}

.popup-body {
  overflow-y: auto;
  flex: 1;
}

.popup-body::-webkit-scrollbar { display: none; }

.popup-body img,
.popup-body iframe {
  width: 100%;
  height: auto;
  display: block;
}

.popup-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #e0e0e0;
}

/* ── Page transitions ── */
@keyframes pageIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pageOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}