/* ============================================================
   더감바이브 — 디지털 시집 / Digital flip-book
   ============================================================ */

:root {
  /* Design sizes — pages always render at these dimensions,
     then the whole book scales to fit the viewport. */
  --page-w: 480px;
  --page-h: 720px;
  --design-w: 960px;   /* desktop: 2 pages wide */
  --design-h: 720px;
  /* fit scale: clamp to [0.4, 1] roughly */
  --book-scale: min(
    1,
    calc((100vw - 80px) / var(--design-w)),
    calc((100vh - 170px) / var(--design-h))
  );

  --paper: #f7f1e3;
  --paper-edge: #ebe3cf;
  --paper-shadow: #d8cdb1;
  --ink: #1a1813;
  --ink-soft: #5b554a;
  --ink-faint: #8e8675;
  --rule: #c9bea4;
  --accent: #6b4f2b;
  --bg: #1c1814;
}

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  font-family: 'Cormorant Garamond', 'Noto Serif KR', 'Nanum Myeongjo', serif;
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

/* ============================================================
   Stage — full viewport, dark, with the book centered
   ============================================================ */

.stage {
  position: fixed; inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(ellipse at center, #2a241d 0%, #14110d 80%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px 14px;
  color: #c7b88f;
  font-family: 'Cormorant Garamond', 'Noto Serif KR', serif;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
}
.topbar .brand { font-weight: 500; white-space: nowrap; }
.topbar .brand em { font-style: italic; color: #9b8a5d; margin-left: 8px; letter-spacing: 0.1em; font-size: 11px; }
.topbar .meta { color: #837456; font-size: 11px; letter-spacing: 0.22em; }

.bottombar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
  padding: 14px 28px 22px;
  color: #c7b88f;
}

.btn-arrow {
  background: transparent;
  border: 1px solid rgba(199,184,143,0.32);
  color: #c7b88f;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
  line-height: 1;
}
.btn-arrow:hover { background: rgba(199,184,143,0.08); border-color: rgba(199,184,143,0.6); }
.btn-arrow:active { transform: translateY(1px); }
.btn-arrow:disabled { opacity: 0.25; cursor: default; }

.page-counter {
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  letter-spacing: 0.24em;
  font-variant-numeric: tabular-nums;
  color: #9b8a5d;
  min-width: 100px;
  text-align: center;
}
.page-counter .of { color: #5e5440; margin: 0 6px; }

.btn-toc {
  background: transparent;
  border: 1px solid rgba(199,184,143,0.32);
  color: #c7b88f;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Noto Serif KR', serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.18em;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}
.btn-toc:hover { background: rgba(199,184,143,0.08); border-color: rgba(199,184,143,0.6); }

.btn-fontsize {
  background: transparent;
  border: 1px solid rgba(199,184,143,0.32);
  color: #c7b88f;
  font-family: 'Noto Serif KR', serif;
  font-weight: 400;
  cursor: pointer;
  padding: 6px 12px;
  height: 34px;
  border-radius: 2px;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s;
}
.btn-fontsize .ico-small { font-size: 12px; }
.btn-fontsize .ico-large { font-size: 17px; }
.btn-fontsize .lbl {
  margin-left: 4px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: #837456;
  align-self: center;
}
.btn-fontsize:hover { background: rgba(199,184,143,0.08); border-color: rgba(199,184,143,0.6); }
.btn-fontsize:active { transform: translateY(1px); }

/* ============================================================
   Book — the centered flipbook
   ============================================================ */

.book-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 2400px;
  perspective-origin: 50% 50%;
  overflow: hidden;
}

.book-scale {
  width: var(--design-w);
  height: var(--design-h);
  transform: scale(var(--book-scale));
  transform-origin: center center;
  position: relative;
}

.book {
  position: relative;
  width: var(--design-w);
  height: var(--design-h);
  transform-style: preserve-3d;
  filter: drop-shadow(0 30px 40px rgba(0,0,0,0.45));
}

/* Static platforms behind the active flipping leaf */
.platform {
  position: absolute;
  top: 0; bottom: 0;
  width: var(--page-w);
  background: var(--paper);
  overflow: hidden;
}
.platform.left { left: 0; box-shadow: inset -22px 0 36px -16px rgba(0,0,0,0.18); }
.platform.right { right: 0; box-shadow: inset 22px 0 36px -16px rgba(0,0,0,0.18); }
.platform.empty { background: transparent; box-shadow: none; }

/* Spine */
.spine {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 14px;
  transform: translateX(-50%);
  background:
    linear-gradient(to right,
      rgba(0,0,0,0.18) 0%,
      rgba(0,0,0,0.05) 40%,
      transparent 50%,
      rgba(0,0,0,0.05) 60%,
      rgba(0,0,0,0.18) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Leaves */
.leaf {
  position: absolute;
  top: 0; right: 0;
  width: var(--page-w);
  height: var(--page-h);
  transform-style: preserve-3d;
  transform-origin: 0% 50%;
  transition: transform 0.85s cubic-bezier(0.45, 0.05, 0.32, 1);
  will-change: transform;
}
.leaf.flipped { transform: rotateY(-180deg); }

.leaf-face {
  position: absolute; inset: 0;
  background: var(--paper);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.leaf-face.front {
  box-shadow:
    inset 22px 0 36px -16px rgba(0,0,0,0.18),
    inset 0 0 0 1px rgba(120,100,70,0.05);
}
.leaf-face.back {
  transform: rotateY(180deg);
  box-shadow:
    inset -22px 0 36px -16px rgba(0,0,0,0.18),
    inset 0 0 0 1px rgba(120,100,70,0.05);
}

/* ============================================================
   Page content — all pages designed at 480 × 720
   ============================================================ */

.page {
  position: absolute; inset: 0;
  width: var(--page-w);
  height: var(--page-h);
  display: flex;
  flex-direction: column;
  padding: 56px 56px 44px;
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  color: var(--ink);
  background: var(--paper);
}

.page::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 60% 40%, rgba(255,250,235,0.4) 0%, transparent 70%),
    radial-gradient(ellipse 70% 70% at 20% 80%, rgba(120,100,70,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.page-footer {
  position: absolute;
  left: 56px; right: 56px; bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Cormorant Garamond', serif;
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--ink-faint);
  text-transform: uppercase;
  pointer-events: none;
}
.page-footer .date { font-variant-numeric: tabular-nums; }
.page-footer .num { font-variant-numeric: tabular-nums; }

/* ============================================================
   Cover — Orange
   ============================================================ */
.page-cover {
  background: #d76b3b;
  color: #fff3e0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 34px 36px 30px;
  position: relative;
  overflow: hidden;
}
.page-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 25% 20%, rgba(255,240,210,0.14) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 80% 90%, rgba(80,30,15,0.20) 0%, transparent 70%);
  pointer-events: none;
}
.cover-grid {
  display: contents;
}
.cover-top {
  position: relative; z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: rgba(255,243,224,0.85);
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,243,224,0.32);
  white-space: nowrap;
}
.cover-mark { text-transform: uppercase; letter-spacing: 0.24em; font-style: normal; font-family: 'Cormorant Garamond', serif; font-weight: 500; color: #fff3e0; font-size: 12px; }
.cover-meta { letter-spacing: 0.14em; font-size: 10.5px; }

.cover-body {
  position: relative; z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 24px 0;
}

.cover-title-ko {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 56px;
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0;
  color: #fff5e2;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}
.cover-title-ko .ln { display: block; white-space: nowrap; }
.cover-title-ko .ln-1 { font-weight: 300; }
.cover-title-ko .ln-2 { font-weight: 400; padding-left: 0.5em; margin-top: 0.06em; }
.cover-title-ko .ln-2 em { font-style: normal; color: #3a1a08; }

.cover-target {
  position: absolute;
  right: -50px;
  bottom: -30px;
  width: 200px;
  height: 200px;
  color: rgba(255,243,224,0.5);
  z-index: 1;
  opacity: 0.7;
}

.cover-bottom {
  position: relative; z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  padding-top: 14px;
  border-top: 1px solid rgba(255,243,224,0.28);
  gap: 16px;
}
.cover-blurb {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 11px;
  line-height: 1.75;
  letter-spacing: 0.02em;
  color: rgba(255,243,224,0.82);
  margin: 0;
  max-width: 62%;
}
.cover-footer-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 9.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255,243,224,0.7);
  white-space: nowrap;
}
.cover-footer-row .vol { font-style: italic; letter-spacing: 0.18em; color: #fff3e0; font-size: 11px; }

/* Orange wall — replaces image for text-only IG posts */
.page-photo.page-orange-wall {
  background: #d76b3b;
  position: relative;
}
.page-photo.page-orange-wall::before {
  background:
    radial-gradient(ellipse 70% 60% at 35% 35%, rgba(255,240,210,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 60% 60% at 70% 85%, rgba(60,20,5,0.16) 0%, transparent 70%);
}
.page-photo.page-orange-wall .photo-num {
  color: rgba(255,243,224,0.7);
}

/* ============================================================
   Title page
   ============================================================ */
.page-title {
  align-items: stretch;
  justify-content: center;
  text-align: center;
  padding: 80px 56px;
}
.page-title h1 {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 52px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 28px;
  text-align: center;
}
.page-title .sub {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-soft);
  margin: 0 auto 60px;
  text-align: center;
}
.page-title .author {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-align: center;
}
.page-title .rule {
  width: 80px;
  height: 1px;
  background: var(--rule);
  margin: 28px auto;
}

/* ============================================================
   Epigraph
   ============================================================ */
.page-epigraph {
  align-items: stretch;
  justify-content: center;
  text-align: center;
  padding: 100px 56px;
}
.page-epigraph blockquote {
  margin: 0 auto;
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 21px;
  line-height: 1.85;
  color: var(--ink);
  text-align: center;
}
.page-epigraph cite {
  display: block;
  margin-top: 36px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-style: normal;
}

/* ============================================================
   TOC
   ============================================================ */
.page-toc {
  padding: 38px 40px 120px;
}
.page-toc .toc-head {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 6px;
}
.page-toc h2 {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 26px;
  margin: 0 0 10px;
}
.page-toc .toc-rule {
  width: 36px; height: 1px;
  background: var(--rule);
  margin: 0 0 14px;
}
.page-toc ol {
  list-style: none;
  margin: 0; padding: 0;
  font-family: 'Noto Serif KR', serif;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--ink);
}
.page-toc li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2.5px 0;
  cursor: pointer;
  transition: color 0.18s;
}
.page-toc li:hover { color: var(--accent); }
.page-toc li .idx {
  font-family: 'Cormorant Garamond', serif;
  font-variant-numeric: tabular-nums;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  min-width: 18px;
  font-style: italic;
}
.page-toc li .ttl {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
}
.page-toc li .dt {
  font-family: 'Cormorant Garamond', serif;
  font-variant-numeric: tabular-nums;
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

/* ============================================================
   Half-title page
   ============================================================ */
.page-half-title {
  align-items: stretch;
  justify-content: center;
  text-align: center;
  padding: 100px 56px;
}
.page-half-title .ht-mark {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
}
.page-half-title .ht-rule {
  width: 44px; height: 1px;
  background: var(--rule);
  margin: 22px auto;
}
.page-half-title .ht-title {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 64px;
  line-height: 1.05;
  color: var(--ink);
  margin: 4px 0 28px;
  text-align: center;
  letter-spacing: 0.08em;
}
.page-half-title .ht-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  text-align: center;
}

/* ============================================================
   Photo page — full bleed
   ============================================================ */
.page-photo {
  padding: 0;
  background: #0e0c09;
}
.page-photo .photo-frame {
  position: absolute;
  inset: 0;
  background: #0e0c09;
  overflow: hidden;
}
.page-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover !important;
  display: block;
}
.page-photo .photo-num {
  position: absolute;
  top: 28px; right: 28px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.24em;
  color: rgba(231,216,173,0.65);
  z-index: 2;
  text-shadow: 0 1px 6px rgba(0,0,0,0.55);
  pointer-events: none;
}

/* ============================================================
   Text page
   ============================================================ */
.page-text {
  padding: 60px 52px 44px;
  display: flex;
  flex-direction: column;
}
.page-text .post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.page-text .post-meta .num { font-style: italic; color: var(--accent); }
.page-text h3 {
  font-family: 'Noto Serif KR', serif;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.4;
  margin: 0 0 8px;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.page-text .title-rule {
  width: 28px; height: 1px;
  background: var(--rule);
  margin: 0 0 22px;
}
.page-text .body {
  flex: 1;
  overflow: hidden;
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink);
  letter-spacing: 0.005em;
}
.page-text .body .stanza {
  margin-bottom: 14px;
}
.page-text .body .stanza:last-child { margin-bottom: 0; }
.page-text .body .line {
  display: block;
}
.page-text .tags {
  margin-top: 16px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.page-text .tags span { margin-right: 10px; }

.page-text.dense .body { font-size: 13px; line-height: 1.75; }
.page-text.dense .stanza { margin-bottom: 12px; }
.page-text.very-dense .body { font-size: 12px; line-height: 1.7; }
.page-text.very-dense h3 { font-size: 19px; }
.page-text.very-dense .stanza { margin-bottom: 10px; }
.page-text.ultra-dense .body { font-size: 11px; line-height: 1.65; }
.page-text.ultra-dense h3 { font-size: 17px; }
.page-text.ultra-dense .stanza { margin-bottom: 8px; }
.page-text.ultra-dense { padding: 50px 48px 40px; }
.page-text.ultra-dense .post-meta { margin-bottom: 16px; }
.page-text.ultra-dense .title-rule { margin: 0 0 16px; }

/* ============================================================
   Afterword, colophon, back cover
   ============================================================ */
.page-afterword {
  padding: 70px 52px 60px;
}
.page-afterword h2 {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 28px;
  line-height: 1.3;
  margin: 0;
}
.page-afterword .sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 8px;
}
.page-afterword p {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 13px;
  line-height: 1.9;
  margin: 0 0 14px;
  color: var(--ink);
}
.page-afterword .signoff {
  margin-top: 28px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.page-colophon {
  padding: 70px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.page-colophon .mark {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 24px;
}
.page-colophon dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px 24px;
  font-family: 'Noto Serif KR', serif;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.7;
}
.page-colophon dt {
  color: var(--ink-faint);
  text-align: right;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  letter-spacing: 0.08em;
}
.page-colophon dd { margin: 0; text-align: left; }

.page-back-cover {
  background: #d76b3b;
  color: #fff3e0;
  padding: 70px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.page-back-cover::before {
  background:
    radial-gradient(ellipse 70% 50% at 70% 30%, rgba(255,243,224,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 30% 90%, rgba(60,20,5,0.16) 0%, transparent 70%);
}
.page-back-cover .blurb {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 1.9;
  color: rgba(255,243,224,0.92);
  max-width: 320px;
}
.page-back-cover .small-mark {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255,243,224,0.7);
}

.page-blank {
  background: var(--paper);
}
.page-blank .center {
  margin: auto;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.page-dedication {
  align-items: stretch;
  justify-content: center;
  text-align: center;
}
.page-dedication .dedication-text {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 15px;
  line-height: 1.95;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  text-align: center;
}

/* ============================================================
   TOC overlay
   ============================================================ */
.toc-overlay {
  position: fixed; inset: 0;
  background: rgba(20,17,13,0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.toc-overlay.open { opacity: 1; pointer-events: auto; }
.toc-overlay-inner {
  max-width: 720px; width: 100%;
  background: var(--paper);
  padding: 60px 56px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 30px 90px rgba(0,0,0,0.6);
  position: relative;
}
.toc-overlay h2 {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: 28px;
  margin: 0 0 6px;
}
.toc-overlay .head {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 4px;
}
.toc-overlay ol {
  list-style: none;
  margin: 0; padding: 0;
  columns: 2;
  column-gap: 36px;
}
.toc-overlay li {
  break-inside: avoid;
  display: flex;
  gap: 10px;
  padding: 6px 0;
  font-family: 'Noto Serif KR', serif;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
}
.toc-overlay li:hover { color: var(--accent); }
.toc-overlay li .idx {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--ink-faint);
  min-width: 22px;
  font-size: 11px;
}
.toc-overlay li .ttl {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc-overlay li .dt {
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}
.toc-close {
  position: absolute;
  top: 18px; right: 22px;
  background: transparent;
  border: 1px solid rgba(91,85,74,0.4);
  color: #5b554a;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  font-family: inherit;
  line-height: 1;
}

/* ============================================================
   Mobile — topbar/bottombar tweaks (mobile uses MobileBook component)
   ============================================================ */

@media (max-width: 820px) {
  .topbar { padding: 12px 18px 8px; font-size: 11px; }
  .topbar .brand em { display: none; }
  .topbar .meta { font-size: 10px; }
  .bottombar { padding: 10px 14px 14px; gap: 12px; }
  .btn-fontsize { padding: 6px 9px; }
  .btn-fontsize .lbl { display: none; }
  .toc-overlay-inner { padding: 50px 32px; }
  .toc-overlay ol { columns: 1; }
}

@media (max-width: 480px) {
  .topbar .meta { display: none; }
  .cover-target { right: -20px; width: 180px; height: 180px; }
  .page-mobile-post .mobile-photo { aspect-ratio: 1 / 1; }
  .page-mobile-post .mobile-text { padding: 28px 22px 40px; }
  .page-mobile-post .mobile-text .body { font-size: calc(14.5px * var(--mobile-text-scale, 1)); line-height: 1.88; }
  .page-mobile-post .mobile-text h3 { font-size: calc(19px * var(--mobile-text-scale, 1)); }
}
.mobile-page-wrap {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}
.mobile-page-slide {
  position: absolute;
  inset: 0;
  background: var(--paper);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: mp-in 0.32s cubic-bezier(.4,0,.2,1);
}
.mobile-page-slide.backward { animation: mp-in-back 0.32s cubic-bezier(.4,0,.2,1); }
@keyframes mp-in {
  from { transform: translateX(8%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes mp-in-back {
  from { transform: translateX(-8%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* mobile post: photo on top, text below */
.page-mobile-post {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.page-mobile-post .mobile-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #0e0c09;
  flex-shrink: 0;
  overflow: hidden;
}
.page-mobile-post .mobile-photo.orange-wall {
  background: #d76b3b;
}
.page-mobile-post .mobile-photo.orange-wall::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 35% 35%, rgba(255,240,210,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 60% 60% at 70% 85%, rgba(60,20,5,0.16) 0%, transparent 70%);
}
.page-mobile-post .mobile-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.page-mobile-post .mobile-photo .photo-num {
  position: absolute;
  top: 18px; right: 20px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 11.5px;
  letter-spacing: 0.22em;
  color: rgba(255,243,224,0.78);
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
  z-index: 2;
}
.page-mobile-post .mobile-photo.orange-wall .photo-num {
  text-shadow: none;
  color: rgba(255,243,224,0.7);
}
.page-mobile-post .mobile-text {
  flex: 1;
  padding: 32px 26px 44px;
  font-family: 'Noto Serif KR', serif;
  color: var(--ink);
}
.page-mobile-post .mobile-text .post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 10.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.page-mobile-post .mobile-text .post-meta .num { font-style: italic; color: var(--accent); }
.page-mobile-post .mobile-text h3 {
  font-family: 'Noto Serif KR', serif;
  font-weight: 400;
  font-size: calc(21px * var(--mobile-text-scale, 1));
  line-height: 1.4;
  margin: 0 0 8px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.page-mobile-post .mobile-text .title-rule {
  width: 28px; height: 1px;
  background: var(--rule);
  margin: 0 0 20px;
}
.page-mobile-post .mobile-text .body {
  font-family: 'Noto Serif KR', serif;
  font-weight: 300;
  font-size: calc(15px * var(--mobile-text-scale, 1));
  line-height: 1.9;
  color: var(--ink);
}
.page-mobile-post .mobile-text .stanza { margin-bottom: 14px; }
.page-mobile-post .mobile-text .stanza:last-child { margin-bottom: 0; }
.page-mobile-post .mobile-text .line { display: block; }
.page-mobile-post .mobile-text .tags {
  margin-top: 18px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.page-mobile-post .mobile-text .tags span { margin-right: 10px; }

/* full-screen single page for cover, dedication, TOC, etc on mobile */
.mobile-page-slide > .page {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 100%;
  inset: auto;
}
.mobile-page-slide > .page-cover,
.mobile-page-slide > .page-back-cover {
  min-height: 100vh;
}
.mobile-page-slide > .page-photo,
.mobile-page-slide > .page-text {
  display: none;
}
/* TOC mobile: show only one part full screen; we have two pages so user can swipe */
.mobile-page-slide > .page-toc {
  padding: 36px 32px 110px;
}
.mobile-page-slide > .page-toc ol { font-size: 13px; line-height: 1.7; }
.mobile-page-slide > .page-toc li { padding: 6px 0; }
.mobile-page-slide > .page-toc li .ttl { font-size: 13px; }
.mobile-page-slide > .page-toc li .idx { font-size: 11.5px; min-width: 22px; }
.mobile-page-slide > .page-toc li .dt { font-size: 10.5px; }
