/* ============================================================================
   Map page — Bluegrass Maker Map (v3)
   All sidebar selectors scoped under `.map-sidebar` to defend against
   cascade from main.css (which also uses names like `.market-card`).
   ============================================================================ */

body.map-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.map-body .footer { display: none; }

:root {
  --map-nav-h: 56px;
  --sidebar-w: 420px;
  --sheet-peek-h: 92px;
  --sheet-half-h: 48dvh;
  --sheet-full-h: 92dvh;
  --sheet-current-h: var(--sheet-half-h);

  --c-sage-wash: color-mix(in srgb, var(--sage) 38%, var(--cream));
  --c-forest-wash: color-mix(in srgb, var(--forest) 7%, var(--paper));
  --c-forest-soft: color-mix(in srgb, var(--forest) 26%, var(--border));
  --c-placeholder: linear-gradient(135deg,
    color-mix(in srgb, var(--sage) 45%, var(--cream)) 0%,
    color-mix(in srgb, var(--sage) 20%, var(--cream)) 100%);
}

/* ─── Layout shell ────────────────────────────────────────────────────────── */
.map-layout {
  position: fixed;
  top: var(--map-nav-h);
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  background: var(--cream);
}

.map-sidebar {
  background: var(--paper);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.map-main {
  position: relative;
  overflow: hidden;
  background: var(--cream);
}

#map {
  width: 100%;
  height: 100%;
  background: var(--cream);
}

/* Leaflet pins: allow the svg stroke to extend beyond viewBox without clipping */
.map-main .leaflet-marker-icon svg { overflow: visible; }

/* ─── Sidebar mobile drag handle ──────────────────────────────────────────── */
.map-sidebar .sidebar-handle-row { display: none; }

/* ─── Sidebar views ───────────────────────────────────────────────────────── */
.map-sidebar .sidebar-view {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.map-sidebar .sidebar-view[hidden] { display: none; }

/* ─── Search box ──────────────────────────────────────────────────────────── */
.map-sidebar .sidebar-search {
  position: relative;
  padding: 18px 20px 0;
  flex-shrink: 0;
}
.map-sidebar .sidebar-search input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: 40px;
  margin: 0;
  padding: 0 16px 0 40px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--cream);
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.map-sidebar .sidebar-search input:focus {
  border-color: var(--forest);
  background: var(--paper);
}
.map-sidebar .sidebar-search input::placeholder { color: var(--muted); }
.map-sidebar .ss-icon {
  position: absolute;
  left: 34px;
  top: 30px;
  color: var(--muted);
  pointer-events: none;
}

/* Search dropdown */
.map-sidebar .search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 20px;
  right: 20px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 50vh;
  overflow-y: auto;
  box-shadow: 0 8px 28px rgba(31, 61, 42, 0.14);
  z-index: 600;
  display: none;
}
.map-sidebar .search-results.show { display: block; }
.map-sidebar .sr-section { padding: 10px 0; }
.map-sidebar .sr-section + .sr-section { border-top: 1px solid var(--border); }
.map-sidebar .sr-label {
  padding: 0 16px 6px;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.map-sidebar .sr-item {
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.1s;
}
.map-sidebar .sr-item:hover { background: var(--cream); }
.map-sidebar .sr-item-name { font-size: 0.92rem; color: var(--ink); font-weight: 500; }
.map-sidebar .sr-item-meta { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.map-sidebar .sr-empty { padding: 18px; text-align: center; font-size: 0.88rem; color: var(--muted); }

/* ─── Time filters ────────────────────────────────────────────────────────── */
.map-sidebar .time-filters {
  display: flex;
  gap: 6px;
  padding: 14px 20px 0;
  flex-shrink: 0;
}
.map-sidebar .tf-pill {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.map-sidebar .tf-pill:hover {
  border-color: var(--forest);
  color: var(--forest);
}
.map-sidebar .tf-pill.active {
  background: var(--forest);
  color: var(--cream);
  border-color: var(--forest);
}

/* ─── Count label ─────────────────────────────────────────────────────────── */
.map-sidebar .sidebar-count {
  padding: 16px 20px 6px;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  flex-shrink: 0;
}

/* ─── Market list (horizontal cards with photo) ──────────────────────────── */
.map-sidebar .market-list {
  padding: 4px 14px 32px;
  flex: 0 1 auto;
}

/* Heavy overrides to defeat any .market-card or similar rule from main.css */
.map-sidebar .market-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 12px !important;
  padding: 12px !important;
  margin: 0 0 2px 0 !important;
  border: none !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: inherit !important;
  text-align: left !important;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  box-sizing: border-box !important;
  box-shadow: none;
  text-decoration: none;
}
.map-sidebar .market-card:hover { background: var(--cream); }
.map-sidebar .market-card.active {
  background: var(--c-forest-wash);
  box-shadow: inset 0 0 0 1px var(--c-forest-soft);
}

.map-sidebar .mc-photo {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--c-sage-wash);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.map-sidebar .mc-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.map-sidebar .mc-photo-placeholder {
  width: 100%;
  height: 100%;
  background: var(--c-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  color: var(--forest);
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.map-sidebar .mc-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
}

.map-sidebar .mc-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.006em;
  /* Clamp to 2 lines so cards stay uniform */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-sidebar .mc-when {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  color: var(--ink-2);
  font-weight: 500;
}
.map-sidebar .mc-when .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.map-sidebar .mc-when.is-open { color: var(--forest); }
.map-sidebar .mc-when.is-open .dot {
  background: var(--forest);
  box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--forest) 20%, transparent);
}
.map-sidebar .mc-when.is-soon { color: var(--rust); }
.map-sidebar .mc-when.is-soon .dot { background: var(--rust); }
.map-sidebar .mc-when.is-later .dot { background: var(--muted); }

.map-sidebar .mc-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.map-sidebar .mc-tag {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--c-sage-wash);
  color: var(--forest);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.map-sidebar .list-empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}
.map-sidebar .list-empty-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ─── Detail view ─────────────────────────────────────────────────────────── */
.map-sidebar .detail-back-row {
  padding: 14px 16px 8px;
  flex-shrink: 0;
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}
.map-sidebar .detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 4px;
  background: none;
  border: none;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--moss);
  cursor: pointer;
  transition: all 0.12s;
}
.map-sidebar .detail-back:hover {
  color: var(--forest);
  background: var(--cream);
}

.map-sidebar .detail-content {
  padding: 4px 22px 36px;
}

/* Featured photo at top of detail view */
.map-sidebar .d-hero {
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 12px;
  overflow: hidden;
  background: var(--c-sage-wash);
  margin-bottom: 18px;
  position: relative;
}
.map-sidebar .d-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.map-sidebar .d-hero-placeholder {
  width: 100%;
  height: 100%;
  background: var(--c-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
}
.map-sidebar .d-hero-placeholder .initial {
  font-family: var(--font-display);
  color: var(--forest);
  font-size: 4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  opacity: 0.85;
}
.map-sidebar .d-hero-placeholder .label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--moss);
  font-weight: 600;
}

.map-sidebar .d-eyebrow {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  margin-bottom: 8px;
}

.map-sidebar .d-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.55rem;
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 12px;
  letter-spacing: -0.012em;
}

.map-sidebar .d-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.94rem;
  font-weight: 600;
  margin: 0 0 18px;
}
.map-sidebar .d-status.is-open { color: var(--forest); }
.map-sidebar .d-status.is-soon { color: var(--rust); }
.map-sidebar .d-status.is-later { color: var(--ink-2); }
.map-sidebar .d-status.is-unknown { color: var(--muted); }
.map-sidebar .d-status .d-dot {
  width: 9px; height: 9px; border-radius: 50%;
  flex-shrink: 0;
}
.map-sidebar .d-status.is-open .d-dot {
  background: var(--forest);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 18%, transparent);
  animation: d-pulse 2.2s ease-in-out infinite;
}
@keyframes d-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--forest) 18%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--forest) 4%, transparent); }
}
.map-sidebar .d-status.is-soon .d-dot   { background: var(--rust); }
.map-sidebar .d-status.is-later .d-dot  { background: var(--ink-2); }
.map-sidebar .d-status.is-unknown .d-dot { background: var(--muted); }

.map-sidebar .d-notice {
  padding: 10px 14px;
  background: #FFF8E1;
  border-left: 3px solid var(--gold, #E6B84A);
  border-radius: 0 8px 8px 0;
  font-size: 0.86rem;
  color: var(--ink-2);
  margin-bottom: 18px;
}

.map-sidebar .d-venue {
  display: flex;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 10px;
  background: var(--cream);
  margin-bottom: 16px;
}
.map-sidebar .d-venue-icon {
  flex-shrink: 0;
  color: var(--moss);
  margin-top: 2px;
}
.map-sidebar .d-venue-text { flex: 1; min-width: 0; }
.map-sidebar .d-venue-text strong {
  display: block;
  font-size: 0.94rem;
  color: var(--ink);
  margin-bottom: 2px;
  font-weight: 600;
}
.map-sidebar .d-venue-text a {
  color: var(--moss);
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.map-sidebar .d-venue-text a:hover { color: var(--forest); }

/* Action button — single full-width Add to Calendar */
.map-sidebar .d-actions {
  margin-bottom: 18px;
}
.map-sidebar .d-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  border: 1px solid var(--forest);
  background: var(--paper);
  color: var(--forest);
  white-space: nowrap;
  box-sizing: border-box;
  margin: 0;
  width: 100%;
}
.map-sidebar .d-btn:hover {
  background: var(--forest);
  color: var(--cream);
}
.map-sidebar .d-btn svg { flex-shrink: 0; }
.map-sidebar .d-btn.on {
  background: var(--forest);
  color: var(--cream);
}
.map-sidebar .d-going-count {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-top: -2px;
  min-height: 1em;
}

/* Section label — used only for "Makers you might find here" now */
.map-sidebar .d-section-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 18px 0 6px;
}

/* Hours list — has its own top spacing since label was removed */
.map-sidebar .d-hours-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex; flex-direction: column;
  gap: 6px;
}
.map-sidebar .d-hours-item {
  padding: 10px 14px;
  background: var(--cream);
  border-radius: 8px;
  font-size: 0.88rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: baseline;
}
.map-sidebar .d-hours-item strong { color: var(--ink); font-weight: 600; }
.map-sidebar .d-hours-time { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.map-sidebar .d-hours-meta {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}
.map-sidebar .d-hours-meta.warn { color: var(--rust); }
.map-sidebar .d-freq-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--c-sage-wash);
  color: var(--forest);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

/* Amenities — chips, no label */
.map-sidebar .d-amenities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.map-sidebar .d-amenity {
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--cream);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-size: 0.76rem;
  font-weight: 500;
}

/* Maker rows — simplified: bigger rounded-square photo + name only */
.map-sidebar .d-maker-caveat {
  font-size: 0.76rem;
  color: var(--muted);
  font-style: italic;
  margin: -4px 0 12px;
  line-height: 1.45;
}
.map-sidebar .d-maker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.map-sidebar .d-maker-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 4px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.12s;
}
.map-sidebar .d-maker-row:hover { background: var(--cream); }
.map-sidebar .d-maker-ph {
  width: 128px; height: 128px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--c-sage-wash);
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-sidebar .d-maker-ph img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.map-sidebar .d-maker-ph .pl {
  font-family: var(--font-display);
  color: var(--forest);
  font-weight: 600;
  font-size: 2.6rem;
  line-height: 1;
}
.map-sidebar .d-maker-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}
.map-sidebar .d-maker-more {
  padding: 10px 6px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

/* Organizer footer links */
.map-sidebar .d-footer-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 22px;
}
.map-sidebar .d-footer-links a {
  padding: 7px 12px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-size: 0.82rem;
  text-decoration: none;
  transition: all 0.12s;
}
.map-sidebar .d-footer-links a:hover {
  border-color: var(--forest);
  color: var(--forest);
}

/* Full-page CTA */
.map-sidebar .d-full-page-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--c-forest-wash);
  border-radius: 10px;
  text-decoration: none;
  color: var(--forest);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.96rem;
  transition: background 0.12s;
  margin-top: 6px;
}
.map-sidebar .d-full-page-link:hover {
  background: color-mix(in srgb, var(--forest) 12%, var(--cream));
}
.map-sidebar .d-full-page-link .arr { transition: transform 0.15s; }
.map-sidebar .d-full-page-link:hover .arr { transform: translateX(3px); }

/* ─── Map chrome ──────────────────────────────────────────────────────────── */
.map-main .map-fab {
  position: absolute;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--forest);
  box-shadow: 0 3px 12px rgba(31,61,42,0.14);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  transition: all 0.15s;
}
.map-main .map-fab:hover {
  background: var(--forest);
  color: var(--cream);
  border-color: var(--forest);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(31,61,42,0.2);
}
.map-main .fab-near { top: 16px; right: 16px; }

.map-main .map-legend {
  position: absolute;
  bottom: 18px;
  right: 18px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 0.76rem;
  color: var(--ink-2);
  box-shadow: 0 3px 12px rgba(31,61,42,0.08);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: bottom 0.3s cubic-bezier(0.32,0.72,0,1);
}
.map-main .legend-pin {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 7px;
}
.map-main .legend-pin.pin-open { background: var(--forest); }
.map-main .legend-pin.pin-closed {
  background: var(--paper);
  border: 1.5px solid var(--forest);
}

.map-main .leaflet-bar {
  border: 1px solid var(--border) !important;
  box-shadow: 0 3px 12px rgba(31,61,42,0.1) !important;
  border-radius: 8px !important;
  overflow: hidden;
}
.map-main .leaflet-bar a {
  color: var(--forest) !important;
  background: var(--paper) !important;
  border-bottom-color: var(--border) !important;
}
.map-main .leaflet-bar a:hover { background: var(--cream) !important; }
.map-main .leaflet-control-attribution {
  font-size: 0.68rem !important;
  background: rgba(250, 246, 238, 0.88) !important;
}

/* ─── Modal (body-level, top stack) ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.42);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease-out;
}
.modal-overlay[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--paper);
  border-radius: 14px;
  padding: 28px 28px 22px;
  max-width: 440px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(31,61,42,0.25);
  animation: modalPop 0.18s cubic-bezier(0.32,0.72,0,1.4);
}
@keyframes modalPop {
  from { transform: translateY(10px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.1s;
}
.modal-close:hover { background: var(--cream); color: var(--ink); }
.modal-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -0.008em;
}
.modal-card p {
  font-size: 0.92rem;
  color: var(--ink-2);
  line-height: 1.5;
  margin: 0 0 18px;
}
.sub-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-primary, .btn-secondary {
  flex: 1;
  min-width: 140px;
  padding: 11px 16px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.15s;
  border: 1px solid var(--forest);
  box-sizing: border-box;
}
.btn-primary {
  background: var(--forest);
  color: var(--cream);
}
.btn-primary:hover { background: var(--moss); border-color: var(--moss); }
.btn-secondary {
  background: var(--paper);
  color: var(--forest);
}
.btn-secondary:hover { background: var(--cream); }
.sub-url-preview {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--cream);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  color: var(--ink-2);
  word-break: break-all;
  line-height: 1.4;
}
.sub-hint {
  margin-top: 12px;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ============================================================================
   MOBILE — bottom-sheet sidebar
   ============================================================================ */
@media (max-width: 768px) {
  .map-layout {
    display: block;
    height: calc(100dvh - var(--map-nav-h));
  }

  .map-main { width: 100%; height: 100%; }

  .map-sidebar {
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    top: auto;
    height: var(--sheet-current-h);
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 24px rgba(31,61,42,0.12);
    transition: height 0.32s cubic-bezier(0.32,0.72,0,1);
    z-index: 500;
    touch-action: none;
  }
  .map-sidebar.no-transition { transition: none; }

  .map-sidebar .sidebar-handle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0 2px;
    cursor: grab;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
  }
  .map-sidebar .sidebar-handle-row:active { cursor: grabbing; }
  .map-sidebar .sidebar-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.2s;
  }

  .map-sidebar .sidebar-view,
  .map-sidebar .detail-content,
  .map-sidebar .market-list { touch-action: pan-y; }

  .map-main .fab-near { top: auto; bottom: calc(var(--sheet-current-h) + 14px); right: 14px; }
  .map-main .map-legend { bottom: calc(var(--sheet-current-h) + 14px); right: 14px; }

  .map-sidebar[data-state="peek"] .sidebar-search,
  .map-sidebar[data-state="peek"] .time-filters,
  .map-sidebar[data-state="peek"] .sidebar-count,
  .map-sidebar[data-state="peek"] .market-list,
  .map-sidebar[data-state="peek"] .detail-content,
  .map-sidebar[data-state="peek"] .detail-back-row { display: none; }
  .map-sidebar[data-state="peek"] .sidebar-view { overflow: hidden; }
  .map-sidebar[data-state="peek"]::after {
    content: attr(data-peek-label);
    position: absolute;
    top: 28px;
    left: 0; right: 0;
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--ink-2);
    pointer-events: none;
  }

  .map-sidebar .detail-content { padding: 4px 20px 80px; }
  .map-sidebar .detail-back-row { padding: 10px 14px 4px; }

  .map-sidebar .search-results {
    position: fixed;
    top: calc(var(--map-nav-h) + 72px);
    bottom: auto;
    left: 12px; right: 12px;
    max-height: 60vh;
  }

  .map-sidebar .mc-photo { width: 76px; height: 76px; }
  .map-sidebar .d-maker-ph { width: 112px; height: 112px; }
  .map-sidebar .d-maker-ph .pl { font-size: 2.2rem; }
}

@media (max-width: 380px) {
  .map-sidebar .d-act-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .map-sidebar .d-status.is-open .d-dot { animation: none; }
  .map-sidebar { transition: none; }
  .modal-card { animation: none; }
}
