/* 작품 상세페이지 공통 스타일 — works/*.html 이 함께 쓴다 (works.html 과 같은 색·서체 규칙) */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --signature: #E8431E;
  --radius-sm: 6px;
  --bg: #ffffff;
  --bg-soft: #f7f6f3;
  --fg: #1f1d1a;
  --fg-mid: #6e6659;
  --fg-dim: #a09889;
  --hair: #ebe9e4;
  --navbg: rgba(255,255,255,0.86);
  --btn-bg: #1f1d1a;
  --btn-fg: #ffffff;
  --nav: 62px;
  --edge: max(1.5rem, calc((100vw - 1700px) / 2 + 1.5rem));
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Pretendard Variable', Pretendard, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  font-size: var(--fs-4); line-height: var(--lh-text);
  background: var(--bg); color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── NAV (works.html 과 동일) ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 40px;
  background: var(--navbg); backdrop-filter: blur(14px);
  border-bottom: 0.5px solid var(--hair);
}
.logo { font-family: 'Fraunces', serif; font-size: var(--fs-3); font-weight: 500; letter-spacing: 0.06em; }
.logo em { font-style: normal; color: var(--signature); }
.nav-cta {
  position: relative;
  font-family: 'Fraunces', serif; font-style: italic; font-size: var(--fs-4);
  display: inline-flex; align-items: baseline; gap: 8px;
  opacity: 0.78; padding-bottom: 4px; transition: opacity 0.3s;
}
.nav-cta .ar { font-family: 'Pretendard Variable', Pretendard, sans-serif; font-style: normal; font-size: var(--fs-5); transition: transform 0.3s; }
.nav-cta::after {
  content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 0.5px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}
.nav-cta:hover { opacity: 1; }
.nav-cta:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-cta:hover .ar { transform: translateX(3px); }

/* ── 상단 한 줄: Works 로 돌아가기 · 번호 ── */
.crumb {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 16px var(--edge) 0;
  font-family: 'Fraunces', serif; font-style: italic; font-size: var(--fs-4); color: var(--fg-mid);
}
.crumb-back { display: inline-flex; gap: 8px; align-items: baseline; transition: color 0.2s; }
.crumb-back .ar { font-style: normal; font-size: var(--fs-5); transition: transform 0.3s; }
.crumb-back:hover { color: var(--fg); }
.crumb-back:hover .ar { transform: translateX(-3px); }
.crumb-no { font-size: var(--fs-5); letter-spacing: 0.02em; color: var(--fg); }
.crumb-no span { color: var(--fg-mid); }

/* ── 첫 화면: 좌 작품 전체 / 우 정보 ── */
.wk-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 27vw, 420px);
  gap: clamp(32px, 4.5vw, 88px);
  padding: 20px var(--edge) 0;
  align-items: start;
}
.wk-plate { margin: 0; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.wk-view {
  display: block; padding: 0; border: 0; background: var(--bg-soft);
  cursor: zoom-in; max-width: 100%;
}
/* 그림 전체가 한 화면 안에 다 보이도록 — 높이를 창에 맞추고 폭이 넘치면 폭에 맞춘다 */
.wk-view img {
  display: block; width: auto; height: auto;
  max-width: 100%;
  max-height: calc(100vh - var(--nav) - 6.5rem);
  box-shadow: 0 26px 56px -18px rgba(31,29,26,0.16), 0 6px 14px rgba(31,29,26,0.06);
}
@supports (height: 100svh) {
  .wk-view img { max-height: calc(100svh - var(--nav) - 6.5rem); }
}
.wk-plate figcaption {
  align-self: stretch; text-align: center; margin-top: 16px;
  font-family: 'Fraunces', serif; font-style: italic; font-size: var(--fs-5); color: var(--fg-mid);
}

.wk-info { position: sticky; top: calc(var(--nav) + 1.5rem); padding-bottom: 16px; }
.eyebrow {
  font-size: var(--fs-5); font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-mid); margin-bottom: 16px;
}
.wk-info h1 {
  font-family: 'Fraunces', serif; font-weight: 500; line-height: var(--lh-title);
  letter-spacing: 0.005em; margin-bottom: 24px;
  display: flex; flex-wrap: wrap; align-items: baseline;
}
.h-code { font-size: var(--fs-1); }
.h-date { font-size: var(--fs-4); font-weight: 400; color: var(--fg-mid); letter-spacing: 0.02em; }
/* 이름이 있는 작품 — 이름을 크게, 주문 코드를 그 아래 작게 */
.h-name { font-size: var(--fs-1); }
.h-sub {
  flex-basis: 100%; margin-top: 12px;
  font-family: 'Pretendard Variable', Pretendard, sans-serif;
  font-size: var(--fs-5); font-weight: 500; letter-spacing: 0.12em; color: var(--fg-mid);
}

.wk-status { margin: -8px 0 24px; font-size: var(--fs-5); color: var(--signature); }
.note { font-size: var(--fs-4); line-height: var(--lh-text); color: var(--fg-mid); margin-bottom: 24px; }
.note .en { margin-top: 8px; font-family: 'Fraunces', serif; font-style: italic; font-size: var(--fs-5); line-height: var(--lh-text); color: var(--fg-mid); }

/* 라인업 대표 작품 안내 — 좌우 실선 한 줄로 격을 만든다 (works.html 의 Lineup 표기와 같은 어법) */
.lu { margin: 0 0 24px; padding: 16px 0 16px; border-top: 0.5px solid var(--hair); }
.lu-tag {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: 'Fraunces', serif; font-style: italic; font-size: var(--fs-4); color: var(--signature);
  margin-bottom: 8px;
}
.lu-tag::before { content: ''; width: 22px; height: 0.5px; background: var(--signature); opacity: 0.7; }
.lu p { font-size: var(--fs-5); line-height: var(--lh-text); color: var(--fg-mid); margin-bottom: 8px; }
.lu-go { font-size: var(--fs-5); border-bottom: 0.5px solid var(--fg-dim); padding-bottom: 1px; opacity: 0.75; transition: opacity 0.2s; }
.lu-go:hover { opacity: 1; }

.spec { border-top: 0.5px solid var(--hair); padding-top: 4px; margin-bottom: 28px; }
.spec-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 8px 0; font-size: var(--fs-5); border-bottom: 0.5px solid var(--hair);
}
.spec-row .k { color: var(--fg-mid); letter-spacing: 0.04em; white-space: nowrap; }
.spec-row .v { text-align: right; }

.wk-size { margin: -16px 0 24px; font-size: var(--fs-5); }
.wk-size a { color: var(--fg-mid); border-bottom: 0.5px solid var(--fg-dim); padding-bottom: 1px; transition: color 0.2s; }
.wk-size a:hover { color: var(--fg); }

.acts { display: flex; flex-direction: column; gap: 8px; }
.btn-l, .btn-d {
  font-size: var(--fs-5); font-weight: 500; padding: 12px 24px; border-radius: var(--radius-sm);
  text-align: center; transition: opacity 0.15s, color 0.2s, border-color 0.2s;
}
.btn-l { background: var(--btn-bg); color: var(--btn-fg); }
.btn-l:hover { opacity: 0.85; }
.btn-d { border: 0.5px solid var(--hair); color: var(--fg-mid); }
.btn-d:hover { color: var(--fg); border-color: var(--fg-dim); }

/* ── 상세 이미지 (최대 6장) ── */
.wk-details { padding: clamp(64px, 9vh, 112px) var(--edge) 0; }
.dt-head {
  display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 24px; border-bottom: 0.5px solid var(--hair);
}
.dt-head h2 { font-family: 'Fraunces', serif; font-weight: 500; font-size: var(--fs-2); line-height: var(--lh-title); }
.dt-head p { font-size: var(--fs-5); color: var(--fg-mid); }
.dt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(12px, 1.2vw, 20px); }
.dt { position: relative; margin: 0; }
.dt-view {
  display: block; width: 100%; aspect-ratio: 1415 / 2000;
  padding: 0; border: 0; background: var(--bg-soft); overflow: hidden; cursor: zoom-in;
}
.dt-view img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s cubic-bezier(0.4,0,0.2,1); }
.dt-view:hover img { transform: scale(1.025); }
.dt figcaption { margin-top: 8px; font-family: 'Fraunces', serif; font-style: italic; font-size: var(--fs-5); color: var(--fg-mid); }

/* 상세 이미지는 있는 장수만큼만 — 3장이면 3열, 2장이면 2열로 빈칸 없이 채운다 (6장은 3열 두 줄) */
.dt-grid[data-n="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1240px; }
.dt-grid[data-n="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dt-grid[data-n="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1240px; }
.dt-grid[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 820px; }
.dt-grid[data-n="1"] { grid-template-columns: minmax(0, 1fr); max-width: 410px; }
.wk-details:has(.dt-grid[data-n="0"]) { display: none; }

/* ── 이전 / 다음 작품 ── */
.pager {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  margin: clamp(64px, 9vh, 104px) var(--edge) 0;
  padding: 24px 0; border-top: 0.5px solid var(--hair);
}
.pg-prev { justify-self: start; }
.pg-next { justify-self: end; flex-direction: row-reverse; text-align: right; }
.pg-prev, .pg-next { display: inline-flex; align-items: center; gap: 16px; min-width: 0; }
.pg-prev img, .pg-next img {
  width: 44px; height: 62px; object-fit: cover; background: var(--bg-soft); flex: none;
  opacity: 0.8; transition: opacity 0.25s;
}
.pg-prev:hover img, .pg-next:hover img { opacity: 1; }
.pg-txt { display: flex; flex-direction: column; min-width: 0; }
.pg-k { font-family: 'Fraunces', serif; font-style: italic; font-size: var(--fs-5); color: var(--fg-mid); display: inline-flex; gap: 8px; }
.pg-next .pg-k { justify-content: flex-end; }
.pg-k .ar { font-style: normal; font-size: var(--fs-5); }
.pg-code { font-size: var(--fs-5); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-prev:hover .pg-k, .pg-next:hover .pg-k { color: var(--fg); }
.pg-all {
  font-family: 'Fraunces', serif; font-style: italic; font-size: var(--fs-4); color: var(--fg-mid);
  border-bottom: 0.5px solid var(--fg-dim); padding-bottom: 1px; transition: color 0.2s;
}
.pg-all:hover { color: var(--fg); }

/* ── 하단 CTA · 푸터 (works.html 과 동일) ── */
.end { border-top: 0.5px solid var(--hair); padding: 72px 24px; }
.end-in { max-width: 1700px; margin: 0 auto; }
.end h2 { font-size: var(--fs-2); font-weight: 700; margin-bottom: 16px; }
.end p { font-size: var(--fs-4); color: var(--fg-mid); max-width: 560px; margin-bottom: 28px; }
.end-actions { display: flex; gap: 12px; flex-wrap: wrap; }
footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 24px 24px; font-size: var(--fs-5); color: var(--fg-mid);
  border-top: 0.5px solid var(--hair);
}

/* ── 크게 보기 ── */
.lb {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(13, 12, 11, 0.94);
  display: flex; align-items: center; justify-content: center;
  animation: lbIn 0.3s ease;
}
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lb-img { max-width: calc(100vw - 8rem); max-height: calc(100vh - 6rem); object-fit: contain; display: block; }
.lb-x, .lb-nav {
  position: absolute; border: 0; background: none; cursor: pointer;
  color: rgba(255,255,255,0.75); line-height: var(--lh-title); transition: color 0.2s;
}
.lb-x:hover, .lb-nav:hover { color: #fff; }
.lb-x { top: 1rem; right: 1.4rem; font-size: 34px; width: 44px; height: 44px; } /* ui-ok: 닫기 기호(아이콘) */
.lb-nav { top: 50%; transform: translateY(-50%); font-size: 40px; width: 56px; height: 80px; } /* ui-ok: 넘김 기호(아이콘) */
.lb-nav:disabled { opacity: 0.15; cursor: default; }
.lb-prev { left: 0.8rem; }
.lb-next { right: 0.8rem; }
.lb-cap {
  position: absolute; bottom: 1.2rem; left: 0; right: 0; text-align: center;
  font-family: 'Fraunces', serif; font-style: italic; font-size: var(--fs-5); color: rgba(255,255,255,0.6);
}
body.lb-open { overflow: hidden; }

/* ── 반응형 ── */
@media (max-width: 1100px) {
  .dt-grid[data-n="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 820px; }
  .dt-grid[data-n="5"] { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1240px; }
}
@media (max-width: 860px) {
  .wk-top { grid-template-columns: 1fr; gap: 36px; padding-top: 16px; }
  .wk-view img { max-height: none; }
  .wk-info { position: static; }
  .acts { flex-direction: column; }
}
@media (max-width: 640px) {
  :root { --edge: 1.25rem; }
  .nav { padding: 16px 20px; }
  .dt-grid { gap: 8px; }
  .pager { grid-template-columns: 1fr 1fr; }
  .pg-all { grid-column: 1 / -1; grid-row: 2; justify-self: center; margin-top: 8px; }
  .pg-prev img, .pg-next img { display: none; }
  .end { padding: 48px 20px; }
  .end-actions { flex-direction: column; }
  footer { padding: 20px; flex-direction: column; align-items: flex-start; }
  .lb-img { max-width: 100vw; max-height: calc(100vh - 7rem); }
  .lb-nav { top: auto; bottom: 0.4rem; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lb { animation: none; }
  .dt-view img, .nav-cta .ar { transition: none; }
}
