/* 복음의 길 — 장소와 인물로 찾아보기
   대상: 샘물청소년부 중심, 40대 이하. 휴대폰 우선(목록 → 누르면 상세), 넓은 화면(960px~)은 왼쪽 목록 + 오른쪽 상세.
   색·글꼴은 css/atlas.css·timeline.css의 토큰과 같은 값(밝은 화면 하나). 누르는 곳은 44px 이상, 본문 대비 4.5:1 이상. */
:root {
  color-scheme: light;
  --bg: #F8F6F2;
  --surface: #FFFFFF;
  --tint: #F0FAF6;
  --ink: #171719;
  --ink-2: #2E2F33;
  --ink-3: #5A5C63;
  --line: #D8D2C6;
  --line-soft: #ECE7DE;
  --line-strong: #8F8879;
  --primary: #1A6B5A;
  --primary-strong: #15594B;
  --brass-text: #8A6A1F;
  --gold: #C99A3C;
  --focus: #1A6B5A;
  --old: #7A5718;
  --now: #3F5D6E;
  --sea: #CFE1E4;
  --shadow: 0 1px 2px rgba(20,38,74,.05), 0 10px 30px -12px rgba(20,38,74,.14);
  --hover: rgba(23, 23, 25, .06);
  --press: rgba(23, 23, 25, .14);
  --font-ui: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --t-body: 1rem;
  --t-label: .9375rem;
  --t-caption: .8125rem;
  --tap: 48px;
  --radius: 16px;
  --radius-btn: 11px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-ui); font-size: var(--t-body); line-height: 1.6;
  -webkit-text-size-adjust: 100%; word-break: keep-all; overflow-wrap: anywhere; overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--primary-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.ic { width: 1.15em; height: 1.15em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 10; background: var(--surface); padding: 10px 16px; border-radius: var(--radius-btn); box-shadow: var(--shadow); font-weight: 700; }
.skip:focus { top: 12px; }
.muted { color: var(--ink-3); }

/* ── 머리 ── */
.masthead {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 14px 16px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.kicker { margin: 0; font-size: var(--t-label); color: var(--ink-3); font-weight: 600; }
.kicker a { color: var(--ink-3); }
.masthead h1 { margin: 0; font-size: 1.5rem; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 16px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-btn);
  background: var(--surface); color: var(--ink);
  font-size: var(--t-label); font-weight: 700; text-decoration: none; cursor: pointer;
}
.tool:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.tool:active { background-image: linear-gradient(var(--press), var(--press)); }
.tool-map { background-color: var(--primary); border-color: var(--primary); color: #fff; }

/* ── 틀: 휴대폰은 목록/상세 중 하나, 넓은 화면은 둘 다 ── */
.browse { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.pane { min-width: 0; }
.browse[data-view="detail"] .list-pane { display: none; }
.browse[data-view="list"] .detail-pane { display: none; }
.detail-pane:focus { outline: none; }
@media (min-width: 960px) {
  .browse { display: grid; grid-template-columns: minmax(360px, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
  .browse[data-view] .list-pane, .browse[data-view] .detail-pane { display: block; }
  .list-pane { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 16px; scrollbar-gutter: stable; }
  .detail-pane { padding-top: 16px; }
  .back-row { display: none; }
}

/* ── 탭 ── */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 14px 0 10px; padding: 4px; background: var(--line-soft); border-radius: 14px; }
.tabs [role="tab"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); border: 0; border-radius: 11px; background: transparent;
  font-size: 1.0625rem; font-weight: 800; color: var(--ink-2); cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--primary-strong); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tabs [role="tab"]:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.tab-n { font-size: var(--t-caption); font-weight: 700; color: var(--ink-3); }

/* ── 찾기 ── */
.find-label { display: block; margin: 0 0 4px; font-size: var(--t-label); font-weight: 700; color: var(--ink-2); }
.find-box {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 4px 0 14px;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 12px;
}
.find-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,107,90,.25); }
.find-box .ic { color: var(--ink-3); }
.find-box input { flex: 1 1 auto; min-width: 0; min-height: 48px; border: 0; background: transparent; font-size: 1.0625rem; outline: none; }
.find-box input::placeholder { color: #6E7077; }
.find-box input::-webkit-search-cancel-button { display: none; }
.find-clear { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: transparent; cursor: pointer; color: var(--ink-2); }
.find-clear:hover { background: var(--hover); }

/* ── 걸러 보기 ── */
.filters { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.seg { border: 0; margin: 0; padding: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.seg legend { float: left; width: 3.2em; margin: 0; padding: 0; font-size: var(--t-label); font-weight: 700; color: var(--ink-3); }
.seg label { position: relative; flex: 0 0 auto; }
.seg input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: var(--t-label); font-weight: 700; color: var(--ink-2);
}
.seg input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg label:hover input:not(:checked) + span { background-image: linear-gradient(var(--hover), var(--hover)); }
.sel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sel { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: var(--t-caption); font-weight: 700; color: var(--ink-3); }
.sel select {
  min-height: 44px; width: 100%; min-width: 0; padding: 0 30px 0 10px;
  border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--surface);
  font-size: var(--t-label); font-weight: 600; color: var(--ink);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E2F33' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px;
}

/* ── 목록 ── */
.count { margin: 10px 0 6px; font-size: var(--t-label); font-weight: 700; color: var(--ink-2); }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.results:focus { outline: none; }
.results .none { padding: 18px 14px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--ink-2); }
.loading { color: var(--ink-3); }
.item {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  min-height: 72px; padding: 12px 44px 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  color: var(--ink); text-decoration: none;
}
.item:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.item:active { background-image: linear-gradient(var(--press), var(--press)); }
.item[aria-current="true"] { border-color: var(--primary); box-shadow: inset 4px 0 0 var(--primary); }
.it-top { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.it-name { font-size: 1.125rem; font-weight: 800; line-height: 1.35; }
.it-now { font-size: var(--t-label); color: var(--now); }
.it-bottom { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: var(--t-caption); color: var(--ink-3); font-weight: 600; }
.it-count { color: var(--ink-2); font-weight: 700; }
.it-dots { display: inline-flex; align-items: center; gap: 3px; }
.dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.dot-more { font-size: .75rem; color: var(--ink-3); margin-left: 2px; }
.it-go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }

.badge { display: inline-block; padding: 0 8px; border-radius: 6px; font-size: .8125rem; font-weight: 700; line-height: 1.6; border: 1px solid currentColor; white-space: nowrap; }
.badge.sure { color: var(--primary-strong); }
.badge.likely { color: var(--brass-text); }
.badge.guess { color: #9C5800; }
.badge.kind { color: var(--ink-3); }

/* ── 상세 ── */
.back-row { margin: 12px 0 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px 0 6px; margin-left: -6px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.back:hover { background: var(--hover); }
.detail-empty { padding: 40px 24px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-2); }
.de-title { font-size: 1.125rem; font-weight: 800; margin: 0 0 6px; color: var(--ink); }
#detail-body { padding-bottom: 24px; }
.d-kicker { margin: 8px 0 0; font-size: var(--t-label); font-weight: 700; color: var(--ink-3); }
.d-name { margin: 0 0 8px; font-size: 1.75rem; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; }
.d-name:focus, .d-name:focus-visible { outline: none; }   /* 상세를 열 때 화면낭독기가 제목부터 읽도록 옮긴 포커스(누르는 곳이 아님) */
.d-sub { font-size: 1.0625rem; font-weight: 700; color: var(--ink-3); }
.d-aka { margin: -4px 0 8px; font-size: var(--t-label); color: var(--ink-3); }
.d-facts { margin: 0 0 10px; display: grid; gap: 2px; }
.d-facts div { display: flex; gap: 10px; }
.d-facts dt { flex: 0 0 5em; color: var(--ink-3); font-size: var(--t-label); font-weight: 700; padding-top: 1px; }
.d-facts dd { margin: 0; font-weight: 600; }
.d-facts .old { color: var(--old); }
.d-facts .now { color: var(--now); }
.cert { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 10px; }
.cert p { margin: 0; font-size: var(--t-label); color: var(--ink-2); flex: 1 1 14em; }
.d-note { margin: 0 0 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: 12px; font-size: var(--t-label); color: var(--ink-2); }
.d-sum { margin: 0 0 8px; color: var(--ink-2); }
.d-stories { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--t-label); }
.d-stories li { display: inline-flex; align-items: center; gap: 6px; }
.d-open { margin: 10px 0 0; }
.d-sec { margin: 22px 0 0; }
.d-sec h3 { margin: 0 0 8px; font-size: 1.1875rem; font-weight: 800; }
.d-sec h3 .n { font-size: var(--t-label); font-weight: 700; color: var(--ink-3); }

/* 이야기 꼬리표(이야기 색 + 묶음·번호). 흰 글씨는 이야기 색 21개 모두에서 4.5:1 이상(지도와 같은 색) */
.chip { display: inline-block; padding: 0 8px; border-radius: 6px; background: var(--story); color: #fff; font-size: .8125rem; font-weight: 800; line-height: 1.7; white-space: nowrap; }

.scenes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sc a {
  display: flex; flex-direction: column; gap: 2px; min-height: 64px; padding: 10px 14px 10px 16px;
  background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--story); border-radius: 12px;
  color: var(--ink); text-decoration: none;
}
.sc a:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.sc a:active { background-image: linear-gradient(var(--press), var(--press)); }
.sc-story { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: var(--t-caption); color: var(--ink-3); font-weight: 600; }
.sc-title { font-size: 1.0625rem; font-weight: 800; line-height: 1.4; }
.sc-meta { font-size: var(--t-label); color: var(--ink-3); }
.sc-place { color: var(--now); font-weight: 700; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pchip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px;
  color: var(--ink); font-weight: 700; text-decoration: none; font-size: var(--t-label);
}
.pchip:hover { background-image: linear-gradient(var(--hover), var(--hover)); border-color: var(--line-strong); }
.pc-sub { font-size: var(--t-caption); font-weight: 600; color: var(--ink-3); }
.pc-no { min-width: 24px; height: 24px; padding: 0 5px; border-radius: 999px; background: var(--ink-2); color: #fff; font-size: .75rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }

/* ── 작은 지도 ── */
.map-slot { margin: 12px 0 0; }
.mini { position: relative; }
.mini-map { height: clamp(220px, 46vw, 360px); border-radius: 14px; overflow: hidden; background: var(--sea); border: 1px solid var(--line); }
.mini-cap { margin: 6px 0 0; font-size: var(--t-caption); color: var(--ink-3); }
.mini .maplibregl-ctrl-group button { width: 44px; height: 44px; }
.mini .maplibregl-ctrl-group button .maplibregl-ctrl-icon { background-size: 30px; }
.map-key { margin: 6px 0 0; font-size: var(--t-caption); color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.map-key .mk-i { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; margin-right: 8px; }
.map-key .k { display: inline-block; width: 24px; height: 0; border-top: 3px solid var(--ink-2); }
.map-key .k.dash { border-top-style: dashed; }
.mk { display: flex; align-items: center; gap: 4px; pointer-events: none; }
.mk-dot { width: 18px; height: 18px; border-radius: 50%; background: #C0392B; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.mk-n { min-width: 22px; height: 22px; padding: 0 4px; border-radius: 999px; background: var(--ink-2); color: #fff; border: 2px solid #fff; font-size: .6875rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.mk-l {
  position: absolute; left: calc(100% + 2px); white-space: nowrap; font-size: .8125rem; font-weight: 800; color: var(--ink);
  paint-order: stroke fill; -webkit-text-stroke: 3px #F4EFE6; text-shadow: 0 0 2px #F4EFE6, 0 0 5px #F4EFE6;
}
.mk.small .mk-dot { width: 11px; height: 11px; border-width: 2px; background: var(--ink-2); }
.mk.here .mk-l { font-size: .9375rem; }
.mk { position: relative; }
.mk.left .mk-l { left: auto; right: calc(100% + 2px); }

/* ── 바닥 ── */
.foot { max-width: 1240px; margin: 24px auto 0; padding: 16px 16px 32px; border-top: 1px solid var(--line); font-size: var(--t-caption); color: var(--ink-3); }
.foot p { margin: 0 0 4px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
