/* 김선열 Kim Sunyoul — 기본 스타일 */
:root {
  --bg: #fbfbfa;
  --fg: #141414;
  --muted: #6f6f6c;
  --line: #e2e2de;
  --pad: clamp(1rem, 3vw, 2.5rem);
  --wide: 1100px;
  --read: 40rem;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* ---------- 머리·바닥 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.25rem 2rem;
  padding: 1rem var(--pad);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}
.site-name { font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.site-name span { font-weight: 400; color: var(--muted); margin-left: 0.35em; }
.site-nav { display: flex; gap: clamp(1rem, 3vw, 2rem); }
.site-nav a {
  text-decoration: none; color: var(--muted);
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.25rem 0;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--fg); }
.site-nav a[aria-current="page"] { box-shadow: 0 1px 0 var(--fg); }

main { padding: clamp(1.5rem, 5vw, 4rem) var(--pad) 5rem; min-height: 70vh; }

.site-footer {
  padding: 2rem var(--pad) 3rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem; color: var(--muted);
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--fg); }

/* ---------- Work 목록: 한 화면에 전시 하나 ---------- */
/* 전시 제목이 위, 표지가 아래.
   표지 틀은 모두 서부전선 표지와 같은 비율(2400:1496)이다. 비율이 다른 사진은 가운데를 기준으로 위아래가 잘린다.
   어느 부분을 보일지는 works.json 의 focus(예: "50% 30%")로 바꿀 수 있다.
   가로가 긴 화면에서는 표지 높이를 화면 높이에서 16rem을 뺀 만큼으로 정하고, 폭은 비율에 따라 정해진다.
   세로가 긴 화면(휴대폰, 세로로 둔 태블릿)에서는 화면 폭에 맞춘다. */
:root { --cover-ratio: 2400 / 1496; }
.page-works main { padding-top: 1.5rem; }
.works { margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(3rem, 8vh, 6rem); }
/* 제목 옆 괄호 안의 연도 */
.yr { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card { display: block; text-decoration: none; scroll-snap-align: start; }
.card__img { display: block; aspect-ratio: var(--cover-ratio); overflow: hidden; background: #ecece8; }
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.3s ease; }
.card:hover .card__img img { opacity: 0.9; }
.card__title { display: block; margin-bottom: 0.9rem; font-size: clamp(1.25rem, 1rem + 0.6vw, 1.625rem); font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
.card:hover .card__title { text-decoration: underline; }
@media (min-width: 641px) and (min-aspect-ratio: 1 / 1) {
  html:has(.page-works) { scroll-snap-type: y proximity; scroll-padding-top: 5.4rem; }
  .works { max-width: min(1600px, 92vw); justify-items: center; }
  .card { width: fit-content; max-width: 100%; }
  .card__img { width: auto; max-width: 100%; height: calc(100vh - 16rem); height: calc(100svh - 16rem); min-height: 18rem; }
}

/* ---------- 작업 페이지 ---------- */
.work { max-width: var(--wide); margin: 0 auto; }
.work__head { margin-bottom: clamp(1.5rem, 4vw, 3rem); }
.work__head h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.5rem); font-weight: 500; line-height: 1.2; letter-spacing: -0.02em; }

.fig { margin: 0 0 clamp(1rem, 2.5vw, 2rem); }
.fig img { width: 100%; background: #ecece8; }
.fig img[data-full] { cursor: zoom-in; }
.fig--link img[data-full] { cursor: pointer; }
.fig figcaption { margin-top: 0.6rem; font-size: 0.875rem; line-height: 1.55; color: var(--muted); text-align: center; }
/* 캡션: 작품 제목은 굵게, 영어 설명은 다음 줄에 */
.fig figcaption strong { font-weight: 700; color: var(--fg); }
.cap-en, .cap-line { display: block; }
.fig--narrow { max-width: min(100%, 36rem); margin-left: auto; margin-right: auto; }
.row { display: flex; gap: clamp(0.5rem, 1.5vw, 1.25rem); align-items: flex-start; }
.row > .fig { min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(0.5rem, 1.5vw, 1.25rem); }
.grid img { aspect-ratio: 3 / 2; object-fit: cover; height: 100%; }
.video { position: relative; width: 100%; background: #191919; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.work > .prose { margin: clamp(2rem, 6vw, 4.5rem) auto; }

/* ---------- 글 ---------- */
.prose { max-width: var(--read); }
.prose p { margin: 0 0 0.9em; }
.prose p.gap { margin-top: 2em; }
.prose p.c { text-align: center; }
.prose p.r { text-align: right; }
.prose strong { font-weight: 600; }
.prose sup { font-size: 0.7em; line-height: 0; }

/* Text: 목록의 항목을 누르면 그 글만 보인다. 주소 끝의 #text-N 이 가리키는 글이 열린다. */
.texts { max-width: var(--read); margin: 0 auto; scroll-margin-top: 7rem; }
.texts__index { list-style: none; margin: 0 0 clamp(2.5rem, 7vw, 5rem); padding: 0; border-top: 1px solid var(--line); }
.texts__index a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.25rem 1.5rem;
  padding: 0.85rem 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
/* 목록은 항목마다 제목 왼쪽, 필자 오른쪽. 넓은 화면에서는 한 줄, 좁은 화면(휴대폰)에서는 긴 제목만 왼쪽 칸 안에서 줄을 바꾸고 필자는 계속 오른쪽에 있다. */
.texts__title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.texts__author { flex-shrink: 0; }
@media (max-width: 640px) {
  .texts__title { white-space: normal; }
}
.texts__index a:hover span:first-child { text-decoration: underline; }
.texts__index a[aria-current="true"] span:first-child { font-weight: 600; }
.texts__author { color: var(--muted); font-size: 0.875rem; white-space: nowrap; }
.essay { display: none; scroll-margin-top: 7rem; }
.essay:target { display: block; }
/* 글 머리말: 제목 왼쪽, 필자 오른쪽(목록과 같은 양식). 둘째 제목 줄이 있으면 그 아래 작게. */
.essay__head { margin-bottom: 2.2em; }
.essay__headrow { display: flex; justify-content: space-between; align-items: baseline; gap: 0.25rem 1.5rem; }
.essay__title { min-width: 0; }
.essay__author { flex-shrink: 0; }
.essay__title { margin: 0; font-size: 1.1875rem; font-weight: 600; line-height: 1.45; }
.essay__author { color: var(--muted); font-size: 0.9375rem; white-space: nowrap; }
.essay .essay__sub { margin: 0.3em 0 0; color: var(--muted); }
.essay .essay__back { margin: 3em 0 0; font-size: 0.875rem; }
.essay__back a { color: var(--muted); text-decoration: none; }
.essay__back a:hover { color: var(--fg); text-decoration: underline; }

.cv { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 3rem clamp(2rem, 6vw, 5rem); }
.cv__col { max-width: none; font-size: 0.9375rem; }
.cv__col p { margin: 0 0 0.3em; }
.cv__col p.gap { margin-top: 2em; }
.cv__col p:first-child { font-size: 1.125rem; margin-bottom: 0.8em; }
.cv__col p:nth-child(2) { margin-bottom: 2em; line-height: 1.75; }
.cv__col[lang="en"] { word-break: normal; overflow-wrap: break-word; }

.contact { margin: 12vh auto; text-align: center; font-size: 1.125rem; }
.contact strong { font-weight: 400; }

/* ---------- 사진 크게 보기 ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 2vmin; background: rgba(12, 12, 12, 0.94); cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 96vh; width: auto; height: auto; object-fit: contain; }
.lightbox__close { position: absolute; top: 0.75rem; right: 1rem; border: 0; background: none; color: #fff; font: inherit; font-size: 0.875rem; letter-spacing: 0.08em; cursor: pointer; padding: 0.5rem; }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 760px) {
  .cv { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .row { flex-direction: column; }
  .row > .fig { flex: none !important; width: 100%; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card__img img { transition: none; }
  html:has(.page-works) { scroll-snap-type: none; }
}
