/* 구조: 0927_ref/site.png (로고 · 태그 알약 · 5열 3:4 그리드)
   태그는 "소개 문장" 안의 단어로 넣어, 여러 분야를 다룬다는 것과
   태그로 작업을 넣고 뺄 수 있다는 것이 함께 보이게 한다.
   모션은 최소한으로: 색·투명도만 짧게 바뀐다. */
:root {
  --bg: #fcfcfc;
  --fg: #000;
  --muted: #9a9a9a;
  --soft: #b8b8b8;
  --gray: #d6d6d6;
  --placeholder: #efefef;
  --g: clamp(20px, 4.75vw, 88px);
  --t: .2s ease;
  --font: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
html.modal-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  letter-spacing: -0.01em;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- 헤더 ---------- */
.site-header { display: grid; grid-template-columns: auto 1fr; padding: 48px var(--g) 0; }
.logo img { width: clamp(260px, 34vw, 620px); height: auto; }
.nav { justify-self: end; display: flex; gap: 26px; font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- 소개 문장 = 필터 ---------- */
.sentence {
  padding: clamp(60px, 9vw, 150px) var(--g) 0;
  font-size: clamp(22px, 2.5vw, 40px);
  font-weight: 600;
  line-height: 2.15;
  letter-spacing: -0.025em;
  max-width: 1500px;
}
.sentence .w { color: var(--soft); transition: color var(--t), opacity var(--t); } /* 문장을 잇는 말 */
.sentence.has-sel .w { opacity: .35; }
.sentence.has-sel .w.live { color: var(--fg); opacity: 1; }                      /* 선택한 태그로 만든 문장 */
.bind { white-space: nowrap; } /* 줄의 마지막 태그 + 끝말이 줄바꿈으로 갈라지지 않게 */
.tk { white-space: nowrap; }    /* 태그 + 쉼표 */

/* 알약: 테두리 없이 면으로 */
.chip {
  --c: var(--gray);
  display: inline-flex; align-items: flex-start; gap: .18em;
  padding: .16em .78em .2em;
  margin: .06em;
  border-radius: 999px;
  background: var(--c);
  color: #000;
  line-height: 1.3;
  letter-spacing: -0.03em;
  transition: background-color var(--t), color var(--t), opacity var(--t), filter .15s;
}
.chip sup { font-size: .36em; font-weight: 600; line-height: 1; margin-top: .55em; opacity: .55; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.chip:hover:not(:disabled) { filter: brightness(.94); }
.chip:focus-visible { outline: 2px solid #000; outline-offset: 2px; }
.chip.on:not(.colored) { --c: #111; color: #fff; }
.chip.on sup { opacity: .8; }
.has-sel .chip:not(.on) { opacity: .22; }
.has-sel .chip:not(.on):hover:not(:disabled) { opacity: .6; }
.chip:disabled { opacity: .1 !important; cursor: default; }

/* PDF 버튼: 태그 알약과 같은 크기, 안쪽 선으로만 구분 */
.pdf-btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: flex-start; gap: .3em;
  margin: .06em .06em .06em .35em;
  padding: .16em .78em .2em;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px #000;
  line-height: 1.3; letter-spacing: -0.03em; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.pdf-btn:hover:not(:disabled) { background: #000; color: #fff; }
.pdf-btn:disabled:not(.busy) { opacity: .3; cursor: default; }
.pdf-btn.busy { cursor: progress; }
/* PDF 만드는 중 진행률 */
.pdf-btn::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 0%); background: currentColor; }

.actions { padding: 36px var(--g) 0; }
.count { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count b { color: var(--fg); font-weight: 600; }
.count button { margin-left: 12px; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 위에 붙는 작은 태그 줄 ---------- */
.mini {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 10px var(--g);
  background: rgb(252 252 252 / .96);
  border-bottom: 1px solid #eee;
  font-size: 12px; font-weight: 600;
  transform: translateY(-100%);
  transition: transform .2s;
}
.mini.show { transform: none; }
.mini .chip { padding: 6px 14px 7px; line-height: 1.2; margin: 0; }
.mini .count { margin-left: auto; font-weight: 400; }

/* ---------- 작업 그리드 (5열 3:4) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 36px 18px;
  padding: 44px var(--g) 160px;
  scroll-margin-top: 80px;
}
.empty { grid-column: 1 / -1; padding: 80px 0; text-align: center; color: var(--muted); font-size: 14px; }

.tile { min-width: 0; cursor: pointer; transition: opacity var(--t); }
.tile.enter { animation: enter .25s ease-out; }
@keyframes enter { from { opacity: 0; } }
.tile-btn { position: relative; display: block; width: 100%; aspect-ratio: 3 / 4; background: var(--placeholder); overflow: hidden; }
.tile-btn img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s ease; }
.tile-btn img.loaded { opacity: 1; }
.tile-btn:focus-visible { outline: 2px solid #000; outline-offset: 3px; }
.video-badge {
  position: absolute; top: 12px; right: 12px;
  display: grid; place-items: center;
  width: 28px; height: 28px; padding-left: 2px;
  border-radius: 50%; background: rgb(0 0 0 / .55); color: #fff; font-size: 10px;
}
.tile-head { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 13px; font-weight: 600; line-height: 1.4; }
.tile-year { flex: none; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
/* 작업에 붙은 태그: 작업 종류는 색 점, 장르는 글자 → 왜 이 작업이 남았는지 보임 */
.tile-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 5px; font-size: 11px; color: var(--muted); }
.tile-tags i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.tile-tags .hit { color: var(--fg); }
@media (hover: hover) {
  .tile:hover .tile-title { text-decoration: underline; text-underline-offset: 3px; }
}
/* 태그에 마우스를 올리면: 해당 없는 작업을 흐리게 (누르기 전 미리보기) */
.grid.peeking .tile:not(.peek) { opacity: .18; }

/* ---------- 상세 ---------- */
.detail {
  width: min(960px, 100vw - 32px);
  max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: 0;
  background: var(--bg); color: var(--fg);
}
.detail::backdrop { background: rgb(0 0 0 / .5); }
.detail-inner { padding: clamp(20px, 4vw, 44px); }
.detail-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.detail h2 { margin: 0 0 6px; font-size: clamp(19px, 2.2vw, 26px); font-weight: 700; line-height: 1.35; }
.detail-meta { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; font-size: 12px; font-weight: 600; }
.detail-tags .chip { padding: 5px 12px 6px; margin: 0; cursor: default; }
.close-btn { flex: none; font-size: 12px; font-weight: 600; padding: 7px 14px; border-radius: 999px; box-shadow: inset 0 0 0 1px #000; }
.close-btn:hover { background: #000; color: #fff; }
.detail-desc { white-space: pre-wrap; font-size: 14px; line-height: 1.85; max-width: 44em; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 13px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }
.detail-videos { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.video { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video.vertical { aspect-ratio: 9 / 16; width: min(100%, 400px); margin: 0 auto; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.detail-images { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.detail-images img { width: 100%; background: var(--placeholder); opacity: 0; transition: opacity .3s ease; }
.detail-images img.loaded { opacity: 1; }

/* ---------- 반응형 ---------- */
@media (max-width: 1280px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) {
  .site-header { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
  .nav { justify-self: start; order: -1; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 28px 10px; }
  .mini { display: none; } /* 폰에서는 태그가 많아 위에 붙이지 않음 */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
  .tile-btn img, .detail-images img { opacity: 1; }
}
