/* Map page: tighter nav + full-viewport layout */
:root {
  --nav-h:     60px;
  --nav-pad-x: 32px;
  --sidebar-w: 284px;
}

html, body { overflow: hidden; }
/* Definite viewport-height body is required on this page. shared.css uses
   min-height:100% globally (so sticky-nav containing blocks grow with
   content on the other pages), but the map needs a *definite* height all
   the way down to #map so Leaflet can measure its canvas. Without an
   explicit body height, the flex:1 on .map-layout has no parent height
   to grow into, .map-area collapses to its content height (which is
   essentially zero — #map is absolutely positioned out of flow), and
   Leaflet renders a partial tile canvas with grey beneath it. */
body { display: flex; flex-direction: column; height: 100vh; }

/* Map page needs the nav not to shrink inside the flex column layout
   (body is display:flex / flex-direction:column, with .map-layout taking
   the remaining space). Background colour comes from shared.css. */
nav { flex-shrink: 0; }
.nav-logo { font-size: 1.4rem; }
.nav-links { gap: 32px; }

/* ── Map layout ── */
.map-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 20px;
  gap: 16px;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--white);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: relative;
  z-index: var(--z-sidebar);
}
/* Fully collapse the panel — width:0 + overflow:hidden on .sidebar hides
   the whole white rectangle. The toggle button is position:fixed so it
   escapes the clipping and stays visible. */
.sidebar.collapsed {
  width: 0;
  min-width: 0;
  box-shadow: none;
  border: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--cream-dark);
  flex-shrink: 0;
  gap: 10px;
  overflow: hidden;
}

/* Lifted out of the sidebar's flex flow and anchored to the viewport so
   it survives the sidebar collapsing to width:0. The `left` value tracks
   the map-area's left edge: open → 20px (map-layout padding) + sidebar-w
   + 16px (map-layout gap); collapsed → 20px + 0 + 16px = 36px. */
.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: calc(20px + var(--sidebar-w) + 16px);
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f3eb;
  border: 1px solid #a7c584;
  border-radius: 24px;
  cursor: pointer;
  color: #619b5f;
  z-index: var(--z-sidebar);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.15s, border-color 0.15s;
  font-size: 1.1rem;
  line-height: 1;
}
.sidebar.collapsed .sidebar-toggle { left: 36px; }
.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  background: #ffffff;
  border-color: #619b5f;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

#sidebar-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-controls {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--cream-dark);
  flex-shrink: 0;
}

.ctrl-btn {
  flex: 1;
  padding: 7px 12px;
  background: var(--cream-warm);
  border: 1px solid var(--cream-dark);
  border-radius: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-mid);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ctrl-btn:hover,
.ctrl-btn:focus-visible {
  background: var(--cream-dark);
  color: var(--forest);
}
.ctrl-btn.primary {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--cream);
}
.ctrl-btn.primary:hover,
.ctrl-btn.primary:focus-visible { background: var(--forest-deep); border-color: var(--forest-deep); }

.sidebar-count {
  padding: 8px 14px 4px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 8px 16px;
}
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-track { background: transparent; }
.sidebar-body::-webkit-scrollbar-thumb { background: var(--cream-dark); border-radius: 2px; }

/* Category items */
.cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.12s, opacity 0.2s;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.cat-item:hover,
.cat-item:focus-visible { background: var(--cream-warm); }
.cat-item.active   { opacity: 1; }
.cat-item.inactive { opacity: 0.38; }

.cat-emoji {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.cat-emoji img { width: 18px; height: 18px; vertical-align: -2px; }

.cat-name {
  flex: 1;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-count { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }

.cat-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid currentColor;
  transition: background 0.15s;
}
.cat-item.active   .cat-indicator { background: currentColor; }
.cat-item.inactive .cat-indicator { background: transparent; }

/* ── Error overlay ── */
#error-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(247, 243, 235, 0.95);
  z-index: var(--z-error-overlay);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 32px;
  text-align: center;
  border-radius: 10px;
}
#error-overlay.visible { display: flex; }
#error-overlay h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.3rem; color: var(--forest); }
#error-overlay p  { font-size: 0.82rem; color: var(--text-muted); max-width: 360px; line-height: 1.6; }
#error-overlay code {
  background: var(--cream-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
}

/* ── Map area ── */
.map-area {
  flex: 1;
  min-width: 0;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
#map { position: absolute; inset: 0; }

/* ── Leaflet overrides ── */
/* Zoom control — two individually pill-shaped buttons stacked with a
   visible gap, so they read as separate buttons rather than one block. */
.leaflet-control-zoom {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: visible;
}
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  border-radius: 24px !important;
  font-weight: 400 !important;
  border: 1px solid #a7c584 !important;
  background: #f7f3eb !important;
  color: #619b5f !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  padding: 0 !important;
}
.leaflet-control-zoom-in { margin-bottom: 6px !important; }
.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover,
.leaflet-control-zoom-in:focus-visible,
.leaflet-control-zoom-out:focus-visible {
  background: #fff !important;
  border-color: #619b5f !important;
  color: #619b5f !important;
}

/* Reset-view control — same chrome as the +/− buttons so the three read as
   one cohesive stack. Wrapper inherits .leaflet-bar but we strip its border
   and shadow so the visible edge comes from the button itself, matching
   .leaflet-control-zoom above. 6px top margin opens a gap from the − button
   so all three buttons read as separate, not a single bar. */
.leaflet-control-reset {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin-top: 6px !important;
}
.leaflet-control-reset-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 24px !important;
  border: 1px solid #a7c584 !important;
  background: #f7f3eb !important;
  color: #619b5f !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.leaflet-control-reset-btn:hover,
.leaflet-control-reset-btn:focus-visible {
  background: #fff !important;
  border-color: #619b5f !important;
  color: #619b5f !important;
}
/* Mobile touch target — bump to ≥44×44 so the button is reliably tappable. */
@media (max-width: 768px) {
  /* Pull the Leaflet bottom-right control container (zoom +/− + reset)
     out of .map-area's overflow:hidden clip — same fix as for the
     bottom-left .map-bl-stack a few commits ago. On mobile .map-area
     can collapse shorter than the visual viewport, which leaves the
     bottom-anchored controls outside its clip box and so invisible.
     Anchoring to the viewport via position:fixed + safe-area-inset
     puts them reliably at the visible bottom-right corner regardless
     of dynamic browser chrome. */
  .leaflet-bottom.leaflet-right {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    right: 12px;
    z-index: 1100;
  }
  /* +/− buttons: 30×30 Leaflet default → 44×44 thumb target, with
     explicit flex centring restated at the mobile breakpoint so
     Leaflet's vendor defaults can't sneak back in (especially the
     `text-indent: 1px` on .leaflet-control-zoom-in/out from
     vendor/leaflet.css, which shifts the +/− glyph off-centre). The
     existing pill styling (border, background, radius, shadow) stays
     intact via the base .leaflet-control-zoom-in/out rules above. */
  .leaflet-control-zoom-in,
  .leaflet-control-zoom-out {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    padding: 0 !important;
    text-indent: 0 !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 22px !important;
  }
  .leaflet-control-reset-btn {
    width: 44px;
    height: 44px;
    font-size: 0.85rem;
  }
}
/* Keep the zoom control below the mobile category panel/backdrop so it
   cannot poke through when the panel is open. The panel sits at
   --z-mobile-panel (9999) and the backdrop at --z-mobile-overlay (9998);
   Leaflet's default control z-index is 1000, but be explicit anyway. */
.leaflet-bottom.leaflet-right { z-index: 600; }

/* Attribution (i) control — discrete pill in the bottom-left, expands to
   show the full attribution on hover (desktop) or tap (mobile). */
.attr-info-wrap {
  position: relative;
  display: inline-block;
  /* Wrap lives inside .map-bl-stack — the container's `gap` handles
     spacing and margin would offset it from the shared left edge. */
  margin: 0;
}
.attr-info-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f3eb;
  border: 1px solid #a7c584;
  border-radius: 24px;
  color: #619b5f;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-style: italic;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: background 0.15s, border-color 0.15s;
}
.attr-info-btn:hover,
.attr-info-btn:focus-visible {
  background: #fff;
  border-color: #619b5f;
}
.attr-info-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: #f7f3eb;
  border: 1px solid #a7c584;
  border-radius: 8px;
  padding: 6px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  line-height: 1.5;
  color: #585f1b;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
}
.attr-info-tooltip a { color: #619b5f; text-decoration: none; }
.attr-info-tooltip a:hover,
.attr-info-tooltip a:focus-visible { text-decoration: underline; }
@media (hover: hover) {
  .attr-info-wrap:hover .attr-info-tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
}
.attr-info-wrap.open .attr-info-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.leaflet-popup-content-wrapper {
  border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12) !important;
  padding: 0 !important;
  overflow: hidden !important;
  font-family: 'DM Sans', system-ui, sans-serif !important;
}
.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
  min-width: 300px;
  max-width: 340px;
}
.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 1.1rem !important;
  padding: 6px 8px !important;
}

/* ── Popup inner ── */
.popup-inner { padding: 16px 18px 18px; }
.popup-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--forest);
  line-height: 1.3;
  margin-bottom: 10px;
  padding-right: 16px;
}

.popup-cats { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.popup-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}
.popup-chip img { width: 13px; height: 13px; vertical-align: -1px; }

.popup-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-mid);
  margin-bottom: 12px;
  border-top: 1px solid var(--cream-dark);
  padding-top: 10px;
}
.popup-desc-full { display: none; }
.popup-read-more {
  display: inline;
  margin-left: 4px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: var(--sage-dark);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.popup-read-more:hover,
.popup-read-more:focus-visible { color: var(--forest); }

.popup-hours {
  margin-bottom: 10px;
  border-top: 1px solid var(--cream-dark);
  padding-top: 10px;
}
.popup-hours-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.popup-hours-note { font-size: 14px; color: var(--text-mid); font-style: italic; }
.popup-hours-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.popup-hours-table td { padding: 1px 0; color: var(--text-mid); }
.popup-hours-day { width: 32px; font-weight: 500; color: var(--text); }

.popup-fields {
  border-top: 1px solid var(--cream-dark);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.popup-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.45;
}
.popup-field-icon { flex-shrink: 0; opacity: 0.6; margin-top: 3px; }
.popup-field-icon img { width: 12px; height: 12px; }

.popup-field-body { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.popup-field-label {
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.popup-field-value { font-size: 14px; color: var(--text-mid); word-break: break-word; }

.popup-field a { color: var(--sage-dark); text-decoration: none; word-break: break-all; }
.popup-field a:hover,
.popup-field a:focus-visible { text-decoration: underline; }

/* ── Emoji markers ── */
.emoji-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f7f3eb;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.06);
  cursor: pointer;
}
.emoji-marker img { width: 20px; height: 20px; display: block; }

/* ── Contact bar — compact on map page ── */
.contact-bar { padding: 10px var(--nav-pad-x); flex-shrink: 0; }
.contact-bar p,
.contact-bar a { font-size: 0.82rem; }

/* ── Map search bar ── */
.map-search {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-search-input);
  display: flex;
  align-items: center;
  background: rgba(247, 243, 235, 0.97);
  border: 1px solid var(--cream-dark);
  border-radius: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  padding: 0 6px 0 14px;
  gap: 4px;
  width: 280px;
  transition: width 0.2s, box-shadow 0.2s;
}
.map-search:focus-within {
  width: 320px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.16);
  border-color: var(--sage);
}

.map-search-icon { flex-shrink: 0; color: var(--text-muted); display: flex; align-items: center; }
.map-search-icon svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.map-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text);
  padding: 9px 4px;
  outline: none;
  min-width: 0;
}
.map-search input::placeholder { color: var(--text-muted); }

.map-search-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 24px;
  border: none;
  background: var(--forest);
  color: var(--cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.map-search-btn:hover,
.map-search-btn:focus-visible { background: var(--forest-deep); }
.map-search-btn svg {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor; stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
}

.map-search-error {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-search-input);
  background: rgba(247, 243, 235, 0.97);
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.78rem;
  color: var(--text-mid);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: none;
}
.map-search-error.visible { display: block; }

/* ── Sustainability filter pills (Bio certified / We support) ────────────
   Desktop: anchored top-right of the map area.
   Mobile (≤768px): positioned just below the full-width search bar. */
.sustain-filter {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: var(--z-search-input);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.sustain-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sustain-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(247, 243, 235, 0.97);
  border: 1px solid var(--cream-dark);
  border-radius: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-mid);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  opacity: 0.62;
}
.sustain-btn .sustain-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  line-height: 1;
}
.sustain-btn .sustain-emoji img {
  width: 18px;
  height: 18px;
  display: block;
}
.sustain-btn:hover,
.sustain-btn:focus-visible {
  opacity: 1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}
.sustain-btn.active {
  opacity: 1;
  color: #ffffff;
  border-color: transparent;
}
.sustain-btn.sustain-bio.active {
  background: #619b5f;
}
.sustain-btn.sustain-bio.active:hover,
.sustain-btn.sustain-bio.active:focus-visible {
  background: var(--forest-bg);
}
.sustain-btn.sustain-natural.active {
  background: #7bb669;
}
.sustain-btn.sustain-natural.active:hover,
.sustain-btn.sustain-natural.active:focus-visible {
  background: #619b5f;
}
.sustain-btn.sustain-unknown.active {
  background: #c8a96e;
}
.sustain-btn.sustain-unknown.active:hover,
.sustain-btn.sustain-unknown.active:focus-visible {
  background: #b5964f;
}

/* (i) info circle next to each pill — tooltip on hover (desktop) / tap (mobile). */
.sustain-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(247, 243, 235, 0.97);
  border: 1px solid var(--cream-dark);
  color: #619b5f;
  cursor: help;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.sustain-info:hover,
.sustain-info:focus-visible {
  background: #ffffff;
  border-color: #619b5f;
  outline: none;
}
.sustain-info-glyph {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-style: italic;
  font-weight: 500;
  line-height: 1;
}
.sustain-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #f7f3eb;
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-mid);
  white-space: normal;
  width: max-content;
  max-width: 240px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
  z-index: var(--z-search-dropdown);
}
@media (hover: hover) {
  .sustain-info:hover .sustain-tooltip {
    opacity: 1;
    transform: translateY(0);
  }
}
.sustain-info:focus-visible .sustain-tooltip,
.sustain-info.open .sustain-tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Combined mobile (i) and its tooltip are desktop-hidden — replaced on
   ≤768px by the per-pill .sustain-info icons. */
.sustain-mobile-info-btn,
.sustain-mobile-info-tooltip { display: none; }

/* Mobile: pills side-by-side, centered, compact widths. The two per-pill
   (i) icons are hidden in favour of the single combined (i) anchored at
   the bottom-left of the map (see .sustain-mobile-info-btn below). */
@media (max-width: 768px) {
  /* Constrain the pill row to the viewport with small side gutters and
     allow flex-wrap as a safety net — at 0.72rem with 10 px horizontal
     padding all three pills (CS labels are the longest) fit a 360 px
     viewport, but on narrower devices (≤380 px) the third pill drops
     to a centred second row instead of overflowing off-screen. */
  .sustain-filter {
    top: 64px;
    left: 8px;
    right: 8px;
    max-width: calc(100% - 16px);
    box-sizing: border-box;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }
  .sustain-item {
    flex: 0 0 auto;
    min-width: 0;
  }
  .sustain-btn {
    flex: 0 0 auto;
    width: auto;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    font-size: 0.72rem;
    min-height: 36px;
    box-sizing: border-box;
  }
  .sustain-btn .sustain-emoji,
  .sustain-btn .sustain-emoji img { width: 16px; height: 16px; }
  /* Hide per-pill (i) icons; the single combined button replaces them. */
  .sustain-info { display: none !important; }

  /* Combined (i) — anchored bottom-left of the map area, stacked above
     the existing Leaflet attribution pill (.attr-info-btn sits at ~bottom:
     8px with a 24px-tall button, so its top is around bottom: 32px). 44px
     here puts ours just above with a small gap. */
  .sustain-mobile-info-btn {
    display: flex;
    position: absolute;
    bottom: 44px;
    left: 8px;
    z-index: var(--z-search-input);
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: #f7f3eb;
    border: 1px solid #a7c584;
    border-radius: 24px;
    color: #585f1b;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-style: italic;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transition: background 0.15s, border-color 0.15s;
  }
  .sustain-mobile-info-btn:hover,
  .sustain-mobile-info-btn:focus-visible {
    background: #ffffff;
    border-color: #619b5f;
    outline: none;
  }

  /* Combined tooltip dialog — floats above the (i) button. */
  .sustain-mobile-info-tooltip {
    display: none;
    position: absolute;
    bottom: 86px;
    left: 12px;
    right: 12px;
    max-width: 360px;
    z-index: var(--z-search-dropdown);
    background: #f7f3eb;
    border: 1px solid #a7c584;
    border-radius: 12px;
    padding: 14px 16px 14px 14px;
    color: #585f1b;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  }
  .sustain-mobile-info-tooltip.open { display: block; }

  .sustain-mobile-info-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-right: 24px;   /* space for the close × */
  }
  .sustain-mobile-info-row + .sustain-mobile-info-row {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--cream-dark);
  }
  .sustain-mobile-info-emoji {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
  }
  .sustain-mobile-info-emoji img { width: 20px; height: 20px; display: block; }
  .sustain-mobile-info-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .sustain-mobile-info-label { font-weight: 500; color: #585f1b; }
  .sustain-mobile-info-tip   { color: #585f1b; opacity: 0.85; }

  .sustain-mobile-info-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 24px;
    color: #585f1b;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
  }
  .sustain-mobile-info-close:hover,
  .sustain-mobile-info-close:focus-visible { background: var(--cream-warm); outline: none; }
}

/* Custom gradient cluster bubbles */
.custom-cluster {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  opacity: 0.92;
  transition: opacity 0.15s;
}
.custom-cluster:hover { opacity: 1; }

/* ── Mobile category bar (trigger above the map) ── */
.mobile-cat-bar {
  display: none;
  flex-shrink: 0;
  padding: 8px 12px;
  background: #f7f3eb;
  border-bottom: 1px solid var(--cream-dark);
  align-items: center;
}

.mobile-cat-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: #585f1b;
  cursor: pointer;
  gap: 8px;
  text-align: left;
  min-height: 44px;
}
.mobile-cat-trigger:hover,
.mobile-cat-trigger:focus-visible { border-color: #619b5f; }
.mobile-cat-trigger svg {
  width: 14px; height: 14px;
  flex-shrink: 0;
  transition: transform 0.2s;
  fill: none; stroke: #619b5f; stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.mobile-cat-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }

/* ── Mobile category multi-select panel ── */
.mobile-cat-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: var(--z-mobile-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.mobile-cat-panel-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-cat-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-mobile-panel);
  display: flex;
  flex-direction: column;
  background: #f7f3eb;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.18);
  max-height: 85vh;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}
.mobile-cat-panel.open { transform: translateY(0); }

.mobile-cat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--cream-dark);
  flex-shrink: 0;
}
.mobile-cat-panel-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: #585f1b;
  margin: 0;
  letter-spacing: 0.01em;
}
.mobile-cat-panel-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 24px;
  color: #585f1b;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.mobile-cat-panel-close:hover,
.mobile-cat-panel-close:focus-visible { background: var(--cream-warm); }

.mobile-cat-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mobile-cat-panel-list::-webkit-scrollbar { width: 4px; }
.mobile-cat-panel-list::-webkit-scrollbar-thumb { background: var(--cream-dark); border-radius: 2px; }

.mobile-cat-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  color: #585f1b;
  cursor: pointer;
  text-align: left;
  min-height: 48px;
  transition: background 0.15s, border-color 0.15s;
}
.mobile-cat-option:hover,
.mobile-cat-option:focus-visible { background: var(--cream-warm); }
.mobile-cat-option.selected {
  background: rgba(97, 155, 95, 0.12);
  border-color: #619b5f;
}

.mobile-cat-option-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mobile-cat-option-icon img { width: 22px; height: 22px; display: block; }

.mobile-cat-option-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-cat-option-count {
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}

.mobile-cat-option-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--cream-dark);
  background: var(--white);
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.mobile-cat-option.selected .mobile-cat-option-check {
  background: #619b5f;
  border-color: #619b5f;
}
.mobile-cat-option.selected .mobile-cat-option-check::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 7px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.mobile-cat-panel-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
  border-top: 1px solid var(--cream-dark);
  background: #f7f3eb;
  flex-shrink: 0;
}
.mobile-cat-panel-show-all,
.mobile-cat-panel-apply {
  flex: 1;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mobile-cat-panel-show-all {
  background: var(--white);
  border-color: var(--cream-dark);
  color: #585f1b;
}
.mobile-cat-panel-show-all:hover,
.mobile-cat-panel-show-all:focus-visible {
  background: var(--cream-warm);
  border-color: #619b5f;
}
.mobile-cat-panel-apply {
  background: #619b5f;
  color: #f7f3eb;
}
.mobile-cat-panel-apply:hover,
.mobile-cat-panel-apply:focus-visible { background: var(--forest-deep); }

/* Desktop: hide panel entirely so it can never appear above 768px. */
@media (min-width: 769px) {
  .mobile-cat-panel,
  .mobile-cat-panel-backdrop { display: none !important; }
}

/* ── Mobile filter FAB ── */
.mobile-filter-btn {
  display: none;
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-error-overlay);
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  height: 48px;
  background: var(--forest);
  color: var(--cream);
  border: none;
  border-radius: 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.28);
  white-space: nowrap;
}
.mobile-filter-btn:hover,
.mobile-filter-btn:focus-visible { background: var(--forest-deep); }
.mobile-filter-btn svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }

/* ── Sidebar backdrop (mobile only) ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: var(--z-mobile-overlay);
  opacity: 0;
  transition: opacity 0.3s;
}
.sidebar-backdrop.visible { opacity: 1; }

/* ── Mobile ── */
@media (max-width: 768px) {
  /* Map layout — edge-to-edge */
  .map-layout { padding: 0; gap: 0; }
  .map-area { border-radius: 0; }
  .contact-bar { display: none; }

  /* Hide sidebar on mobile (use the dropdown bar + FAB instead) */
  .sidebar { display: none !important; }
  .mobile-cat-bar { display: flex; }

  /* Search bar full-width */
  .map-search { left: 12px; right: 12px; top: 12px; transform: none; width: auto; }
  .map-search:focus-within { width: auto; }

  /* Touch targets */
  .ctrl-btn { min-height: 44px; }
  .cat-item { min-height: 44px; }
}
@media (max-width: 480px) {
  .map-search input { font-size: 1rem; }
}

/* ── Search autocomplete dropdown ── */
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #f7f3eb;
  border: 1px solid var(--cream-dark);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: var(--z-search-dropdown);
  overflow: hidden;
  display: none;
}
.search-suggestions.visible { display: block; }

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--cream-dark);
  transition: background 0.12s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--sage-light); }

.suggestion-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.suggestion-icon img { width: 18px; height: 18px; display: block; }

.suggestion-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.suggestion-name   {
  font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggestion-region {
  font-size: 13px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Support popup ── */
.support-popup {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f7f3eb;
  border: 1px solid #a7c584;
  border-radius: 24px;
  padding: 10px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: #585f1b;
  max-width: calc(100vw - 32px);
}
.support-popup.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.support-popup-heart {
  flex-shrink: 0;
  color: #619b5f;
  font-size: 18px;
  line-height: 1;
}
.support-popup a {
  color: #585f1b;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}
.support-popup a:hover { color: #619b5f; }
.support-popup-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: #585f1b;
  font-size: 16px;
  line-height: 1;
  padding: 0 0 0 6px;
  opacity: .6;
}
.support-popup-close:hover { opacity: 1; }
@media (max-width: 768px) {
  .support-popup { bottom: 120px; right: 12px; }
}

/* ── Community suggestion: entry button + modal ──
   Bottom-left pill on the map; on mobile it stacks above the sustain
   info button (which sits at bottom: 44px) and the attribution pill. */
/* Bottom-left stack — one absolutely-positioned flex container that
   carries the (i) attribution pill and the 'Nahlásit místo' button.
   Both elements share this single left-edge reference; align-items:
   flex-start guarantees flush vertical alignment regardless of each
   button's intrinsic width. The (i) pill used to be a Leaflet
   bottomleft control, but Leaflet's auto-applied .leaflet-control
   class and its 10 px margin-left always beat any override on
   .attr-info-wrap; rendering the wrap as a plain DOM child here
   sidesteps that fight entirely. */
/* Desktop: absolute-positioned inside .map-area (its containing block
   is tall enough on desktop that .map-area's overflow:hidden never
   clips the stack). The mobile override below switches to position:
   fixed so the same stack escapes that clip on small viewports
   where the map-area can collapse shorter than the stack. */
.map-bl-stack {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: var(--z-search-input);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.suggest-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #f7f3eb;
  border: 1px solid #a7c584;
  border-radius: 24px;
  color: #585f1b;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.suggest-btn:hover,
.suggest-btn:focus-visible {
  background: #fff;
  border-color: #619b5f;
}
.suggest-btn-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #a7c584;
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

@media (max-width: 768px) {
  /* Mobile: switch to position: fixed so the stack escapes
     .map-area's overflow:hidden clip on viewports where map-area
     collapses short. Bottom uses env(safe-area-inset-bottom) so the
     button lands at the visible viewport bottom on iOS (accounting
     for the home indicator) and Android (where the inset is 0). The
     visual viewport — including the dynamic address bar — is already
     what position: fixed anchors to in modern mobile browsers, so the
     button tracks chrome retraction automatically. */
  .map-bl-stack {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    left: 12px;
    z-index: 1100;
  }
  .suggest-btn {
    padding: 7px 12px;
    font-size: 12px;
  }
  /* Remove the doubled-(i) appearance — the sustain mobile-info
     pill renders as a second small cream-with-sage "(i)" circle that
     visually duplicates the attribution (i) in the stack. Hidden on
     mobile so only one (i) is shown; the per-pill (i) info dialog can
     be reintroduced later in a less ambiguous form (a different icon
     or near the sustain-filter pills themselves). */
  .sustain-mobile-info-btn,
  .sustain-mobile-info-tooltip { display: none !important; }
}

/* Suggestion modal styles live in shared.css — every page renders the same
   modal via shared.js. The map-page-only floating .suggest-btn trigger is
   defined above; only its hover state and the bottom-left stack layout
   remain map-specific. */
