/*
Theme Name: 중드살롱
Theme URI: https://mongsangsalon.com
Author: 몽상아뜰리에 (Mongsang Atelier)
Description: 중국 드라마를 작품 단위로 정리하는 편집형 테마. 스위스 그리드, 명조 표제, 괘선 중심.
Version: 2.0.0
Requires at least: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: jungdeu-salon
*/

/* ─────────────  토큰  ───────────── */
:root {
  --paper:     #f7f5f1;   /* 종이 */
  --surface:   #ffffff;
  --ink:       #15141a;   /* 먹 */
  --ink-2:     #4a4650;
  --ink-3:     #8b8590;
  --rule:      #17161c1f; /* 괘선 — 먹의 옅은 농도 */
  --rule-2:    #17161c0f;
  --jusa:      #9e2b2b;   /* 주사(朱砂) — 아주 아껴 쓴다 */

  --display: "Gowun Batang", "Nanum Myeongjo", serif;
  --sans: "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", system-ui, sans-serif;

  --gut: 24px;       /* 단 사이 */
  --wrap: 1280px;
  --read: 680px;

  --s1: 8px;  --s2: 16px; --s3: 24px; --s4: 40px;
  --s5: 64px; --s6: 96px; --s7: 128px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:   #0e0d11;
    --surface: #16151a;
    --ink:     #ece8e2;
    --ink-2:   #a8a2ad;
    --ink-3:   #746e7b;
    --rule:    #ece8e229;
    --rule-2:  #ece8e214;
    --jusa:    #e08585;
  }
}
:root[data-theme="dark"] {
  --paper:   #0e0d11;
  --surface: #16151a;
  --ink:     #ece8e2;
  --ink-2:   #a8a2ad;
  --ink-3:   #746e7b;
  --rule:    #ece8e229;
  --rule-2:  #ece8e214;
  --jusa:    #e08585;
}

/* ─────────────  바탕  ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1.2em; }
figure { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--s3); }
.read { width: 100%; max-width: var(--read); margin-inline: auto; }

:focus-visible { outline: 2px solid var(--jusa); outline-offset: 3px; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 0; top: 0; z-index: 999; background: var(--ink); color: var(--paper); padding: 12px 18px; }

/* 작은 대문자 라벨 — 알약 대신 이것이 편집물의 어법이다 */
.kicker {
  font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--jusa); display: inline-block;
}
.meta {
  font-size: 12px; color: var(--ink-3); letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

/* ─────────────  제호  ───────────── */
.masthead { border-bottom: 1px solid var(--ink); }
.masthead-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3);
  padding: var(--s4) 0 var(--s3);
}
.wordmark {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(32px, 4.4vw, 46px); letter-spacing: -.03em; line-height: .95;
}
.wordmark .mark { color: var(--jusa); }
.masthead-tag { font-size: 12.5px; color: var(--ink-2); letter-spacing: .01em; text-align: right; }

.masthead-nav { border-top: 1px solid var(--rule); }
.masthead-nav .wrap { display: flex; align-items: center; gap: var(--s3); min-height: 46px; }
.nav .menu-list { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s3); flex-wrap: wrap; }
.nav a {
  font-size: 13px; font-weight: 500; letter-spacing: .04em; color: var(--ink-2);
  padding: 4px 0; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--jusa); }
.nav .current-menu-item > a { color: var(--ink); border-bottom-color: var(--jusa); }

.tools { margin-left: auto; display: flex; gap: var(--s1); }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  border: 0; background: transparent; color: var(--ink-2); padding: 0;
}
.icon-btn:hover { color: var(--jusa); }
.icon-btn svg { width: 17px; height: 17px; }
.nav-toggle { display: none; }

.search-drawer { display: none; border-bottom: 1px solid var(--rule); background: var(--surface); }
.search-drawer.open { display: block; }
.search-drawer form { display: flex; gap: var(--s1); padding: var(--s2) 0; }
.search-drawer input[type="search"] {
  flex: 1; font: inherit; font-size: 15px; padding: 10px 14px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 0;
}
.search-drawer button {
  font: inherit; font-size: 14px; font-weight: 600; padding: 10px 22px; border: 0;
  background: var(--ink); color: var(--paper); cursor: pointer;
}

/* ─────────────  머리기사  ───────────── */
.lead { padding: var(--s5) 0 var(--s4); border-bottom: 1px solid var(--ink); }
.lead-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s4); align-items: start; }

.lead-media { position: relative; overflow: hidden; background: var(--rule-2); aspect-ratio: 3 / 2; }

/* 세로 사진일 때 — 늘리지 않고 판형을 세워 단 폭을 줄인다 */
.lead-grid.is-portrait { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); align-items: center; }
.lead-grid.is-portrait .lead-media { aspect-ratio: 4 / 5; }
.lead-grid.is-portrait .lead-media img { object-position: center 22%; }

.card-media.is-portrait img { object-position: center 18%; }
.lead-media img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: center 28%;            /* 인물 사진이 들어와도 얼굴이 잘리지 않게 */
  transition: transform .6s cubic-bezier(.2,.7,.3,1);
}
.lead:hover .lead-media img { transform: scale(1.02); }

.lead-body { padding-top: 2px; }
.lead-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(30px, 3.6vw, 46px); line-height: 1.22; letter-spacing: -.025em;
  margin: var(--s2) 0 var(--s2);
}
.lead-title a:hover { color: var(--jusa); }
.lead-stand { font-size: 16.5px; line-height: 1.75; color: var(--ink-2); margin-bottom: var(--s2); }

/* ─────────────  단  ───────────── */
.section { padding: var(--s5) 0; border-bottom: 1px solid var(--rule); }
.section:last-of-type { border-bottom: 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2);
  padding-bottom: var(--s2); margin-bottom: var(--s4); border-bottom: 2px solid var(--ink);
}
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.section-more { font-size: 12px; color: var(--ink-3); letter-spacing: .04em; }
.section-more:hover { color: var(--jusa); }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4) var(--gut); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ─────────────  기사 카드  ───────────── */
.card { display: flex; flex-direction: column; min-width: 0; position: relative; }
.card + .card::before {
  content: ""; position: absolute; left: calc(var(--gut) / -2); top: 0; bottom: 0;
  width: 1px; background: var(--rule-2);
}
.card-media { display: block; overflow: hidden; background: var(--rule-2); aspect-ratio: 3 / 2; margin-bottom: var(--s2); }
.card-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 28%;
  transition: transform .5s cubic-bezier(.2,.7,.3,1);
}
.card:hover .card-media img { transform: scale(1.03); }
.card-media.is-empty {
  display: grid; place-items: center; color: var(--ink-3);
  font-family: var(--display); font-size: 34px;
}
.card-title {
  font-family: var(--display); font-weight: 700; font-size: 19px; line-height: 1.4;
  letter-spacing: -.015em; margin: var(--s1) 0;
}
.card-title a:hover { color: var(--jusa); }
.card-stand { font-size: 14px; line-height: 1.68; color: var(--ink-2); margin: 0 0 var(--s2); }
.card-meta { margin-top: auto; }

/* 목록형(사진 없는 줄) */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--rule-2); padding: var(--s2) 0; }
.list li:first-child { border-top: 0; padding-top: 0; }
.list .t { font-family: var(--display); font-weight: 700; font-size: 16px; line-height: 1.45; letter-spacing: -.01em; }
.list a:hover .t { color: var(--jusa); }

/* ─────────────  본문  ───────────── */
.crumbs { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); display: flex; gap: var(--s1); margin-bottom: var(--s3); }
.crumbs a:hover { color: var(--jusa); }

.entry-header { padding: var(--s5) 0 0; }
.entry-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(28px, 4vw, 44px); line-height: 1.24; letter-spacing: -.025em;
  margin: var(--s2) 0 var(--s3);
}
.entry-meta { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); padding-bottom: var(--s3); border-bottom: 1px solid var(--ink); }

.entry-hero { margin: var(--s4) auto var(--s1); }
.entry-hero img { width: 100%; }
.entry-hero figcaption, .entry-content figcaption {
  font-size: 12px; color: var(--ink-3); margin-top: var(--s1); line-height: 1.6;
  padding-left: var(--s1); border-left: 2px solid var(--rule);
}

.entry-content { font-size: 17px; line-height: 1.85; padding: var(--s4) 0 var(--s5); }
.entry-content h2 {
  font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1.35; letter-spacing: -.02em;
  margin: 2.4em 0 .8em; padding-top: .8em; border-top: 1px solid var(--rule);
}
.entry-content h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.entry-content h3 { font-family: var(--display); font-weight: 700; font-size: 19px; margin: 2em 0 .6em; letter-spacing: -.015em; }
.entry-content ul, .entry-content ol { padding-left: 1.2em; margin: 0 0 1.3em; }
.entry-content li { margin-bottom: .45em; }
.entry-content a { color: var(--jusa); border-bottom: 1px solid currentColor; }
.entry-content a:hover { background: color-mix(in srgb, var(--jusa) 8%, transparent); }
.entry-content strong { font-weight: 700; }
.entry-content figure { margin: 2em auto; }
.entry-content blockquote {
  margin: 2em 0; padding: 0 0 0 var(--s3); border-left: 2px solid var(--jusa);
  font-family: var(--display); font-size: 19px; line-height: 1.6; color: var(--ink);
}
.entry-content hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; }

/* 표 */
.table-scroll { overflow-x: auto; margin: 2em 0; -webkit-overflow-scrolling: touch; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 460px; }
.entry-content caption { text-align: left; font-size: 12px; color: var(--ink-3); padding-bottom: var(--s1); }
.entry-content thead th { border-bottom: 2px solid var(--ink); }
.entry-content th, .entry-content td {
  padding: 10px 14px 10px 0; border-bottom: 1px solid var(--rule-2); text-align: left; vertical-align: top;
}
.entry-content th { font-weight: 700; font-size: 13.5px; letter-spacing: .02em; white-space: nowrap; color: var(--ink); }

/* 덧붙임 상자 */
.note {
  margin: 2em 0; padding: var(--s3); background: var(--surface);
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
  font-size: 15.5px; line-height: 1.75;
}
.note-title {
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--jusa); margin-bottom: var(--s1);
}
.note p:last-child { margin-bottom: 0; }

/* 스포일러 */
.entry-content details { margin: 2em 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); padding: var(--s2) 0; }
.entry-content summary {
  cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--jusa);
  list-style: none; display: flex; align-items: center; gap: var(--s1);
}
.entry-content summary::-webkit-details-marker { display: none; }
.entry-content summary::after { content: "＋"; margin-left: auto; font-size: 15px; color: var(--ink-3); }
.entry-content details[open] summary::after { content: "－"; }
.entry-content details > *:not(summary) { margin-top: 1.2em; }

.entry-tags { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); padding: 0 0 var(--s4); border-bottom: 1px solid var(--rule); }
.tag { font-size: 12px; color: var(--ink-3); letter-spacing: .02em; }
.tag:hover { color: var(--jusa); }

.adjacent { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gut); padding: var(--s4) 0; }
.adjacent a { min-width: 0; }
.adjacent .dir { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); display: block; margin-bottom: var(--s1); }
.adjacent .t { font-family: var(--display); font-weight: 700; font-size: 16px; line-height: 1.45; }
.adjacent a:hover .t { color: var(--jusa); }
.adjacent .next { text-align: right; border-left: 1px solid var(--rule-2); padding-left: var(--gut); }

/* ─────────────  목록 머리  ───────────── */
.page-head { padding: var(--s5) 0 var(--s3); border-bottom: 2px solid var(--ink); margin-bottom: var(--s5); }
.page-head h1 { font-family: var(--display); font-weight: 700; font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -.025em; }
.page-head p { color: var(--ink-2); margin: var(--s2) 0 0; max-width: 46ch; font-size: 15.5px; }

.pagination { display: flex; gap: var(--s2); justify-content: center; flex-wrap: wrap; padding: var(--s5) 0 0; }
.pagination .page-numbers { font-size: 14px; color: var(--ink-3); padding: 6px 4px; border-bottom: 2px solid transparent; font-variant-numeric: tabular-nums; }
.pagination .page-numbers:hover { color: var(--ink); }
.pagination .current { color: var(--ink); border-bottom-color: var(--jusa); font-weight: 700; }

/* ─────────────  꼬리  ───────────── */
.site-footer {
  border-top: 2px solid var(--ink); margin-top: var(--s6);
  padding: var(--s5) 0 calc(var(--s4) + env(safe-area-inset-bottom));
  font-size: 13.5px; color: var(--ink-2);
}
.footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s4); }
.footer-brand .wordmark { font-size: 22px; }
.footer-brand p { margin: var(--s2) 0 0; color: var(--ink-3); max-width: 46ch; font-size: 13.5px; line-height: 1.7; }
.footer-links .menu-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s1); }
.footer-links a { font-size: 13.5px; }
.footer-links a:hover { color: var(--jusa); }
.footer-legal { grid-column: 1 / -1; border-top: 1px solid var(--rule); padding-top: var(--s2); font-size: 12px; color: var(--ink-3); line-height: 1.7; }

/* ─────────────  빈 화면  ───────────── */
.empty { text-align: center; padding: var(--s7) var(--s3); color: var(--ink-2); }
.empty .big { font-family: var(--display); font-size: 52px; color: var(--jusa); margin-bottom: var(--s2); }

/* ─────────────  좁은 화면  ───────────── */
@media (max-width: 1000px) {
  .lead-grid, .lead-grid.is-portrait { grid-template-columns: 1fr; gap: var(--s3); }
  .lead-grid.is-portrait .lead-media { aspect-ratio: 3 / 2; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card:nth-child(odd)::before { display: none; }
}

@media (max-width: 680px) {
  :root { --gut: 16px; }
  .wrap { padding-inline: var(--s2); }
  .masthead-top { padding: var(--s3) 0 var(--s2); flex-direction: column; align-items: flex-start; gap: var(--s1); }
  .masthead-tag { text-align: left; }
  .nav-toggle { display: grid; }
  .masthead-nav .wrap { position: relative; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 40;
    background: var(--paper); border-bottom: 1px solid var(--ink); padding: var(--s2);
  }
  .nav.open { display: block; }
  .nav .menu-list { flex-direction: column; gap: 0; }
  .nav a { display: block; padding: 10px 0; border-bottom: 1px solid var(--rule-2); }
  .lead { padding: var(--s4) 0 var(--s3); }
  .section { padding: var(--s4) 0; }
  .grid { grid-template-columns: 1fr; gap: var(--s4); }
  .card::before { display: none !important; }
  .card + .card { border-top: 1px solid var(--rule-2); padding-top: var(--s4); }
  .adjacent { grid-template-columns: 1fr; }
  .adjacent .next { text-align: left; border-left: 0; padding-left: 0; border-top: 1px solid var(--rule-2); padding-top: var(--s3); }
  .footer-grid { grid-template-columns: 1fr; }
  .entry-content { font-size: 16.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .masthead, .site-footer, .adjacent, .entry-tags, .search-drawer { display: none; }
}
