/* 메인 지도 화면 스타일.
   모바일 퍼스트로 짜고 넓은 화면에서 좌우 2단으로 바뀐다. */

/* --- 레이아웃 (기본 = 모바일 ~599px) ------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 1fr;   /* 모바일: 지도 위, 목록 아래 */
  gap: 16px;
  align-items: start;
}

.map {
  width: 100%;
  height: 44vh;
  min-height: 240px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border-soft);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 0;
  font-size: 0.76rem;
  color: var(--c-text-dim);
}
.map-legend__item { display: inline-flex; align-items: center; gap: 4px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot--spot { background: var(--gm-spot); }
.dot--cherry { background: var(--gm-cherry); }

.dash {
  width: 16px;
  height: 0;
  border-top: 3px dotted var(--gm-corridor);
  display: inline-block;
}

/* --- 검색과 필터 ---------------------------------------------------------- */

.finder__controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.field { display: block; min-width: 0; }
.field__label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-text-dim);
}

.finder input[type="search"],
.finder__controls input[type="search"],
.finder__controls select {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 0.95rem;
  font-family: inherit;
}

.finder__toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-surface);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease),
              color .15s var(--ease);
}
.toggle:hover { border-color: var(--c-primary); }
.toggle input { width: 18px; height: 18px; accent-color: var(--c-primary); cursor: pointer; }
.toggle:has(input:checked) {
  border-color: transparent;
  background: var(--c-primary);
  color: #fff;
}
.toggle:has(input:checked) input { accent-color: #fff; }

.finder__count {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--c-text-dim);
}

/* --- 스팟 목록 ------------------------------------------------------------ */

.spot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.spot-item {
  /* 테두리와 그림자를 여기에 둬서, 안의 카드와 [지도에서 보기] 버튼이
     하나의 덩어리로 보이게 한다. 버튼을 링크(<a>) 안에 넣을 수 없어
     형제로 두는데, 그러면 따로 떠 보이기 때문이다. */
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  background: var(--c-surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease),
              transform .18s var(--ease);
}
.spot-item:hover {
  border-color: var(--c-primary);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.spot-item:focus-within { border-color: var(--c-primary); box-shadow: var(--ring); }

.spot-item.is-highlighted {
  border-color: var(--c-primary);
  box-shadow: var(--shadow-lift), 0 0 0 3px var(--c-primary-soft);
}

.spot-item__locate {
  align-self: stretch;
  margin: 0;
  border: none;
  border-top: 1px solid var(--c-border-soft);
  border-radius: 0;
  background: var(--c-surface-2);
  color: var(--c-text-dim);
  font-size: .82rem;
}
.spot-item__locate:hover:not(:disabled) {
  background: var(--c-primary-soft);
  color: var(--c-primary-ink);
  border-color: var(--c-border-soft);
}

.spot-card {
  display: block;
  padding: 14px 15px;
  border: none;
  background: transparent;
  color: var(--c-text);
  text-decoration: none;
  min-width: 0;
  flex: 1;
}
.spot-card:focus-visible { outline: none; }

.spot-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.spot-card__name {
  font-weight: 700;
  font-size: 1rem;
  min-width: 0;
  overflow-wrap: break-word;
}

.spot-card__tag {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--c-primary-soft);
  color: var(--c-primary-ink);
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}

.spot-card__season {
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-cherry);
}

.spot-card__zone {
  margin-top: 3px;
  font-size: 0.74rem;
  color: var(--c-text-dim);
  font-weight: 600;
}

.spot-card__desc {
  margin: 6px 0 8px;
  font-size: 0.88rem;
  color: var(--c-text-dim);
  /* 설명이 길어도 두 줄까지만 보여 준다 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spot-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.muted { color: var(--c-text-dim); font-size: 0.85rem; }

/* --- 태블릿 600~1023px ---------------------------------------------------- */

@media (min-width: 600px) {
  .map { height: 50vh; max-height: 440px; }
  .finder__controls { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  /* 목록을 2열로 */
  .spot-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- PC 1024px~ ----------------------------------------------------------- */

@media (min-width: 1024px) {
  /* 지도와 목록을 좌우로 나눈다.
     minmax(0, ...)가 핵심이다. 그냥 1fr을 쓰면 긴 한글이나 SVG가 열을 밀어내
     가로 스크롤이 생긴다. */
  .layout {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 20px;
  }

  .layout__map {
    /* 목록을 스크롤하는 동안 지도가 계속 보이게 한다 */
    position: sticky;
    top: calc(var(--topbar-h) + 14px);
  }

  .map { height: 560px; max-height: none; }

  /* 좁은 열이므로 목록은 1열로 되돌린다 */
  .spot-list { grid-template-columns: minmax(0, 1fr); }

  .finder__controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.mb-12 { margin-bottom: 12px; }
