/* 이천·여주 일자리 지도
   카테고리 색이 곧 이 화면의 체계다. 칩·마커·목록의 색띠·묶음 마커의 고리가
   모두 같은 색을 쓴다. 나머지는 조용하게 둔다. */

:root {
  --ink: #1d2b36;
  --ink-2: #55636f;
  --ink-3: #8794a0;
  --paper: #f2f4f1;
  --surface: #ffffff;
  --line: #dde2de;
  --bar: #1d2b36;
  --bar-ink: #f2f4f1;
  --bar-line: #3a4a57;
  --signal: #ffd23f;
  --signal-ink: #362b00;
  --out: #c8372d;
  --focus: #0090ff;

  --display: "Do Hyeon", "IBM Plex Sans KR", sans-serif;
  --body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --sheet-peek: 172px;
  --tiles: saturate(0.35) contrast(0.96) brightness(1.03);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e6ebee;
    --ink-2: #a7b2bb;
    --ink-3: #75828d;
    --paper: #10171c;
    --surface: #182129;
    --line: #2a3640;
    --bar: #0b1116;
    --bar-ink: #e6ebee;
    --bar-line: #2a3640;
    --out: #ff6b5e;
    --tiles: invert(1) hue-rotate(180deg) saturate(0.3) brightness(0.82) contrast(0.92);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ink: #e6ebee;
  --ink-2: #a7b2bb;
  --ink-3: #75828d;
  --paper: #10171c;
  --surface: #182129;
  --line: #2a3640;
  --bar: #0b1116;
  --bar-ink: #e6ebee;
  --bar-line: #2a3640;
  --out: #ff6b5e;
  --tiles: invert(1) hue-rotate(180deg) saturate(0.3) brightness(0.82) contrast(0.92);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  display: grid;
  /* minmax(0, …): 가로로 긴 카테고리 띠가 열 너비를 화면 밖으로 밀어내지 않게 */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

/* ── 머리 띠 ─────────────────────────────────────────── */

.bar {
  min-width: 0;
  background: var(--bar);
  color: var(--bar-ink);
  padding: calc(10px + env(safe-area-inset-top)) 16px 0;
  z-index: 20;
}

.bar-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  margin: 0;
  font: 24px/1.1 var(--display);
  color: var(--signal);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.tally {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: color-mix(in srgb, var(--bar-ink) 72%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tally strong {
  font: 18px/1 var(--display);
  color: var(--bar-ink);
  font-weight: 400;
  margin-right: 2px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--bar-line);
  border-radius: 18px;
  background: transparent;
  color: var(--bar-ink);
  font-size: 14px;
  position: relative;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--signal);
  color: var(--signal-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.search { margin: 10px 0 0; }

.search input {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bar-ink) 12%, transparent);
  color: var(--bar-ink);
  font-size: 15px;
}

.search input::placeholder { color: color-mix(in srgb, var(--bar-ink) 55%, transparent); }

/* 카테고리 띠: 가로로 밀어서 본다 */
.strip {
  display: flex;
  gap: 6px;
  margin: 0 -16px;
  padding: 10px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.strip::-webkit-scrollbar { display: none; }

.chip {
  --c: var(--ink-3);
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--chip-line, var(--line));
  border-radius: 16px;
  background: transparent;
  font-size: 14px;
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
}

.chip .count {
  font-size: 12px;
  color: var(--chip-count, var(--ink-3));
  font-variant-numeric: tabular-nums;
}

.chip[data-state="in"] {
  background: var(--c);
  border-color: var(--c);
  color: #fff;
}

.chip[data-state="in"]::before { background: #fff; }
.chip[data-state="in"] .count { color: rgba(255, 255, 255, 0.8); }

.chip[data-state="out"] {
  border-style: dashed;
  border-color: var(--out);
  color: var(--out);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.chip[data-state="out"]::before { background: var(--out); opacity: 0.5; }

.strip .chip {
  --chip-line: var(--bar-line);
  --chip-count: color-mix(in srgb, var(--bar-ink) 55%, transparent);
  color: var(--bar-ink);
}

.strip .chip[data-state="out"] { color: #ff8a80; border-color: #ff8a80; }

/* ── 지도와 목록 ─────────────────────────────────────── */

.stage {
  position: relative;
  min-height: 0;
}

.map {
  position: absolute;
  inset: 0;
  background: var(--paper);
  /* Leaflet 내부 층(z-index 400~1000)이 목록 서랍과 필터 서랍을 덮지 않게 가둔다 */
  isolation: isolate;
}

.map .leaflet-tile-pane { filter: var(--tiles); }

.leaflet-container { font: inherit; }

.leaflet-control-attribution {
  font-size: 10px;
  background: color-mix(in srgb, var(--surface) 80%, transparent) !important;
  color: var(--ink-2);
}

.leaflet-bar a {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

/* 한 장소 마커 */
.place {
  --c: var(--ink-3);
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--fill, var(--c));
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  color: #fff;
  font: 12px/1 var(--display);
}

.place.is-picked {
  box-shadow: 0 0 0 3px var(--signal), 0 0 0 4px rgba(0, 0, 0, 0.35);
}

/* 묶음 마커: 고리가 그 안의 카테고리 비율을 보여준다 */
.cluster {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--ring);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.cluster span {
  display: grid;
  place-items: center;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font: 16px/1 var(--display);
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--sheet-peek);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -1px 0 var(--line), 0 -8px 24px rgba(0, 0, 0, 0.12);
  z-index: 10;
  transition: height 0.24s ease;
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet[data-state="half"] { height: 55%; }
.sheet[data-state="full"] { height: calc(100% - 8px); }
.sheet.is-dragging { transition: none; }

.sheet-handle {
  flex: none;
  display: grid;
  place-items: center;
  height: 28px;
  border: 0;
  background: transparent;
  touch-action: none;
}

.grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}

.sheet-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--line);
}

.sheet-title {
  margin: 0;
  font: 19px/1.2 var(--display);
  font-weight: 400;
}

.sheet-title .n {
  color: var(--ink-2);
  margin-left: 4px;
}

.sheet-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-tools select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
}

.text-button {
  border: 0;
  background: transparent;
  padding: 6px 4px;
  color: var(--focus);
  font-size: 14px;
}

.unmapped-note {
  flex: none;
  margin: 0;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}

.unmapped-note button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--focus);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.jobs {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 접힌 서랍에는 첫 공고의 머리만 보이게 안내 줄을 접는다 */
.sheet[data-state="peek"] .unmapped-note { display: none; }

.job {
  --c: var(--ink-3);
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--c);
}

.job-main {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 12px 16px 12px 12px;
  border: 0;
  background: transparent;
  text-align: left;
}

.job-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

.job-company {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-new {
  flex: none;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--signal);
  color: var(--signal-ink);
  font-size: 11px;
  font-weight: 700;
}

.job-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.job-pay {
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.job-pay:empty { display: none; }

.job-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.job-tags:empty { display: none; }

.tag {
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  line-height: 20px;
  color: var(--ink-2);
}

.job-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-2);
}

.job-place {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-deadline {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.job-deadline.is-soon { color: var(--out); font-weight: 500; }

.job.is-open { background: color-mix(in srgb, var(--c) 6%, var(--surface)); }

/* 지도에서 누른 장소의 공고 — 마커의 노란 테두리와 같은 색으로 잇는다 */
.job.is-here { background: color-mix(in srgb, var(--signal) 14%, var(--surface)); }

.list-divider {
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}

.job-more {
  padding: 0 16px 14px 12px;
}

.job-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0 0 12px;
  font-size: 14px;
}

.job-facts dt { color: var(--ink-2); }
.job-facts dd { margin: 0; word-break: keep-all; overflow-wrap: anywhere; }

.job-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.job-links a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.job-links a + a {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.job-links .on-map {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
}

.more {
  display: block;
  width: calc(100% - 32px);
  margin: 12px 16px 20px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.empty {
  margin: 0;
  padding: 24px 16px;
  color: var(--ink-2);
  font-size: 14px;
}

/* ── 필터 서랍 ─────────────────────────────────────── */

.filters {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  background: var(--surface);
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

.filters-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.filters-head h2 {
  margin: 0;
  font: 24px/1.2 var(--display);
  font-weight: 400;
}

.group {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.group h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}

.hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips .chip { color: var(--ink); }
.chips .chip[data-state="in"] { color: #fff; }
.chips .chip[data-state="out"] { color: var(--out); }

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: var(--paper);
  gap: 2px;
}

.segmented button {
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 14px;
  color: var(--ink-2);
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.words {
  display: flex;
  gap: 8px;
}

.words input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.words button {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
}

.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.word-list:empty { display: none; }

.word-list button {
  height: 30px;
  padding: 0 10px;
  border: 1px dashed var(--out);
  border-radius: 15px;
  background: transparent;
  color: var(--out);
  font-size: 13px;
}

.sources {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sources li + li { border-top: 1px solid var(--line); }

.sources label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: center;
  padding: 10px 0;
}

.sources input {
  grid-row: span 2;
  width: 20px;
  height: 20px;
  accent-color: var(--ink);
}

.sources .name { font-size: 15px; }

.sources .status {
  font-size: 12px;
  color: var(--ink-2);
}

.sources .status.is-bad { color: var(--out); }

.filters-foot {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.filters-foot .text-button { color: var(--out); }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.35);
}

/* ── 넓은 화면: 왼쪽 목록, 오른쪽 지도 ─────────────────── */

@media (min-width: 960px) {
  body { font-size: 15px; }

  .bar {
    display: grid;
    grid-template-columns: 420px 1fr;
    grid-template-areas:
      "top strip"
      "search strip";
    column-gap: 20px;
    padding-bottom: 10px;
  }

  .bar-top { grid-area: top; }
  .search { grid-area: search; }

  .strip {
    grid-area: strip;
    align-self: end;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .stage {
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    /* 목록이 길어도 행이 화면 높이를 넘지 않게. 넘으면 지도 중심이 화면 밖으로 간다. */
    grid-template-rows: minmax(0, 1fr);
  }

  .map {
    position: relative;
    grid-column: 2;
    grid-row: 1;
  }

  .sheet,
  .sheet[data-state] {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    height: auto;
    border-radius: 0;
    box-shadow: 1px 0 0 var(--line);
    transition: none;
  }

  .sheet-handle { display: none; }
  .sheet-head { padding-top: 12px; }

  .filters {
    left: auto;
    width: 400px;
    box-shadow: -1px 0 0 var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet { transition: none; }
}
