/* 화성장로교회 모바일 주보 — 화면 모양. 색·글꼴·간격 값은 tokens.css (구역예배 앱과 같은 파일) */
/*
  시안 C · 감사 노트 — 편집 규칙
  · 여백: 바깥 여백(위 44 · 왼쪽 30 · 아래 56)과 오른쪽 인덱스 탭 자리를 모든 쪽에 똑같이
  · 간격 단위: 4 · 8 · 12 · 16 · 24 · 32 · 48 만 사용
  · 위계: 쪽 머리(작은 글) → 표어 → 큰 제목 → 리드 → 본문 → 소제목
  · 정렬: 모든 글은 왼쪽 한 줄에 맞춤. 상자·그림자·기울임은 최소로
*/
:root {
  /* 주보 전용 값 (색·글꼴은 tokens.css — 구역예배 앱과 같은 파일) */
  --m-top: 44px;
  --m-left: 30px;
  --m-bottom: 56px;
  --rail: 46px;          /* 오른쪽 인덱스 탭 폭 */
  --gutter: 18px;        /* 본문과 탭 사이 */
  --body: 18px;
  --z: 1;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--paper); }
body {
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--body);
  line-height: 1.75;
  letter-spacing: -0.01em;       /* 한글 본문: 살짝 좁혀 단어 덩어리가 또렷하게 */
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.shell {
  position: relative;
  height: 100vh; height: 100dvh;
  max-width: 430px; margin: 0 auto;
  background: var(--paper);
  overflow: hidden;
}

/* ── 쪽 ── */
.book {
  height: 100%;
  display: flex;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.book::-webkit-scrollbar { display: none; }
.page {
  flex: 0 0 100%; width: 100%; height: 100%;
  overflow-y: auto; overflow-x: hidden;
  scroll-snap-align: start; scroll-snap-stop: always;
  overscroll-behavior-y: contain;
  /* 바깥 여백: 돋보기 배율과 상관없이 고정 */
  padding: max(var(--m-top), env(safe-area-inset-top)) calc(var(--rail) + var(--gutter)) var(--m-bottom) var(--m-left);
}
.content { zoom: var(--z); min-width: 0; }

/* ── 쪽 머리 ── */
.head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
        padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.head .kicker { font-size: 14px; line-height: 1.5; letter-spacing: .02em; color: var(--muted); }
.head .folio { font-size: 14px; line-height: 1.5; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.motto { margin-top: 32px; font-size: 13px; line-height: 1.5; letter-spacing: 0.02em; color: var(--muted); }
.motto b { display: block; margin-top: 2px; font-weight: 500; font-size: 15px; line-height: 1.5; letter-spacing: -0.01em; color: var(--ink); }
.title { margin-top: 12px; font-family: var(--font-hand); font-weight: 400; line-height: 1.2; letter-spacing: 0.01em; }
.title .ln, .fit .ln { display: block; white-space: nowrap; }
.page-title { font-size: 36px; }
.hl { background: linear-gradient(transparent 60%, var(--hl, var(--peach)) 60%); padding: 0 2px; }
.lead { margin-top: 16px; font-size: 16px; line-height: 1.65; color: var(--muted); }
.body-start { margin-top: 32px; }

.section { margin-top: 48px; }
.label {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-hand); font-size: 24px; line-height: 1.2; color: var(--accent);
}
.label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 누르면 창이 열리는 글 */
.link {
  display: inline; padding: 0; text-align: left;
  text-decoration: underline; text-decoration-color: var(--peach);
  text-decoration-thickness: 3px; text-underline-offset: 5px;
}
.link .open { display: inline-block; vertical-align: -2px; margin-left: 4px; width: 16px; height: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--peach-soft); font-size: 16px; line-height: 1.3;
}
.pill svg { width: 18px; height: 18px; flex: 0 0 auto; }

/* ── 1 표지: 머리(날짜) → 표어 → 제목 → 본문·시간 → 그림 → 비전 ── */
.cover { min-height: calc(100dvh - var(--m-top) - var(--m-bottom)); display: flex; flex-direction: column; }
.head .date { flex: 1; min-width: 0; font-family: var(--font-hand); font-size: 26px; line-height: 1.2; letter-spacing: 0.02em; color: var(--ink); }
.cover .motto { margin-top: 32px; }
.cover-title { font-size: 38px; }
.cover .sub { margin-top: 16px; font-size: 16px; line-height: 1.6; color: var(--muted); }
.cover .sub .link { color: var(--ink); }
.cover .sub .sep { margin: 0 8px; }
.polaroid {
  position: relative; align-self: center;
  margin-top: 40px; width: 236px; padding: 10px 10px 12px;
  background: var(--white); box-shadow: 0 4px 14px rgba(58,53,48,.08);
  transform: rotate(-2deg);
}
.tape { position: absolute; height: 20px; opacity: .85; }
.polaroid .tape.l { left: -12px; top: -8px; width: 70px; background: var(--peach); transform: rotate(-22deg); }
.polaroid .tape.r { right: -12px; top: -6px; width: 66px; background: var(--mint); transform: rotate(24deg); }
.polaroid .pic { height: 172px; background: var(--mint-soft); display: grid; place-items: center; }
.polaroid .cap { margin: 8px 2px 0; font-family: var(--font-hand); font-size: 20px; line-height: 1.2; letter-spacing: 0.02em; }
.vision { margin-top: auto; padding-top: 40px; }
.vision p { padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.85; color: var(--muted); }

/* ── 2 예배 ── */
.order { list-style: none; }
.order li { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); line-height: 1.6; }
.order li:first-child { padding-top: 0; }
.num { width: 22px; height: 22px; margin-top: 3px; border-radius: 50%; display: grid; place-items: center;
       font-size: 12px; font-weight: 600; background: var(--mint-soft); }
.num.song { background: var(--peach-soft); }
.o-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.o-t { font-weight: 600; }
.o-who { font-size: 16px; color: var(--muted); white-space: nowrap; }
.o-d { margin-top: 0; }
.hymn-no { font-family: var(--font-hand); font-size: 21px; color: var(--accent); white-space: nowrap; }
.next { margin-top: 24px; font-size: 16px; color: var(--muted); }

/* ── 3 말씀 ── */
.points { list-style: none; display: flex; flex-direction: column; gap: 32px; }
.points > li { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; }
.pn { font-family: var(--font-hand); font-size: 28px; line-height: 1.1; color: var(--accent); }
.points h3 { font-size: var(--body); font-weight: 600; line-height: 1.7; }
.points ul { list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.points ul li { font-size: 17px; line-height: 1.85; color: var(--ink); }
.q { margin-top: 16px; font-size: var(--body); line-height: 1.75; }
.q + .write { margin-top: 12px; }
.write { height: 32px; border-bottom: 1.5px dotted #D9CDBB; }

/* ── 4 교리 ── */
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--mint-soft); }
.seg[hidden] { display: none; }
.seg button { min-width: 56px; min-height: 44px; padding: 0 14px; border-radius: 999px; font-size: 16px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--ink); font-weight: 600; }
.qa + .qa { margin-top: 48px; }
.qa .qn { font-family: var(--font-hand); font-size: 24px; line-height: 1.2; color: var(--accent); }
.qa .qq { margin-top: 8px; font-weight: 600; line-height: 1.7; }
.qa .aa { margin-top: 16px; padding: 16px 18px; background: var(--butter-soft); border-radius: 4px; line-height: 1.85; }
.qa .aa b { display: block; font-weight: 600; font-size: 15px; color: var(--muted); margin-bottom: 4px; }
.qa .refs { margin-top: 12px; font-size: 15px; line-height: 1.7; color: var(--muted); }
[data-cat="ko"] .en, [data-cat="en"] .ko { display: none; }

/* ── 5 소식 ── */
.welcome { font-size: var(--body); line-height: 1.8; }
.news { list-style: none; }
.news li { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.news li:first-child { padding-top: 4px; }
.news li p { line-height: 1.8; min-width: 0; }
.news b { font-weight: 600; }
.pray { margin-top: 24px; font-family: var(--font-hand); font-size: 22px; line-height: 1.45; color: var(--accent); }
.rows { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; }
.rows > * { padding: 10px 0; border-bottom: 1px solid var(--line-soft); line-height: 1.55; }
.rows .r { text-align: right; font-weight: 600; white-space: nowrap; }
.rows .muted { color: var(--muted); font-weight: 400; }
.tags { margin-top: 4px; font-size: 16px; line-height: 2; color: var(--ink); }
.tags span + span::before { content: " · "; color: var(--muted); }
.map { margin-top: 16px; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--mint-soft); font-size: 16px; text-decoration: none; }
.map svg { width: 18px; height: 18px; }

/* ── 오른쪽 인덱스 탭 (모든 쪽 같은 자리) ── */
.rail {
  position: absolute; z-index: 10;
  top: max(var(--m-top), env(safe-area-inset-top));
  bottom: max(24px, env(safe-area-inset-bottom));
  right: 0; width: var(--rail);
  display: flex; flex-direction: column; align-items: flex-end;
  pointer-events: none;
}
.tabs { display: flex; flex-direction: column; align-items: flex-end; margin-top: 56px; pointer-events: auto; }
.tabs button {
  position: relative;
  width: 34px; height: 60px;
  border-radius: 10px 0 0 10px;
  box-shadow: -1px -1px 4px rgba(58,53,48,.07);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 9px;
  font-size: 12px; line-height: 1;
  color: var(--ink);
  transition: width .15s ease;
}
.tabs button span { writing-mode: vertical-rl; text-orientation: sideways; letter-spacing: 0.14em; }   /* 글자를 옆으로 눕힘 */
.tabs button + button { margin-top: -18px; }               /* 30%씩 겹치기 */
.tabs button:nth-child(1) { z-index: 1; background: #F9DDCF; }
.tabs button:nth-child(2) { z-index: 2; background: #DCEBE1; }
.tabs button:nth-child(3) { z-index: 3; background: #F7EBC8; }
.tabs button:nth-child(4) { z-index: 4; background: #D3E5DA; }
.tabs button:nth-child(5) { z-index: 5; background: #F6D3C2; }
.tabs button[aria-current="page"] { width: 42px; font-weight: 600; box-shadow: -2px 0 8px rgba(58,53,48,.14); }
.zoom {
  pointer-events: auto;
  width: 44px; height: 44px; margin-top: 12px; margin-right: 2px; border-radius: 50%;
  background: var(--white); border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(58,53,48,.12);
  display: grid; place-items: center; position: relative;
}
.zoom svg { width: 22px; height: 22px; }
.zoom .lv { position: absolute; right: -2px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
            background: var(--ink); color: var(--white); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.zoom[data-level="0"] .lv { display: none; }
.zoom[data-level="1"] { background: var(--mint); }
.zoom[data-level="2"] { background: var(--butter); }

/* ── 팝업 창 ── */
.backdrop {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(58,53,48,.42);
  display: flex; align-items: center; justify-content: center;
  padding: 28px 18px;
}
.backdrop[hidden] { display: none; }
.popup {
  position: relative; width: 100%; max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--paper); border-radius: 18px;
  box-shadow: 0 18px 50px rgba(58,53,48,.25);
}
.popup > .tape { left: 50%; top: -9px; width: 90px; margin-left: -45px; background: var(--peach); transform: rotate(-2deg); }
.pop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 28px 24px 16px; border-bottom: 1px solid var(--line); }
.pop-kicker { font-size: 14px; line-height: 1.5; color: var(--muted); }
.pop-title { margin-top: 4px; font-family: var(--font-hand); font-weight: 400; font-size: 30px; line-height: 1.15; text-wrap: balance; }
.close { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; background: var(--white); border: 1px solid var(--line); display: grid; place-items: center; }
.close svg { width: 20px; height: 20px; }
.popup .seg { margin: 16px 24px 0; align-self: flex-start; }
.pop-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px 24px; }
.pop-body > * { zoom: var(--z); }
.verse { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 8px; font-size: 19px; line-height: 1.85; }
.verse + .verse { margin-top: 16px; }
.verse .n { font-family: var(--font-hand); font-size: 22px; color: var(--accent); line-height: 1.6; }
.stanza + .stanza { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.stanza .sn { display: block; font-family: var(--font-hand); font-size: 22px; line-height: 1.2; color: var(--accent); margin-bottom: 8px; }
.stanza .l { display: block; font-size: 19px; line-height: 1.8; padding-left: 1.1em; text-indent: -1.1em; }
.pop-foot { padding: 14px 24px 18px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.6; color: var(--muted); }
.pop-foot .btn { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; padding: 0 18px; border-radius: 999px; background: var(--peach-soft); color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; }

@media (min-width: 760px) {
  html, body { background: #EFE8DC; }
  .shell { height: min(844px, 96vh); margin-top: 2vh; border-radius: 28px; box-shadow: 0 24px 60px rgba(58,53,48,.16); }
  .cover { min-height: calc(min(844px, 96vh) - var(--m-top) - var(--m-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .book { scroll-behavior: auto; } .tabs button { transition: none; } }

/* 저작권 확인 전 가사 대신 보이는 안내 */
.lyrics-hold { padding: 16px 18px; background: var(--butter-soft); border-radius: 4px; line-height: 1.8; }

/* ── 쪽 사이 삽화 (연필 선, 움직이지 않음). 그림은 js/illustrations.js 라이브러리 ──
   · 글 사이 쉼표 역할: 위아래 간격 32, 가운데 정렬, 폭 120 (돋보기 배율 따라 함께 커짐)
   · 화면 읽기 프로그램에는 숨김(aria-hidden) */
.doodle { margin: 32px auto 0; width: 120px; max-width: 60%; }
.doodle[data-kind="wide"] { width: 100%; max-width: none; margin-top: 40px; }   /* 가로 장면: 내용 폭 그대로 */
.doodle svg { display: block; width: 100%; height: auto; overflow: visible; }
.doodle + .section { margin-top: 24px; }
