@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&family=Noto+Serif+KR:wght@700;900&display=swap");

:root {
  --bg: #f6f3ec;
  --card: #ffffff;
  --ink: #1d2327;
  --muted: #646b72;
  --line: #e4ded1;
  --accent: #1f5367;
  --accent-soft: #e3eef2;
  --gold: #b9792a;
  --gold-soft: #f8ecd9;
  --ok: #2c7a4b;
  --ok-soft: #e2f1e8;
  --warn: #b2452d;
  --warn-soft: #fae7e1;
  --sunday: #c96a1c;
  --sunday-soft: #fbeadb;
  --youth: #2d67a8;
  --youth-soft: #e1ecf8;
  --adult: #2f7a57;
  --adult-soft: #e0f0e7;
  --shadow: 0 1px 2px rgba(30, 30, 20, 0.05), 0 4px 14px rgba(30, 30, 20, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181b;
    --card: #1f2327;
    --ink: #e9e6df;
    --muted: #9aa1a8;
    --line: #343a40;
    --accent: #79b6cc;
    --accent-soft: #1e3138;
    --gold: #e0ab62;
    --gold-soft: #3a2e1d;
    --ok: #7ccb9b;
    --ok-soft: #1c3226;
    --warn: #ef9b86;
    --warn-soft: #3b2420;
    --sunday: #f0a464;
    --sunday-soft: #3a2a1c;
    --youth: #8ab8ec;
    --youth-soft: #1d2a3a;
    --adult: #86cfa9;
    --adult-soft: #1b3127;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #15181b; --card: #1f2327; --ink: #e9e6df; --muted: #9aa1a8; --line: #343a40;
  --accent: #79b6cc; --accent-soft: #1e3138; --gold: #e0ab62; --gold-soft: #3a2e1d;
  --ok: #7ccb9b; --ok-soft: #1c3226; --warn: #ef9b86; --warn-soft: #3b2420;
  --sunday: #f0a464; --sunday-soft: #3a2a1c; --youth: #8ab8ec; --youth-soft: #1d2a3a;
  --adult: #86cfa9; --adult-soft: #1b3127; --shadow: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: break-word;
}
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* 상단 */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.brand { font-weight: 900; font-size: 17px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--gold); }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { background: var(--accent-soft); color: var(--accent); }

.hero { padding: 40px 0 28px; }
.hero .eyebrow { color: var(--gold); font-weight: 700; font-size: 15px; letter-spacing: 0.5px; }
.hero h1 { font-family: "Noto Serif KR", serif; font-weight: 900; font-size: clamp(28px, 5vw, 42px); line-height: 1.25; margin: 6px 0 12px; letter-spacing: -0.5px; }
.hero p { margin: 0; color: var(--muted); max-width: 640px; font-size: 16px; }

section.block { padding: 28px 0; }
.sec-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.sec-head h2 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -0.3px; }
.sec-head p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

/* 통계 타일 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 28px; font-weight: 900; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 14px; }

/* 필터 칩 */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* 강좌 카드 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ccard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.ccard h3 { margin: 0; font-size: 18px; line-height: 1.4; }
.ccard .sum { color: var(--muted); font-size: 14px; margin: 0; }
.ccard .meta { font-size: 14px; display: grid; gap: 2px; }
.ccard .meta div { display: flex; gap: 8px; }
.ccard .meta b { color: var(--muted); font-weight: 500; min-width: 34px; }
.ccard .foot { margin-top: auto; display: flex; gap: 8px; align-items: center; justify-content: space-between; padding-top: 6px; border-top: 1px dashed var(--line); }
.ccard .deadline { font-size: 14px; font-weight: 700; color: var(--gold); }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.tag.sunday { background: var(--sunday-soft); color: var(--sunday); }
.tag.youth { background: var(--youth-soft); color: var(--youth); }
.tag.adult { background: var(--adult-soft); color: var(--adult); }
.tag.line { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.tag.open { background: var(--ok-soft); color: var(--ok); }
.tag.soon { background: var(--gold-soft); color: var(--gold); }
.tag.closed, .tag.full, .tag.tbd, .tag.info { background: var(--line); color: var(--muted); }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: 28px; text-align: center; color: var(--muted); }

/* 과정 단계 색 */
:root { --l100: #2f7a57; --l200: #2d67a8; --l300: #7a4ea3; --lsvc: #a8661c; --lnext: #c45a1c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --l100: #86cfa9; --l200: #8ab8ec; --l300: #c4a2e8; --lsvc: #e8b26a; --lnext: #f0a464; } }
:root[data-theme="dark"] { --l100: #86cfa9; --l200: #8ab8ec; --l300: #c4a2e8; --lsvc: #e8b26a; --lnext: #f0a464; }
.lv-100 { --lc: var(--l100); } .lv-200 { --lc: var(--l200); } .lv-300 { --lc: var(--l300); } .lv-svc { --lc: var(--lsvc); } .lv-next { --lc: var(--lnext); }

/* 큰 그림 */
.life { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; font-size: 14px; }
.life a { text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 700; }
.life a span { color: var(--muted); font-weight: 400; margin-left: 4px; }
.life i { color: var(--muted); font-style: normal; }
.start { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--gold-soft); border-radius: 14px; padding: 14px 18px; margin-bottom: 14px; }
.start b { color: var(--gold); }
.ladder { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; position: relative; }
@media (max-width: 900px) { .ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .ladder { grid-template-columns: 1fr; } }
.tier { background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--lc); border-radius: 16px; padding: 16px 14px 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tier .rng { font-size: 13px; font-weight: 900; color: var(--lc); letter-spacing: 0.3px; }
.tier h3 { margin: 2px 0 4px; font-size: 19px; font-weight: 900; }
.tier .d { font-size: 13.5px; color: var(--muted); margin: 0 0 10px; min-height: 40px; }
.tier .step { position: absolute; }
.clist { list-style: none; margin: 0; padding: 0; }
.clist li + li { border-top: 1px dashed var(--line); }
.crow { display: flex; align-items: center; gap: 8px; width: 100%; background: none; color: var(--ink); text-align: left; padding: 9px 4px; border-radius: 8px; font-weight: 500; white-space: normal; }
.crow:hover { background: var(--bg); }
.crow .no { font-weight: 900; color: var(--lc); min-width: 34px; font-variant-numeric: tabular-nums; }
.crow .t { flex: 1; line-height: 1.35; }
.crow .t small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.crow .st { font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--muted); }
.crow .st.open { color: var(--ok); }
.crow .st.soon { color: var(--gold); }
.next-panel { margin-top: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.next-panel .tier { border-top-color: var(--lnext); }
.codebadge { font-weight: 900; font-size: 15px; color: var(--lc); }
.tag.lvl { background: transparent; border: 1.5px solid var(--lc); color: var(--lc); }

/* 버튼·폼 */
button, .btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer;
  background: var(--accent); color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
:root[data-theme="dark"] button:not(.ghost):not(.chip):not(.plain):not(.crow):not(.x):not(.danger), :root[data-theme="dark"] .btn:not(.ghost) { color: #0f1a1e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button:not(.ghost):not(.chip):not(.plain):not(.crow):not(.x):not(.danger), :root:not([data-theme="light"]) .btn:not(.ghost) { color: #0f1a1e; } }
button.ghost, .btn.ghost { background: var(--accent-soft); color: var(--accent); }
button.danger { background: var(--warn-soft); color: var(--warn); }
button.gold { background: var(--gold); }
button.plain { background: none; color: var(--muted); padding: 6px 8px; }
button.sm, .btn.sm { padding: 6px 12px; font-size: 14px; border-radius: 8px; }
button.block { width: 100%; padding: 13px; font-size: 17px; }
button:disabled { opacity: 0.5; cursor: default; }
/* 긴 글자가 들어가는 버튼(강의안 파일 이름 등)은 줄을 바꿔 화면 밖으로 나가지 않게 */
button.wrap, .btn.wrap { white-space: normal; text-align: left; max-width: 100%; overflow-wrap: anywhere; }
/* 잠긴 입력 칸(강사가 고칠 수 없는 칸)은 흐리게 */
input:disabled, select:disabled, textarea:disabled { opacity: 0.55; cursor: not-allowed; }
label { display: block; font-weight: 700; font-size: 14.5px; margin: 12px 0 5px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input[type="checkbox"] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 110px; resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; min-width: 0; }
.agree { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 14px; margin-top: 14px; }
.agree input { margin-top: 4px; }
.msg { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 15px; }
.msg:empty { display: none; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.err { background: var(--warn-soft); color: var(--warn); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 10px; font-size: 18px; }

/* 모달 */
.modal { position: fixed; inset: 0; background: rgba(10, 14, 16, 0.5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; }
.modal .box { background: var(--card); width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 22px 20px 26px; }
@media (min-width: 680px) { .modal { align-items: center; padding: 20px; } .modal .box { border-radius: 18px; } }
.modal .x { float: right; background: none; color: var(--muted); font-size: 22px; padding: 0 4px; line-height: 1; }
.modal h2 { margin: 6px 0 4px; font-size: 22px; line-height: 1.35; }
.dl { display: grid; grid-template-columns: 70px 1fr; gap: 4px 10px; font-size: 15px; margin: 12px 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.weeks { list-style: none; padding: 0; margin: 8px 0 0; border-top: 1px solid var(--line); }
.weeks li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; display: flex; gap: 10px; }
.weeks li .wn { color: var(--muted); min-width: 44px; font-size: 14px; }
.pre { white-space: pre-wrap; }

/* 표 */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { background: var(--bg); font-weight: 700; color: var(--muted); font-size: 13px; position: sticky; top: 0; }
.tbl td.c, .tbl th.c { text-align: center; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { font-variant-numeric: tabular-nums; text-align: right; }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }

footer.site { padding: 36px 0 48px; color: var(--muted); font-size: 14px; text-align: center; }
footer.site a { color: var(--muted); }

/* 버튼 묶음: 폭을 늘리지 않고 필요하면 줄바꿈 */
.btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 0 0 auto; }
.btns.end { justify-content: flex-end; }

/* 좁은 화면: 상단 메뉴가 잘리지 않게 */
@media (max-width: 440px) {
  .topbar .wrap { gap: 6px; }
  .brand { font-size: 15px; }
  .nav a { padding: 6px 6px; font-size: 14px; }
}

/* 강좌 소개 창 이동 */
.dnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dnav.top { margin-bottom: 10px; }
.dnav.top .x { float: none; }
.dnav.bottom { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.dnav.bottom button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; white-space: normal; text-align: left; padding: 10px 12px; }
.dnav.bottom button[data-dir=next] { align-items: flex-end; text-align: right; }
.dnav.bottom button b { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.dnav.bottom > span { flex: 1 1 0; }

/* 온라인 강좌 수강 규정·수료 요건 안내 (강좌 소개 창) */
.rulesnote { background: var(--gold-soft); color: var(--ink); border-radius: 12px; padding: 12px 14px; margin: 14px 0; font-size: 14.5px; }
.rulesnote ol { margin: 6px 0 0; padding-left: 20px; line-height: 1.65; }

/* 한눈에 보기 두 묶음 제목(1. 신앙강좌와 훈련 / 2. 생애주기별 강좌와 훈련) */
.map-sub { margin: 18px 0 10px; }
.sec-head + .map-sub { margin-top: 4px; }
.map-sub h3 { margin: 0; font-size: 18px; font-weight: 900; }
.map-sub p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
/* 생애주기별 주일학교: 연령대(미취학·어린이·청소년·교사) 묶음 */
.agegrp + .agegrp { margin-top: 6px; }
.agegrp .ag { font-size: 13px; font-weight: 900; color: var(--lc); padding: 6px 4px 2px; border-bottom: 1px solid var(--line); }
.agegrp .ag span { font-weight: 500; color: var(--muted); margin-left: 6px; font-size: 12px; }
.agegrp .ag .agage { display: inline-block; font-size: 11.5px; font-weight: 800; color: #fff; background: #e07b24; border-radius: 99px; padding: 1px 8px; margin-right: 6px; vertical-align: 1px; }
.agegrp .ag .agnm { font-weight: 900; }
/* 신청 창 회비 선택 */
.fees { display: grid; gap: 8px; margin: 6px 0 4px; }
.feeopt { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-weight: 500; cursor: pointer; margin: 0; }
.feeopt input { width: 20px; height: 20px; flex: none; margin: 0; }
.feeopt:has(input:checked) { border-color: var(--accent, #2f5d50); background: var(--bg); }
/* 강의실: 회비 입금 안내 · 사진 과제 */
.paybox { border: 2px solid var(--accent); }
.paybox .big { font-size: 19px; }
.photopick { display: flex; align-items: center; gap: 10px; border: 2px dashed var(--line); border-radius: 12px; padding: 16px; cursor: pointer; font-weight: 700; margin: 0; }
.photopick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photoprev { display: block; max-width: 100%; max-height: 360px; margin-top: 10px; border-radius: 10px; border: 1px solid var(--line); }
.hperson { margin-top: 14px; }
/* 모집 링크(?r=1) 전용 화면: 양육체계 안내는 숨기고 함께 신청 창만 페이지에 펼쳐 보여 줌 */
body.ronly .nav, body.ronly .hero, body.ronly section.block, body.ronly footer.site { display: none; }
body.ronly #recruitM { position: static; background: none; z-index: auto; padding: 24px 16px 0; }
body.ronly #recruitM .box { max-height: none; border-radius: 18px; box-shadow: var(--shadow); }
body.ronly #recruitM .x { display: none; }
