/* ============================================================
   티스토리 스킨 에디터 > CSS 탭에 붙여넣으세요.
   폰트 import는 HTML 탭 <head> 안에 별도로 넣어야 합니다.
   ============================================================ */

/* ===== VARIABLES ===== */
:root {
  --bg: #e8e4d9;
  --bg-header: #dedad0;
  --surface: #d8d4c8;
  --border: rgba(60,50,30,0.18);
  --border-strong: rgba(60,50,30,0.45);
  --text-primary: #1a1610;
  --text-secondary: #5a5040;
  --text-muted: #8a7e6a;
  --accent: #1a1610;
  --col-gap: 3px;
  --font-display: 'Playfair Display', 'Times New Roman', Georgia, serif;
  --font-body: 'Libre Baskerville', 'Times New Roman', Georgia, serif;
}

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

html, body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ===== HEADER ===== */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--bg-header);
  border-bottom: 2.5px double var(--border-strong);
}

#header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 28px 4px;
  border-bottom: 0.5px solid var(--border);
}

#header-top span {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-style: italic;
}

#header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 28px 7px;
  min-height: 46px;
}

#header h1 a {
  font-family: 'UnifrakturMaguntia', 'Times New Roman', serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--accent);
  line-height: 1;
  white-space: nowrap;
}

/* ===== NAV (카테고리 가로 정렬) ===== */
/* [##_category_list_##]가 <ul><li><a> 구조로 출력되므로
   ul/li를 display:contents 로 투명화 → a만 flex item으로 노출 */
#header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  max-height: 56px;
  overflow: hidden;
  border-left: 0.5px solid var(--border-strong);
}

#header nav ul {
  display: contents;
  list-style: none;
}

#header nav ul li {
  display: contents;
}

#header nav a,
#header nav > a {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 12px;
  height: 28px;
  border-right: 0.5px solid var(--border-strong);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

#header nav a:hover {
  color: var(--accent);
  background: rgba(60,50,30,0.07);
}

/* ===== LAYOUT ===== */
#wrap { padding-top: 90px; }

/* 구분선 */
#gallery-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(550px * 3 + var(--col-gap) * 4);
  margin: 10px auto 0;
  padding: 0 var(--col-gap);
}

#gallery-rule::before,
#gallery-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

#gallery-rule span {
  font-family: var(--font-body);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  font-style: italic;
}

/* ===== GALLERY GRID ===== */
#gallery {
  display: grid;
  grid-template-columns: repeat(3, 550px);
  gap: var(--col-gap);
  padding: var(--col-gap);
  justify-content: center;
  max-width: calc(550px * 3 + var(--col-gap) * 4);
  margin: 6px auto 0;
}

/* ===== GALLERY CARD ===== */
.gallery-item {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  display: block;
}

/* 투명 링크 레이어:
   카드 전체를 덮는 position:absolute <a> 태그.
   티스토리가 외부 구조를 어떻게 변경해도
   이 레이어는 카드 내부에 고정되어 링크가 끊기지 않음. */
.gallery-item .card-link {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: block;
}

.gallery-item .thumb-wrap {
  position: relative;
  width: 550px;
  overflow: hidden;
  min-height: 400px;
  background: var(--surface);
}

/* ===== 썸네일 이미지 (기본: 흑백) ===== */
.gallery-item .thumb-wrap img {
  display: block;
  width: 550px;
  height: 550px;
  object-fit: cover;
  filter: grayscale(100%) sepia(12%) contrast(1.06);
  transition:
    transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    filter 0.55s ease;
}

/* 호버: 컬러 전환 + 줌인 */
.gallery-item:hover .thumb-wrap img {
  filter: grayscale(0%) sepia(0%) contrast(1);
  transform: scale(1.03);
}

/* 이미지 없을 때 fallback */
.gallery-item .no-thumb {
  width: 550px;
  height: 550px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--border);
}

.gallery-item .no-thumb span {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-style: italic;
}

/* ===== 오버레이 (좋아요·댓글 카운트) ===== */
.gallery-item .overlay {
  position: absolute;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.overlay-meta {
  display: flex;
  gap: 18px;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-item:hover .overlay-meta {
  opacity: 1;
  transform: translateY(0);
}

.overlay-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  font-style: italic;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,0.6), 0 0 24px rgba(0,0,0,0.35);
}

.overlay-meta svg {
  width: 17px; height: 17px;
  fill: #fff;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

/* ===== PAGINATION ===== */
#pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 36px 0 60px;
  border-top: 0.5px solid var(--border-strong);
  margin-top: 10px;
  max-width: calc(550px * 3 + var(--col-gap) * 4);
  margin-left: auto;
  margin-right: auto;
}

#pagination a,
#pagination span {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-muted);
  border: 0.5px solid var(--border);
  border-right: none;
  transition: all 0.15s;
  letter-spacing: 0.04em;
}

#pagination a:last-child,
#pagination span:last-child {
  border-right: 0.5px solid var(--border);
}

#pagination a:hover {
  color: var(--accent);
  background: rgba(60,50,30,0.08);
}

#pagination .active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
  font-style: italic;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1720px) {
  #gallery { grid-template-columns: repeat(2, 550px); max-width: calc(550px * 2 + var(--col-gap) * 3); }
  #gallery-rule, #pagination { max-width: calc(550px * 2 + var(--col-gap) * 3); }
}

@media (max-width: 1160px) {
  #gallery { grid-template-columns: repeat(1, 550px); max-width: calc(550px + var(--col-gap) * 2); }
  #gallery-rule, #pagination { max-width: calc(550px + var(--col-gap) * 2); }
}

@media (max-width: 580px) {
  :root { --col-gap: 2px; }
  #gallery { grid-template-columns: 1fr; max-width: 100%; }
  .gallery-item .thumb-wrap,
  .gallery-item .thumb-wrap img,
  .gallery-item .no-thumb { width: 100%; }
  #header h1 a { font-size: 22px; }
  #header nav { max-height: 56px; }
}