:root {
  --bg: #0b0b0d;
  --surface: #17171b;
  --surface-2: #202024;
  --text: #f3f1ea;
  --text-dim: #9a978f;
  --line: #2a2a30;
  --red: #e8283c;
  --blue: #2f6fed;
  --gold: #f5b700;
  --teal: #17c3b2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif;
}

a { color: inherit; }

/* Masthead */
header.masthead {
  text-align: center;
  padding: 48px 20px 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
  display: inline-block;
}

.wordmark {
  font-weight: 900;
  font-size: 34px;
  letter-spacing: -0.5px;
  margin: 0 0 8px;
}

.logo-icon {
  font-size: 0.85em;
  margin-right: 4px;
}

.subcopy {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
}

.visit-counter {
  font-size: 11px;
  color: var(--text-dim);
  margin: 10px 0 0;
}
.visit-counter:empty { display: none; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 12px 80px;
}

/* Filter chips */
.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 20px 0;
  padding: 0 8px;
}

.filter-chip {
  border: 1.5px solid var(--line);
  background: var(--surface);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}

.filter-chip.active,
.filter-chip:hover {
  border-color: var(--text);
}

/* Search */
.search-row {
  display: flex;
  justify-content: center;
  margin: 0 0 16px;
  padding: 0 8px;
}
.search-row input {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.search-row input:focus { border-color: var(--text-dim); }
.search-row input::placeholder { color: var(--text-dim); }

/* Gallery grid — 갤러리가 메인, 홈/허브 둘 다 공유 */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

@media (min-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

.gallery-tile {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}

.gallery-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 세로로 긴 인물 원본(예: 괄하이드 규리하, 륜 페이)이 4:5 타일에 맞춰 크롭될 때
     가운데 기준이면 머리가 잘려나간다 — 위쪽을 기준으로 잘라서 얼굴이 항상 보이게 한다. */
  object-position: top center;
  display: block;
  transition: transform .25s ease;
}

.gallery-tile:hover img { transform: scale(1.04); }

/* 이미지가 도착하기 전엔 빈 칸이 툭 비어 보였음 — 살짝 페이드인시켜 자연스럽게 채운다. */
.gallery-tile img { opacity: 0; transition: transform .25s ease, opacity .35s ease; }
.gallery-tile img.loaded { opacity: 1; }

/* 시리즈 표지 타일은 낱개 타일과 겉모습이 같아서 여러 장인지 알 수 없었음 — 장수 뱃지로 구분. */
.tile-count {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}

.gallery-tile .tile-scrim {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 24px 10px 10px;
  background: linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,0));
}

.gallery-tile .tile-cat {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  color: #0b0b0d;
  margin-bottom: 5px;
}

.gallery-tile .tile-title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
}

.empty-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 60px 20px;
}

/* Hub page */
.hub-header {
  text-align: center;
  padding: 20px 0 4px;
}
.hub-header h1 { font-size: 24px; margin: 0 0 4px; font-weight: 900; }
.hub-header .meta { font-size: 12px; color: var(--text-dim); }

/* Post detail — 이미지가 화면 대부분을 차지, 텍스트는 캡션 수준으로 최소화 */
.post-hero {
  margin: 0 -12px 0;
  background: var(--surface);
}
.post-hero img {
  width: 100%;
  /* 뷰포트 높이가 얼마든 상단(뒤로가기·카테고리·제목) + 캡션 첫 줄 몫(약 260px)은 항상 남겨서,
     사진이 화면을 꽉 채워 "이 밑에 뭔가 더 있다"는 걸 못 알아채는 문제를 막는다. */
  max-height: calc(100vh - 260px);
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: #000;
}

/* 시리즈 페이지는 표지 아래 바로 "수록 작품" 그리드(리스트)가 나오므로, 표지 이미지 자체는
   중복이라 아예 없앤다 — 개별 게시물 상세(post.html)는 위 .post-hero img 크기 그대로 유지. */
body[data-page="series"] .post-hero { display: none; }

/* 한 게시물에 이미지가 여러 장(post.images)이면 옆으로 스와이프하는 슬라이드로 보여준다 —
   가로 스크롤 + snap이라 터치/트랙패드/마우스 드래그(스크롤바) 전부에서 자연스럽게 작동한다. */
.post-hero-wrap {
  position: relative;
}
.post-hero-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.post-hero-track::-webkit-scrollbar { display: none; }
.post-hero-track .post-hero-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  background: #000;
}
.post-hero-track .post-hero-slide img {
  width: 100%;
  max-height: calc(100vh - 260px);
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
/* 터치/트랙패드 스와이프가 없는 데스크톱 마우스 사용자용 클릭 이동 버튼 */
.post-hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}
.post-hero-arrow:hover { background: rgba(0, 0, 0, 0.75); }
.post-hero-arrow.prev { left: 10px; }
.post-hero-arrow.next { right: 10px; }
.post-hero-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 0;
}
.post-hero-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  opacity: 0.4;
  cursor: pointer;
}
.post-hero-dots .dot.active { opacity: 1; background: var(--gold); }

.post-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 8px 6px;
}

.cat-pill {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #0b0b0d;
  padding: 4px 11px;
  border-radius: 999px;
}

.post-date { font-size: 12px; color: var(--text-dim); }

.post-title {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.3px;
  line-height: 1.4;
  margin: 6px 8px 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.post-caption {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text);
  margin: 0 8px 20px;
  max-width: 640px;
}
.post-caption p { margin: 0 0 14px; }
.post-caption p:last-child { margin-bottom: 0; }

/* 캡션 중간에 사진 한 장 끼워넣을 때(예: 예전/현재 비교) 쓰는 기본 스타일. */
.post-caption img {
  width: 100%;
  border-radius: 6px;
  display: block;
  margin: 4px 0 6px;
}
.post-caption .img-caption {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  margin: 0 0 18px;
}

/* 도감(내부 자료) 캡션 — 설정자료 파일의 문서 양식을 그대로 화면으로 가져온 것.
   머리말(분류 필드) → 인용 → 팩트 → 컬러 → 꼬리말 순서로 고정한다. */
.post-caption .dsr-head {
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-dim);
  letter-spacing: 0.01em;
  border-left: 2px solid var(--text-dim);
  padding-left: 10px;
  margin-bottom: 16px;
}
.post-caption .dsr-quote {
  font-size: 15px;
  line-height: 1.7;
  font-style: italic;
  margin-bottom: 16px;
}
.post-caption .dsr-quote span {
  display: block;
  font-style: normal;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
}
.post-caption .dsr-color {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.post-caption .dsr-color .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: 0 0 11px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.post-caption .dsr-foot {
  font-size: 12px;
  color: var(--text-dim);
  opacity: 0.75;
}

.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 8px 20px;
}
.tag-pill {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}

.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 8px 32px;
  background: var(--surface);
}
.source-card:empty { display: none; }
.source-card-head {
  background: var(--surface-2);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 9px 14px;
}
.source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.source-item .source-type {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.source-item .arrow { color: var(--text-dim); flex-shrink: 0; }

/* 이전/다음 게시물 이동 */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 8px 28px;
}
.post-nav:empty { display: none; }
.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  min-height: 58px;
}
.post-nav-item.disabled { visibility: hidden; }
.post-nav-item:hover { border-color: var(--text-dim); }
.post-nav-item:last-child { text-align: right; }
.post-nav-dir {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--text-dim);
}
.post-nav-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.related-section { padding: 8px 0 0; }
.related-section h2 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 8px 12px;
}

footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-dim);
  font-size: 12px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
}

.back-link {
  display: block;
  text-align: center;
  padding: 20px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-dim);
}


/* 홈 안내 버튼 / 하단 CTA / 더 보기 */
.intro { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 20px 0 4px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 8px; }
.cta-btn {
  display: inline-block; padding: 11px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; text-decoration: none;
}
.cta-btn:hover { border-color: var(--text-dim); }
.cta-btn.primary { background: var(--gold); border-color: var(--gold); color: #111; }
.more-link {
  display: block; margin-top: 12px; padding: 12px; text-align: center; border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 700;
}
.more-link:hover { background: var(--surface); }


/* ---- 단순화: 카드는 그림 아래에 짧은 제목만, 글머리는 목록으로 ---- */
.gallery-tile { aspect-ratio: auto; overflow: visible; background: none; border-radius: 0; }
.gallery-tile .tile-img { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 6px; background: var(--surface); }
.gallery-tile .tile-caption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 8px 2px 14px; }
.gallery-tile .tile-title { font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--text); }
.gallery-tile .tile-n { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.tag-list:empty, .intro:empty { display: none; }
.post-caption .dsr-foot, .post-caption .dsr-color { display: none; }
.post-caption .dsr-list { margin: 0 0 16px; padding-left: 1.2em; }
.post-caption .dsr-list li { margin-bottom: 6px; padding-left: 2px; }
header.masthead + main { padding-top: 18px; }
