/* 서화, 시간을 펼치다 v2 — styles.v11.css
 * 5 챕터 (산수·초상·풍속·영모·민화)
 * 변경: 챕터별 색조 미세 차이, 막(幕) 패널 살리기, 저작권 카드 패턴, 챕터별 마무리
 */

:root {
  --bg: #15110d;
  --bg2: #211a14;
  --ink: #ece2d0;
  --ink2: #b9ac96;
  --faint: #7f7460;
  --jeok: #c6564c;
  --jeok2: #a23b34;
  --gold: #caa45c;
  --gold2: #b89148;
  --line: #3a3026;
  --surface: #241d16;
}

/* ===== 챕터별 미세 색조 — 같은 가족 안의 다른 결 ===== */
.stage[data-current-chapter="sansu"]   { --bg: #15110d; --bg2: #211a14; }  /* 잉크 (기본) */
.stage[data-current-chapter="chosang"] { --bg: #181410; --bg2: #251c16; }  /* 살짝 더 따뜻 */
.stage[data-current-chapter="pungsok"] { --bg: #1a1611; --bg2: #271e17; }  /* 한지 분위기 */
.stage[data-current-chapter="yeongmo"] { --bg: #131514; --bg2: #1f211e; }  /* 살짝 푸른 잉크 */
.stage[data-current-chapter="minhwa"]  { --bg: #1a1310; --bg2: #2a1c14; }  /* 단(丹) 강조 */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Nanum Myeongjo", "Noto Serif KR", serif;
  -webkit-font-smoothing: antialiased;
  transition: background 0.6s ease;
}
a { color: inherit; }

/* ===== 상단 LAB 링크 ===== */
.topbar {
  position: fixed; top: 14px; right: 18px; z-index: 40;
  display: inline-block; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(15, 12, 9, 0.7); color: var(--ink2);
  text-decoration: none; font-size: 0.78rem; letter-spacing: 0.14em;
  backdrop-filter: blur(6px);
}
.topbar:hover { border-color: var(--gold); color: var(--gold); }

/* ===== PC 좌측 스파인 — 5 챕터 ===== */
.spine {
  position: fixed; left: 18px; top: 50%; transform: translateY(-50%);
  z-index: 30; display: flex; flex-direction: column; gap: 14px;
  padding: 18px 0;
}
.spine::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 2px; background: rgba(236, 226, 208, 0.1);
  transform: translateX(-50%); z-index: -1;
}
.spine-fill {
  position: absolute; left: 50%; top: 0;
  width: 2px; height: 0;
  background: linear-gradient(var(--jeok), var(--jeok2));
  transform: translateX(-50%);
  transition: height 0.15s ease-out; z-index: -1;
}
.spine [data-chapter] {
  position: relative; width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1.5px solid var(--faint); border-radius: 6px;
  background: var(--bg2); color: var(--faint);
  text-decoration: none; font-size: 16px; font-weight: 700;
  transition: 0.25s; cursor: pointer;
}
.spine [data-chapter]:hover,
.spine [data-chapter].active {
  border-color: var(--jeok); color: var(--gold); background: #2a1e16;
  box-shadow: 0 0 18px rgba(198, 86, 76, 0.32);
}
.spine [data-chapter]::after {
  content: attr(data-label);
  position: absolute; left: 48px; top: 50%; transform: translateY(-50%);
  font-size: 0.78rem; color: var(--gold);
  white-space: nowrap; letter-spacing: 0.18em;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.spine [data-chapter]:hover::after,
.spine [data-chapter].active::after { opacity: 1; }

/* ===== 모바일 하단 가로 막대 ===== */
.mobile-bar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 0%, rgba(21, 17, 13, 0.92) 60%, rgba(21, 17, 13, 0.7) 100%);
  border-top: 1px solid var(--line); backdrop-filter: blur(8px);
  justify-content: space-around; align-items: center; gap: 8px;
}
.mobile-bar [data-chapter] {
  flex: 1; max-width: 58px; height: 46px;
  display: grid; place-items: center;
  border: 1.5px solid var(--faint); border-radius: 8px;
  background: var(--bg2); color: var(--faint);
  text-decoration: none; font-size: 18px; font-weight: 700; transition: 0.2s;
}
.mobile-bar [data-chapter].active { border-color: var(--jeok); color: var(--gold); background: #2a1e16; }

@media (max-width: 780px), (max-height: 500px) {
  .spine { display: none; }
  .mobile-bar { display: flex; }
}

/* ===== 두루마리 (runway / stage / strip) ===== */
.runway { position: relative; }
.stage {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background: var(--bg);
  transition: background 0.6s ease;
}
.strip {
  position: absolute; top: 50%; left: 0;
  display: flex; flex-direction: row;
  align-items: stretch; height: 70vh;
  transform: translate(0, -50%);
  will-change: transform; padding-left: 60px;
}
@media (max-width: 780px), (max-height: 500px) {
  .strip { height: 64vh; padding-left: 0; padding-bottom: 64px; }
}

.panel { height: 100%; flex: 0 0 auto; position: relative; margin: 0 1.4vw; }

/* ===== 표지 (cover) ===== */
.cover {
  width: 78vw; max-width: 900px;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center; padding: 0 5vw;
}
.cover h1 {
  font-family: "Nanum Myeongjo", serif;
  font-size: clamp(2.4rem, 7vw, 4.8rem); font-weight: 800;
  letter-spacing: 0.04em; color: #f3ead8; line-height: 1.1;
}
.cover-han {
  font-size: clamp(1rem, 1.4vw, 1.4rem); color: var(--gold);
  letter-spacing: 0.55em; margin: 24px 0 0; padding-left: 0.55em;
}
.cover p {
  font-size: clamp(0.95rem, 1.05vw, 1.05rem);
  color: var(--ink2); line-height: 2;
  max-width: 540px; margin-top: 32px;
}
.cover-cue {
  margin-top: 36px !important;
  color: var(--jeok);
  font-size: 0.85rem !important;
  letter-spacing: 0.14em; line-height: 1.6 !important;
}
.cover-cue b { font-weight: 400; color: var(--gold); margin: 0 6px; }

/* ===== 다섯 갈래 목차 ===== */
.landing-cover {
  width: calc(100vw - 60px); max-width: none;
  padding: 0 7vw 0 10vw;
}
.landing-cover > p { max-width: 620px; }
.chapter-grid {
  width: min(1120px, 100%); margin-top: 34px;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px;
}
.chapter-card {
  min-height: 148px; padding: 18px 16px;
  display: flex; flex-direction: column; align-items: flex-start;
  text-align: left; text-decoration: none;
  border: 1px solid rgba(202, 164, 90, 0.24);
  background: linear-gradient(145deg, rgba(42, 30, 22, 0.8), rgba(21, 17, 13, 0.54));
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.chapter-card:hover {
  transform: translateY(-5px); border-color: var(--gold);
  background: linear-gradient(145deg, rgba(54, 36, 25, 0.9), rgba(24, 18, 13, 0.66));
}
.chapter-card-han {
  color: var(--gold); font-size: 1.5rem; letter-spacing: 0.14em;
}
.chapter-card-title {
  color: var(--ink); margin-top: 12px; font-size: 0.95rem; line-height: 1.5;
}
.chapter-card-meta {
  color: var(--faint); margin-top: auto; padding-top: 16px;
  font-size: 0.72rem; letter-spacing: 0.08em;
}
.chapter-card-open {
  color: var(--jeok); margin-top: 8px;
  font-size: 0.72rem; letter-spacing: 0.08em;
}
@media (max-width: 780px), (max-height: 500px) {
  .cover { width: 88vw; }
  .cover h1 { font-size: clamp(1.8rem, 7vw, 2.6rem); }
  .cover p { font-size: 0.95rem; line-height: 1.85; margin-top: 24px; }
  .cover-cue { margin-top: 28px !important; }
  .stage[data-view="index"] .strip { height: calc(100vh - 20px); padding-bottom: 72px; }
  .landing-cover { width: 100vw; max-width: none; padding: 0 5vw; }
  .landing-cover > p { margin-top: 14px; line-height: 1.65; }
  .chapter-grid { margin-top: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .chapter-card { min-height: 76px; padding: 9px 10px; }
  .chapter-card-han { font-size: 1.05rem; }
  .chapter-card-title { margin-top: 4px; font-size: 0.78rem; line-height: 1.35; }
  .chapter-card-meta { padding-top: 7px; font-size: 0.64rem; }
  .chapter-card-open { display: none; }
  .landing-cover .cover-cue { margin-top: 14px !important; font-size: 0.72rem !important; }
}

/* ===== 챕터 표지 (chapter-cover) ===== */
.chapter-cover {
  width: 74vw; max-width: 780px;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center; padding: 0 5vw; position: relative;
}
.chapter-cover::before {
  content: ""; position: absolute; left: 0; top: 18%; bottom: 18%;
  width: 3px; background: var(--jeok);
  box-shadow: 0 0 20px rgba(198, 86, 76, 0.4);
}
.chapter-cover .chapter-han {
  font-size: clamp(2.8rem, 7vw, 4.6rem); color: var(--gold);
  letter-spacing: 0.18em; font-weight: 400; line-height: 1;
}
.chapter-cover .chapter-num {
  font-size: 0.72rem; color: var(--jeok);
  letter-spacing: 0.32em; margin-top: 16px; font-weight: 700;
}
.chapter-cover h2 {
  font-size: clamp(1.5rem, 3.2vw, 2.4rem); font-weight: 800;
  margin-top: 14px; color: #f3ead8; line-height: 1.25;
}
.chapter-cover p {
  font-size: clamp(0.92rem, 1.05vw, 1.02rem);
  color: var(--ink2); line-height: 1.95;
  max-width: 38ch; margin-top: 24px;
}
/* 챕터 표지 안에 들어갈 막 목차 — 새로 추가 */
.chapter-acts-toc {
  margin-top: 36px; padding-top: 24px;
  border-top: 1px solid rgba(202, 164, 90, 0.2);
  display: flex; flex-direction: column; gap: 10px;
  text-align: left; max-width: 28em;
}
.chapter-acts-toc li {
  list-style: none; color: var(--ink2); font-size: 0.85rem;
  display: flex; gap: 12px; line-height: 1.5;
}
.chapter-acts-toc li::before {
  content: ""; flex: 0 0 1.4em; height: 1px; background: var(--gold);
  margin-top: 0.7em; opacity: 0.5;
}
.chapter-acts-toc li b { color: var(--gold); font-weight: 400; margin-right: 6px; }
@media (max-width: 780px), (max-height: 500px) {
  .chapter-cover { width: 86vw; }
  .chapter-cover .chapter-han { font-size: clamp(2rem, 9vw, 3rem); }
  .chapter-cover h2 { font-size: clamp(1.2rem, 5vw, 1.8rem); }
  .chapter-cover p { font-size: 0.92rem; line-height: 1.8; margin-top: 18px; }
  .chapter-acts-toc { margin-top: 24px; padding-top: 16px; }
  .chapter-acts-toc li { font-size: 0.8rem; }
}

/* ===== 막 (act) — v1 CSS 유지 + 강화 ===== */
.act {
  width: clamp(280px, 28vw, 420px);
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 4vw; position: relative; overflow: hidden;
}
.act::after {
  content: ""; position: absolute; left: 0; top: 14%; bottom: 14%;
  width: 3px; background: var(--jeok);
}
.act .act-num {
  position: absolute; right: 3vw; top: 5%;
  font-size: clamp(4rem, 16vh, 9rem);
  color: rgba(198, 86, 76, 0.12);
  font-weight: 800; line-height: 1; font-family: "Nanum Myeongjo", serif;
}
.act .act-eyebrow {
  color: var(--jeok); letter-spacing: 0.3em;
  font-size: 0.74rem; margin-bottom: 8px; font-weight: 700;
}
.act .act-title {
  font-size: clamp(1.3rem, 3.4vh, 2rem); font-weight: 800;
  color: #f3ead8; line-height: 1.2; letter-spacing: 0.02em;
}
.act .act-desc {
  color: var(--ink2); font-size: clamp(0.88rem, 1.8vh, 0.98rem);
  line-height: 1.9; margin-top: 18px; max-width: 32ch;
}
@media (max-width: 780px), (max-height: 500px) {
  .act { width: 84vw; padding: 0 7vw; }
  .act .act-num { font-size: clamp(2.8rem, 12vh, 5rem); right: 6vw; top: 3%; }
  .act .act-title { font-size: clamp(1.15rem, 4.5vh, 1.6rem); }
  .act .act-desc { font-size: clamp(0.86rem, 2vh, 0.95rem); line-height: 1.75; max-width: none; margin-top: 14px; }
}

/* ===== 그림 (art) ===== */
.art { display: flex; flex-direction: column; align-items: center; margin: 0 1.4vw; }
.art img {
  display: block;
  height: calc(100% - 108px);
  width: auto; max-width: none;
  background: #0d0a08;
  border: 1px solid rgba(236, 226, 208, 0.14);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.6), 0 0 70px rgba(202, 164, 90, 0.06);
}
.art figcaption {
  margin-top: 10px; padding: 9px 14px 0;
  text-align: center;
  font-size: 0.82rem; color: var(--ink);
  max-width: 36ch;
  border-top: 1px solid rgba(202, 164, 90, 0.22);
  letter-spacing: 0.01em; line-height: 1.5;
}
.art figcaption b { color: var(--gold); margin-right: 4px; }
.art figcaption em { color: var(--ink2); font-style: italic; font-size: 0.78rem; }

/* 큐레이터 노트 — 필요할 때만 펼치는 작은 서랍 */
.art .note-wrap {
  margin-top: 8px; color: var(--ink2);
  font-size: 0.76rem; width: min(100%, 36ch);
}
.art .note-wrap summary {
  width: max-content; margin: 0 auto;
  color: var(--gold); cursor: pointer; list-style: none;
  border: 1px solid rgba(202, 164, 90, 0.3);
  border-radius: 999px; padding: 5px 12px;
  letter-spacing: 0.1em; transition: 0.2s;
}
.art .note-wrap summary::-webkit-details-marker { display: none; }
.art .note-wrap summary:hover { border-color: var(--gold); background: rgba(202, 164, 90, 0.08); }
.art .note-wrap[open] {
  position: absolute; z-index: 8; left: 50%; bottom: 0;
  width: min(380px, 88vw); max-height: 70%;
  overflow-y: auto; transform: translateX(-50%);
  padding: 14px 14px 16px;
  border: 1px solid rgba(202, 164, 90, 0.34);
  background: rgba(21, 17, 13, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.58);
}
.art .note-wrap[open] summary { margin-bottom: 12px; }
.art .note {
  display: block;
  margin-top: 0;
  color: var(--ink2);
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.7;
  max-width: 36ch;
  text-align: left;
  border-left: 2px solid rgba(198, 86, 76, 0.3);
  padding-left: 10px;
}
.art .note p { margin: 0 0 6px 0; }
.art .note p:last-child { margin-bottom: 0; }
@media (max-width: 780px), (max-height: 500px) {
  .art { margin: 0 4vw; }
  .art img { height: calc(100% - 92px); }
  .art figcaption { font-size: 0.76rem; padding: 8px 12px 0; margin-top: 6px; max-width: 26ch; }
  .art .note-wrap { margin-top: 6px; font-size: 0.7rem; }
  .art .note-wrap summary { padding: 4px 10px; }
  .art .note { font-size: 0.74rem; max-width: none; }
}

/* ===== 저작권 보호 카드 (copyright-card) — 신규 ===== */
.copyright-card {
  width: clamp(280px, 26vw, 360px);
  display: flex; flex-direction: column; justify-content: center;
  padding: 32px 28px; position: relative;
  border: 1px dashed rgba(202, 164, 90, 0.3);
  background: linear-gradient(180deg,
    rgba(36, 29, 22, 0.5) 0%,
    rgba(15, 12, 9, 0.3) 100%);
  border-radius: 4px;
  margin: 0 1.4vw;
}
.copyright-card .cc-frame {
  width: 100%; aspect-ratio: 4 / 5;
  border: 2px solid rgba(202, 164, 90, 0.4);
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.3);
  position: relative; overflow: hidden;
  margin-bottom: 16px;
}
.copyright-card .cc-frame::before {
  content: "權"; font-size: 2.4rem; color: var(--gold); opacity: 0.38;
}
.copyright-card .cc-frame::after {
  content: "저작권 보호 작품"; position: absolute; bottom: 12%;
  font-size: 0.74rem; color: var(--gold); letter-spacing: 0.16em;
  font-weight: 700;
}
.copyright-card .cc-title {
  font-size: 1.2rem; font-weight: 800; color: #f3ead8;
  margin-top: 4px; line-height: 1.25;
}
.copyright-card .cc-meta {
  font-size: 0.82rem; color: var(--ink2);
  margin-top: 6px; letter-spacing: 0.02em;
}
.copyright-card .cc-note {
  font-size: 0.82rem; color: var(--ink2);
  font-style: italic; line-height: 1.7;
  margin-top: 14px;
  border-left: 2px solid rgba(198, 86, 76, 0.3);
  padding-left: 10px;
}
.copyright-card .cc-link {
  display: inline-block; margin-top: 18px;
  padding: 8px 18px;
  border: 1px solid var(--gold);
  color: var(--gold); text-decoration: none;
  font-size: 0.78rem; letter-spacing: 0.14em;
  border-radius: 2px;
  transition: 0.25s;
}
.copyright-card .cc-link:hover { background: rgba(202, 164, 90, 0.1); }
.copyright-card .cc-copyright {
  font-size: 0.7rem; color: var(--faint); margin-top: 10px;
  letter-spacing: 0.06em;
}
@media (max-width: 780px), (max-height: 500px) {
  .copyright-card { width: 80vw; padding: 24px 20px; }
}

/* ===== 챕터 끝 — 작품 뒤에 붙는 작은 종결 패널 ===== */
.chapter-end {
  width: clamp(300px, 30vw, 420px);
  display: grid; grid-template-rows: 5.4em 72px 36px;
  align-content: center; justify-items: center; row-gap: 18px;
  text-align: center;
  padding: 0 2.4vw; position: relative;
}
.chapter-end::after {
  content: ""; position: absolute; right: 0; top: 18%; bottom: 18%;
  width: 1px; background: rgba(202, 164, 90, 0.24);
}
.chapter-end .end-actions {
  display: flex; gap: 8px; flex-wrap: nowrap; justify-content: center; align-items: center;
}
.chapter-end .end-actions a {
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink2); text-decoration: none; font-size: 0.7rem;
  letter-spacing: 0.08em; transition: 0.2s;
}
.chapter-end .end-actions a:hover { color: var(--gold); border-color: var(--gold); }
.chapter-end .end-message {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink2);
  font-size: 0.9rem; letter-spacing: 0.04em;
  font-style: italic; max-width: 28em;
  line-height: 1.65;
}
.chapter-end .end-seal {
  width: 72px; height: 72px;
  border: 2.5px solid var(--jeok); border-radius: 8px;
  display: grid; place-items: center;
  color: var(--gold); font-size: 1.7rem; font-weight: 700;
  transform: rotate(-4deg);
  box-shadow: 0 0 24px rgba(198, 86, 76, 0.18);
  font-family: "Nanum Myeongjo", serif;
}
@media (max-width: 780px), (max-height: 500px) {
  .chapter-end {
    width: 76vw; padding: 0 5vw;
    grid-template-rows: 4.8em 48px 32px; row-gap: 10px;
  }
  .chapter-end .end-message { font-size: 0.8rem; line-height: 1.5; }
  .chapter-end .end-seal { width: 48px; height: 48px; font-size: 1.2rem; }
  .chapter-end .end-actions { gap: 6px; }
  .chapter-end .end-actions a { padding: 6px 9px; font-size: 0.64rem; }
}

/* ===== 마지막 印 (페이지 전체 끝) ===== */
.final-seal {
  width: calc(100vw - 60px); min-width: calc(100vw - 60px);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center; padding: 0 6vw;
}
.final-seal .seal {
  width: 110px; height: 110px;
  border: 3px solid var(--jeok); border-radius: 10px;
  display: grid; place-items: center;
  color: var(--gold); font-size: 2.2rem; font-weight: 700;
  transform: rotate(-4deg);
  box-shadow: 0 0 30px rgba(198, 86, 76, 0.18);
  font-family: "Nanum Myeongjo", serif;
}
.final-seal p {
  margin-top: 28px;
  font-size: clamp(0.95rem, 2vh, 1.1rem);
  color: var(--ink2); letter-spacing: 0.02em;
}
.final-seal .more {
  margin-top: 24px; display: inline-block;
  font-size: 0.88rem; letter-spacing: 0.14em;
  color: var(--gold); border: 1px solid var(--line);
  padding: 10px 22px; border-radius: 999px;
  text-decoration: none; transition: 0.25s;
}
.final-seal .more:hover { border-color: var(--gold); background: rgba(202, 164, 90, 0.08); }
@media (max-width: 780px), (max-height: 500px) {
  .final-seal { width: 100vw; min-width: 100vw; padding: 0 5vw; }
  .final-seal .seal { width: 84px; height: 84px; font-size: 1.7rem; }
  .final-seal p { margin-top: 22px; font-size: 0.92rem; }
  .final-seal .more { font-size: 0.82rem; padding: 8px 18px; }
}

/* ===== 푸터 ===== */
.footer {
  padding: 32px 24px 80px;
  text-align: center;
  color: var(--faint); font-size: 0.8rem; line-height: 1.85;
}
body[data-seohwa-view="chapter"] .footer { display: none; }
.footer a { color: var(--ink2); text-decoration: none; border-bottom: 1px solid var(--line); }
.footer a:hover { color: var(--gold); }
.footer .cred {
  margin-top: 14px; color: var(--faint); font-size: 0.75rem;
  max-width: 880px; margin-left: auto; margin-right: auto;
}
@media (max-width: 780px), (max-height: 500px) {
  .footer { padding-bottom: 120px; }
}
