/* magazine-stand — 밤의 가판대. 종이색 잉크, 어두운 매대. */

:root {
  --ink: #100f13;
  --ink-2: #191820;
  --ink-3: #23222c;
  --line: #33313f;
  --paper: #f5efe2;
  --paper-2: #cdc5b4;
  --paper-3: #8b8477;
  --accent: #e2573c;
  --accent-2: #6ea8e0;
  --radius: 12px;
  --head-h: 52px;
  --foot-h: 54px;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body { line-height: 1.55; }

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

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------- 공통 헤더 */

.site-head {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #17161d, var(--ink));
}
.site-head .wrap { padding-top: 26px; padding-bottom: 22px; }

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.brand h1 {
  margin: 0;
  font-size: clamp(26px, 6.5vw, 40px);
  letter-spacing: -0.03em;
  font-weight: 800;
}
.brand .en {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
}
.tagline {
  margin: 8px 0 0;
  color: var(--paper-3);
  font-size: 13.5px;
}
.tagline b { color: var(--paper-2); font-weight: 600; }

/* 상단 되돌아가기 바 (뷰어/정보) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--head-h);
  padding: 0 12px;
  background: rgba(16, 15, 19, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .t-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink-2);
  color: var(--paper-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--paper-3); color: var(--paper); }
.btn.-accent { border-color: var(--accent); color: #ffd9d0; }

/* ---------------------------------------------------------- 가판대 */

.rack {
  list-style: none;
  margin: 22px 0 40px;
  padding: 0;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.vol {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 14px;
  padding: 12px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  transition: border-color .15s, transform .15s;
}
.vol:hover { border-color: var(--paper-3); }

.vol-cover {
  display: block;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  background: var(--ink-3);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
}
.vol-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vol-meta { min-width: 0; display: flex; flex-direction: column; }
.vol-masthead {
  font-size: 10px;
  letter-spacing: 0.2em;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 3px;
}
.vol-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.vol-orig {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--paper-3);
}
.vol-summary {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--paper-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vol-foot {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--paper-3);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--paper-2);
}
.chip.-resume { border-color: var(--accent); color: #ffc9be; }

.stretch::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.vol-links { position: relative; z-index: 2; display: flex; gap: 8px; }

@media (min-width: 640px) {
  .rack { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
  .vol { grid-template-columns: 1fr; }
  .vol-title { font-size: 18px; }
}

/* ---------------------------------------------------------- 고지 */

.notice {
  border-top: 1px solid var(--line);
  background: var(--ink-2);
}
.notice .wrap { padding-top: 18px; padding-bottom: 28px; }
.notice p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--paper-3);
  max-width: 62ch;
}
.notice strong { color: var(--paper-2); font-weight: 700; }
.notice .n-head {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}

/* ---------------------------------------------------------- 권 정보 */

.info-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 22px 0 8px;
}
.info-hero .cover {
  width: 150px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .55);
}
.info-hero .cover img { width: 100%; display: block; }
.info-hero h1 {
  margin: 0;
  font-size: clamp(22px, 5.5vw, 32px);
  letter-spacing: -0.03em;
}
.info-hero .orig { margin: 6px 0 0; color: var(--paper-3); font-size: 13px; }
.info-hero .sum { margin: 12px 0 0; color: var(--paper-2); font-size: 14px; max-width: 60ch; }
.info-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

@media (min-width: 720px) {
  .info-hero { grid-template-columns: 150px 1fr; align-items: start; }
}

.sec { padding: 26px 0 0; }
.sec > h2 {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 800;
}
.toc { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.toc li {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 11px 13px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.toc li:hover { border-color: var(--paper-3); }
.toc .pg {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent-2);
  letter-spacing: 0.04em;
}
.toc .tx { font-size: 13.5px; color: var(--paper-2); }
.toc .tx.-none { color: var(--paper-3); font-style: italic; }

.srcs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.srcs a {
  font-size: 12.5px;
  color: var(--accent-2);
  word-break: break-all;
  border-bottom: 1px solid transparent;
}
.srcs a:hover { border-color: currentColor; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.plain li {
  font-size: 12.8px;
  color: var(--paper-2);
  padding-left: 14px;
  position: relative;
}
.plain li::before {
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--paper-3);
}
.empty {
  font-size: 12.5px;
  color: var(--paper-3);
  font-style: italic;
  margin: 0;
}

/* ---------------------------------------------------------- 뷰어 */

body.reader {
  height: 100%;
  overflow: hidden;
  background: #08080a;
}
.reader-root {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: none;
}
.track {
  display: flex;
  height: 100%;
  will-change: transform;
}
.unit {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  gap: 2px;
}
.unit img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  background: #1b1a20;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .75);
  user-select: none;
  -webkit-user-drag: none;
}
.unit.-spread img { max-width: 50%; }
.zoomer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

/* 권 마무리 카드 */
.endcard {
  flex: 0 0 100%;
  height: 100%;
  overflow-y: auto;
  padding: 24px 18px 40px;
  -webkit-overflow-scrolling: touch;
}
.endcard .inner { max-width: 640px; margin: 0 auto; }
.endcard h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.endcard .fin {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 10px;
}

/* 상/하단 크롬 */
.r-head, .r-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: #0c0c0f;
  border-color: var(--line);
  border-style: solid;
  border-width: 0;
}
.r-head { height: var(--head-h); border-bottom-width: 1px; }
.r-foot {
  height: var(--foot-h);
  border-top-width: 1px;
  padding-bottom: env(safe-area-inset-bottom);
}
.r-title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ink-2);
  color: var(--paper-2);
  font-size: 17px;
  cursor: pointer;
  font-family: var(--sans);
}
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn:not(:disabled):hover { border-color: var(--paper-3); color: var(--paper); }

.pager {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.pager small { color: var(--paper-3); font-weight: 600; }

.ai-chip {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid #5a3b34;
  border-radius: 999px;
  background: #241613;
  color: #ffb9ab;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--sans);
}

/* 안내 시트 */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(6, 6, 8, .78);
  display: grid;
  place-items: end center;
  padding: 0;
}
.sheet[hidden] { display: none; }
.sheet .card {
  width: 100%;
  max-width: 560px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 82vh;
  overflow-y: auto;
}
.sheet h3 { margin: 0 0 10px; font-size: 15px; }
.sheet p { margin: 0 0 14px; font-size: 13px; color: var(--paper-2); line-height: 1.75; }

.zoom-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .66);
  color: var(--paper-2);
  font-size: 11.5px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.zoom-hint.-on { opacity: 1; }

/* 데스크톱 클릭 넘김 영역 */
.nav-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12%;
  min-width: 46px;
  cursor: pointer;
  z-index: 5;
  background: transparent;
  border: 0;
}
.nav-zone.-prev { left: 0; }
.nav-zone.-next { right: 0; }
@media (hover: none) { .nav-zone { display: none; } }

.loading { padding: 40px 16px; text-align: center; color: var(--paper-3); font-size: 14px; }
