/* ─────────────────────────────────────────────────────────────
   MAP PAGE — Layout & Interactions
   Gallery Map
───────────────────────────────────────────────────────────── */

/* ── Layout ────────────────────────────────────────── */
html, body { height: 100%; overflow: hidden; }

body.map-page {
  background: var(--c-white);
  overflow: hidden;
}

/* ── Map Container ─────────────────────────────────── */
#map {
  position: fixed;
  inset: 0;
  top: var(--header-h);
  z-index: var(--z-map);
  background: var(--c-white);
  overflow: hidden;
}

/* SVG fills the container */
#map svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#map svg:active { cursor: grabbing; }

/* ── Map Attribution ───────────────────────────────── */
.map-attribution {
  position: fixed;
  bottom: var(--sp-12);
  left: var(--sp-12);
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--c-muted);
  letter-spacing: 0.03em;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(6px);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  z-index: var(--z-overlay);
  pointer-events: none;
}
.map-attribution a { color: var(--c-muted); pointer-events: auto; }

/* ── Zoom Controls ─────────────────────────────────── */
.map-zoom-controls {
  position: fixed;
  left: var(--sp-20);
  top: calc(var(--header-h) + var(--sp-16));
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  z-index: var(--z-overlay);
  animation: fadeIn 600ms ease 300ms both;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-18);
  line-height: 1;
  color: var(--c-body);
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  user-select: none;
}
.zoom-btn:hover {
  background: var(--c-surface);
  border-color: var(--c-border-mid);
  transform: scale(1.05);
}
.zoom-btn:active { transform: scale(0.95); }

/* ── Zoom Level Indicator ───────────────────────────── */
.zoom-level-indicator {
  position: fixed;
  right: var(--sp-20);
  top: calc(var(--header-h) + var(--sp-16));
  width: 36px;
  height: calc(36px * 2 + var(--sp-6)); /* matches combined zoom btn height */
  /* reuses .zoom-btn visual style */
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-xs);
  z-index: var(--z-overlay);
  animation: fadeIn 600ms ease 300ms both;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  touch-action: none;
}
.zoom-level-indicator:hover {
  background: var(--c-surface);
  border-color: var(--c-border-mid);
}

.zoom-track {
  width: 0.5px;
  height: calc(100% - var(--sp-12));
  background: var(--c-black);
  border-radius: var(--r-pill);
  position: relative;
  pointer-events: none;
}

.zoom-thumb {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 2px;
  background: var(--c-black);
  border-radius: 1px;
  bottom: 0;
  transition: bottom 120ms ease-out;
  pointer-events: none;
}
.zoom-level-indicator.is-dragging .zoom-thumb {
  transition: none;
}

/* ── City Badge ────────────────────────────────────── */
.city-badge {
  position: fixed;
  top: calc(var(--header-h) + var(--sp-16));
  left: 0;
  right: 0;
  width: fit-content;
  margin: 0 auto;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  padding: var(--sp-6) var(--sp-16);
  font-family: var(--font-sans);
  font-size: var(--text-11);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-subtle);
  z-index: var(--z-overlay);
  opacity: 0;
  transition: opacity 350ms ease;
  white-space: normal;
  text-align: center;
  max-width: calc(100% - 140px); /* 70px each side clears the zoom controls */
  box-shadow: var(--shadow-xs);
  pointer-events: none;
}
.city-badge.visible {
  opacity: 1;
}

/* ── Gallery Count Badge ───────────────────────────── */
.gallery-count {
  position: fixed;
  bottom: var(--sp-20);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  padding: var(--sp-6) var(--sp-16);
  font-family: var(--font-sans);
  font-size: var(--text-11);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-subtle);
  z-index: var(--z-overlay);
  animation: fadeIn 600ms ease 400ms both;
  white-space: nowrap;
  pointer-events: none;
}

/* ── Gallery Preview Panel ─────────────────────────── */
.gallery-preview {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-panel);
  transform: translateY(100%);
  transition: transform 360ms cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.gallery-preview.visible {
  transform: translateY(0);
}

.preview-inner {
  background: var(--c-white);
  border-top: 1px solid var(--c-border);
  border-radius: var(--r-md) var(--r-md) 0 0;
  padding: var(--sp-24) var(--sp-24) calc(var(--sp-24) + env(safe-area-inset-bottom));
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.1);
}

/* Drag handle */
.preview-handle {
  width: 36px;
  height: 3px;
  background: var(--c-border-mid);
  border-radius: var(--r-pill);
  margin: 0 auto var(--sp-16);
  flex-shrink: 0;
}

/* ── Preview top bar: pin (left) + close (right) ───── */
.preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-12);
}

.preview-pin-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  font-size: var(--text-12);
  font-weight: var(--fw-ui);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  flex-shrink: 0;
}
.preview-pin-btn:hover { background: var(--c-surface); color: var(--c-black); border-color: var(--c-muted); }
.preview-pin-btn.pinned {
  background: var(--c-black);
  border-color: var(--c-black);
  color: var(--c-white);
}
.preview-pin-btn.pinned .pin-icon ellipse { fill: currentColor; }
.preview-pin-btn.pinned .pin-icon line { stroke: var(--c-white); }

.preview-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--c-muted);
  font-size: var(--text-18);
  transition: background var(--t-fast), color var(--t-fast);
  flex-shrink: 0;
}
.preview-close:hover { background: var(--c-surface); color: var(--c-black); }

/* Name comes first — before tags */
.preview-name {
  font-family: var(--font-serif);
  font-size: var(--text-28);
  font-weight: var(--fw-heading);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--c-black);
  margin-bottom: var(--sp-12);
}

.preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-6);
  margin-bottom: var(--sp-16);
}

/* Divider */
.preview-divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: var(--sp-16) 0;
}

/* Contact info block */
.preview-contact {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
  margin-bottom: var(--sp-20);
}

.preview-contact-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-10);
}

.preview-contact-label {
  font-family: var(--font-sans);
  font-size: var(--text-11);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-muted);
  min-width: 52px;
  padding-top: 1px;
}

.preview-contact-value {
  font-family: var(--font-sans);
  font-size: var(--text-13);
  color: var(--c-body);
  line-height: 1.45;
}

.preview-contact-value a {
  color: var(--c-body);
  border-bottom: 1px solid var(--c-border);
  transition: border-color var(--t-fast), color var(--t-fast);
}
.preview-contact-value a:hover { color: var(--c-black); border-color: var(--c-black); }

.preview-unverified {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-8);
  background: var(--c-warning-bg);
  border: 1px solid var(--c-warning-border);
  border-radius: var(--r-md);
  padding: var(--sp-10) var(--sp-12);
  font-size: var(--text-12);
  color: var(--c-warning-text);
  line-height: 1.4;
  margin-bottom: var(--sp-16);
}

.preview-unverified-icon {
  flex-shrink: 0;
  font-style: normal;
  margin-top: 1px;
}

.preview-actions {
  display: flex;
  gap: var(--sp-10);
  align-items: center;
}

/* ── Cluster gallery list ──────────────────────────── */
.preview-gallery-list {
  display: none;
  flex-direction: column;
  margin-top: var(--sp-4);
}

.preview-list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  padding: var(--sp-20) 0;
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: opacity var(--t-fast);
}
.preview-list-item:first-child { border-top: 1px solid var(--c-border); }
.preview-list-item:hover { opacity: 0.6; }

.preview-list-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.preview-list-name {
  font-family: var(--font-serif);
  font-size: var(--text-16);
  font-weight: 500;
  color: var(--c-black);
  line-height: 1.2;
}

.preview-list-address {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--c-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-list-arrow {
  font-size: var(--text-13);
  color: var(--c-muted);
  flex-shrink: 0;
}

/* ── Preview Navigation (prev / next) ──────────────── */
.preview-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-10);
}

.preview-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1;
  padding: var(--sp-4) 0;
  color: var(--c-body);
  text-decoration: none;
  transition: color var(--t-fast);
}

.preview-nav-btn.next {
  align-items: flex-end;
  text-align: right;
}

.preview-nav-btn.disabled {
  opacity: 0.25;
  pointer-events: none;
}

.preview-nav-arrow {
  font-family: var(--font-serif);
  font-size: var(--text-18);
  line-height: 1;
  color: var(--c-black);
  transition: transform var(--t-fast);
}

.preview-nav-name {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--c-subtle);
  line-height: 1.3;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-nav-btn:hover:not(.disabled) .preview-nav-name {
  color: var(--c-body);
}
.preview-nav-btn.prev:hover:not(.disabled) .preview-nav-arrow {
  transform: translateX(-3px);
}
.preview-nav-btn.next:hover:not(.disabled) .preview-nav-arrow {
  transform: translateX(3px);
}

/* Dragging state — applied to outer panel during swipe */
.gallery-preview.is-dragging {
  transition: none !important;
}

/* ── Desktop: wider preview card ───────────────────── */
@media (min-width: 768px) {
  .gallery-preview {
    bottom: var(--sp-32);
    left: var(--sp-32);
    right: auto;
    max-width: 380px;
    border-radius: var(--r-md);
  }

  .preview-inner {
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding-bottom: var(--sp-24);
  }

  .preview-handle { display: none; }
}

/* ── Map loading state ─────────────────────────────── */
.map-loading {
  position: fixed;
  inset: 0;
  top: var(--header-h);
  background: var(--c-white);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-overlay);
  transition: opacity var(--t-slow);
}
.map-loading.hidden { opacity: 0; pointer-events: none; }

.loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-border-mid);
  animation: loadingPulse 1.2s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.2s; margin: 0 var(--sp-6); }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingPulse {
  0%, 80%, 100% { transform: scale(1); opacity: 0.4; }
  40% { transform: scale(1.4); opacity: 1; }
}

/* ── Selected dot pulse ─────────────────────────────── */
.dot-pulse-ring {
  animation: dotPulse 1.8s ease-out infinite;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

@keyframes dotPulse {
  0%   { transform: scale(1);   opacity: 0.45; }
  75%  { transform: scale(3);   opacity: 0;    }
  100% { transform: scale(3);   opacity: 0;    }
}
