/* 봉불사 · 봉찬회 공통 디자인 — 따뜻한 색, 큰 글자 */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&family=Noto+Serif+KR:wght@600;700&display=swap");

:root {
  --bg: #fbf5ea;        /* 따뜻한 크림 */
  --panel: #fffdf8;
  --sand: #f2e7d3;      /* 연한 베이지 면 */
  --text: #2a1d14;
  --muted: #65523f;     /* 크림 위에서도 읽기 편한 진한 갈색 회색 */
  --line: #e2d3ba;
  --brand: #8c4a2f;     /* 황토빛 갈색 */
  --brand-dark: #6e3720;
  --gold: #c8862a;
  --ok-bg: #e2f0de; --ok-fg: #2a5f25;
  --off-bg: #ece3d3; --off-fg: #5b4b3a;
  --red: #b3261e; --red-bg: #fde8e6;
  --serif: "Noto Serif KR", "Batang", "Nanum Myeongjo", serif;
  --sans: "Noto Sans KR", "Pretendard", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 19px; }
/* 한글은 낱말(띄어쓰기) 단위로 줄이 바뀌게: "봉불사 행사 일정을 / 확인하세요" 처럼. 아주 긴 낱말(주소 등)만 어쩔 수 없이 끊음 */
body { word-break: keep-all; overflow-wrap: break-word; }
h1, h2, h3, .desc, .hint, .state, .msg, p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  background: var(--bg);
  color: var(--text);
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.35; }
a { color: var(--brand-dark); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-block;
  font: inherit; font-weight: 700; font-size: 1rem; text-decoration: none; text-align: center;
  min-height: 48px; padding: 11px 22px;
  border: 0; border-radius: 12px; cursor: pointer;
  background: var(--brand); color: #fff;
}
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: var(--panel); color: var(--text); border: 1.5px solid var(--line); font-weight: 500; }
.btn.ghost:hover { background: var(--sand); }
.btn.small { min-height: 42px; padding: 8px 16px; font-size: .95rem; }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- 카드 · 배지 ---------- */
.item, .card, .box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}
.item { display: grid; gap: 12px; }
.item.past { opacity: .72; }
.item.urgent { border-color: var(--red); border-left: 7px solid var(--red); }
.top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title { font-size: 1.3rem; font-weight: 700; margin: 0; }
.badge { font-size: .85rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; }
.badge.open { background: var(--ok-bg); color: var(--ok-fg); }
.badge.closed, .badge.canceled, .badge.dday { background: var(--off-bg); color: var(--off-fg); }
.badge.dday.urgent { background: var(--red); color: #fff; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--muted); font-size: 1rem; }
.meta .urgent { color: var(--red); font-weight: 700; }
.desc { margin: 0; line-height: 1.75; white-space: pre-line; }
.list { display: grid; gap: 16px; }
.actions, .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* 구역 제목: 가는 선 위에 작은 글씨 (조용한 느낌) */
.sec { font-size: 1.1rem; font-weight: 500; font-family: var(--sans); color: var(--muted); margin: 36px 0 16px; padding-bottom: 10px; border-bottom: 1.5px solid var(--line); }
.sec:first-child { margin-top: 0; }

/* ---------- 안내 · 메시지 ---------- */
.state { padding: 44px 0; text-align: center; color: var(--muted); }
.state .btn { margin-top: 14px; }
.msg { font-size: .95rem; min-height: 1.4em; }
.msg.err { color: var(--red); font-weight: 500; }
.msg.ok { color: var(--ok-fg); font-weight: 500; }
.hint { color: var(--muted); font-size: .95rem; margin: 0 0 18px; }

/* ---------- 입력 ---------- */
form.box { display: grid; gap: 16px; }
form.box.edit { border-color: var(--gold); border-width: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
label.f { display: grid; gap: 6px; font-size: .95rem; color: var(--muted); font-weight: 500; }
label.f.wide { grid-column: 1 / -1; }
input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1.5px solid #cdb995; border-radius: 10px;
  padding: 10px 12px; min-height: 48px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }

/* ---------- 성지순례 전단 사진 칸 (flyers.js) ---------- */
.flyers { margin-bottom: 22px; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; display: grid; gap: 10px; }
.flyers-title { margin: 0; font-size: 1.4rem; color: var(--brand-dark); }
.flyers-hint { margin: 0; color: var(--muted); font-size: .95rem; }
.flyers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 14px; } /* 넓으면 2장씩 나란히, 좁으면 1장씩 */
.flyers-fig { margin: 0; display: grid; gap: 6px; }
.flyers-fig a { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; cursor: zoom-in; }
.flyers-fig img { display: block; width: 100%; height: auto; }
.flyers-fig figcaption { text-align: center; color: var(--muted); font-size: .9rem; }
@media (max-width: 760px) { .flyers { padding: 14px 12px; } .flyers-title { font-size: 1.2rem; } }

/* ---------- 들어오면 뜨는 안내 팝업 (popup.js) ---------- */
.popup-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(30,20,12,.72); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
/* 높이는 화면의 80%만 쓰고(휴대폰 주소창 때문에 잘리지 않게 dvh = 실제 보이는 높이 기준), 가로는 PC에서 760px 까지만 */
.popup-box { width: min(760px, 100%); max-height: 80vh; max-height: 80dvh; display: flex; flex-direction: column; background: var(--panel); border-radius: 18px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.popup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--sand); }
.popup-title { margin: 0; font-size: 1.35rem; color: var(--brand-dark); }
.popup-body { min-height: 0; overflow-y: auto; padding: 16px 18px; display: grid; gap: 16px; background: var(--bg); -webkit-overflow-scrolling: touch; }
.popup-hint { margin: 0; color: var(--muted); font-size: .95rem; text-align: center; }
.popup-fig { margin: 0; display: grid; gap: 6px; }
.popup-fig a { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; cursor: zoom-in; }
.popup-fig img { display: block; width: 100%; height: auto; }
.popup-fig figcaption { text-align: center; color: var(--muted); font-size: .9rem; }
.popup-foot { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel); }
@media (max-width: 760px) {
  .popup-overlay { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .popup-box { max-height: 78vh; max-height: 78dvh; border-radius: 14px; }
  .popup-head { padding: 10px 12px; }
  .popup-body { padding: 12px; gap: 12px; }
  .popup-foot { padding: 10px 12px; }
  .popup-title { font-size: 1.1rem; }
  .popup-hint { font-size: .85rem; }
  .popup-foot .btn { flex: 1 1 auto; min-height: 44px; }
}

/* ---------- 맨 위로 버튼 (totop.js) ---------- */
.to-top {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  width: 54px; height: 54px; border: 0; border-radius: 50%;
  background: var(--brand); color: #fff; font: 700 1.7rem/1 var(--sans);
  display: grid; place-items: center; padding: 0 0 3px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(42,29,20,.35);
}
.to-top:hover { background: var(--brand-dark); }
@media (max-width: 760px) { .to-top { right: 12px; bottom: 12px; } }

/* ---------- 검색창 ---------- */
.searchbar { display: grid; gap: 8px; margin-bottom: 22px; padding: 18px 20px; background: var(--sand); border-radius: 16px; }
.searchbar-label { font-weight: 700; color: var(--brand-dark); }
.searchbar-row { display: flex; gap: 10px; }
.searchbar-row input { flex: 1; min-width: 0; font-size: 1.05rem; }
.searchbar-info { color: var(--muted); font-size: .95rem; min-height: 1.4em; }

/* ---------- 페이지 나누기 ---------- */
.pager-wrap { margin-top: 28px; display: grid; gap: 10px; justify-items: center; }
.pager { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.pager .btn { min-width: 48px; min-height: 48px; padding: 8px 14px; font-size: 1rem; }
.pager .btn.current { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.pager .btn:disabled:not(.current) { opacity: .45; }
.pager-gap { color: var(--muted); padding: 0 2px; }
.pager-info { color: var(--muted); font-size: .9rem; }

/* ---------- 사진 넘기기(슬라이드) — 홈, 절 소개 ---------- */
.hero-media { display: grid; gap: 8px; }
.carousel { position: relative; overflow: hidden; border-radius: 16px; background: var(--car-bg, var(--sand)); aspect-ratio: var(--car-ratio, 16 / 9); touch-action: pan-y; }
.slides { display: flex; height: 100%; transition: transform .7s ease; }
.slides.no-anim { transition: none; }
.slide { flex: 0 0 100%; min-width: 0; height: 100%; margin: 0; }
.slide img { display: block; width: 100%; height: 100%; object-fit: cover; }
.car-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border: 0; border-radius: 50%;
  background: rgba(42,29,20,.55); color: #fff; font-size: 1.7rem; line-height: 1;
  display: grid; place-items: center; padding: 0 0 4px; cursor: pointer;
}
.car-btn:hover { background: rgba(42,29,20,.82); }
.car-btn.prev { left: 10px; }
.car-btn.next { right: 10px; }
.car-dots { display: flex; justify-content: center; align-items: center; gap: 0; }
.car-dot { width: 26px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.car-dot::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #cdb995; transition: width .3s ease, background .3s ease; }
.car-dot[aria-current="true"]::before { width: 22px; border-radius: 5px; background: var(--brand); }
@media (prefers-reduced-motion: reduce) { .slides { transition: none; } }

/* ---------- 사진 자리 (나중에 실제 사진으로 교체) ---------- */
.photo-ph {
  display: grid; place-items: center; text-align: center;
  width: 100%; aspect-ratio: 16 / 7; min-height: 160px;
  background: var(--sand);
  border: 2px dashed #c9b48f; border-radius: 16px;
  color: var(--muted); font-size: 1.2rem; font-weight: 500;
}
img.photo { display: block; width: 100%; max-height: 380px; object-fit: cover; border-radius: 16px; }

/* ---------- 위쪽 띠 (관리 페이지용) ---------- */
.bar {
  background: var(--sand); color: var(--text);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 32px;
}
.bar .name { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; color: var(--brand-dark); }
.bar .sub { font-size: .85rem; color: var(--muted); }
.bar .sp { flex: 1; }
.bar a, .bar button.link {
  color: var(--text); text-decoration: none; font: inherit; font-size: 1rem;
  background: none; border: 0; padding: 10px 14px; border-radius: 10px; cursor: pointer; min-height: 44px;
}
.bar a:hover, .bar button.link:hover { background: rgba(140,74,47,.12); }

header.page { padding: 26px 32px; border-bottom: 1px solid var(--line); background: var(--panel); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
header.page h1 { margin: 0; font-size: 1.7rem; }
.admin-tag { font-size: .85rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; background: #f3e1bd; color: #6f4a0c; }

@media (max-width: 720px) {
  html { font-size: 18px; }
  .item, .card, .box { padding: 20px; }
  .bar, header.page { padding-left: 16px; padding-right: 16px; }
}

/* 입금 안내 팝업 (pay.js) */
.pay-body { display: grid; gap: 12px; }
.pay-trip { font-weight: 700; margin: 0; }
.pay-amt { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--brand-dark); }
.pay-sub { margin: 4px 0 0; font-weight: 700; }
.pay-acc .btn { min-width: 6.2em; white-space: nowrap; padding: 10px 14px; }
.pay-num { white-space: nowrap; user-select: all; }
.pay-acc { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; background: var(--sand); border: 1.5px solid var(--line); border-radius: 12px; }
.pay-bank { font-weight: 700; }
.pay-num { font-size: 1.3rem; font-weight: 700; letter-spacing: .02em; word-break: keep-all; }
.pay-owner { color: var(--muted); font-size: .95rem; }
.pay-note { margin: 4px 0 0; padding: 12px 14px; background: #fff7e0; border-radius: 10px; font-weight: 500; }

/* 확인 팝업 (pay.js 의 askPopup) */
.ask-box { width: min(460px, 100%); }
.ask-msg { margin: 0; font-size: 1.1rem; line-height: 1.7; text-align: center; font-weight: 500; }
.ask-box .popup-foot .btn { flex: 1 1 0; min-height: 52px; }
