:root {
  --bg: #f6f3ec; --paper: #ffffff; --ink: #1d1d1b; --muted: #6d6c66; --line: #e6e2d9;
  --accent: #8a3b12; --accent-ink: #ffffff; --soft: #efe9dd; --shadow: 0 1px 2px rgba(0,0,0,.04);
  --serif: 'Noto Serif KR', 'Apple SD Gothic Neo', serif;
  --sans: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141412; --paper: #1d1c1a; --ink: #ece8df; --muted: #a29e94; --line: #34322e;
    --accent: #e08a55; --accent-ink: #141412; --soft: #262420;
  }
}
:root[data-theme="dark"] {
  --bg: #141412; --paper: #1d1c1a; --ink: #ece8df; --muted: #a29e94; --line: #34322e;
  --accent: #e08a55; --accent-ink: #141412; --soft: #262420;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); word-break: keep-all; overflow-wrap: anywhere; }
a { color: var(--accent); }
img { max-width: 100%; }
button { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 1100; }
.bar { display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: #1d1d1b; color: #fff; }
.brand { flex: 1; font-weight: 800; letter-spacing: 1px; font-size: 17px; }
.bar-btn { background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; padding: 2px 6px; cursor: pointer; }
.bar-btn.text { font-size: 14px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 6px 12px; }

.chips { box-sizing: border-box; width: 100%; display: flex; gap: 6px;
  overflow-x: auto; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 1 1 0; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 6px; font-size: 13px; letter-spacing: -0.3px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

main { max-width: 800px; margin: 0 auto; padding: 0 16px calc(env(safe-area-inset-bottom) + 48px); }
.loading, .empty { padding: 80px 0; text-align: center; color: var(--muted); }

.cover { padding: 30px 0 22px; border-bottom: 1px solid var(--line); }
.cover .kicker { font-size: 12px; letter-spacing: 2px; color: var(--accent); font-weight: 700; }
.cover h1 { font-family: var(--serif); font-size: 30px; line-height: 1.3; margin: 10px 0 8px; }
.cover .sub { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0; }
.lead { font-size: 16px; line-height: 1.85; margin: 18px 0 0; }

.sec { scroll-margin-top: 110px; }
.sec-head { margin: 44px 0 4px; padding: 0 0 10px; border-bottom: 3px solid var(--ink); font-size: 22px; font-weight: 800; letter-spacing: -.3px; }

.ex { scroll-margin-top: 110px; margin: 40px 0 0; padding: 16px 0 0; border-top: 2px solid var(--ink); }
.sec-head + .ex { border-top: 0; margin-top: 18px; padding-top: 0; }
.ex .no { font-size: 24px; font-weight: 800; letter-spacing: 1px; color: var(--accent); }
.ex .no small { font-size: 12px; letter-spacing: 1.5px; color: var(--muted); font-weight: 700; margin-left: 6px; }
.ex h2 { font-size: 22px; line-height: 1.35; margin: 6px 0 4px; font-weight: 800; }
.ex .meta { font-size: 14px; color: var(--muted); }
a.ttl { color: inherit; text-decoration: none; }
.home { display: inline-block; margin: 10px 0 0; padding: 6px 12px; border: 1px solid var(--ink); border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink); text-decoration: none; }
.closing .home { margin: 2px 0 0; padding: 4px 10px; font-size: 12px; }
.poster { margin: 16px 0 4px; border-radius: 10px; overflow: hidden; background: var(--soft); }
.poster img { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; }
.caption { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 4px 0 14px; }
.desc p { font-size: 16px; line-height: 1.85; margin: 0 0 12px; }

.stay { margin: 22px 0 0; padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.stay h3 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.stay .intro { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 0 0 12px; }
.mapbox { position: relative; isolation: isolate; z-index: 0;  /* 지도 조각(z-index 400~1000)을 이 상자 안에 가둬 상단 틀 아래로 지나가게 */ border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); aspect-ratio: 760 / 560; }
.mapbox img, .mapbox .live { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.maptoggle { position: absolute; right: 8px; bottom: 8px; z-index: 500; border: 0; border-radius: 999px; padding: 7px 12px;
  background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.cafes { display: grid; gap: 10px; margin: 14px 0 0; }
.cafe { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cafe:last-child { border-bottom: 0; }
.cafe img, .cafe .ph { flex: none; width: 84px; height: 84px; border-radius: 8px; object-fit: cover; background: var(--soft); }
.cafe .name { font-weight: 700; font-size: 15px; line-height: 1.4; }
.num { display: inline-block; width: 22px; height: 22px; line-height: 22px; border-radius: 11px; background: var(--accent); color: var(--accent-ink);
  font-size: 12px; text-align: center; margin-right: 6px; font-weight: 700; }
.cafe .dist { font-size: 12.5px; color: var(--muted); margin: 3px 0 0; }
.cafe .cdesc { font-size: 14px; line-height: 1.6; margin: 4px 0 0; }
.links { font-size: 12.5px; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.links a { color: var(--accent); }
.note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }

.info { margin: 16px 0 0; padding: 12px 14px; background: var(--soft); border-radius: 10px; font-size: 13.5px; line-height: 1.8; color: var(--muted); }
.info div { display: flex; gap: 8px; }
.info .ic { flex: none; width: 20px; text-align: center; }

.closing { display: flex; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); margin: 16px 0 0; scroll-margin-top: 110px; }
.closing .pic { flex: none; width: 112px; }
.closing .pic img, .closing .pic .ph { width: 112px; border-radius: 6px; display: block; background: var(--soft); }
.closing .pic img { height: auto; aspect-ratio: 3 / 4; object-fit: cover; }  /* 사진 비율과 상관없이 3:4로 잘라 보여 준다(가로·세로 크기 속성이 높이로 먹지 않게) */
.closing .pic .ph { height: 150px; }
.closing .no { font-size: 20px; font-weight: 800; color: var(--accent); letter-spacing: 1px; }
.closing h2 { font-size: 17px; margin: 4px 0 2px; line-height: 1.4; }
.closing .meta { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.closing .end { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--accent-ink); background: var(--accent); border-radius: 4px; padding: 2px 6px; margin: 0 0 6px; }
.closing p { font-size: 14.5px; line-height: 1.7; margin: 0 0 6px; }

.foot { margin: 48px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.foot .tags { color: var(--accent); margin: 0 0 12px; }
.foot details summary { cursor: pointer; }
.foot ul { padding-left: 18px; }

.issues { padding: 20px 0; }
.issues h1 { font-size: 22px; margin: 6px 0 16px; }
.issue { display: flex; gap: 14px; align-items: center; padding: 14px; margin: 0 0 10px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; text-align: left; width: 100%; }
.issue img, .issue .ph { flex: none; width: 72px; height: 90px; object-fit: cover; border-radius: 6px; background: var(--soft); }
.issue .t { font-weight: 800; font-size: 16px; line-height: 1.4; }
.issue .s { font-size: 13px; color: var(--muted); margin: 3px 0 0; line-height: 1.5; }
.issue .badge { font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: 1px; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 18px); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-size: 13px; z-index: 50; max-width: calc(100% - 32px); }
.leaflet-container { font-family: var(--sans); }
.pin { width: 24px; height: 24px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.pin.g { background: #1d1d1b; width: 28px; height: 28px; border-radius: 6px; font-size: 13px; }
@media (min-width: 640px) {
  .cover h1 { font-size: 36px; }
  .cafes { grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .cafe:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .closing .pic, .closing .pic img, .closing .pic .ph { width: 150px; }
  .closing .pic .ph { height: 200px; }
}
