/* ============================= */
/* Reset */
/* ============================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  background: #ffffff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
    "Noto Sans KR", sans-serif;
  color: #000000;
}

.page {
  width: 100%;
  height: 100vh;
}

.map-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ============================= */
/* Map */
/* ============================= */
.map {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.map-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
  user-select: none;
}

/* ============================= */
/* Marker */
/* ============================= */
.manhole-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;

  display: flex;
  flex-direction: column;
  align-items: center;

  z-index: 10;
}

.manhole-marker:hover {
  z-index: 999;
}

/* 점 */
.marker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #000;
}

/* ============================= */
/* 지도 위 기본 라벨 */
/* ============================= */
.marker-label {
  font-family: "seoul-namsan-vert", sans-serif;
  font-weight: 400;
  font-style: normal;

  font-size: 0.9rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  margin-bottom: 4px;

  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

.manhole-marker:hover .marker-label {
  transform: scale(1.05);
  opacity: 0.9;
}

/* ============================= */
/* Hover 이미지 */
/* ============================= */
.marker-icon {
  position: absolute;
  bottom: 104%;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: auto;
  display: none;
  pointer-events: none;
  z-index: 30;
}

.manhole-marker:not(.icon-mode):hover .marker-icon {
  display: block;
  transform: translateX(-50%) translateY(6px);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));
}

/* icon-mode */
.manhole-marker.icon-mode .marker-label,
.manhole-marker.icon-mode .marker-dot {
  display: none;
}

.manhole-marker.icon-mode .marker-icon {
  display: block;
  width: 70px;
  transform: translateX(-50%);
  filter: none;
}

/* ============================= */
/* Tooltip (중앙정렬 + 내용 기반 크기) */
/* ============================= */
.tooltip {
  position: absolute;
  top: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);

  /* ✅ 박스 크기 = 텍스트 크기 */
  width: max-content;
  max-width: 320px;

  padding: 8px 12px;

  background: #000000;
  color: #ffffff;

  /* 설명 전용 가로 폰트 */
  font-family: "seoul-namsan", sans-serif;
  font-weight: 300;
  font-style: normal;

  font-size: 0.72rem;
  letter-spacing: -0.01em;
  line-height: 1.6;

  /* ✅ 텍스트 중앙 정렬 */
  text-align: center;
  white-space: normal;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  z-index: 31;
}

.manhole-marker:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================= */
/* Legend (Bottom bar) */
/* ============================= */
.legend-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  width: 100%;
  z-index: 40;
}

.legend-list {
  list-style: none;
  width: 100%;

  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 0 10px;
}

.legend-item {
  flex: 1;
  display: flex;
  justify-content: center;
}

.legend-button {
  border: none;
  background: transparent;
  cursor: pointer;
}

.legend-button img {
  max-width: 110px;
  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

.legend-button.active img {
  opacity: 0.35;
}

.legend-button:hover img {
  transform: scale(1.05);
}

/* ============================= */
/* Responsive */
/* ============================= */
@media (max-width: 768px) {
  .marker-label {
    font-size: 0.8rem;
  }

  .marker-icon {
    width: 110px;
  }

  .manhole-marker.icon-mode .marker-icon {
    width: 55px;
  }

  .legend-button img {
    max-width: 80px;
  }

  .tooltip {
    font-size: 0.7rem;
    max-width: 260px;
  }
}

