/* ==========================================================================
   Map page — sidebar + full map layout
   ========================================================================== */

.map-body {
  overflow: hidden;
}

.map-body .site-main {
  overflow: hidden;
}

.map-body .site-footer {
  display: none;
}

.map-page {
  display: flex;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  margin-top: var(--header-height);
}

/* -------------------------------------------------------------------------- */
/* Sidebar                                                                    */
/* -------------------------------------------------------------------------- */

.map-sidebar {
  flex: 0 0 320px;
  width: 320px;
  display: flex;
  flex-direction: column;
  background: #f8f5f0;
  box-shadow: 4px 0 24px rgba(74, 63, 53, 0.08);
  z-index: 2;
  overflow: hidden;
}

.map-sidebar__header {
  flex-shrink: 0;
  padding: 1.5rem 1.25rem 1rem;
}

.map-sidebar__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif-display);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-brown);
  line-height: 1.25;
}

.map-sidebar__desc {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--color-brown-soft);
}

.map-sidebar__search {
  position: relative;
  flex-shrink: 0;
  margin: 0 1.25rem 1rem;
}

.map-sidebar__search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--color-brown-soft);
  pointer-events: none;
}

.map-sidebar__search-input {
  width: 100%;
  padding: 0.65rem 0.85rem 0.65rem 2.5rem;
  border: 1px solid rgba(201, 169, 98, 0.45);
  border-radius: 999px;
  background: var(--color-white);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--color-brown);
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.map-sidebar__search-input::placeholder {
  color: rgba(107, 93, 79, 0.55);
}

.map-sidebar__search-input:focus {
  border-color: var(--color-brass);
  box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.15);
}

.map-sidebar__filters {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.25rem 1rem;
}

.map-chip {
  padding: 0.3rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-brown);
  background: var(--color-white);
  border: 1px solid var(--color-brass);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.map-chip:hover:not(.map-chip--active) {
  background: rgba(201, 169, 98, 0.1);
}

.map-chip--active {
  color: var(--color-white);
  background: var(--color-brown);
  border-color: var(--color-brown);
}

.map-sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 169, 98, 0.4) transparent;
}

.map-sidebar__list::-webkit-scrollbar {
  width: 4px;
}

.map-sidebar__list::-webkit-scrollbar-thumb {
  background: rgba(201, 169, 98, 0.4);
  border-radius: 4px;
}

/* Site cards in sidebar */
.map-site-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem;
  background: var(--color-white);
  border: 1px solid rgba(212, 196, 176, 0.4);
  border-radius: 0.5rem;
  box-shadow: 0 2px 10px rgba(74, 63, 53, 0.06);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.map-site-card:hover,
.map-site-card--active {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 63, 53, 0.12);
}

.map-site-card--active {
  border-color: var(--color-brass);
}

.map-site-card__thumb {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 0.35rem;
  object-fit: cover;
}

.map-site-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.map-site-card__name {
  margin: 0 0 0.25rem;
  font-family: var(--font-serif-display);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-brown);
}

.map-site-card__summary {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--color-brown-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-site-card__location {
  margin: auto 0 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-brass-dark);
}

.map-sidebar__empty {
  padding: 2rem 0.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--color-brown-soft);
}

/* -------------------------------------------------------------------------- */
/* Map panel                                                                  */
/* -------------------------------------------------------------------------- */

.map-panel {
  flex: 1;
  position: relative;
  min-width: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: #e8e4dc;
}

.map-locate {
  position: absolute;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--color-white);
  border: 1px solid rgba(212, 196, 176, 0.5);
  border-radius: 0.35rem;
  color: var(--color-brown);
  box-shadow: 0 2px 10px rgba(74, 63, 53, 0.12);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.map-locate:hover {
  background: var(--color-brown);
  color: var(--color-white);
  box-shadow: 0 4px 16px rgba(74, 63, 53, 0.18);
}

.map-locate svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* -------------------------------------------------------------------------- */
/* Custom markers                                                             */
/* -------------------------------------------------------------------------- */

.heritage-marker {
  background: none;
  border: none;
}

.heritage-marker__pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-brass);
  border: 2.5px solid var(--color-brown);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 10px rgba(74, 63, 53, 0.25);
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.heritage-marker__pin::after {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--color-brown);
  border-radius: 50%;
  transform: rotate(45deg);
  transition: background 0.25s ease;
}

.heritage-marker:hover .heritage-marker__pin,
.heritage-marker--active .heritage-marker__pin {
  transform: rotate(-45deg) scale(1.15);
  background: var(--color-brass-dark);
  box-shadow: 0 5px 16px rgba(74, 63, 53, 0.35);
}

.heritage-marker:hover .heritage-marker__pin::after,
.heritage-marker--active .heritage-marker__pin::after {
  background: var(--color-white);
}

/* -------------------------------------------------------------------------- */
/* Leaflet control overrides                                                  */
/* -------------------------------------------------------------------------- */

.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 2px 10px rgba(74, 63, 53, 0.12) !important;
  margin-bottom: 4.5rem !important;
  margin-right: 1.25rem !important;
}

.leaflet-control-zoom a {
  width: 2.5rem !important;
  height: 2.5rem !important;
  line-height: 2.5rem !important;
  font-size: 1.125rem !important;
  color: var(--color-brown) !important;
  background: var(--color-white) !important;
  border: 1px solid rgba(212, 196, 176, 0.5) !important;
  transition: background 0.25s ease, color 0.25s ease !important;
}

.leaflet-control-zoom a:hover {
  background: var(--color-brown) !important;
  color: var(--color-white) !important;
}

.leaflet-control-zoom-in {
  border-radius: 0.35rem 0.35rem 0 0 !important;
}

.leaflet-control-zoom-out {
  border-radius: 0 0 0.35rem 0.35rem !important;
}

.leaflet-control-attribution {
  font-size: 0.625rem !important;
  background: rgba(255, 255, 255, 0.75) !important;
  color: var(--color-brown-soft) !important;
}

.leaflet-popup-content-wrapper {
  border-radius: 0.5rem !important;
  box-shadow: 0 6px 24px rgba(74, 63, 53, 0.15) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 10px !important;
  line-height: 1.4;
}

.leaflet-popup-tip {
  box-shadow: 0 2px 8px rgba(74, 63, 53, 0.1) !important;
}

.popup-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 280px;
  padding: 10px;
}

.popup-left {
  flex-shrink: 0;
}

.popup-left img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.popup-right {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.popup-right .title {
  font-family: var(--font-serif-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-brown);
  margin-bottom: 4px;
}

.popup-right .summary {
  font-size: 12px;
  color: var(--color-brown-soft);
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popup-right .detail-btn {
  background: var(--color-brass-dark);
  color: #fff;
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  align-self: flex-start;
  transition: background 0.25s ease;
}

.popup-right .detail-btn:hover {
  background: var(--color-brown);
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .map-page {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--header-height));
    min-height: calc(100dvh - var(--header-height));
  }

  .map-sidebar {
    flex: none;
    width: 100%;
    max-height: 45vh;
    box-shadow: 0 4px 16px rgba(74, 63, 53, 0.08);
  }

  .map-panel {
    height: 55vh;
    min-height: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-site-card,
  .map-chip,
  .map-locate,
  .heritage-marker__pin {
    transition: none;
  }

  .map-site-card:hover,
  .map-site-card--active {
    transform: none;
  }
}
