/* ═══════════════════════════════════════════════════════════════════
   월간 루나웨일 — Magazine Design System
   톤: Kinfolk (차분·여백) + WIRED (깊이·인포그래픽) + Esquire (인물)
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Typography ─── */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@300;400;500;600;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined');

:root {
  /* Palette ─ Kinfolk Cream + Indigo + Mustard */
  --mag-cream: #F5F0E8;
  --mag-cream-deep: #EBE4D6;
  --mag-paper: #FAF7F2;
  --mag-ink: #1A1A1A;
  --mag-ink-soft: #3A3A3A;
  --mag-ink-mute: #6B6B6B;
  --mag-indigo: #1B2645;
  --mag-indigo-light: #2C3D6F;
  --mag-mustard: #D4A437;
  --mag-mustard-deep: #A87E20;
  --mag-rust: #B85C38;
  --mag-sage: #87A878;
  --mag-line: #D9D2C4;
  --mag-line-soft: #ECE6D8;

  /* WIRED Accent (used in tech / infographic only) */
  --mag-tech-accent: #FF6B6B;
  --mag-tech-cyan: #4ECDC4;
  --mag-tech-bg: #0F1419;

  /* Type */
  --mag-font-sans: 'Pretendard', 'Inter', -apple-system, sans-serif;
  --mag-font-serif: 'Noto Serif KR', 'Cormorant Garamond', 'Playfair Display', serif;
  --mag-font-display: 'Playfair Display', 'Noto Serif KR', serif;
  --mag-font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Page */
  --page-width: 210mm;
  --page-height: 297mm;
  --page-margin: 20mm;
  --page-margin-top: 28mm;
  --page-margin-bottom: 24mm;
  --page-shadow: 0 30px 80px -20px rgba(27, 38, 69, 0.25),
                 0 10px 30px -5px rgba(27, 38, 69, 0.15);

  /* Animation */
  --mag-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mag-ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ─── Reset ─── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--mag-font-sans);
  background: var(--mag-cream);
  color: var(--mag-ink);
  line-height: 1.6;
  font-feature-settings: 'kern', 'liga', 'palt';
  word-break: keep-all;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
}

/* ═══════════════════════════════════════════════════════════════════
   페이지 컨테이너 — A4 잡지 페이지
   ═══════════════════════════════════════════════════════════════════ */

.mag-shell {
  min-height: 100vh;
  background: linear-gradient(
    to bottom,
    var(--mag-cream-deep) 0%,
    var(--mag-cream) 30%,
    var(--mag-cream) 70%,
    var(--mag-cream-deep) 100%
  );
  padding: 80px 20px 120px;
}

.mag-stage {
  max-width: var(--page-width);
  margin: 0 auto;
}

.mag-page {
  position: relative;
  width: var(--page-width);
  min-height: var(--page-height);
  background: var(--mag-paper);
  margin: 0 auto 40px;
  box-shadow: var(--page-shadow);
  overflow: hidden;
  page-break-after: always;
  break-after: page;
}

.mag-page-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: var(--page-height);
  padding: var(--page-margin-top) var(--page-margin) var(--page-margin-bottom);
}

/* 페이지 번호 */
.mag-pagenum {
  position: absolute;
  bottom: 12mm;
  font-family: var(--mag-font-serif);
  font-size: 10pt;
  letter-spacing: 0.3em;
  color: var(--mag-ink-mute);
  font-weight: 300;
}

.mag-pagenum.left { left: 20mm; }
.mag-pagenum.right { right: 20mm; }

.mag-folio {
  position: absolute;
  top: 14mm;
  font-family: var(--mag-font-sans);
  font-size: 8pt;
  letter-spacing: 0.4em;
  color: var(--mag-ink-mute);
  text-transform: uppercase;
  font-weight: 500;
  z-index: 5;
  /* 긴 라벨이 페이지 폭을 넘지 않게 */
  max-width: calc(100% - 40mm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mag-folio.left { left: 20mm; }
.mag-folio.right { right: 20mm; }

/* ═══════════════════════════════════════════════════════════════════
   타입 시스템
   ═══════════════════════════════════════════════════════════════════ */

.mag-eyebrow {
  font-family: var(--mag-font-sans);
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--mag-mustard-deep);
  font-weight: 600;
  margin-bottom: 16px;
}

.mag-h1 {
  font-family: var(--mag-font-serif);
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--mag-ink);
  margin-bottom: 24px;
}

.mag-h1-display {
  font-family: var(--mag-font-display);
  font-size: clamp(48px, 7vw, 96px);
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--mag-ink);
}

.mag-h2 {
  font-family: var(--mag-font-serif);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--mag-ink);
  margin-bottom: 16px;
}

.mag-h3 {
  font-family: var(--mag-font-serif);
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.3;
  font-weight: 600;
  color: var(--mag-ink);
  margin-bottom: 12px;
}

.mag-deck {
  font-family: var(--mag-font-serif);
  font-size: 18px;
  line-height: 1.5;
  font-weight: 300;
  font-style: italic;
  color: var(--mag-ink-soft);
  margin-bottom: 24px;
}

.mag-body {
  font-family: var(--mag-font-sans);
  font-size: 13px;
  line-height: 1.75;
  font-weight: 400;
  color: var(--mag-ink-soft);
  letter-spacing: -0.005em;
}

.mag-body p { margin-bottom: 14px; }

.mag-body p:first-of-type::first-letter {
  font-family: var(--mag-font-serif);
  font-size: 56px;
  font-weight: 700;
  float: left;
  line-height: 0.9;
  margin: 6px 8px 0 0;
  color: var(--mag-indigo);
}

.mag-caption {
  font-family: var(--mag-font-sans);
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.05em;
  color: var(--mag-ink-mute);
  text-transform: uppercase;
  font-weight: 500;
}

.mag-pullquote {
  font-family: var(--mag-font-serif);
  font-size: 24px;
  line-height: 1.4;
  font-weight: 400;
  font-style: italic;
  color: var(--mag-indigo);
  border-top: 2px solid var(--mag-mustard);
  border-bottom: 2px solid var(--mag-mustard);
  padding: 24px 0;
  margin: 24px 0;
  text-align: center;
}

.mag-pullquote::before { content: '" '; color: var(--mag-mustard); }
.mag-pullquote::after { content: ' "'; color: var(--mag-mustard); }

.mag-byline {
  font-family: var(--mag-font-sans);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mag-ink-mute);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════
   레이아웃 그리드
   ═══════════════════════════════════════════════════════════════════ */

.mag-grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.mag-col-2 { grid-column: span 2; }
.mag-col-3 { grid-column: span 3; }
.mag-col-4 { grid-column: span 4; }
.mag-col-5 { grid-column: span 5; }
.mag-col-6 { grid-column: span 6; }
.mag-col-7 { grid-column: span 7; }
.mag-col-8 { grid-column: span 8; }
.mag-col-9 { grid-column: span 9; }
.mag-col-10 { grid-column: span 10; }
.mag-col-12 { grid-column: span 12; }

.mag-cols-2 { columns: 2; column-gap: 16px; }
.mag-cols-3 { columns: 3; column-gap: 14px; }

/* ═══════════════════════════════════════════════════════════════════
   네비게이션 — 잡지 컨트롤
   ═══════════════════════════════════════════════════════════════════ */

.mag-toolbar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(27, 38, 69, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 100px;
  padding: 8px 12px;
  box-shadow: 0 12px 40px rgba(27, 38, 69, 0.3);
  z-index: 100;
  color: var(--mag-paper);
  font-family: var(--mag-font-sans);
  transition: padding 0.3s var(--mag-ease), gap 0.3s var(--mag-ease);
}

/* 🔴 툴바 접힘 모드 — 토글 버튼만 작은 원으로 남기고 나머지 다 숨김 */
body.toolbar-collapsed .mag-toolbar {
  gap: 0;
  padding: 4px;
}

body.toolbar-collapsed .mag-toolbar > *:not(.mag-toolbar-collapse) {
  display: none !important;
}

body.toolbar-collapsed .mag-toolbar-collapse {
  width: 32px;
  height: 32px;
  background: rgba(212, 164, 55, 0.25);
  color: var(--mag-mustard);
}

/* 토글 버튼 아이콘 — JS 에서 textContent 직접 교체 (expand_less ↔ expand_more) */

.mag-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: rgba(245, 240, 232, 0.85);
  transition: background 0.2s var(--mag-ease), color 0.2s var(--mag-ease);
}

.mag-toolbar-btn:hover {
  background: rgba(212, 164, 55, 0.2);
  color: var(--mag-mustard);
}

.mag-toolbar-btn .material-symbols-outlined {
  font-size: 20px;
  font-variation-settings: 'wght' 400;
}

.mag-toolbar-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
  border-left: 1px solid rgba(245, 240, 232, 0.15);
  border-right: 1px solid rgba(245, 240, 232, 0.15);
}

.mag-toolbar-vol {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(245, 240, 232, 0.6);
  text-transform: uppercase;
  font-weight: 500;
}

.mag-toolbar-page {
  font-family: var(--mag-font-serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--mag-paper);
  letter-spacing: 0.05em;
}

.mag-toolbar-page span { color: var(--mag-mustard); }

/* 진행바 */
.mag-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(27, 38, 69, 0.08);
  z-index: 99;
}

.mag-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mag-mustard), var(--mag-rust));
  width: 0%;
  transition: width 0.1s linear;
}

/* 사이드 페이지 인디케이터 */
.mag-pageindex {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
}

.mag-pageindex-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(27, 38, 69, 0.2);
  border: none;
  cursor: pointer;
  transition: all 0.3s var(--mag-ease);
  position: relative;
}

.mag-pageindex-dot:hover { background: var(--mag-mustard); transform: scale(1.5); }
.mag-pageindex-dot.active {
  background: var(--mag-indigo);
  width: 24px;
  border-radius: 4px;
}

.mag-pageindex-dot::after {
  content: attr(data-label);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: var(--mag-indigo);
  color: var(--mag-paper);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s var(--mag-ease);
  font-family: var(--mag-font-sans);
  letter-spacing: 0.05em;
}

.mag-pageindex-dot:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ═══════════════════════════════════════════════════════════════════
   인터랙션 — 스크롤 리빌
   ═══════════════════════════════════════════════════════════════════ */

[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s var(--mag-ease), transform 1s var(--mag-ease);
}

[data-reveal].in {
  opacity: 1;
  transform: translateY(0);
}

/* 책 모드에서는 reveal/stagger 효과 끄기 — PageFlip 이 다음 페이지 미리 layout 할 때
   IntersectionObserver 가 트리거 안 되어 빈 종이로 보이는 문제 방지 */
body.page-mode [data-reveal],
body.page-mode .fade-stagger > *,
body.page-mode [data-stagger] [data-reveal] {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
  animation: none !important;
  transition-delay: 0s !important;
}

[data-reveal="left"] { transform: translateX(-40px); }
[data-reveal="left"].in { transform: translateX(0); }

[data-reveal="right"] { transform: translateX(40px); }
[data-reveal="right"].in { transform: translateX(0); }

[data-reveal="scale"] { transform: scale(0.92); }
[data-reveal="scale"].in { transform: scale(1); }

[data-reveal="blur"] { filter: blur(8px); }
[data-reveal="blur"].in { filter: blur(0); }

[data-stagger] [data-reveal] { transition-delay: calc(var(--idx, 0) * 0.08s); }

/* ═══════════════════════════════════════════════════════════════════
   유틸 — 디바이더, 박스
   ═══════════════════════════════════════════════════════════════════ */

.mag-rule {
  border: none;
  border-top: 1px solid var(--mag-line);
  margin: 24px 0;
}

.mag-rule.thick {
  border-top-width: 2px;
  border-top-color: var(--mag-ink);
}

.mag-rule.gold {
  border-top: 1px solid var(--mag-mustard);
}

.mag-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px 0;
  color: var(--mag-mustard);
}

.mag-ornament::before, .mag-ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--mag-mustard);
  opacity: 0.5;
}

.mag-ornament span {
  margin: 0 16px;
  font-family: var(--mag-font-serif);
  font-size: 16px;
  letter-spacing: 0.2em;
}

.mag-tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--mag-mustard);
  color: var(--mag-paper);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
  border-radius: 100px;
}

.mag-tag.indigo { background: var(--mag-indigo); }
.mag-tag.outline { background: transparent; color: var(--mag-ink); border: 1px solid var(--mag-ink); }

.mag-divider-dots {
  text-align: center;
  font-family: var(--mag-font-serif);
  letter-spacing: 0.5em;
  color: var(--mag-mustard);
  margin: 16px 0;
  font-size: 14px;
}

.mag-divider-dots::before { content: '· · ·'; }

/* ═══════════════════════════════════════════════════════════════════
   PDF / Print 모드
   ═══════════════════════════════════════════════════════════════════ */

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  body {
    background: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .mag-shell {
    background: white;
    padding: 0;
  }
  .mag-page {
    width: 210mm;
    height: 297mm;
    margin: 0;
    page-break-after: always;
    break-after: page;
    box-shadow: none;
    transform: none !important;
  }
  .mag-page:last-child { page-break-after: auto; }
  .mag-toolbar, .mag-progress, .mag-pageindex,
  .no-print, [data-no-print] { display: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; filter: none !important; }
}

body.print-mode .mag-toolbar,
body.print-mode .mag-progress,
body.print-mode .mag-pageindex {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════
   페이지 모드 — 한 장씩 보기
   ═══════════════════════════════════════════════════════════════════ */

body.page-mode {
  overflow: hidden;
  height: 100vh;
}

body.page-mode .mag-shell {
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  /* 밝은 크림 배경 + 도트 그리드 (정적, 깜빡임 방지) */
  background-color: var(--mag-cream);
  background-image:
    radial-gradient(circle, rgba(27, 38, 69, 0.18) 1.4px, transparent 1.8px);
  background-size: 26px 26px;
  background-position: 0 0;
  background-attachment: fixed;
  position: relative;
}
/* 인터랙티브 화이트 하이라이트는 별도 ::after 레이어로 분리 (책 깜빡임 방지) */
body.page-mode .mag-shell::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.18) 14%,
    transparent 30%
  );
  will-change: background;
}

body.page-mode .mag-stage {
  position: relative;
  width: 100%;
  max-width: 1600px;
  height: 100%;
  max-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* PageFlip 컨테이너 — 양면 spread 600×2=1200 / portrait 600 */
.mag-bookflip {
  width: 1200px;
  max-width: 100%;
  height: 848px;
  max-height: 100%;
  position: relative;
  margin: 0 auto;
  z-index: 2; /* 화이트 하이라이트 (z=0) 위에 책 올리기 */
  /* 책 깊이감 — box-shadow (drop-shadow 대비 GPU 비용 적고 깜빡임 방지) */
}
/* 책 그림자는 stf__block 에 적용 — element 자체 모양 따라 */
/* 화면이 세로 비율(아이패드 세로/모바일)이면 단면 portrait 폭으로 */
@media (orientation: portrait) {
  .mag-bookflip {
    width: 600px;
  }
}

/* PageFlip이 페이지를 자체 캔버스에 그리므로 스타일은 페이지 안 콘텐츠가 그대로 보이게 */
body.page-mode .mag-page {
  background: var(--mag-paper);
  overflow: hidden;
  position: relative;
  display: block;
  margin: 0;
  box-shadow: none;
}

body.page-mode .mag-page-inner {
  padding: var(--page-margin-top) var(--page-margin) var(--page-margin-bottom);
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* 양면 책 컨테이너 — 펼친 책 효과 (20% 강도, 책 영역만) */
body.page-mode .mag-stage::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  height: 848px;
  width: 18px;
  margin-left: -9px;
  margin-top: -424px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.05) 35%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.05) 65%,
    rgba(0, 0, 0, 0) 100%
  );
  z-index: 50;
  pointer-events: none;
  border-radius: 2px;
  filter: blur(0.5px);
}
/* 화면이 세로 비율(아이패드 세로/모바일)이면 spine 자체 숨김 (단면이라 spine 의미 없음) */
@media (orientation: portrait) {
  body.page-mode .mag-stage::before { display: none; }
}

/* PageFlip 라이브러리 + GPU 가속으로 부드러운 책 넘김 */

/* StPageFlip 클래스 — 그림자 + GPU 가속 + 페이지 안 padding 강제 */
.stf__parent {
  perspective: 2000px;
  will-change: transform;
}
/* stf__wrapper / block 은 PageFlip 자체가 inline style 로 사이즈 부여 */
.stf__block {
  box-shadow:
    0 28px 56px -12px rgba(0, 0, 0, 0.32),
    0 8px 16px -6px rgba(0, 0, 0, 0.18);
  will-change: transform;
  /* backface-visibility 제거 — 종이가 휘어질 때 뒷면(다음 페이지)이 보여야 한다 */
}
.stf__item {
  background: var(--mag-paper) !important;
  will-change: transform;
  /* backface-visibility 제거 — 페이지 양면이 둘 다 paint 되어야 미리보기가 작동 */
  /* 🔴 position absolute 강제 — PageFlip이 mid-flip 도중 다음 spread 페이지를 relative 로 두는
     버그로 인해 normal flow 첫 자리가 책 바깥(top 800+)이 되어 다음 우측 페이지가 안 보이는 현상 차단 */
  position: absolute !important;
}

/* PageFlip이 .mag-page에 .stf__item 클래스를 ADD 함 (자식 wrap 아님)
   width/height은 PageFlip inline style(540×762)을 살려야 하므로 강제하지 않음.
   min-height만 강제로 무력화해서 mag-page의 본래 min-height 1122px 우회 */
.stf__item.mag-page,
.stf__item .mag-page {
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  box-shadow: none !important;
  overflow: hidden !important;
}
.stf__item .mag-page-inner,
.stf__item.mag-page .mag-page-inner {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 32px 28px 32px !important;  /* folio 안 겹치게 충분한 여백 */
  box-sizing: border-box !important;
}

/* folio — 페이지 모드(책 모드) 에서는 숨김.
   각 페이지 헤드라인이 이미 카테고리 라벨을 표시하기 때문에 중복.
   인쇄·스크롤 모드에서는 정상 표시 (관습적인 잡지 folio 라인). */
.stf__item .mag-folio { display: none !important; }

/* 페이지 콘텐츠 padding-top 정리 — 헤드라인이 페이지 위에서 자연스럽게 시작 */
.stf__item .mag-page-inner { padding-top: 18px !important; }

.stf__item .mag-pagenum {
  bottom: 10px !important;
  font-size: 8pt !important;
}
.stf__item .mag-pagenum.left { left: 18px !important; }
.stf__item .mag-pagenum.right { right: 18px !important; }

/* 페이지 모드에서 툴바 · 화살표 · 인덱스 항상 보이게 (PageFlip 위) */
body.page-mode .mag-toolbar { z-index: 9999 !important; }
body.page-mode .mag-progress { z-index: 9999 !important; }
body.page-mode .mag-pageindex { right: 24px; z-index: 9000 !important; }

/* 페이지 모드 진입 시 본문 첫 단락 drop cap 비활성 (folio 겹침 원인 차단) */
.stf__item .mag-page p:first-of-type::first-letter { all: unset; }
.stf__item .p04-cols .lead::first-letter,
.stf__item .mag-body p:first-of-type::first-letter,
.stf__item .p02-letter-body p:first-child::first-letter { all: unset; }

/* GPU 합성 강화 — 페이지 사이 가운데 잔상 차단 */
.stf__parent {
  -webkit-transform: translate3d(0,0,0);
  transform: translate3d(0,0,0);
}
.stf__block, .stf__item, .stf__wrapper {
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  /* backface-visibility hidden 은 종이 뒷면(다음 페이지) 미리보기를 깨뜨리므로 사용 금지 */
}
/* 책 캔버스 밖 페이지 보이지 않게 */
.stf__parent { overflow: hidden !important; }

/* ═══════════════════════════════════════════════════════════════
   페이지 모드 — 화면 좌우 큰 ◀ ▶ 버튼 (작은 화면 친화)
   ═══════════════════════════════════════════════════════════════ */
.mag-flip-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(212, 164, 55, 0.95);
  color: #1B2645;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s var(--mag-ease), background 0.25s var(--mag-ease);
}
.mag-flip-arrow:hover {
  transform: translateY(-50%) scale(1.1);
  background: var(--mag-paper);
}
.mag-flip-arrow:active {
  transform: translateY(-50%) scale(0.95);
}
.mag-flip-arrow.next { right: 16px; }
.mag-flip-arrow.prev { left: 16px; }
.mag-flip-arrow .material-symbols-outlined {
  font-size: 32px;
  font-variation-settings: 'wght' 700;
}
body.page-mode .mag-flip-arrow { display: flex; }

@media (max-width: 720px) {
  .mag-flip-arrow { width: 48px; height: 48px; }
  .mag-flip-arrow .material-symbols-outlined { font-size: 26px; }
  .mag-flip-arrow.next { right: 8px; }
  .mag-flip-arrow.prev { left: 8px; }
}

/* ═══════════════════════════════════════════════════════════════════
   반응형 — 아이패드 가로 1024 / 세로 768 / 모바일
   ═══════════════════════════════════════════════════════════════════ */

/* 아이패드 가로 (1024px ~ 1366px) — 페이지 살짝 축소, 양면 모드는 단면 폴백 */
@media (max-width: 1366px) {
  .mag-shell { padding: 70px 16px 100px; }
}

/* 아이패드 세로 + 작은 태블릿 (768px ~ 1024px) */
@media (max-width: 1024px) {
  .mag-shell { padding: 60px 12px 80px; }
  :root {
    --page-width: 92vw;
    --page-margin-top: 22mm;
    --page-margin: 16mm;
    --page-margin-bottom: 18mm;
  }
  .mag-pageindex { display: none; }
  .mag-toolbar { top: 8px; }
}

/* 모바일 (768px 이하) */
@media (max-width: 768px) {
  .mag-shell { padding: 56px 8px 60px; }
  :root {
    --page-width: 96vw;
    --page-margin-top: 18mm;
    --page-margin: 12mm;
    --page-margin-bottom: 14mm;
  }
  .mag-toolbar { padding: 6px 8px; gap: 4px; }
  .mag-toolbar-btn { width: 32px; height: 32px; }
  .mag-toolbar-btn .material-symbols-outlined { font-size: 18px; }
  .mag-toolbar-info { padding: 0 10px; }
  .mag-toolbar-vol { font-size: 8px; }
  .mag-toolbar-page { font-size: 12px; }
}

/* 풀스크린 모드 — 크롬 주소창 사라진 상태 */
body.is-fullscreen .mag-shell {
  padding: 24px 12px 24px;
}

body.is-fullscreen.page-mode .mag-stage {
  max-height: calc(100vh - 60px);
}

/* iOS Safe Area (노치/홈 인디케이터 회피) */
@supports (padding: env(safe-area-inset-top)) {
  .mag-toolbar {
    top: max(16px, env(safe-area-inset-top));
  }
  .mag-progress {
    top: env(safe-area-inset-top, 0);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   유틸 — 호버 인터랙션
   ═══════════════════════════════════════════════════════════════════ */

.mag-link-hover {
  position: relative;
  display: inline-block;
  transition: color 0.3s var(--mag-ease);
}

.mag-link-hover::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.3s var(--mag-ease);
}

.mag-link-hover:hover::after { width: 100%; }

.mag-card-hover {
  transition: transform 0.4s var(--mag-ease), box-shadow 0.4s var(--mag-ease);
}

.mag-card-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 48px -12px rgba(27, 38, 69, 0.18);
}

/* ═══════════════════════════════════════════════════════════════════
   특수 효과 — 종이 텍스쳐
   ═══════════════════════════════════════════════════════════════════ */

.mag-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0, 0, 0, 0.015) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.015) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

.mag-page-inner > * { position: relative; z-index: 2; }

/* ═══════════════════════════════════════════════════════════════════
   호 별 색상 변형 (issue-01 = 5월호 = 연한 봄)
   ═══════════════════════════════════════════════════════════════════ */

body[data-issue="01"] {
  --mag-mustard: #D4A437;
  --mag-rust: #C68B5C;
  --mag-sage: #87A878;
}

/* 컬러 라벨 */
.mag-label-feature { color: var(--mag-rust); }
.mag-label-people { color: var(--mag-indigo); }
.mag-label-art { color: var(--mag-sage); }
.mag-label-tech { color: var(--mag-tech-cyan); }
.mag-label-weekend { color: var(--mag-mustard-deep); }
.mag-label-luna { color: var(--mag-rust); }
.mag-label-readers { color: var(--mag-indigo); }

/* ═══════════════════════════════════════════════════════════════════
   페이지 오버플로 방지 — 본문 잘림 보호 (모든 잡지 공통)
   ═══════════════════════════════════════════════════════════════════ */

/* P02 에디터 레터 — 한 페이지에 다 들어가게 타이포 압축 + 안전 스크롤 */
.p02 {
  padding: 44px 42px 32px !important;
  overflow: hidden;
}
.p02-letter {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 6px;
}
.p02-letter::-webkit-scrollbar { width: 4px; }
.p02-letter::-webkit-scrollbar-thumb { background: rgba(80,40,30,0.18); border-radius: 4px; }
.p02-letter p {
  font-size: 11.5px !important;
  line-height: 1.72 !important;
  margin: 0 0 9px !important;
}
.p02-letter p:last-child { margin-bottom: 4px !important; }
.p02-letter p:first-child::first-letter {
  font-size: 38px !important;
  margin: 2px 6px 0 0 !important;
}
.p02-eyebrow { margin-bottom: 14px !important; }
.p02-sign { padding-top: 12px !important; font-size: 10px !important; }

/* 본문 essay·deck 단원 — 비슷한 안전장치 */
.mag-page-inner .art-text-page,
.mag-page-inner .art-img-page,
.mag-page-inner .appendix-page,
.mag-page-inner .colophon {
  overflow: hidden;
}
.art-essay { overflow-y: auto; scrollbar-width: thin; }
.art-essay::-webkit-scrollbar { width: 4px; }
.art-essay::-webkit-scrollbar-thumb { background: rgba(80,40,30,0.18); border-radius: 4px; }
.ap-content { overflow-y: auto; scrollbar-width: thin; max-height: 100%; }
.ap-content::-webkit-scrollbar { width: 4px; }
.ap-content::-webkit-scrollbar-thumb { background: rgba(80,40,30,0.18); border-radius: 4px; }
