/* ==========================================================
   본좌는 미소녀가 아니다 — 웹북 스타일
   ========================================================== */

:root {
  --bg: #0c0a0f;
  --bg-soft: #131019;
  --surface: #17131f;
  --line: rgba(217, 178, 106, 0.18);
  --text: #eae4ef;
  --text-dim: #a79fb4;
  --text-faint: #6f677c;
  --accent: #c13352;
  --accent-soft: rgba(193, 51, 82, 0.14);
  --gold: #d9b26a;
  --gold-soft: rgba(217, 178, 106, 0.12);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --nav-bg: rgba(12, 10, 15, 0.86);
  --serif: "Noto Serif KR", "NanumMyeongjo", "AppleMyungjo", "Apple SD Gothic Neo", "Malgun Gothic", serif;
  --sans: "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
}

html[data-theme="light"] {
  --bg: #f6f1e8;
  --bg-soft: #efe7da;
  --surface: #fffdf8;
  --line: rgba(120, 80, 40, 0.18);
  --text: #221c1b;
  --text-dim: #6b5e56;
  --text-faint: #948779;
  --accent: #94203a;
  --accent-soft: rgba(148, 32, 58, 0.1);
  --gold: #8a6a2b;
  --gold-soft: rgba(138, 106, 43, 0.1);
  --shadow: 0 16px 40px rgba(80, 55, 30, 0.16);
  --nav-bg: rgba(246, 241, 232, 0.9);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  -webkit-text-size-adjust: 100%;
}

body {
  /* Netlify 배지(우측 하단)가 하단 내비게이션/본문을 가리지 않도록 충분한 여백 */
  padding-bottom: 128px;
  transition: background-color .3s ease, color .3s ease;
  overflow-x: hidden;
}

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

/* ---------- 읽기 진행률 ---------- */
#progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  z-index: 90;
  transition: width .1s linear;
}

/* ---------- 표지 ---------- */
.cover {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background: #08060b;
}

.cover__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  opacity: .92;
  transform: scale(1.02);
  animation: coverIn 1.6s ease-out both;
}

@keyframes coverIn {
  from { transform: scale(1.08); opacity: 0; }
  to   { transform: scale(1.02); opacity: .92; }
}

.cover__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8,6,11,.55) 0%, rgba(8,6,11,0) 26%, rgba(8,6,11,.35) 58%, rgba(8,6,11,.94) 88%, #08060b 100%);
}

.cover__inner {
  position: relative;
  padding: 0 26px 148px;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
  animation: riseIn 1.2s .2s ease-out both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cover__eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .42em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 18px;
}

.cover__title {
  margin: 0 0 10px;
  font-size: clamp(2.1rem, 8.4vw, 3.3rem);
  line-height: 1.24;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 4px 26px rgba(0,0,0,.75);
}

.cover__title span { color: var(--accent); }

.cover__sub {
  font-size: clamp(.92rem, 3.4vw, 1.05rem);
  color: rgba(255,255,255,.78);
  letter-spacing: .04em;
  margin: 0 0 26px;
  line-height: 1.9;
}

.cover__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 30px;
}

.chip {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: .06em;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(217,178,106,.38);
  color: var(--gold);
  background: rgba(217,178,106,.08);
}

.cover__cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a8233f, #6d1226);
  color: #fff;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: .04em;
  box-shadow: 0 14px 34px rgba(168, 35, 63, .42), inset 0 1px 0 rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.14);
}

.cover__cta:active { transform: translateY(1px) scale(.99); }
.cover__cta b { font-weight: 700; }
.cover__hint {
  margin-top: 16px;
  font-family: var(--sans);
  font-size: 12px;
  color: rgba(255,255,255,.45);
  letter-spacing: .04em;
}

/* ---------- 목차 ---------- */
.toc {
  max-width: 760px;
  margin: 0 auto;
  padding: 54px 22px 40px;
}

.toc__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 8px;
}

.toc__head h2 {
  margin: 0;
  font-size: 1.06rem;
  letter-spacing: .3em;
  color: var(--gold);
  font-weight: 600;
}

.toc__head span {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: .1em;
}

.ep {
  display: flex;
  gap: 18px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}

.ep:active { background: var(--accent-soft); }

.ep__no {
  flex: 0 0 46px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--accent);
  padding-top: 5px;
  font-weight: 700;
}

.ep__body h3 {
  margin: 0 0 7px;
  font-size: 1.12rem;
  line-height: 1.5;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--text);
}

.ep__body p {
  margin: 0;
  font-family: var(--sans);
  font-size: 12.8px;
  line-height: 1.75;
  color: var(--text-dim);
}

.ep__body em {
  font-style: normal;
  color: var(--gold);
  font-size: 11.5px;
  letter-spacing: .08em;
  font-family: var(--sans);
  display: inline-block;
  margin-top: 8px;
}

.ep__lock {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-faint);
  padding-top: 6px;
  white-space: nowrap;
}

.toc__note {
  margin-top: 34px;
  padding: 18px 20px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--text-dim);
  background: var(--gold-soft);
}

.toc__note b { color: var(--gold); font-weight: 700; }

/* ---------- 본문 ---------- */
.reader {
  max-width: 700px;
  margin: 0 auto;
  padding: 34px 22px 30px;
}

.reader__head {
  text-align: center;
  padding: 22px 0 34px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}

.reader__ep {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: .34em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 14px;
}

.reader__title {
  margin: 0;
  font-size: clamp(1.5rem, 6.2vw, 2rem);
  line-height: 1.42;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.reader__sub {
  margin: 12px 0 0;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--text-faint);
  letter-spacing: .05em;
}

.prose {
  font-size: clamp(16.2px, 4.35vw, 17.6px);
  line-height: 2.02;
  letter-spacing: -0.003em;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.prose p {
  margin: 0 0 1.05em;
  text-indent: 0;
}

.prose .sp { height: .55em; }

.prose .center {
  text-align: center;
  text-indent: 0;
  color: var(--gold);
  letter-spacing: .1em;
  font-size: .92em;
  margin: 2.2em 0;
}

.prose .say { text-indent: 0; }

.prose .think {
  color: var(--text-dim);
  font-style: normal;
}

.prose strong { font-weight: 700; color: var(--text); }

.prose .scene {
  margin: 1.9em 0 1.2em;
  text-align: center;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .55em;
  text-indent: .55em;
  color: var(--text-faint);
}

/* 삽화 */
figure.art {
  margin: 2.5em -6px 2.7em;
  padding: 0;
}

figure.art img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: var(--bg-soft);
}

figure.art figcaption {
  margin-top: 12px;
  text-align: center;
  font-family: var(--sans);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-faint);
  letter-spacing: .03em;
  padding: 0 10px;
}

figure.art figcaption b {
  color: var(--gold);
  font-weight: 600;
  letter-spacing: .08em;
}

/* 회차 끝 */
.endmark {
  text-align: center;
  margin: 54px 0 10px;
  color: var(--gold);
  letter-spacing: .7em;
  font-size: 13px;
}

.nextup {
  margin: 44px 0 0;
  padding: 22px 22px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.nextup span {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--accent);
  font-weight: 700;
}

.nextup h4 {
  margin: 8px 0 6px;
  font-size: 1rem;
  font-weight: 700;
}

.nextup p {
  margin: 0;
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--text-dim);
}

/* ---------- 하단 내비게이션 ---------- */
.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 80;
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid var(--line);
}

.nav a, .nav button {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .06em;
  cursor: pointer;
  transition: all .18s ease;
}

.nav .ico { font-size: 15px; line-height: 1; }

.nav a:active, .nav button:active { background: var(--accent-soft); }

.nav .primary {
  flex: 1.35 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 6px;
  border-radius: 12px;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .06em;
  background: linear-gradient(135deg, rgba(193,51,82,.9), rgba(109,18,38,.92));
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 6px 18px rgba(168,35,63,.28);
}

.nav .primary.disabled {
  background: transparent;
  border: 1px dashed var(--line);
  box-shadow: none;
  color: var(--text-faint);
}

.nav .disabled {
  opacity: .32;
  pointer-events: none;
}

/* ---------- 확대 모달 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 3, 6, .94);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 12px;
  overscroll-behavior: contain;
}

.modal.on { display: flex; animation: fadeIn .22s ease; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.modal img {
  max-width: 100%;
  max-height: 88svh;
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0,0,0,.8);
  animation: zoomIn .26s cubic-bezier(.2,.8,.3,1);
}

@keyframes zoomIn { from { transform: scale(.94); opacity: .4 } to { transform: scale(1); opacity: 1 } }

.modal__close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: 16px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.modal__cap {
  position: absolute;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 12px;
  color: rgba(255,255,255,.6);
  padding: 0 24px;
  letter-spacing: .04em;
}

/* ---------- 상단 미니 헤더 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--text-dim);
  letter-spacing: .04em;
  padding: 6px 10px;
  margin-left: -6px;
  border-radius: 9px;
}

.topbar__back:active { background: var(--accent-soft); }

.topbar__title {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: .1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__spacer { flex: 1; }

.theme-btn {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 푸터 ---------- */
.foot {
  text-align: center;
  padding: 46px 20px 20px;
  font-family: var(--sans);
  font-size: 11px;
  line-height: 2;
  color: var(--text-faint);
  letter-spacing: .06em;
}

/* ---------- 데스크톱 ---------- */
@media (min-width: 780px) {
  body { padding-bottom: 96px; }
  .reader { padding-top: 46px; }
  .prose { font-size: 18.2px; line-height: 2.08; }
  figure.art { margin-left: -34px; margin-right: -34px; }
  .nav { max-width: 700px; margin: 0 auto; border-radius: 18px 18px 0 0; left: 50%; right: auto; transform: translateX(-50%); width: 100%; }
  .cover__inner { padding-bottom: 160px; }
}

/* 모바일: Netlify 배지(우측 하단 198×64 고정 영역)와 절대 겹치지 않도록
   하단 내비게이션을 배지 위로 띄운다 */
@media (max-width: 779px) {
  body { padding-bottom: 200px; }
  .nav {
    left: 10px;
    right: 10px;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px;
    border: 1px solid var(--line);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
    padding: 8px 10px;
  }
  .nav a, .nav button { padding: 8px 4px; }
}
