/* ============================================================
   share.css — 이만나 공유 사이트 스타일
   Mobile-first 반응형 + 다크모드 (data-theme)
   ============================================================ */

:root {
  --em-bg: #f5f7fa;
  --em-bg-soft: #eef2f7;
  --em-surface: #ffffff;
  --em-border: #e2e8f0;
  --em-text: #1a2a3a;
  --em-text-soft: #475569;
  --em-muted: #7a8a9a;
  --em-cardinal: #cc0000;
  --em-steel: #336699;
  --em-life: #2563a0;
  --em-truth: #9a3412;
  --em-en: #6b21a8;
  --em-shadow: 0 4px 16px rgba(15, 23, 42, .06);
  --em-shadow-lg: 0 20px 40px rgba(15, 23, 42, .08);
  --em-radius: 16px;
}

html[data-theme="dark"] {
  --em-bg: #0b1220;
  --em-bg-soft: #121a2b;
  --em-surface: #172033;
  --em-border: #2b3954;
  --em-text: #e8edf5;
  --em-text-soft: #b0bccf;
  --em-muted: #7a8aa0;
  --em-life: #4f95ee;
  --em-truth: #f97316;
  --em-en: #c084fc;
  --em-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  --em-shadow-lg: 0 20px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--em-bg);
  color: var(--em-text);
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a { color: var(--em-steel); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 헤더 ── */
.em-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--em-surface);
  border-bottom: 1px solid var(--em-border);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  backdrop-filter: saturate(180%) blur(12px);
}
.em-logo { display: flex; align-items: center; gap: 8px; color: var(--em-text); font-weight: 800; font-size: 18px; }
.em-logo:hover { text-decoration: none; }
.em-logo-icon { font-size: 22px; }
.em-nav { display: flex; gap: 4px; }
.em-nav-btn {
  background: transparent; border: 1px solid transparent;
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; color: var(--em-text);
  transition: background .15s, border-color .15s;
}
.em-nav-btn:hover { background: var(--em-bg-soft); border-color: var(--em-border); }
.em-theme-dark { display: none; }
html[data-theme="dark"] .em-theme-light { display: none; }
html[data-theme="dark"] .em-theme-dark { display: inline; }

/* ── 메인 ── */
.em-main { max-width: 720px; margin: 0 auto; padding: 20px 16px 80px; }

/* ── 날짜 네비 ── */
.em-date-nav {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--em-surface); border: 1px solid var(--em-border);
  border-radius: var(--em-radius); padding: 12px 16px; margin-bottom: 24px;
  box-shadow: var(--em-shadow);
}
.em-date-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--em-bg-soft); color: var(--em-text);
  font-size: 24px; font-weight: 600;
  text-decoration: none; transition: all .15s;
}
.em-date-btn:hover { background: var(--em-steel); color: #fff; text-decoration: none; }
.em-date-btn-disabled { opacity: .3; cursor: default; }
.em-date-btn-disabled:hover { background: var(--em-bg-soft); color: var(--em-text); }
.em-date-current { text-align: center; flex: 1; }
.em-date-big { font-size: 18px; font-weight: 700; color: var(--em-text); }
.em-date-sub { font-size: 13px; color: var(--em-muted); margin-top: 2px; }
.em-date-inline { font-size: 14px; color: var(--em-muted); font-weight: 500; margin: 4px 0 0 0; }

/* ── 카드 (모바일 우선) ── */
.em-card {
  background: var(--em-surface); border: 1px solid var(--em-border);
  border-radius: var(--em-radius); padding: 20px 18px;
  margin-bottom: 18px; box-shadow: var(--em-shadow);
  border-left: 4px solid var(--em-border);
}
.em-card-life { border-left-color: var(--em-life); }
.em-card-truth { border-left-color: var(--em-truth); }
.em-card-truth-en { border-left-color: var(--em-en); }
.em-card-solo { padding: 24px 18px; }
.em-card-head { margin-bottom: 14px; }
.em-card-badge {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 700;
}
.em-badge-life { background: rgba(37, 99, 160, .12); color: var(--em-life); }
.em-badge-truth { background: rgba(154, 52, 18, .12); color: var(--em-truth); }
.em-badge-en { background: rgba(107, 33, 168, .12); color: var(--em-en); }
.em-card-title { margin: 12px 0 0 0; font-size: 22px; line-height: 1.35; font-weight: 800; color: var(--em-text); letter-spacing: -0.01em; }
.em-card-title-solo { font-size: 26px; margin-top: 14px; line-height: 1.3; }
.em-card-verse {
  background: var(--em-bg-soft); border-radius: 12px; padding: 16px 18px;
  margin: 16px 0; font-size: 16px; color: var(--em-text-soft);
  border-left: 3px solid var(--em-border); line-height: 1.85;
}
.em-card-body { color: var(--em-text); font-size: 17px; line-height: 1.95; }
.em-card-body p { margin: 0 0 18px 0; }
.em-card-body p:last-child { margin-bottom: 0; }
.em-en { font-family: 'Lucida Sans Unicode', 'Lucida Grande', 'Georgia', serif; font-size: 16px; line-height: 1.7; }

/* ── 공유 바 ── */
.em-share-bar {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--em-border);
  display: flex; flex-wrap: wrap; gap: 6px;
}
.em-share-btn {
  flex: 1; min-width: 76px;
  background: var(--em-bg-soft); border: 1px solid var(--em-border);
  border-radius: 12px; padding: 10px 8px;
  cursor: pointer; color: var(--em-text);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  transition: all .15s;
}
.em-share-btn:hover {
  background: var(--em-surface); border-color: var(--em-steel);
  transform: translateY(-1px); box-shadow: var(--em-shadow);
}
.em-share-btn .em-icon { font-size: 22px; }
.em-share-btn .em-label { font-size: 11px; color: var(--em-text-soft); }

/* ── 주말 안내/빈 상태 ── */
.em-weekend-notice, .em-empty {
  background: var(--em-surface); border: 1px solid var(--em-border);
  border-radius: var(--em-radius); padding: 48px 24px;
  text-align: center; box-shadow: var(--em-shadow);
}
.em-weekend-icon, .em-empty-icon { font-size: 56px; margin-bottom: 12px; }
.em-weekend-notice h2 { margin: 0 0 8px 0; font-size: 22px; color: var(--em-text); }
.em-weekend-notice p, .em-empty p { margin: 0 0 20px 0; color: var(--em-muted); }
.em-btn-primary {
  display: inline-block; padding: 12px 24px; border-radius: 999px;
  background: var(--em-steel); color: #fff; font-weight: 700; text-decoration: none;
  transition: background .15s;
}
.em-btn-primary:hover { background: var(--em-cardinal); color: #fff; text-decoration: none; }

/* ── 섹션 네비 ── */
.em-breadcrumb {
  color: var(--em-muted); font-size: 13px; margin-bottom: 16px;
}
.em-breadcrumb a { color: var(--em-text-soft); }
.em-section-nav {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding: 16px;
  background: var(--em-surface); border: 1px solid var(--em-border);
  border-radius: var(--em-radius);
}
.em-btn-ghost {
  padding: 8px 16px; border-radius: 999px; background: var(--em-bg-soft);
  color: var(--em-text); font-size: 14px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--em-border);
}
.em-btn-ghost:hover { background: var(--em-surface); border-color: var(--em-steel); text-decoration: none; }

/* ── 검색 ── */
.em-search-hero { margin-bottom: 24px; }
.em-search-hero h1 { margin: 0 0 16px 0; font-size: 26px; color: var(--em-text); }
.em-search-form { display: flex; gap: 8px; }
.em-search-form input {
  flex: 1; padding: 12px 16px; border: 1px solid var(--em-border);
  border-radius: 12px; background: var(--em-surface); color: var(--em-text);
  font-size: 16px; outline: none;
}
.em-search-form input:focus { border-color: var(--em-steel); }
.em-search-form button {
  width: 48px; height: 48px; border: none; border-radius: 12px;
  background: var(--em-steel); color: #fff; font-size: 20px; cursor: pointer;
}
.em-search-form button:hover { background: var(--em-cardinal); }
.em-search-meta { color: var(--em-muted); font-size: 14px; margin-top: 12px; }
.em-search-meta strong { color: var(--em-text); }
.em-search-results { display: flex; flex-direction: column; gap: 12px; }
.em-result-card {
  background: var(--em-surface); border: 1px solid var(--em-border);
  border-radius: 12px; padding: 16px 18px; text-decoration: none;
  color: var(--em-text); transition: all .15s;
}
.em-result-card:hover { border-color: var(--em-steel); transform: translateY(-1px); text-decoration: none; box-shadow: var(--em-shadow); }
.em-result-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.em-result-date { font-size: 12px; color: var(--em-muted); }
.em-result-title { margin: 6px 0 4px 0; font-size: 16px; font-weight: 700; }
.em-result-excerpt { margin: 0; font-size: 13px; color: var(--em-text-soft); line-height: 1.5; }

/* ── 모달 ── */
.em-modal {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .6); padding: 20px;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.em-modal.open { display: flex; }
.em-modal-inner {
  position: relative; background: var(--em-surface); color: var(--em-text);
  border-radius: var(--em-radius); padding: 28px 24px;
  max-width: 420px; width: 100%; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--em-shadow-lg);
}
.em-modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--em-bg-soft); border: 1px solid var(--em-border);
  color: var(--em-text-soft); font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.em-modal-close:hover { background: var(--em-cardinal); color: #fff; border-color: var(--em-cardinal); }

/* ── 푸터 ── */
.em-footer {
  border-top: 1px solid var(--em-border); background: var(--em-surface);
  margin-top: 60px; padding: 32px 16px;
}
.em-footer-inner { max-width: 720px; margin: 0 auto; text-align: center; color: var(--em-muted); font-size: 13px; }
.em-footer nav { margin-top: 8px; }
.em-footer a { color: var(--em-text-soft); }

/* ── 토스트 ── */
.em-toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--em-text); color: var(--em-surface);
  padding: 10px 20px; border-radius: 999px; font-size: 14px; font-weight: 600;
  z-index: 200; box-shadow: var(--em-shadow-lg);
  animation: em-toast-in .3s ease;
}
@keyframes em-toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ── 반응형 ── */
@media (min-width: 640px) {
  body { font-size: 17px; }
  .em-main { padding: 28px 20px 80px; }
  .em-card { padding: 28px 32px; margin-bottom: 22px; }
  .em-card-solo { padding: 36px 32px; }
  .em-card-title { font-size: 24px; }
  .em-card-title-solo { font-size: 30px; }
  .em-card-verse { font-size: 16px; padding: 18px 22px; }
  .em-card-body { font-size: 17px; line-height: 1.9; }
  .em-en { font-size: 16px; }
  .em-share-btn .em-label { font-size: 12px; }
  .em-date-big { font-size: 19px; }
}

@media (min-width: 900px) {
  body { font-size: 17px; }
  .em-card-title-solo { font-size: 34px; }
  .em-card-body { font-size: 17px; line-height: 2; }
}

/* ── 모바일 세밀 조정 (가독성 우선) ── */
@media (max-width: 480px) {
  body { font-size: 18px; line-height: 1.8; }

  .em-main { padding: 16px 14px 70px; }
  .em-card { padding: 22px 18px; margin-bottom: 16px; border-radius: 14px; }
  .em-card-solo { padding: 24px 18px; }
  .em-card-head { margin-bottom: 14px; }
  .em-card-badge { padding: 5px 14px; font-size: 13px; }
  .em-card-title { font-size: 22px; margin-top: 12px; line-height: 1.4; }
  .em-card-title-solo { font-size: 24px; line-height: 1.35; }
  .em-card-verse {
    font-size: 17px; padding: 16px 18px; margin: 16px 0;
    line-height: 1.9;
  }
  .em-card-body { font-size: 18px; line-height: 1.95; }
  .em-card-body p { margin-bottom: 20px; }
  .em-en { font-size: 17px; line-height: 1.7; }

  .em-header { padding: 10px 14px; }
  .em-logo { font-size: 17px; }
  .em-logo-icon { font-size: 22px; }
  .em-nav-btn { width: 40px; height: 40px; font-size: 17px; }

  .em-date-nav { padding: 12px 14px; margin-bottom: 18px; }
  .em-date-big { font-size: 17px; }
  .em-date-sub { font-size: 13px; }
  .em-date-btn { width: 38px; height: 38px; font-size: 22px; }

  .em-share-bar { gap: 5px; padding-top: 16px; margin-top: 18px; }
  .em-share-btn { min-width: 0; padding: 10px 4px; border-radius: 10px; }
  .em-share-btn .em-icon { font-size: 22px; }
  .em-share-btn .em-label { font-size: 11px; }

  .em-footer { padding: 26px 14px; margin-top: 40px; font-size: 14px; }

  .em-search-hero h1 { font-size: 22px; }
  .em-search-form input { font-size: 17px; padding: 13px 16px; }
  .em-result-title { font-size: 17px; }
  .em-result-excerpt { font-size: 14px; }
}

/* 아주 좁은 화면 (iPhone SE 등 ≤360px) */
@media (max-width: 360px) {
  body { font-size: 17px; }
  .em-card { padding: 18px 14px; }
  .em-card-title { font-size: 20px; }
  .em-card-verse { font-size: 16px; padding: 14px 16px; }
  .em-card-body { font-size: 17px; line-height: 1.9; }
  .em-share-btn .em-icon { font-size: 20px; }
  .em-share-btn .em-label { font-size: 10px; }
}

/* ── 스크롤 버튼 (top/bottom) ── */
.em-scroll-nav {
  position: fixed; right: 16px; bottom: 20px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
  pointer-events: none;
}
.em-scroll-nav.visible {
  opacity: 1; visibility: visible; transform: translateY(0);
  pointer-events: auto;
}
.em-scroll-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--em-surface); border: 1px solid var(--em-border);
  color: var(--em-text); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; font-family: inherit;
  box-shadow: var(--em-shadow);
  transition: background .15s, color .15s, transform .15s, border-color .15s;
}
.em-scroll-btn:hover {
  background: var(--em-steel); color: #fff; border-color: var(--em-steel);
  transform: scale(1.05);
}
.em-scroll-btn:active { transform: scale(.95); }
@media (max-width: 480px) {
  .em-scroll-nav { right: 12px; bottom: 16px; }
  .em-scroll-btn { width: 40px; height: 40px; font-size: 16px; }
}

/* QR 모달 내부 */
#em-qr-box { text-align: center; padding: 12px; }
#em-qr-box img, #em-qr-box canvas { max-width: 100%; height: auto; background: #fff; padding: 12px; border-radius: 8px; }
#em-qr-box .em-qr-url { margin-top: 12px; color: var(--em-muted); font-size: 12px; word-break: break-all; }
