/* ============================================
   MAP PAGE — Full-viewport interactive map
   ============================================ */

/* ---- Body & layout ---- */
.map-body {
  margin: 0;
  overflow: hidden;
  background: var(--color-midnight);
}

.map-page {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
/* Hidden by default (mobile-first). Shown on screens > 600px via media query below. */
.map-sidebar {
  display: none;
}

@media (min-width: 601px) and (min-device-width: 601px) {
  .map-sidebar {
    width: 380px;
    display: flex;
    flex-direction: column;
    /* Always overlaid on top of map */
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow: hidden;
    /* Semi-transparent so map peeks through */
    background: linear-gradient(
      180deg,
      rgba(10, 22, 40, 0.82) 0%,
      rgba(12, 26, 46, 0.82) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(250, 248, 245, 0.08);
    /* Intro: hidden off-screen */
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 2s cubic-bezier(0.22, 1, 0.36, 1), opacity 1.6s ease;
  }
}

.map-sidebar--revealed {
  transform: translateX(0);
  opacity: 1;
}

.map-sidebar__header {
  padding: 48px var(--space-xl) var(--space-lg);
  text-align: center;
}

/* Eyebrow: "— Freysta —" with decorative gold lines */
.map-sidebar__eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin: 0 0 var(--space-md);
  opacity: 0;
  animation: sidebarFadeIn 0.8s var(--ease-out-expo) 0.2s forwards;
  animation-play-state: paused;
}

.map-sidebar--revealed .map-sidebar__eyebrow {
  animation-play-state: running;
}

.map-sidebar__eyebrow-line {
  display: block;
  width: 28px;
  height: 1px;
  background: var(--color-gold);
  opacity: 0.5;
}

.map-sidebar__title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 3vw, 2.8rem);
  font-weight: 400;
  color: var(--color-warm-white);
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  opacity: 0;
  animation: sidebarFadeIn 1s var(--ease-out-expo) 0.4s forwards;
  animation-play-state: paused;
}

.map-sidebar--revealed .map-sidebar__title {
  animation-play-state: running;
}

/* Gradient accent line below title */
.map-sidebar__accent {
  width: 40px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-aurora), var(--color-gold));
  margin: 0 auto var(--space-md);
  opacity: 0;
  animation: sidebarAccentIn 1.2s var(--ease-out-expo) 0.6s forwards;
  animation-play-state: paused;
}

.map-sidebar--revealed .map-sidebar__accent {
  animation-play-state: running;
}

.map-sidebar__subtitle {
  font-family: var(--font-display);
  font-size: 1rem;
  font-style: italic;
  font-weight: 400;
  color: rgba(250, 248, 245, 0.45);
  margin: 0;
  letter-spacing: 0.01em;
  opacity: 0;
  animation: sidebarFadeIn 0.8s var(--ease-out-expo) 0.7s forwards;
  animation-play-state: paused;
}

.map-sidebar--revealed .map-sidebar__subtitle {
  animation-play-state: running;
}

@keyframes sidebarFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sidebarAccentIn {
  from {
    opacity: 0;
    width: 0;
  }
  to {
    opacity: 1;
    width: 40px;
  }
}

/* ---- Search ---- */
.map-sidebar__search {
  padding: 0 var(--space-xl) var(--space-md);
}

.map-search {
  position: relative;
  display: flex;
  align-items: center;
}

.map-search__icon {
  position: absolute;
  left: 16px;
  width: 16px;
  height: 16px;
  color: rgba(250, 248, 245, 0.35);
  pointer-events: none;
  transition: color 0.25s ease;
}

.map-search__input {
  width: 100%;
  padding: 11px 40px 11px 44px;
  background: rgba(250, 248, 245, 0.05);
  border: 1px solid rgba(250, 248, 245, 0.08);
  border-radius: var(--radius-full);
  color: var(--color-warm-white);
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.map-search__input::placeholder {
  color: rgba(250, 248, 245, 0.3);
}

.map-search__input:focus {
  background: rgba(250, 248, 245, 0.08);
  border-color: rgba(196, 145, 138, 0.35);
  box-shadow: 0 0 0 3px rgba(196, 145, 138, 0.08);
}

.map-search__input:focus ~ .map-search__icon {
  color: var(--color-gold);
}

.map-search__clear {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: rgba(250, 248, 245, 0.08);
  border: none;
  border-radius: var(--radius-full);
  color: rgba(250, 248, 245, 0.45);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.map-search__clear[hidden] {
  display: none !important;
}

.map-search__clear svg {
  width: 12px;
  height: 12px;
}

.map-search__clear:hover {
  background: rgba(250, 248, 245, 0.15);
  color: var(--color-warm-white);
}

/* ---- Filters ---- */
.map-sidebar__filters {
  padding: 0 var(--space-xl) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-filters__row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-filters__row--inline {
  flex-direction: row;
  align-items: center;
}

.map-filter-select {
  width: 100%;
  padding: 9px 30px 9px 12px;
  background: rgba(250, 248, 245, 0.04);
  border: 1px solid rgba(250, 248, 245, 0.08);
  border-radius: var(--radius-full);
  color: rgba(250, 248, 245, 0.75);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='rgba(250,248,245,0.3)' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition:
    background 0.25s ease,
    border-color 0.25s ease;
}

.map-filter-select:focus {
  border-color: rgba(196, 145, 138, 0.35);
  box-shadow: 0 0 0 2px rgba(196, 145, 138, 0.08);
}

.map-filter-select option {
  background: var(--color-midnight);
  color: var(--color-warm-white);
}

.map-filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.map-filter-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.map-filter-toggle__switch {
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: rgba(250, 248, 245, 0.1);
  position: relative;
  transition: background 0.3s ease;
  flex-shrink: 0;
}

.map-filter-toggle__switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(250, 248, 245, 0.45);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
}

.map-filter-toggle input:checked + .map-filter-toggle__switch {
  background: var(--color-gold);
}

.map-filter-toggle input:checked + .map-filter-toggle__switch::after {
  transform: translateX(16px);
  background: var(--color-midnight);
}

.map-filter-toggle__text {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: rgba(250, 248, 245, 0.5);
  transition: color 0.25s ease;
}

.map-filter-toggle input:checked ~ .map-filter-toggle__text {
  color: var(--color-gold);
}

.map-filters__reset {
  margin-left: auto;
  padding: 4px 12px;
  background: none;
  border: 1px solid rgba(250, 248, 245, 0.1);
  border-radius: var(--radius-full);
  color: rgba(250, 248, 245, 0.4);
  font-family: var(--font-body);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.map-filters__reset[hidden] {
  display: none !important;
}

.map-filters__reset:hover {
  color: var(--color-warm-white);
  border-color: rgba(250, 248, 245, 0.25);
}

/* ---- Results count ---- */
.map-sidebar__count {
  padding: var(--space-sm) var(--space-xl);
  font-family: var(--font-body);
  font-size: 0.6875rem;
  color: rgba(250, 248, 245, 0.3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  border-top: 1px solid rgba(250, 248, 245, 0.05);
  flex-shrink: 0;
}

/* ---- Village list ---- */
.map-sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-sm);
  scrollbar-width: thin;
  scrollbar-color: rgba(250, 248, 245, 0.1) transparent;
}

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

.map-sidebar__list::-webkit-scrollbar-thumb {
  background: rgba(250, 248, 245, 0.1);
  border-radius: 2px;
}

/* Village list items */
.map-village-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border-left: 3px solid transparent;
  cursor: pointer;
  position: relative;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.map-village-item:hover {
  background: rgba(196, 145, 138, 0.10);
  border-left-color: rgba(196, 145, 138, 0.5);
}

.map-village-item--active {
  background: rgba(196, 145, 138, 0.18);
  border-left-color: var(--color-gold);
}

.map-village-item__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-gold);
  flex-shrink: 0;
  opacity: 0.6;
  /* Align dot vertically with the village name text
     Name: 1.15rem × 1.2 line-height ≈ 22px → (22 - 7) / 2 ≈ 7.5px */
  margin-top: 8px;
  transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.map-village-item:hover .map-village-item__dot {
  opacity: 1;
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(196, 145, 138, 0.35);
}

.map-village-item--active .map-village-item__dot {
  background: var(--color-gold);
  opacity: 1;
  transform: scale(1.4);
  box-shadow: 0 0 12px rgba(196, 145, 138, 0.6), 0 0 4px rgba(196, 145, 138, 0.3);
}

/* Map hover cross-highlight */
.map-village-item--hover {
  background: rgba(196, 145, 138, 0.10);
  border-left-color: rgba(196, 145, 138, 0.5);
}

.map-village-item--hover .map-village-item__dot {
  opacity: 1;
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(196, 145, 138, 0.35);
}

.map-village-item--hover .map-village-item__name {
  color: var(--color-warm-white);
}

.map-village-item__info {
  flex: 1;
  min-width: 0;
}

.map-village-item__name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: rgba(250, 248, 245, 0.88);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  transition: color 0.25s ease;
}

.map-village-item:hover .map-village-item__name {
  color: var(--color-warm-white);
}

.map-village-item--active .map-village-item__name {
  color: var(--color-warm-white);
}

.map-village-item__desc {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 400;
  color: rgba(250, 248, 245, 0.4);
  margin: 2px 0 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s ease;
}

.map-village-item:hover .map-village-item__desc,
.map-village-item--hover .map-village-item__desc {
  color: rgba(250, 248, 245, 0.55);
}

.map-village-item--active .map-village-item__desc {
  color: rgba(250, 248, 245, 0.65);
}

.map-village-item__meta {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  color: rgba(250, 248, 245, 0.25);
  margin: 4px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

.map-village-item__member {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--color-gold);
  opacity: 0.5;
  margin-top: 0.3em;
  transition: opacity 0.25s ease;
}

.map-village-item:hover .map-village-item__member {
  opacity: 0.8;
}

/* ---- Skeleton loading ---- */
.map-village-skeleton {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skeleton-line {
  height: 12px;
  border-radius: var(--radius-full);
  background: linear-gradient(
    90deg,
    rgba(250, 248, 245, 0.03) 25%,
    rgba(250, 248, 245, 0.07) 50%,
    rgba(250, 248, 245, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.8s ease-in-out infinite;
}

.skeleton-line--name { width: 55%; height: 14px; }
.skeleton-line--meta { width: 38%; }

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Empty state ---- */
.map-sidebar__empty[hidden] {
  display: none !important;
}

.map-sidebar__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
}

.map-sidebar__empty p {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  color: rgba(250, 248, 245, 0.4);
  margin: 0 0 var(--space-lg);
}

.map-sidebar__empty-reset {
  padding: 9px 24px;
  background: rgba(196, 145, 138, 0.1);
  border: 1px solid rgba(196, 145, 138, 0.2);
  border-radius: var(--radius-full);
  color: var(--color-gold);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.map-sidebar__empty-reset:hover {
  background: rgba(196, 145, 138, 0.18);
  border-color: rgba(196, 145, 138, 0.35);
}

/* ---- Detail panel ---- */
/* Scroll hint — mobile only, hidden on desktop/tablet */
.map-detail__scroll-hint { display: none; }

/* Default: overlays sidebar area (narrow screens) */
.map-detail-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 380px;
  background: var(--color-midnight);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 150;
  animation: detail-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  scrollbar-width: thin;
  scrollbar-color: rgba(250, 248, 245, 0.12) transparent;
}

.map-detail-panel::-webkit-scrollbar { width: 4px; }
.map-detail-panel::-webkit-scrollbar-thumb {
  background: rgba(250, 248, 245, 0.12);
  border-radius: 2px;
}

.map-detail-panel[hidden] {
  display: none !important;
}

/* Cross-fade when switching between villages — tablet / mobile
   Double class for specificity — must beat tablet --enter rules */
.map-detail-panel.map-detail-panel--switching .map-detail__hero,
.map-detail-panel.map-detail-panel--switching .map-detail__content {
  transition: opacity 0.35s ease-in, transform 0.35s ease-in !important;
  opacity: 0 !important;
  transform: translateY(14px) scale(0.97) !important;
}

.map-detail-panel.map-detail-panel--switching-in .map-detail__hero,
.map-detail-panel.map-detail-panel--switching-in .map-detail__content {
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}

.map-detail-panel.map-detail-panel--switching-in .map-detail__hero { transition-delay: 60ms !important; }
.map-detail-panel.map-detail-panel--switching-in .map-detail__content { transition-delay: 160ms !important; }

/* Cross-fade — desktop floating card: whole card shrinks and fades */
@media (min-width: 1101px) {
  .map-detail-panel.map-detail-panel--switching {
    transition: opacity 0.3s ease-in, transform 0.3s ease-in !important;
    opacity: 0.15 !important;
    transform: scale(0.96) translateY(8px) !important;
  }

  /* Override child transitions — card-level anim handles everything */
  .map-detail-panel.map-detail-panel--switching .map-detail__hero,
  .map-detail-panel.map-detail-panel--switching .map-detail__content {
    transition: none !important;
    opacity: 0 !important;
    transform: none !important;
  }

  .map-detail-panel.map-detail-panel--switching-in {
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
    opacity: 1 !important;
    transform: scale(1) translateY(0) !important;
  }

  .map-detail-panel.map-detail-panel--switching-in .map-detail__hero,
  .map-detail-panel.map-detail-panel--switching-in .map-detail__content {
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
  }

  .map-detail-panel.map-detail-panel--switching-in .map-detail__hero { transition-delay: 80ms !important; }
  .map-detail-panel.map-detail-panel--switching-in .map-detail__content { transition-delay: 180ms !important; }
}

@keyframes detail-slide-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes detail-card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Back button */
.map-detail__back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 100px var(--space-lg) var(--space-sm);
  background: none;
  border: none;
  color: rgba(250, 248, 245, 0.45);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.25s ease, gap 0.25s ease;
}

.map-detail__back svg {
  width: 18px;
  height: 18px;
  transition: transform 0.25s ease;
}

.map-detail__back:hover {
  color: var(--color-warm-white);
  gap: 10px;
}

.map-detail__back:hover svg {
  transform: translateX(-2px);
}

/* Drag handle (wide screens only) */
.map-detail__drag-handle {
  display: none;
}

/* Close button (wide screens only — floating card) */
.map-detail__close {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: rgba(10, 22, 40, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(250, 248, 245, 0.15);
  border-radius: 50%;
  color: rgba(250, 248, 245, 0.75);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  z-index: 5;
}

.map-detail__close svg {
  width: 16px;
  height: 16px;
}

.map-detail__close:hover {
  background: rgba(10, 22, 40, 0.85);
  border-color: rgba(250, 248, 245, 0.25);
  color: var(--color-warm-white);
}

/* Hero: image + badge overlay */
.map-detail__hero {
  position: relative;
  margin: var(--space-xs) var(--space-lg) 0;
}

.map-detail__image-wrap {
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: rgba(250, 248, 245, 0.04);
}

.map-detail__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.map-detail__image.loaded {
  opacity: 1;
}

/* Badge overlaid on image */
.map-detail__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  right: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(250, 248, 245, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 20px;
  color: var(--color-midnight);
  font-family: var(--font-body);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.map-detail__badge[hidden] {
  display: none;
}

.map-detail__badge svg {
  width: 11px;
  height: 11px;
  color: var(--color-gold);
}

/* Content area */
.map-detail__content {
  display: flex;
  flex-direction: column;
  padding: var(--space-lg) var(--space-lg) var(--space-xl);
  min-height: 0;
}

/* Village name */
.map-detail__name {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 2.4vw, 2.2rem);
  font-weight: 400;
  color: var(--color-warm-white);
  margin: 0 0 0.3rem;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

/* Gradient accent — animates on reveal */
.map-detail__accent {
  width: 32px;
  height: 2.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-aurora), var(--color-gold));
  margin-bottom: var(--space-md);
  transition: width 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.map-detail-panel:not([hidden]) .map-detail__accent {
  width: 48px;
}

/* Tagline — prominent italic display text */
.map-detail__tagline {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 400;
  color: rgba(250, 248, 245, 0.7);
  line-height: 1.4;
  margin: 0;
}

/* Divider between tagline and location/description */
.map-detail__divider {
  width: 100%;
  height: 1px;
  background: rgba(250, 248, 245, 0.08);
  margin: var(--space-md) 0;
}

/* Location with pin icon */
.map-detail__location {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: rgba(250, 248, 245, 0.5);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.map-detail__location svg {
  flex-shrink: 0;
  color: var(--color-gold);
  opacity: 0.7;
}

/* Full description */
.map-detail__description {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: rgba(250, 248, 245, 0.58);
  line-height: 1.75;
  margin: 0 0 var(--space-lg);
}

/* Actions */
.map-detail__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.map-detail__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition:
    background 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease,
    color 0.25s ease;
}

.map-detail__link--primary {
  background: linear-gradient(135deg, var(--color-gold), #b57e77);
  color: var(--color-midnight);
}

.map-detail__link--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(196, 145, 138, 0.35);
}

.map-detail__link--primary svg {
  transition: transform 0.25s ease;
}

.map-detail__link--primary:hover svg {
  transform: translateX(3px);
}

.map-detail__link--secondary {
  background: rgba(250, 248, 245, 0.05);
  border: 1px solid rgba(250, 248, 245, 0.1);
  color: rgba(250, 248, 245, 0.6);
}

.map-detail__link--secondary:hover {
  background: rgba(250, 248, 245, 0.09);
  border-color: rgba(250, 248, 245, 0.18);
  color: var(--color-warm-white);
}

/* ---- Detail tabs (< 1200px, villages with tour) ---- */
.map-detail__tabs {
  display: none;
}

.map-detail__tabs:not([hidden]) {
  display: flex;
  gap: 4px;
  padding: 0 var(--space-lg) var(--space-sm);
  border-bottom: 1px solid rgba(250, 248, 245, 0.06);
}

.map-detail__tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(250, 248, 245, 0.4);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.map-detail__tab:hover {
  color: rgba(250, 248, 245, 0.65);
}

.map-detail__tab--active {
  color: var(--color-gold);
  border-bottom-color: var(--color-gold);
}

.map-detail__tab svg {
  opacity: 0.7;
}

.map-detail__tab--active svg {
  opacity: 1;
}

/* ---- Inline tour embed (inside detail panel) ---- */
.map-detail__tour {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-md) var(--space-lg);
  min-height: 0;
}

.map-detail__tour[hidden] {
  display: none !important;
}

.map-detail__tour-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
}

.map-detail__tour-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ---- Tour-mode shape transition ---- */
.map-detail-panel {
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Content visibility toggle for tour mode */
.map-detail__hero,
.map-detail__content {
  transition: opacity 0.25s ease;
}

.map-detail-panel--tour-mode .map-detail__hero,
.map-detail-panel--tour-mode .map-detail__content {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

/* ---- Wide screen: floating detail card on the map ---- */
@media (min-width: 1101px) {
  .map-detail-panel {
    top: 80px;
    right: 24px;
    bottom: auto;
    left: auto;
    width: 380px;
    max-height: calc(100vh - 104px);
    border-radius: 16px;
    background: rgba(10, 22, 40, 0.92);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border: 1px solid rgba(250, 248, 245, 0.08);
    box-shadow:
      0 8px 40px rgba(0, 0, 0, 0.4),
      0 0 0 1px rgba(250, 248, 245, 0.04);
    z-index: 200;
    animation: detail-card-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .map-detail-panel {
    cursor: grab;
  }

  .map-detail__content {
    cursor: default;
  }

  .map-detail__drag-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 0;
  }

  .map-detail__drag-handle span {
    width: 36px;
    height: 3px;
    border-radius: 3px;
    background: rgba(250, 248, 245, 0.15);
    transition: background 0.2s ease;
  }

  .map-detail__drag-handle:hover span {
    background: rgba(250, 248, 245, 0.3);
  }

  .map-detail__back {
    display: none;
  }

  .map-detail__close {
    display: flex;
    top: 12px;
    right: 12px;
  }

  .map-detail__hero {
    margin: 44px var(--space-md) 0;
  }

  .map-detail__image-wrap {
    border-radius: 12px;
  }

  .map-detail__content {
    padding: var(--space-md) var(--space-md) var(--space-lg);
  }

  .map-detail__name {
    font-size: clamp(1.5rem, 2vw, 1.85rem);
  }

  .map-detail__tagline {
    font-size: 1.15rem;
  }

  .map-detail__link {
    padding: 11px 18px;
    font-size: 0.8125rem;
  }
}

/* ---- Compact card below 1700px ---- */
@media (min-width: 1101px) and (max-width: 1699px) {
  .map-detail-panel {
    width: 350px;
  }

  .map-detail__hero {
    margin: 40px var(--space-sm) 0;
  }

  .map-detail__image-wrap {
    aspect-ratio: 16 / 9;
    border-radius: 10px;
  }

  .map-detail__content {
    padding: var(--space-sm) var(--space-sm) var(--space-md);
  }

  .map-detail__name {
    font-size: clamp(1.35rem, 2vw, 1.65rem);
  }

  .map-detail__tagline {
    font-size: 1.05rem;
    line-height: 1.35;
  }

  .map-detail__description {
    font-size: 0.8125rem;
    line-height: 1.65;
    margin-bottom: var(--space-md);
  }

  .map-detail__location {
    font-size: 0.75rem;
    margin-bottom: var(--space-sm);
  }

  .map-detail__link {
    padding: 10px 16px;
    font-size: 0.78rem;
  }

  .map-detail__badge {
    padding: 4px 10px;
    font-size: 0.5625rem;
  }

  .map-detail__accent {
    margin-bottom: var(--space-sm);
  }

  .map-detail__divider {
    margin: var(--space-sm) 0;
  }
}

/* ---- Laptop: even narrower floating card ---- */
@media (min-width: 1101px) and (max-width: 1199px) {
  .map-detail-panel {
    width: 320px;
    right: 16px;
    top: 72px;
  }

  .map-detail__name {
    font-size: clamp(1.3rem, 2vw, 1.55rem);
  }

  .map-detail-panel--tour-mode {
    width: min(560px, calc(100vw - 40px));
  }
}

/* Tour-mode width for mid-desktop (1200–1699px) */
@media (min-width: 1200px) and (max-width: 1699px) {
  .map-detail-panel--tour-mode {
    width: min(600px, calc(100vw - 40px));
  }
}

/* Hide tabs on large desktop (separate tour panel at ≥1700px) */
@media (min-width: 1700px) {
  .map-detail__tabs {
    display: none !important;
  }
}

/* ---- 360° Tour panel (wide screens only) ---- */
.map-tour-panel {
  display: none;
}

.map-tour-panel[hidden] {
  display: none !important;
}

@media (min-width: 1700px) {
  .map-tour-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 420px;
    bottom: 24px;
    width: 600px;
    border-radius: 16px;
    background: rgba(10, 22, 40, 0.92);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border: 1px solid rgba(250, 248, 245, 0.08);
    box-shadow:
      0 8px 40px rgba(0, 0, 0, 0.4),
      0 0 0 1px rgba(250, 248, 245, 0.04);
    z-index: 200;
    padding: 20px;
    animation: tour-card-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 0.15s;
  }

  .map-tour-panel[hidden] {
    display: none !important;
  }
}

@keyframes tour-card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.map-tour__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 22, 40, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(250, 248, 245, 0.15);
  border-radius: 50%;
  color: rgba(250, 248, 245, 0.75);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  z-index: 5;
}

.map-tour__close svg {
  width: 14px;
  height: 14px;
}

.map-tour__close:hover {
  background: rgba(10, 22, 40, 0.85);
  border-color: rgba(250, 248, 245, 0.25);
  color: var(--color-warm-white);
}

.map-tour__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-right: 40px;
  cursor: grab;
}

.map-tour__icon {
  width: 20px;
  height: 20px;
  color: var(--color-gold);
  opacity: 0.6;
  flex-shrink: 0;
}

.map-tour__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 400;
  color: rgba(250, 248, 245, 0.6);
  margin: 0;
  white-space: nowrap;
}

.map-tour__accent {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(196, 145, 138, 0.35), transparent);
  margin-left: 12px;
}

.map-tour__embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  flex: 1;
  min-height: 0;
}

.map-tour__embed iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ---- Panel resize handles (wide screens only) ---- */
.map-panel-resize {
  display: none;
}

@media (min-width: 1101px) {
  .map-panel-resize {
    display: block;
    position: absolute;
    width: 24px;
    height: 24px;
    z-index: 10;
  }

  .map-panel-resize--br { bottom: 0; right: 0; cursor: nwse-resize; }
  .map-panel-resize--bl { bottom: 0; left: 0;  cursor: nesw-resize; }
  .map-panel-resize--tr { top: 0;    right: 0; cursor: nesw-resize; }
  .map-panel-resize--tl { top: 0;    left: 0;  cursor: nwse-resize; }

  /* Subtle corner marks */
  .map-panel-resize::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-color: rgba(250, 248, 245, 0.12);
    border-style: solid;
    border-width: 0;
    transition: border-color 0.2s ease;
  }

  .map-panel-resize--br::before {
    bottom: 6px; right: 6px;
    border-right-width: 2px; border-bottom-width: 2px;
    border-radius: 0 0 3px 0;
  }

  .map-panel-resize--bl::before {
    bottom: 6px; left: 6px;
    border-left-width: 2px; border-bottom-width: 2px;
    border-radius: 0 0 0 3px;
  }

  .map-panel-resize--tr::before {
    top: 6px; right: 6px;
    border-right-width: 2px; border-top-width: 2px;
    border-radius: 0 3px 0 0;
  }

  .map-panel-resize--tl::before {
    top: 6px; left: 6px;
    border-left-width: 2px; border-top-width: 2px;
    border-radius: 3px 0 0 0;
  }

  .map-panel-resize:hover::before {
    border-color: rgba(196, 145, 138, 0.45);
  }
}

/* ---- Map canvas ---- */
.map-canvas {
  flex: 1;
  position: relative;
}

.map-canvas::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 120px 50px rgba(10, 22, 40, 0.55);
  pointer-events: none;
  z-index: 1;
}

/* Custom Mapbox controls */
.map-canvas .mapboxgl-ctrl-group {
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(250, 248, 245, 0.1);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.map-canvas .mapboxgl-ctrl-group button {
  width: 36px;
  height: 36px;
  border: none;
}

.map-canvas .mapboxgl-ctrl-group button + button {
  border-top: 1px solid rgba(250, 248, 245, 0.1);
}

.map-canvas .mapboxgl-ctrl-group button:hover {
  background: rgba(250, 248, 245, 0.1);
}

.map-canvas .mapboxgl-ctrl-group button .mapboxgl-ctrl-icon {
  filter: invert(1) brightness(0.85);
}

.map-canvas .mapboxgl-ctrl-attrib {
  background: rgba(10, 22, 40, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 6px;
}

.map-canvas .mapboxgl-ctrl-attrib a {
  color: rgba(250, 248, 245, 0.4);
}

/* ---- Mobile sidebar toggle ---- */
.map-sidebar-toggle {
  display: none;
  position: fixed;
  top: 90px;
  left: 12px;
  z-index: 200;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(10, 22, 40, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(250, 248, 245, 0.12);
  border-radius: 10px;
  color: var(--color-warm-white);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: background var(--duration-fast);
}

.map-sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.map-sidebar-toggle:hover {
  background: rgba(10, 22, 40, 0.95);
}

.map-sidebar-toggle__count {
  color: var(--color-aurora);
  font-weight: 500;
}

/* ---- Hamburger nav button (top-right) ---- */
.map-nav-burger {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(250, 248, 245, 0.15);
  border-radius: 12px;
  background: rgba(10, 22, 40, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.map-nav-burger:hover {
  background: rgba(10, 22, 40, 0.85);
  border-color: rgba(250, 248, 245, 0.25);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.map-nav-burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-warm-white);
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

/* X state */
.map-nav-burger--open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.map-nav-burger--open span:nth-child(2) {
  opacity: 0;
}
.map-nav-burger--open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Nav drawer — slides in from right, auto-width */
.map-nav-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 550;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  min-width: 420px;
  padding: 80px 48px 48px;
  background: rgba(10, 22, 40, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(250, 248, 245, 0.08);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.map-nav-overlay--visible {
  transform: translateX(0);
}

.map-nav-overlay__nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.map-nav-overlay__nav a {
  display: block;
  padding: 10px 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: rgba(250, 248, 245, 0.6);
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.map-nav-overlay__nav a:hover {
  color: var(--color-warm-white);
}

.map-nav-overlay__active {
  color: var(--color-gold) !important;
  font-weight: 500;
}

.map-nav-overlay__member {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid rgba(250, 248, 245, 0.15);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(250, 248, 245, 0.6);
  letter-spacing: 0.02em;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.map-nav-overlay__member:hover {
  color: var(--color-warm-white);
  border-color: var(--color-gold);
  background: rgba(196, 145, 138, 0.1);
}

/* ============================================
   RESPONSIVE — Tablet & Mobile
   ============================================ */
@media (max-width: 1100px) {
  .map-sidebar {
    width: 320px;
  }

  /* Content-fit panel: shrinks to content, scrolls if too tall */
  .map-detail-panel {
    width: 320px;
    inset: 0 auto 0 0 !important;
    height: auto !important;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }

  /* Reduce top space — back button sits near top */
  .map-detail__back {
    padding-top: var(--space-md);
  }

  /* Tighter content padding */
  .map-detail__content {
    padding: var(--space-sm) var(--space-lg) var(--space-md);
  }

  .map-detail__hero {
    margin-top: var(--space-xs);
  }

  /* Let actions sit right after content instead of pushing to bottom */
  .map-detail__actions {
    margin-top: var(--space-md);
  }

  /* Tour-mode: expand to full height + wider for iframe */
  .map-detail-panel--tour-mode {
    width: min(600px, calc(100vw - 24px));
    max-height: 100vh;
    max-height: 100dvh;
  }

  /* Tour embed fills available height instead of fixed aspect-ratio */
  .map-detail-panel--tour-mode .map-detail__tour {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
  }

  .map-detail-panel--tour-mode .map-detail__tour-embed {
    aspect-ratio: auto;
    flex: 1;
    height: 100%;
  }

  /* ---- Tablet tour-mode transition ---- */

  /* Info content fades out smoothly */
  .map-detail-panel--tour-transitioning .map-detail__hero,
  .map-detail-panel--tour-transitioning .map-detail__content {
    transition: opacity 0.22s ease, transform 0.22s ease;
    opacity: 0;
    transform: translateY(-8px);
  }

  /* Tour embed fades in */
  .map-detail__tour {
    transition: opacity 0.3s ease 0.15s, transform 0.3s ease 0.15s;
  }

  .map-detail-panel--tour-transitioning .map-detail__tour:not([hidden]) {
    opacity: 0;
    transform: translateY(10px);
  }

  .map-detail-panel--tour-mode .map-detail__tour:not([hidden]) {
    opacity: 1;
    transform: translateY(0);
  }

  /* Back-button fades in when returning to info */
  .map-detail-panel--info-returning .map-detail__hero,
  .map-detail-panel--info-returning .map-detail__content {
    opacity: 0;
    transform: translateY(10px);
  }

  .map-detail-panel--info-returned .map-detail__hero,
  .map-detail-panel--info-returned .map-detail__content {
    transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 601px) and (min-device-width: 601px) and (max-width: 1100px) {
  .map-page {
    --panel-swap-duration: 620ms;
    --panel-swap-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --panel-content-duration: 520ms;
    --panel-content-ease: cubic-bezier(0.2, 0.72, 0.22, 1);
  }

  .map-sidebar {
    transition: opacity var(--panel-swap-duration) var(--panel-swap-ease),
                transform var(--panel-swap-duration) var(--panel-swap-ease),
                filter var(--panel-swap-duration) var(--panel-swap-ease);
    transform-origin: left center;
    will-change: opacity, transform, filter;
  }

  .map-sidebar--detail-hidden {
    opacity: 0;
    transform: translateX(-20px) scale(0.985);
    filter: blur(1.5px);
    pointer-events: none;
  }

  .map-detail-panel {
    animation: none;
    transition: opacity var(--panel-swap-duration) var(--panel-swap-ease),
                transform var(--panel-swap-duration) var(--panel-swap-ease),
                filter var(--panel-swap-duration) var(--panel-swap-ease),
                width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: left center;
    will-change: opacity, transform, filter;
  }

  .map-detail-panel[hidden].map-detail-panel--transitioning {
    display: flex !important;
  }

  .map-detail-panel--from-sidebar,
  .map-detail-panel--exit {
    opacity: 0;
    transform: translateX(26px) scale(0.985);
    filter: blur(1.5px);
    pointer-events: none;
  }

  .map-detail-panel--enter {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0);
    pointer-events: auto;
  }

  .map-detail-panel .map-detail__back,
  .map-detail-panel .map-detail__tabs,
  .map-detail-panel .map-detail__hero,
  .map-detail-panel .map-detail__content,
  .map-detail-panel .map-detail__tour {
    transition: opacity var(--panel-content-duration) var(--panel-content-ease),
                transform var(--panel-content-duration) var(--panel-content-ease);
    will-change: opacity, transform;
  }

  .map-detail-panel--from-sidebar .map-detail__back,
  .map-detail-panel--from-sidebar .map-detail__tabs,
  .map-detail-panel--from-sidebar .map-detail__hero,
  .map-detail-panel--from-sidebar .map-detail__content,
  .map-detail-panel--from-sidebar .map-detail__tour,
  .map-detail-panel--exit .map-detail__back,
  .map-detail-panel--exit .map-detail__tabs,
  .map-detail-panel--exit .map-detail__hero,
  .map-detail-panel--exit .map-detail__content,
  .map-detail-panel--exit .map-detail__tour {
    opacity: 0;
    transform: translateY(14px);
  }

  .map-detail-panel--enter .map-detail__back,
  .map-detail-panel--enter .map-detail__tabs,
  .map-detail-panel--enter .map-detail__hero,
  .map-detail-panel--enter .map-detail__content,
  .map-detail-panel--enter .map-detail__tour {
    opacity: 1;
    transform: translateY(0);
  }

  .map-detail-panel--enter .map-detail__back { transition-delay: 40ms; }
  .map-detail-panel--enter .map-detail__tabs { transition-delay: 90ms; }
  .map-detail-panel--enter .map-detail__hero { transition-delay: 140ms; }
  .map-detail-panel--enter .map-detail__content { transition-delay: 210ms; }
  .map-detail-panel--enter .map-detail__tour { transition-delay: 230ms; }
}

@media (prefers-reduced-motion: reduce) {
  .map-sidebar,
  .map-detail-panel {
    transition: none !important;
  }
}

@media (max-width: 600px), (max-device-width: 600px) {
  .map-detail-panel {
    inset: auto 0 0 0 !important;
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    height: 52dvh !important;
    max-height: 52dvh !important;
    min-height: 46dvh !important;
  }

  html.map-viewport-locked,
  html.map-viewport-locked body.map-body {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden !important;
    overflow-x: clip;
    overscroll-behavior: none;
  }

  html.map-viewport-locked body.map-body {
    position: fixed;
    inset: 0;
  }

  #map-sidebar.map-sidebar {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .map-page {
    position: relative;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overflow-x: clip;
    overscroll-behavior: none;
  }

  .map-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    overflow: hidden;
    overflow-x: clip;
  }

  /* Sidebar, toggle and overlay are hidden on mobile via mobile-first base rules.
     No need to redeclare display:none here — they're already hidden. */

  /* Mapbox controls — sit below the carousel, flush to bottom */
  .map-canvas .mapboxgl-ctrl-bottom-right {
    right: 8px !important;
    bottom: 2px !important;
    z-index: 50 !important;
  }

  .map-canvas .mapboxgl-ctrl-bottom-right .mapboxgl-ctrl {
    margin: 0 !important;
  }

  .map-canvas .mapboxgl-ctrl-bottom-right .mapboxgl-ctrl-attrib {
    margin: 0 !important;
    background: rgba(10, 22, 40, 0.5);
    border-radius: 10px;
    font-size: 10px;
    padding: 2px 6px;
    opacity: 0.6;
  }

  .map-canvas .mapboxgl-ctrl-bottom-left {
    bottom: 2px !important;
    left: 8px !important;
    z-index: 50 !important;
  }

  .map-canvas .mapboxgl-ctrl-bottom-left .mapboxgl-ctrl {
    margin: 0 !important;
  }

  .map-canvas .mapboxgl-ctrl-top-right {
    top: calc(var(--map-mobile-controls-bottom, 118px) + 16px);
    left: 16px;
    right: auto;
  }

  /* Align burger with floating search bar */
  .map-nav-burger {
    top: max(14px, env(safe-area-inset-top));
    right: 16px;
  }

  /* ---- Bottom sheet detail panel ---- */
  .map-detail-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: 52dvh !important;
    max-height: calc(100dvh - (var(--map-mobile-controls-bottom, 118px) + 12px));
    min-height: 46dvh;
    transform: translateY(0);
    border-radius: 20px 20px 0 0;
    background: rgba(10, 22, 40, 0.86);
    backdrop-filter: blur(14px) saturate(125%);
    -webkit-backdrop-filter: blur(14px) saturate(125%);
    border-top: 1px solid rgba(250, 248, 245, 0.1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
    will-change: transform;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    opacity: 1;
    z-index: 500;
    touch-action: pan-y;
    pointer-events: auto;
    overscroll-behavior: contain;
  }

  /* Scroll hint — sticky gradient + bouncing chevron */
  .map-detail__scroll-hint {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 56px;
    padding-bottom: 8px;
    background: linear-gradient(to bottom, transparent 0%, rgba(10, 22, 40, 0.7) 50%, rgba(10, 22, 40, 0.92) 100%);
    pointer-events: none;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.4s ease;
  }

  .map-detail__scroll-hint svg {
    color: rgba(250, 248, 245, 0.5);
    animation: scroll-hint-bounce 1.8s ease-in-out infinite;
  }

  .map-detail__scroll-hint--hidden {
    opacity: 0;
  }

  @keyframes scroll-hint-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
  }

  .map-detail-panel--mobile-animated {
    transition: transform 1.5s cubic-bezier(0.22, 0.88, 0.2, 1);
    will-change: transform;
  }

  .map-detail-panel--mobile-enter-start,
  .map-detail-panel--mobile-exit {
    transform: translate3d(0, 100%, 0);
    pointer-events: none;
  }

  .map-detail__drag-handle {
    display: none;
    justify-content: center;
    padding: 16px 56px 12px 16px;
    cursor: grab;
    touch-action: none;
    -ms-touch-action: none;
  }

  .map-detail__drag-handle span {
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: rgba(250, 248, 245, 0.25);
    pointer-events: none;
  }

  /* Prevent scroll/pan during active drag */
  .map-detail-panel--dragging {
    touch-action: none;
  }

  .map-detail__back {
    display: none;
  }

  .map-detail__close {
    display: flex;
    position: sticky;
    top: calc(14px + env(safe-area-inset-top, 0px));
    right: auto;
    margin: 0 14px 0 auto;
    padding: 0;
    align-self: flex-end;
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 12;
    border-color: rgba(250, 248, 245, 0.26);
    background: rgba(10, 22, 40, 0.84);
  }

  body.map-body--detail-open .map-nav-burger {
    opacity: 0;
    pointer-events: none;
  }

  .map-detail__name {
    font-size: clamp(1.85rem, 6vw, 2.25rem);
  }

  .map-detail__content {
    flex: 0 0 auto;
    overflow: visible;
    touch-action: pan-y;
    min-height: auto;
    padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom, 36px));
  }

  /* Peek state: hide heavy content */
  .map-detail-panel--peek .map-detail__tour {
    display: none;
  }


  /* Safe area for home indicator */
  .map-detail__actions {
    padding-bottom: env(safe-area-inset-bottom, 16px);
    margin-top: var(--space-lg);
  }

  /* Disable transition during drag */
  .map-detail-panel--dragging {
    transition: none !important;
  }

  .map-canvas {
    width: 100%;
    height: 100vh;
  }

  /* Nav overlay — fit to screen */
  .map-nav-overlay {
    min-width: 0;
    width: min(420px, 100%);
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: 70px 36px 40px;
  }

  /* Overlay when sidebar is open */
  .map-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 450;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }

  .map-sidebar-overlay--visible {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 480px) {
  .map-detail-panel {
    border-radius: 16px 16px 0 0;
  }

  .map-detail__name {
    font-size: clamp(1.7rem, 6.4vw, 2.05rem);
  }

  /* Nav overlay — full-width on phones */
  .map-nav-overlay {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 60px 28px 32px;
  }

  .map-nav-overlay__nav a {
    font-size: 1.25rem;
  }
}

/* ============================================
   MOBILE-ONLY ELEMENTS — Desktop guard
   ============================================ */
@media (min-width: 601px) and (min-device-width: 601px) {
  .map-mobile-controls,
  .map-mobile-carousel,
  .map-mobile-filter-overlay {
    display: none !important;
  }
}

/* ============================================
   MOBILE FLOATING CONTROLS
   ============================================ */
@media (max-width: 600px), (max-device-width: 600px) {
  .map-mobile-controls {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    padding: 12px 16px 0;
    padding-top: max(12px, env(safe-area-inset-top));
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.map-body--detail-open .map-mobile-chips {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .map-mobile-search {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: center;
    min-height: 48px;
    height: 48px;
    background: rgba(10, 22, 40, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(250, 248, 245, 0.1);
    border-radius: var(--radius-full);
    margin-right: 64px;
    width: calc(100% - 64px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }

  .map-mobile-search__icon {
    position: absolute;
    left: 16px;
    width: 16px;
    height: 16px;
    color: rgba(250, 248, 245, 0.35);
    pointer-events: none;
    transition: color 0.25s ease;
  }

  .map-mobile-search__input {
    width: 100%;
    height: 100%;
    padding: 12px 40px 12px 44px;
    background: none;
    border: none;
    color: var(--color-warm-white);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    outline: none;
  }

  .map-mobile-search__input::placeholder {
    color: rgba(250, 248, 245, 0.3);
  }

  .map-mobile-search__input:focus {
    outline: none;
  }

  .map-mobile-search__input:focus ~ .map-mobile-search__icon {
    color: var(--color-gold);
  }

  .map-mobile-search__clear {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: rgba(250, 248, 245, 0.08);
    border: none;
    border-radius: 50%;
    color: rgba(250, 248, 245, 0.45);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
  }

  .map-mobile-search__clear[hidden] {
    display: none !important;
  }

  .map-mobile-search__clear svg {
    width: 12px;
    height: 12px;
  }

  .map-mobile-search__clear:active {
    background: rgba(250, 248, 245, 0.15);
    color: var(--color-warm-white);
  }

  /* ---- Filter chips ---- */
  .map-mobile-chips {
    pointer-events: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0 0;
    margin-right: 64px;
    width: calc(100% - 64px);
    transition: opacity 0.2s ease;
  }

  .map-mobile-chip {
    flex: 0 1 auto;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    min-height: 36px;
    background: rgba(10, 22, 40, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(250, 248, 245, 0.12);
    border-radius: var(--radius-full);
    color: rgba(250, 248, 245, 0.6);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 400;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  }

  .map-mobile-chip[hidden] {
    display: none !important;
  }

  .map-mobile-chip svg {
    flex-shrink: 0;
  }

  .map-mobile-chip:active {
    transform: scale(0.95);
  }

  .map-mobile-chip--active {
    border-color: rgba(196, 145, 138, 0.5);
    color: var(--color-gold);
    background: rgba(196, 145, 138, 0.12);
  }

  .map-mobile-chip--reset {
    border-color: rgba(250, 248, 245, 0.08);
    color: rgba(250, 248, 245, 0.4);
    font-size: 0.75rem;
  }
}

/* ============================================
   MOBILE VILLAGE CAROUSEL
   ============================================ */
@media (max-width: 600px), (max-device-width: 600px) {
  .map-mobile-carousel {
    position: fixed;
    bottom: 12px;
    left: 0;
    right: 0;
    z-index: 150;
    padding: 0 0 16px;
    padding-bottom: max(16px, calc(env(safe-area-inset-bottom) + 4px));
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: 100vw;
    overflow-x: clip;
  }

  /* Gradient fade above carousel — softens map-to-cards transition */
  .map-mobile-carousel::before {
    content: '';
    position: absolute;
    top: -40px;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(10, 22, 40, 0.25));
    pointer-events: none;
    z-index: -1;
  }

  /* Right edge fade — hints at more cards */
  .map-mobile-carousel::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 32px;
    background: linear-gradient(to right, transparent, rgba(10, 22, 40, 0.6));
    pointer-events: none;
    z-index: 2;
    opacity: 1;
    transition: opacity 0.3s ease;
  }

  .map-mobile-carousel--at-end::after {
    opacity: 0;
  }

  .map-mobile-carousel--intro-prep {
    opacity: 0;
    transform: translateY(18px);
    pointer-events: none;
  }

  .map-mobile-carousel--intro-prep.map-mobile-carousel--intro-in {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 1s cubic-bezier(0.22, 0.88, 0.2, 1), transform 1s cubic-bezier(0.22, 0.88, 0.2, 1);
  }

  body.map-body--detail-open .map-mobile-carousel {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
  }

  .map-mobile-carousel__track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding: 0 20px;
    padding: 0 20px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }

  .map-mobile-carousel__track::-webkit-scrollbar {
    display: none;
  }

  .map-mobile-carousel__card {
    flex-shrink: 0;
    width: 280px;
    scroll-snap-align: center;
    background: rgba(10, 22, 40, 0.82);
    backdrop-filter: blur(24px) saturate(130%);
    -webkit-backdrop-filter: blur(24px) saturate(130%);
    border: 1px solid rgba(250, 248, 245, 0.08);
    border-radius: 18px;
    padding: 16px 16px 18px;
    display: flex;
    gap: 14px;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.25s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease, background 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
      inset 0 1px 0 rgba(250, 248, 245, 0.06),
      0 8px 32px rgba(0, 0, 0, 0.35),
      0 2px 8px rgba(0, 0, 0, 0.2);
  }

  .map-mobile-carousel__card:active {
    transform: scale(0.96);
    background: rgba(10, 22, 40, 0.88);
  }

  .map-mobile-carousel__card--active {
    border-color: rgba(196, 145, 138, 0.6);
    background: rgba(10, 22, 40, 0.88);
    transform: translateY(-2px);
    box-shadow:
      inset 0 1px 0 rgba(250, 248, 245, 0.08),
      0 8px 32px rgba(0, 0, 0, 0.4),
      0 0 0 1.5px rgba(196, 145, 138, 0.35),
      0 0 24px rgba(196, 145, 138, 0.1);
  }

  .map-mobile-carousel__card--active .map-mobile-carousel__name {
    color: var(--color-warm-white);
  }

  .map-mobile-carousel__card--active .map-mobile-carousel__accent {
    width: 36px;
    opacity: 0.8;
  }

  .map-mobile-carousel__card--active .map-mobile-carousel__thumb {
    transform: scale(1.03);
  }

  .map-mobile-carousel__card--active .map-mobile-carousel__member {
    opacity: 1;
  }

  .map-mobile-carousel__thumb {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(250, 248, 245, 0.05);
    border: 1px solid rgba(250, 248, 245, 0.06);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .map-mobile-carousel__info {
    flex: 1;
    min-width: 0;
  }

  .map-mobile-carousel__name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: rgba(250, 248, 245, 0.88);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15;
    letter-spacing: -0.01em;
    transition: color 0.25s ease;
  }

  .map-mobile-carousel__accent {
    display: block;
    width: 24px;
    height: 1.5px;
    border-radius: 1px;
    background: linear-gradient(90deg, var(--color-gold), rgba(196, 145, 138, 0.2));
    margin: 6px 0 0;
    opacity: 0.5;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  }

  .map-mobile-carousel__tagline {
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-style: italic;
    font-weight: 400;
    color: rgba(250, 248, 245, 0.38);
    margin: 4px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    transition: color 0.25s ease;
  }

  .map-mobile-carousel__card--active .map-mobile-carousel__tagline {
    color: rgba(250, 248, 245, 0.55);
  }

  .map-mobile-carousel__location {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    color: rgba(250, 248, 245, 0.38);
    margin: 4px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
  }

  .map-mobile-carousel__member {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--color-gold);
    opacity: 0.7;
    align-self: flex-start;
    margin-top: 18px;
    transition: opacity 0.25s ease;
  }

  /* Empty carousel */
  .map-mobile-carousel__empty {
    padding: 16px 20px;
    text-align: center;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-style: italic;
    color: rgba(250, 248, 245, 0.35);
    width: 100%;
  }

  /* Reduced motion: disable carousel transitions */
  @media (prefers-reduced-motion: reduce) {
    .map-mobile-carousel,
    .map-mobile-carousel__card,
    .map-mobile-carousel__accent,
    .map-mobile-carousel__thumb,
    .map-mobile-carousel__name,
    .map-mobile-carousel__member {
      transition: none !important;
    }

    .map-detail__scroll-hint svg {
      animation: none !important;
    }
  }
}

/* ============================================
   MOBILE FILTER OVERLAY
   ============================================ */
@media (max-width: 600px), (max-device-width: 600px) {
  .map-mobile-filter-overlay {
    position: fixed;
    inset: 0;
    z-index: 700;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }

  .map-mobile-filter-overlay[hidden] {
    display: none !important;
  }

  .map-mobile-filter-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: filterBackdropIn 0.2s ease both;
  }

  @keyframes filterBackdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .map-mobile-filter-overlay__sheet {
    position: relative;
    background: rgba(10, 22, 40, 0.98);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border-top: 1px solid rgba(250, 248, 245, 0.1);
    border-radius: 20px 20px 0 0;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 env(safe-area-inset-bottom, 16px);
    animation: filterSheetUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  }

  @keyframes filterSheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .map-mobile-filter-overlay__handle {
    display: flex;
    justify-content: center;
    padding: 14px 0 8px;
  }

  .map-mobile-filter-overlay__handle span {
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: rgba(250, 248, 245, 0.2);
  }

  .map-mobile-filter-overlay__title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--color-warm-white);
    margin: 0;
    padding: 0 20px 12px;
    border-bottom: 1px solid rgba(250, 248, 245, 0.06);
  }

  .map-mobile-filter-overlay__options {
    padding: 8px 0;
  }

  .map-mobile-filter-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    min-height: 48px;
    background: none;
    border: none;
    color: rgba(250, 248, 245, 0.7);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .map-mobile-filter-option:active {
    background: rgba(250, 248, 245, 0.05);
  }

  .map-mobile-filter-option--active {
    color: var(--color-gold);
  }

  .map-mobile-filter-option__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid rgba(250, 248, 245, 0.2);
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
  }

  .map-mobile-filter-option--active .map-mobile-filter-option__dot {
    background: var(--color-gold);
    border-color: var(--color-gold);
  }

  /* ---- Improved bottom sheet peek state ---- */
  .map-detail-panel--peek .map-detail__hero {
    display: block !important;
  }

  .map-detail-panel--peek .map-detail__image-wrap {
    position: absolute;
    left: 16px;
    top: 44px;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
  }

  .map-detail-panel--peek .map-detail__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .map-detail-panel--peek .map-detail__badge {
    display: none;
  }

  .map-detail-panel--peek .map-detail__content {
    padding-left: 84px;
    padding-top: 0;
  }

  .map-detail-panel--peek .map-detail__name {
    font-size: 1.1rem;
    margin-bottom: 2px;
  }

  .map-detail-panel--peek .map-detail__accent {
    display: none;
  }

  .map-detail-panel--peek .map-detail__tagline {
    display: none;
  }

  .map-detail-panel--peek .map-detail__location {
    font-size: 0.75rem;
  }
}


