/* ============================================
   홍익대 기숙사 제휴 지도 - 스타일
   색 값은 전부 아래 :root 한 곳에 모아뒀다.
   색을 바꾸고 싶으면 여기만 고치면 전체에 반영된다.
   ============================================ */

:root {
  --bg:        #ffffff;
  --text:      #17171a;
  --sub:       #6b6b76;
  --line:      #e6e6ec;
  --shadow:    0 2px 12px rgba(0,0,0,.10);
  --shadow-lg: 0 -4px 24px rgba(0,0,0,.14);

  /* 업종별 색. 핀과 배지와 목록 아이콘이 이 색을 함께 쓴다.

     색상환에서 서로 붙어 있는 구간(청록-파랑-남보라-자주)만 골랐다.
     네 색이지만 한 벌로 읽히라고 이렇게 잡은 것이다.
     전부 어둡게 잡은 이유는, 흐린 지도 위에서는
     밝은 색보다 어두운 색이 훨씬 잘 튀기 때문이다.

     카카오 지도의 배경 아이콘은 빨강·주황 계열이라
     이 차가운 색들과는 절대 섞이지 않는다.                        */
  --food:      #14675F;   /* 딥 청록 */
  --cafe:      #1D4E7C;   /* 딥 파랑 */
  --bar:       #463F8C;   /* 남보라 */
  --lifestyle: #6E3560;   /* 자주   */

  /* 위 네 색의 아주 옅은 짝. 목록 아이콘 배경에 쓴다 */
  --food-bg:      #E4F0EE;
  --cafe-bg:      #E5EDF4;
  --bar-bg:       #EAE8F4;
  --lifestyle-bg: #F2E8EF;

  --sheet-peek: 132px;   /* 시트가 살짝 올라온 높이 */
  --sheet-full: 78vh;    /* 시트를 끝까지 올렸을 때 높이 */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
               "Malgun Gothic", "맑은 고딕", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 지도 ---------- */

#map {
  position: fixed; inset: 0;
  background: #eef0f2;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

/* ---------- 지도 색조 ----------

   카카오 지도는 다른 가게 이름과 색이 많아 우리 핀이 묻힌다.
   지도 그림에서 색을 빼면 핀이 앞으로 튀어나온다.

   지도 조각은 전부 <img> 이고 우리 핀은 전부 <div> 라서,
   img 에만 색조를 걸면 지도만 흐려지고 핀은 그대로 남는다.

   주소 뒤에 ?map=gray 처럼 붙이면 다른 색조로 바꿔 볼 수 있다.
   soft / gray / paper / mono / faint / blank / none 일곱 가지.       */

body[data-map="soft"]  #map img { filter: saturate(.40) brightness(1.04); }
body[data-map="gray"]  #map img { filter: saturate(.12) brightness(1.08) contrast(.92); }
body[data-map="paper"] #map img { filter: saturate(.10) brightness(1.10) contrast(.86) sepia(.14); }
body[data-map="mono"]  #map img { filter: grayscale(1)  brightness(1.06) contrast(.90); }
body[data-map="none"]  #map img { filter: none; }

/* 아래 둘은 "다른 가게 상호명을 지우는" 것이 목적이다.

   카카오는 글씨를 지도 그림에 미리 찍어서 보내기 때문에
   코드로 글씨만 골라서 끌 방법이 없다. 그래서 지도 전체를
   흰 종이에 가깝게 날려버리는 방식으로 글씨를 안 보이게 한다.

   대신 도로와 골목도 같이 흐려진다. 이건 맞바꾸는 것이다.
   흰 바탕을 깔아야 날아간 자리가 흰색으로 채워진다.            */

body[data-map="faint"] #map     { background: #fff; }
body[data-map="faint"] #map img { filter: grayscale(1) opacity(.42); }

body[data-map="blank"] #map     { background: #fff; }
body[data-map="blank"] #map img { filter: grayscale(1) contrast(.55) opacity(.22); }
#map:active { cursor: grabbing; }

#mapPlaceholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #b9bcc2; font-size: 13px; letter-spacing: .04em;
  pointer-events: none; user-select: none;
}

#pinLayer { position: absolute; inset: 0; }

/* 핀. 카카오 지도와 임시 화면이 같은 모양을 쓴다.
   기준점이 핀의 뾰족한 끝(가게 위치)이 되도록 위로 끌어올린다 */
/* --dx, --dy 는 같은 자리에 뭉친 핀을 벌릴 때 app.js 가 넣는다 */
.pin {
  position: absolute; cursor: pointer;
  --dx: 0px; --dy: 0px;
  transform: translate(calc(-50% + var(--dx)), calc(-100% + var(--dy)));
  transition: transform .12s ease, opacity .15s;
}
.pin .pinBody {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.28);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; user-select: none;
}
.pin .pinTail {
  width: 0; height: 0; margin: -3px auto 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 9px solid;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.2));
}
.pin:hover  { transform: translate(calc(-50% + var(--dx)), calc(-100% + var(--dy))) scale(1.08); }
.pin.sel    { transform: translate(calc(-50% + var(--dx)), calc(-100% + var(--dy))) scale(1.15);
              z-index: 10; }

/* 가게 이름표. 충분히 확대했을 때와 선택했을 때만 붙는다 */
.pinLabel {
  position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  margin-top: 1px; padding: 2px 6px;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(0,0,0,.09);
  border-radius: 5px;
  font-size: 11px; font-weight: 700; line-height: 1.3;
  color: #24242b; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.16);
  pointer-events: none; user-select: none;
}
.pin.sel .pinLabel { background: #17171a; color: #fff; border-color: #17171a; }

/* 가까이 붙은 핀을 하나로 묶은 표시. 숫자는 그 안의 업체 수 */
.cluster {
  position: absolute; transform: translate(-50%, -50%);
  min-width: 34px; height: 34px; padding: 0 7px;
  border-radius: 999px; border: 2.5px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; user-select: none;
  transition: transform .12s ease;
}
.cluster:hover { transform: translate(-50%, -50%) scale(1.1); }

/* 기숙사 표시 */
.dormMark {
  position: absolute; transform: translate(-50%, -50%);
  width: 27px; height: 27px; border-radius: 50%;
  background: #2b6be4; border: 3px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; user-select: none;
}

/* ---------- 상단 필터 ---------- */

#topBar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  padding: 12px 12px 20px;
  background: linear-gradient(#fff 40%, rgba(255,255,255,0));
  pointer-events: none;
}
#filters {
  display: flex; gap: 7px; overflow-x: auto;
  pointer-events: auto;
  scrollbar-width: none;
}
#filters::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line); background: #fff; color: var(--sub);
  padding: 8px 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  box-shadow: var(--shadow); cursor: pointer;
  transition: background .12s, color .12s;
}
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }

/* 업종 필터를 누르면 그 업종의 핀 색으로 켜진다.
   필터 색과 지도 위 핀 색이 같아야 눈이 바로 연결한다.  */
.chip.on[data-cat="food"]      { background: var(--food);      border-color: var(--food); }
.chip.on[data-cat="cafe"]      { background: var(--cafe);      border-color: var(--cafe); }
.chip.on[data-cat="bar"]       { background: var(--bar);       border-color: var(--bar); }
.chip.on[data-cat="lifestyle"] { background: var(--lifestyle); border-color: var(--lifestyle); }

/* ---------- 우하단 버튼 ---------- */

/* 시트 바로 위에 붙어 다닌다. bottom 값은 app.js 가 시트 높이에 맞춰 넣는다 */
#mapBtns {
  position: fixed; right: 14px; bottom: 148px; z-index: 20;
  display: flex; flex-direction: column; gap: 8px;
}

#mapBtns button {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: var(--sub);
  font-size: 17px; font-weight: 700; font-family: inherit;
  box-shadow: var(--shadow); cursor: pointer;
}
#mapBtns button.on { background: #2b6be4; color: #fff; border-color: #2b6be4; }
#btnGps { font-size: 20px; }

/* ---------- 하단 시트 ---------- */

/* 3단계로 오르내린다. 높이는 app.js 가 픽셀로 지정한다
   peek(128px) / half(화면 50%) / full(화면 88%) */
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: 128px;               /* peek 과 같은 값. 첫 화면에서 시트가 출렁이지 않게 */
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  touch-action: none;          /* 시트를 끌 때 브라우저가 페이지를 스크롤하지 않게 */
}

#handle {
  flex: 0 0 auto; padding: 10px 0 6px;
  display: flex; justify-content: center; cursor: grab;
}
#handle::before {
  content: ""; width: 38px; height: 4px; border-radius: 2px; background: #d5d5dd;
}

#sheetBody {
  flex: 1 1 auto; overflow-y: auto;
  padding: 4px 18px 28px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;         /* 내용은 세로 스크롤 허용 */
  overscroll-behavior: contain;
}

/* 시트 안 내용 */
.shopHead { display: flex; align-items: flex-start; gap: 9px; }
.shopName { font-size: 19px; font-weight: 700; margin: 0; line-height: 1.3; }

.badge {
  flex: 0 0 auto; margin-top: 3px;
  font-size: 11px; font-weight: 700; color: #fff;
  padding: 3px 8px; border-radius: 999px;
}
.badge.food{background:var(--food)} .badge.cafe{background:var(--cafe)}
.badge.bar{background:var(--bar)}   .badge.lifestyle{background:var(--lifestyle)}

.dist { margin: 5px 0 0; font-size: 12.5px; color: var(--sub); }

.benefits { margin: 12px 0 0; padding: 0; list-style: none; }
.benefits li {
  position: relative; padding: 7px 0 7px 22px;
  font-size: 14.5px; line-height: 1.5; font-weight: 600;
  border-top: 1px solid var(--line);
}
.benefits li:first-child { border-top: none; }
.benefits li::before {
  content: "🎁"; position: absolute; left: 0; top: 7px; font-size: 13px;
}
.note { margin: 7px 0 0; font-size: 12.5px; color: var(--sub); line-height: 1.55; }

.actions { display: flex; gap: 8px; margin: 16px 0 0; }
.actions a, .actions button {
  flex: 1; text-align: center; text-decoration: none;
  padding: 12px 0; border-radius: 11px;
  border: 1px solid var(--line); background: #f7f7f9; color: var(--text);
  font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.actions a.primary { background: var(--text); color: #fff; border-color: var(--text); }
.actions .off { opacity: .38; pointer-events: none; }

.warn {
  margin: 14px 0 0; padding: 11px 13px;
  background: #fff5f4; border: 1px solid #ffd9d4; border-radius: 11px;
  font-size: 12.5px; line-height: 1.6; color: #9a3b2c; white-space: pre-line;
}
.warn b { display: block; margin-bottom: 4px; font-size: 13px; }

.sect { margin: 18px 0 0; }
.sect h3 {
  margin: 0 0 7px; font-size: 12px; font-weight: 700;
  color: var(--sub); letter-spacing: .05em;
}
.sect p { margin: 0; font-size: 13.5px; line-height: 1.65; white-space: pre-line; color: #3d3d45; }

details.more { margin: 16px 0 0; border-top: 1px solid var(--line); padding-top: 12px; }
details.more summary {
  font-size: 13.5px; font-weight: 700; cursor: pointer; color: var(--sub);
  list-style: none;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: " ▾"; }
details.more[open] summary::after { content: " ▴"; }
details.more p {
  margin: 10px 0 0; font-size: 13px; line-height: 1.7;
  white-space: pre-line; color: #3d3d45;
}

/* 목록 모드 (필터만 걸고 핀을 안 눌렀을 때) */
.listTitle { font-size: 13px; font-weight: 700; color: var(--sub); margin: 2px 0 10px; }
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer;
}
.row:first-of-type { border-top: none; }
.rowIco { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
          display: flex; align-items: center; justify-content: center; font-size: 15px; }
.rowIco.food{background:var(--food-bg)} .rowIco.cafe{background:var(--cafe-bg)}
.rowIco.bar{background:var(--bar-bg)}   .rowIco.lifestyle{background:var(--lifestyle-bg)}
.rowTxt { flex: 1 1 auto; min-width: 0; }
.rowName { font-size: 14.5px; font-weight: 700; }
.rowBen  { font-size: 12.5px; color: var(--sub); margin-top: 2px;
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowDist { flex: 0 0 auto; font-size: 12px; color: var(--sub); }

/* 이용 안내 시트 */
.guideBox {
  margin: 14px 0 0; padding: 14px 15px;
  background: #f5f8ff; border: 1px solid #dbe6ff; border-radius: 12px;
}
.guideBox > b { display: block; font-size: 14px; margin-bottom: 9px; }
.guideBox p   { margin: 0 0 8px; font-size: 13.5px; line-height: 1.6; color: #2d3340; }
.guideBox p:last-child { margin-bottom: 0; }
.guideBox .small { font-size: 12.5px; color: var(--sub); }

.stamp { margin: 22px 0 0; font-size: 12px; color: #a0a0aa; text-align: center; }

/* ---------- 토스트 ---------- */

#toast {
  position: fixed; left: 50%; bottom: 40%; z-index: 60;
  transform: translate(-50%, 10px);
  background: rgba(23,23,26,.92); color: #fff;
  padding: 11px 17px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
