/* 스텔라이브 맛지도 — 단순한 디자인, 모바일 우선 */

/* ---------- 색상 ---------- */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --line: #e2e5ea;
  --text: #1c1e24;
  --muted: #636a79;
  --accent: #3355d1;
  --accent-ink: #ffffff;
  --ok: #0b6b47;
  --ok-bg: #e3f4ec;
  --warn: #7a5200;
  --warn-bg: #fdf0d2;
  --ring: rgba(0, 0, 0, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic",
    "맑은 고딕", "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #16181d;
    --bg-soft: #1e2128;
    --line: #2f343e;
    --text: #e9ebef;
    --muted: #9da4b3;
    --accent: #8fa8ff;
    --accent-ink: #10131c;
    --ok: #7fd9a8;
    --ok-bg: #1d3329;
    --warn: #f0c56a;
    --warn-bg: #3a2f17;
    --ring: rgba(255, 255, 255, 0.4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16181d;
  --bg-soft: #1e2128;
  --line: #2f343e;
  --text: #e9ebef;
  --muted: #9da4b3;
  --accent: #8fa8ff;
  --accent-ink: #10131c;
  --ok: #7fd9a8;
  --ok-bg: #1d3329;
  --warn: #f0c56a;
  --warn-bg: #3a2f17;
  --ring: rgba(255, 255, 255, 0.4);
}

/* ---------- 기본 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 120px;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
h4,
p,
ul,
dl,
dd,
blockquote {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.muted {
  color: var(--muted);
}

/* ---------- 머리말 ---------- */
.site-header {
  padding: 18px 0 12px;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.brand {
  flex: 1 1 0;
  min-width: 0;
}

.brand h1 {
  font-size: 1.4rem;
  line-height: 1.3;
}

.brand p {
  font-size: 0.85rem;
  color: var(--muted);
}

.text-btn {
  flex: none;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.85rem;
}

.search {
  order: 3;
  flex: 1 1 100%;
  display: block;
}

.search input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 1rem;
}

.search input::placeholder {
  color: var(--muted);
}

@media (min-width: 760px) {
  .search {
    order: 0;
    flex: 0 1 280px;
  }
}

/* ---------- 멤버 칩과 분류 탭 ---------- */
.filters {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  padding-top: 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.chips,
.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar,
.tabs::-webkit-scrollbar {
  display: none;
}

.chips {
  padding: 2px;
}

.chip-gen {
  flex: none;
  align-self: center;
  padding: 0 2px 0 6px;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.88rem;
  white-space: nowrap;
}

.dot {
  flex: none;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--m, var(--accent));
  box-shadow: 0 0 0 1px var(--ring);
}

.chip[aria-pressed="true"] {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
}

.tabs {
  margin-top: 6px;
  gap: 2px;
}

.tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.tab .n {
  font-size: 0.78rem;
}

.tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
  font-weight: 700;
}

/* ---------- 본문 ---------- */
main {
  padding-top: 20px;
  padding-bottom: 48px;
  min-height: 50vh;
}

main:focus {
  outline: none;
}

.status {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.section-head h2,
.place-list-head h2 {
  font-size: 1.15rem;
}

.count {
  font-size: 0.85rem;
  color: var(--muted);
}

.lead {
  margin: 2px 0 14px;
  font-size: 0.88rem;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 700px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.group {
  margin-bottom: 24px;
}

.group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.group-head h3 {
  font-size: 1rem;
}

.group-head .unit {
  font-size: 0.8rem;
  color: var(--muted);
}

.tag-grad {
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- 카드 ---------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.card-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.card-who .name {
  font-weight: 600;
  color: var(--text);
}

.card h3,
.card h4 {
  font-size: 1.02rem;
  line-height: 1.4;
}

.card .detail {
  font-size: 0.92rem;
}

/* 서브웨이 조합: 이름표와 값이 한 줄씩 */
.slots {
  border-top: 1px solid var(--line);
}

.slot {
  display: grid;
  grid-template-columns: 3.2em minmax(0, 1fr);
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.slot dt {
  color: var(--muted);
}

.slot dd {
  font-weight: 600;
}

.slot dd.none {
  font-weight: 400;
  color: var(--muted);
}

.note {
  font-size: 0.86rem;
  color: var(--muted);
}

.btn {
  align-self: flex-start;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.86rem;
}

.btn:hover,
.text-btn:hover {
  border-color: var(--muted);
}

/* ---------- 출처 ---------- */
.src {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

.src-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.badge {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
  white-space: nowrap;
}

.badge.is-verified {
  border-color: transparent;
  background: var(--ok-bg);
  color: var(--ok);
}

.badge.is-secondary {
  border-color: transparent;
  background: var(--warn-bg);
  color: var(--warn);
}

.src a.orig {
  margin-left: auto;
  white-space: nowrap;
}

.src blockquote {
  margin-top: 6px;
  font-size: 0.84rem;
}

.src blockquote small {
  display: block;
  font-size: 0.74rem;
}

/* ---------- 자료 없음 ---------- */
.empty {
  padding: 22px 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
}

.empty strong {
  display: block;
  color: var(--text);
}

.nodata {
  margin-top: 20px;
  font-size: 0.86rem;
  color: var(--muted);
}

.nodata h3 {
  display: inline;
  font-size: inherit;
  font-weight: 600;
}

.nodata ul {
  display: inline;
}

.nodata li {
  display: inline;
}

.nodata li + li::before {
  content: ", ";
}

.nodata .dot {
  display: none;
}

/* ---------- 맛집 지도 ---------- */
.place-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.place-map-col {
  order: -1;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.provider-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.provider-switch:empty {
  display: none;
}

.provider-switch button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  background: var(--bg);
  font-size: 0.84rem;
  color: var(--muted);
}

.provider-switch button + button {
  border-left: 1px solid var(--line);
}

.provider-switch button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}

.map-msg {
  font-size: 0.82rem;
  color: var(--muted);
}

.map-frame {
  position: relative;
  height: 56vh;
  min-height: 320px;
  max-height: 560px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-soft);
  isolation: isolate;
}

.map {
  position: absolute;
  inset: 0;
}

.map-empty {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 500;
  width: min(92%, 400px);
  transform: translateX(-50%);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
  pointer-events: none;
}

.map-empty strong {
  display: block;
  color: var(--text);
}

.place-list-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.place-list {
  display: grid;
  gap: 10px;
}

.place-item {
  cursor: pointer;
}

.place-item.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.place-item .addr {
  font-size: 0.84rem;
  color: var(--muted);
}

.map-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.84rem;
}

.map-links a {
  white-space: nowrap;
}

@media (min-width: 900px) {
  .place-view {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    align-items: start;
    gap: 16px;
  }
  .place-map-col {
    order: 0;
    position: sticky;
    top: 112px;
  }
  .map-frame {
    height: calc(100vh - 150px);
    min-height: 420px;
    max-height: none;
  }
  .place-list-col {
    min-width: 0;
  }
}

/* 핀과 묶음 */
.sfm-pin {
  background: none;
  border: 0;
}

.sfm-pin svg {
  display: block;
  width: 30px;
  height: 40px;
}

.sfm-cluster {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #2b2f3a;
  color: #ffffff;
  font: 700 14px/1 var(--font);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* 지도 말풍선: 세 지도 공통 (말풍선 바탕은 항상 흰색) */
.sfm-popup {
  width: min(250px, 68vw);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  color: #1c1e24;
}

.sfm-popup .p-name {
  font-size: 15px;
  font-weight: 700;
}

.sfm-popup .p-who {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 4px;
  color: #636a79;
}

.sfm-popup .p-who .dot {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.sfm-popup .p-said {
  margin-bottom: 4px;
}

.sfm-popup .p-src {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  color: #636a79;
}

.sfm-popup a {
  color: #3355d1;
}

.sfm-popup .badge {
  border-color: #e2e5ea;
  color: #1c1e24;
  font-size: 11px;
}

.sfm-popup .badge.is-verified {
  border-color: transparent;
  background: #e3f4ec;
  color: #0b6b47;
}

.sfm-popup .badge.is-secondary {
  border-color: transparent;
  background: #fdf0d2;
  color: #7a5200;
}

.sfm-popup .map-links {
  font-size: 12px;
}

.sfm-overlay {
  position: relative;
  padding: 12px 14px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.sfm-overlay .p-close {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: 0;
  background: none;
  font-size: 18px;
  line-height: 1;
  color: #636a79;
}

.leaflet-container {
  font-family: var(--font);
  background: var(--bg-soft);
}

.leaflet-popup-content {
  margin: 12px 14px;
}

/* ---------- 알림 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.toast.show {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 꼬리말 ---------- */
.site-footer {
  padding: 22px 0 36px;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--muted);
}

.footer-grid {
  display: grid;
  gap: 14px;
}

.site-footer h2 {
  font-size: 0.88rem;
  color: var(--text);
}

.site-footer p + p {
  margin-top: 2px;
}

@media (min-width: 760px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 28px;
  }
}
