/* 한양분식 지도 — 아이보리 지면 · 먹선 · 금 · 붉은 먹 · 밤/낮
 * 구조: <div class="hb-map-wrap" data-mode="day"> [인라인 map.svg] </div> <section id="place-panel">…</section> */

.hb-map-wrap {
  --m-paper: #f7f1e3;
  --m-ground: #efe6cf;
  --m-yard: #e9ddbf;
  --m-street: #e3dac6;
  --m-hatch: #dacfb6;
  --m-floor: #fcf8ef;
  --m-room: #f1e9d8;
  --m-wood: #e8d7b4;
  --m-shadow: #ddd1b6;
  --m-ink: #2b2724;
  --m-ink-soft: #8a7f6e;
  --m-furn: #e6dcc8;
  --m-red: #a8322a;
  --m-gold: #b8892f;
  --m-inset: #f2e9d2;
  --m-tree: #c7ceaa;
  --m-tree-line: #8f9a6f;
  --m-bloom: #e3b2a8;
  --m-roof: #5a5550;
  --m-earth: #d9c7a0;
  --m-window: #dfe3df;
  --m-moon: #efe6cf;
  --m-label: #2b2724;
  --m-label-soft: #7a6f5e;
  --m-halo: #fcf8ef;
  --m-lamp: 0;
  --m-hover: rgba(184, 137, 47, .14);
  --m-edge: #e2d6bd;

  position: relative;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--m-edge);
  border-radius: 14px;
  background: var(--m-paper);
  transition: background-color .5s ease, border-color .5s ease;
}

.hb-map-wrap[data-mode="night"] {
  --m-paper: #18171a;
  --m-ground: #222024;
  --m-yard: #29262a;
  --m-street: #1e1c20;
  --m-hatch: #2d2a2f;
  --m-floor: #2f2b29;
  --m-room: #262327;
  --m-wood: #4a3f33;
  --m-shadow: #121114;
  --m-ink: #d8ccb4;
  --m-ink-soft: #7f7566;
  --m-furn: #3a3532;
  --m-red: #c0463a;
  --m-gold: #d9a94a;
  --m-inset: #1f1d22;
  --m-tree: #2f3a2e;
  --m-tree-line: #4f5f48;
  --m-bloom: #8a5a55;
  --m-roof: #0f0e10;
  --m-earth: #3a3229;
  --m-window: #e7b65c;
  --m-moon: #f3e3b5;
  --m-label: #f1e7d2;
  --m-label-soft: #b4a78f;
  --m-halo: #18171a;
  --m-lamp: 1;
  --m-hover: rgba(217, 169, 74, .16);
  --m-edge: #333036;
}

.hb-map-wrap > svg,
.hb-map-wrap svg.hb-map {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  touch-action: pan-y;          /* 확대 전: 세로 스크롤은 페이지에 맡김 */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.hb-map-wrap.is-zoomed > svg,
.hb-map-wrap.is-zoomed svg.hb-map { touch-action: none; cursor: grab; }
.hb-map-wrap.is-dragging svg.hb-map,
.hb-map-wrap.is-dragging svg.hb-map [data-place] { cursor: grabbing; }

/* 색 바뀜 */
.hb-map [class^="m-"], .hb-map [class*=" m-"] {
  transition: fill .5s ease, stroke .5s ease, opacity .6s ease;
}

/* 등롱빛: 밤에만 · 살짝 일렁임 */
.hb-map .m-lamp { transition: opacity .8s ease; }
.hb-map-wrap[data-mode="night"] .hb-map .m-lamp { animation: hb-lamp 4.2s ease-in-out infinite alternate; }
.hb-map-wrap[data-mode="night"] .hb-map .m-lamp:nth-of-type(2n) { animation-duration: 5.1s; animation-delay: -1.3s; }
.hb-map-wrap[data-mode="night"] .hb-map .m-portal { animation: hb-portal 2.8s ease-in-out infinite; }
.hb-map-wrap[data-mode="night"] .hb-map .m-link { animation: hb-link 1.6s linear infinite; }
@keyframes hb-lamp { from { opacity: .7; } to { opacity: 1; } }
@keyframes hb-portal { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes hb-link { to { stroke-dashoffset: -20; } }

/* 누르는 곳: 머무름 · 초점 · 선택 */
.hb-map [data-place] { outline: none; }
.hb-map [data-place] .hit { transition: fill .2s ease, stroke .2s ease; }
.hb-map [data-place]:hover .hit { fill: var(--m-hover); stroke: var(--m-gold); }
.hb-map [data-place]:focus-visible .hit {
  fill: var(--m-hover);
  stroke: var(--m-gold);
  stroke-width: 4;
  stroke-dasharray: 8 5;
}
.hb-map [data-place].is-active .hit {
  fill: rgba(168, 50, 42, .10);
  stroke: var(--m-red);
  stroke-width: 4;
  stroke-dasharray: none;
}
.hb-map [data-place].is-active .m-label { fill: var(--m-red); }

/* 도구 단추 */
.hb-map-tools {
  position: absolute;
  z-index: 2;
  top: 10px;
  inset-inline-end: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.hb-map-btn {
  min-width: 40px;
  height: 40px;                 /* 손가락으로 누르기 쉬운 크기 */
  padding: 0 10px;
  border: 1px solid var(--m-edge);
  border-radius: 999px;
  background: var(--m-paper);
  color: var(--m-label);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
  transition: background-color .3s ease, color .3s ease, transform .15s ease, border-color .3s ease;
}
.hb-map-btn:hover:not(:disabled) { border-color: var(--m-gold); transform: translateY(-1px); }
.hb-map-btn:focus-visible { outline: 2px solid var(--m-gold); outline-offset: 2px; }
.hb-map-btn:disabled { opacity: .4; cursor: default; }

/* 밤/낮 단추 */
.hb-map-btn.is-mode {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  font-size: 14px;
  font-weight: 700;
}
.hb-map-btn.is-mode span {
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  white-space: nowrap;
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  transition: background-color .35s ease, color .35s ease;
}
.hb-map-btn.is-mode .hb-mode-sun { background: var(--m-gold); color: #fffaf0; }
.hb-map-btn.is-mode .hb-mode-moon { color: var(--m-label-soft); }
.hb-map-wrap[data-mode="night"] .hb-map-btn.is-mode .hb-mode-sun { background: transparent; color: var(--m-label-soft); }
.hb-map-wrap[data-mode="night"] .hb-map-btn.is-mode .hb-mode-moon { background: var(--m-red); color: #fff4e4; }

/* 장소 설명 칸 */
.place-panel {
  margin-top: 16px;
  padding: 18px 20px;
  border: 1px solid #e2d6bd;
  border-inline-start: 4px solid #b8892f;
  border-radius: 12px;
  background: #fcf8ef;
  color: #2b2724;
  overflow-wrap: anywhere;
}
.place-panel .place-name {
  margin: 0 0 10px;
  font-size: 1.2rem;
  line-height: 1.4;
  color: #2b2724;
}
.place-panel .place-name::before {
  content: "";
  display: inline-block;
  width: .55em;
  height: .55em;
  margin-inline-end: .45em;
  border-radius: 50%;
  background: #a8322a;
  vertical-align: .12em;
}
.place-panel .place-figure { margin: 0 0 12px; }
.place-panel .place-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: #efe6cf;
}
.place-panel .place-intro { margin: 0 0 .6em; line-height: 1.75; }
.place-panel .place-intro:last-child { margin-bottom: 0; }
.place-panel.is-enter { animation: hb-panel .35s ease both; }
@keyframes hb-panel { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 넓은 화면: 지도 옆에 설명 */
@media (min-width: 1100px) {
  .hb-map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
  .hb-map-layout .place-panel { margin-top: 0; position: sticky; top: 20px; }
}

/* 폰 */
@media (max-width: 480px) {
  .hb-map-wrap { border-radius: 10px; }
  .hb-map-tools { top: 6px; inset-inline-end: 6px; gap: 4px; }
  .hb-map-btn { min-width: 36px; height: 36px; font-size: 16px; padding: 0 8px; }
  .hb-map-btn.is-mode span { min-width: 28px; height: 28px; }
  .place-panel { padding: 14px 16px; }
}

/* 움직임 줄이기 */
@media (prefers-reduced-motion: reduce) {
  .hb-map-wrap,
  .hb-map [class^="m-"], .hb-map [class*=" m-"],
  .hb-map [data-place] .hit,
  .hb-map-btn, .hb-map-btn.is-mode span { transition: none !important; }
  .hb-map-wrap[data-mode="night"] .hb-map .m-lamp,
  .hb-map-wrap[data-mode="night"] .hb-map .m-portal,
  .hb-map-wrap[data-mode="night"] .hb-map .m-link,
  .place-panel.is-enter { animation: none !important; }
}
