:root {
  --red: #b51f2e;
  --red-dark: #8e1723;
  --ink: #171c1f;
  --muted: #617078;
  --line: #dce2e4;
  --paper: #f7f5ef;
  --white: #ffffff;
  --blue: #17324a;
  --gold: #d19b2c;
  --green: #2f7a48;
  --shadow: 0 18px 50px rgba(25, 37, 43, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: 76px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between;
  background: var(--white); border-bottom: 1px solid var(--line); position: relative; z-index: 1001;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 44px; height: 44px; display: block; object-fit: contain; flex: 0 0 auto; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 22px; line-height: 1; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex: 1; margin-left: clamp(48px, 11vw, 190px); }
.social-follow { display: flex; flex: 1; flex-direction: row; align-items: center; justify-content: flex-end; gap: clamp(22px, 3vw, 48px); color: var(--blue); }
.social-follow-title { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; white-space: nowrap; }
.social-follow-links { display: flex; align-items: center; gap: 12px; }
.social-chip { min-height: 42px; display: inline-flex; align-items: center; gap: 10px; padding: 6px 15px 6px 8px; border: 1px solid #e4e8ea; border-radius: 999px; background: #fff; color: #263b4a; font-size: 14px; font-weight: 750; white-space: nowrap; }
.social-icon { width: 28px; height: 28px; display: grid; flex: 0 0 28px; place-items: center; border-radius: 8px; color: #fff; font-family: Arial, sans-serif; font-weight: 800; }
.instagram-icon { background: linear-gradient(135deg, #7653c9 0%, #d83277 55%, #f0a33b 100%); }
.instagram-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.instagram-icon .instagram-dot { fill: currentColor; stroke: none; }
.tiktok-icon { background: #111; font-size: 19px; line-height: 1; }
.linkedin-icon { background: #0a66c2; font-size: 14px; letter-spacing: -.08em; }
.about-button, .outline-button { border: 0; background: transparent; color: var(--ink); font-size: 14px; font-weight: 700; }
.about-button, .outline-button { padding: 10px 15px; border: 1px solid var(--line); border-radius: 999px; }
.outline-button:hover, .about-button:hover { border-color: var(--red); color: var(--red); }

.stats-ribbon { min-height: 42px; padding: 8px 24px; display: flex; justify-content: center; gap: 12px; align-items: center; color: #16344a; background: linear-gradient(90deg, #f6efe1 0%, #f2f5f6 100%); border-bottom: 1px solid #e2e7e8; font-size: 13px; position: relative; z-index: 1001; }
.stats-ribbon strong { font-size: 14px; }
.stats-ribbon span { color: var(--muted); }

.workspace { height: calc(100vh - 118px); min-height: 0; display: grid; grid-template-columns: minmax(390px, 36%) 1fr; }
.sidebar { background: var(--paper); padding: 30px 32px 36px; overflow-y: auto; border-right: 1px solid var(--line); z-index: 500; }
.eyebrow { margin: 0 0 9px; color: var(--red); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.intro h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 4vw, 58px); line-height: .98; letter-spacing: -.04em; }
.intro > p:last-of-type { max-width: 540px; margin: 18px 0 24px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 24px; }
.primary-action, .secondary-action {
  min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 800;
}
.primary-action { background: var(--red); color: white; }
.primary-action:hover { background: var(--red-dark); }
.secondary-action { background: white; color: var(--blue); border-color: #cad2d5; }
.secondary-action:hover { border-color: var(--blue); }

.search label, .filters legend { display: block; margin-bottom: 8px; padding: 0; font-size: 13px; font-weight: 800; }
.search-field { min-height: 52px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 6px; padding: 5px 6px 5px 14px; background: white; border: 1px solid #c9d1d4; border-radius: 12px; box-shadow: 0 5px 18px rgba(41, 52, 58, .06); }
.search-field span { font-size: 23px; color: var(--muted); }
.search-field input { min-width: 0; height: 40px; border: 0; outline: 0; font-size: 16px; color: var(--ink); background: transparent; }
.search-field button { height: 40px; padding: 0 17px; border: 0; border-radius: 8px; background: var(--red); color: white; font-weight: 800; }
.search-field button:hover { background: var(--red-dark); }

.filters { margin: 22px 0; padding: 0; border: 0; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { padding: 9px 13px; border: 1px solid #cad2d5; border-radius: 999px; background: transparent; color: #46545a; font-size: 13px; font-weight: 750; }
.filter-chip:hover, .filter-chip:focus-visible { border-color: var(--red); color: var(--red); }
.filter-chip.active { border-color: var(--blue); color: white; background: var(--blue); }

.results-heading { display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 20px; }
.results-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 21px; }
.results-heading span { color: var(--muted); font-size: 13px; }
.results { display: grid; gap: 10px; margin-top: 14px; }
.result-card { width: 100%; padding: 16px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.78); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.result-card:hover, .result-card:focus-visible { transform: translateY(-2px); border-color: #aeb9bd; box-shadow: 0 10px 26px rgba(37, 49, 55, .09); outline: none; }
.card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.result-card h3 { margin: 0 0 5px; font-size: 16px; }
.result-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.sample-badge { flex: 0 0 auto; height: fit-content; padding: 4px 7px; border-radius: 999px; background: #edf3f5; color: #315066; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.product-line { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--blue); font-size: 13px; font-weight: 750; }
.product-line::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.meta-chip { padding: 4px 8px; border-radius: 999px; background: #f0f4f5; color: #3f5964; font-size: 11px; font-weight: 700; }
.empty-state { padding: 26px 18px; border: 1px dashed #bcc6ca; border-radius: 14px; text-align: center; color: var(--muted); }

.map-panel { position: relative; min-height: 0; }
#map { height: 100%; width: 100%; background: #dce6e7; }
.map-key { position: absolute; z-index: 700; left: 18px; bottom: 38px; padding: 8px 11px; display: flex; gap: 7px; align-items: center; border-radius: 8px; background: rgba(255,255,255,.94); box-shadow: 0 4px 18px rgba(27,40,47,.15); font-size: 12px; font-weight: 750; }
.map-key span { width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid white; box-shadow: 0 0 0 1px var(--red); }
.map-attribution-note { position: absolute; right: 6px; bottom: 2px; z-index: 700; padding: 3px 5px; color: #46545a; background: rgba(255,255,255,.78); font-size: 10px; }
.leaflet-control-attribution { display: none; }
.leaflet-control-zoom a { color: var(--ink); }
.canada-near-me-pin { filter: drop-shadow(0 6px 12px rgba(72, 13, 22, .30)); }

.category-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.category-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; background: #f3f6f7; border-radius: 999px; font-size: 11px; font-weight: 800; color: #35505f; }
.category-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .85; }

.retailer-summary { margin-top: 16px; padding: 12px 14px; background: #f8fafb; border: 1px solid var(--line); border-radius: 12px; }
.retailer-summary strong { display: block; margin-bottom: 6px; font-size: 13px; }
.retailer-summary p { margin: 0; color: var(--muted); font-size: 13px; }

.detail-dialog { width: min(640px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); padding: 0; overflow: auto; }
.about-dialog { width: min(640px, calc(100vw - 28px)); padding: 34px; }
.about-dialog h2 { margin: 0 0 18px; font-family: Georgia, serif; font-size: 34px; line-height: 1.08; }
.about-dialog p:not(.eyebrow) { color: var(--muted); font-size: 16px; line-height: 1.6; }
dialog { color: var(--ink); border: 0; border-radius: 18px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(12, 22, 28, .54); backdrop-filter: blur(3px); }
.dialog-close { position: sticky; top: 12px; float: right; z-index: 2; width: 38px; height: 38px; margin: 12px; border: 0; border-radius: 50%; background: #eef1f2; color: var(--ink); font-size: 24px; }

.detail-hero { clear: both; padding: 8px 30px 26px; border-bottom: 1px solid var(--line); }
.detail-hero h2 { margin: 4px 0 8px; font-family: Georgia, serif; font-size: 30px; line-height: 1.1; }
.detail-hero p { margin: 0; color: var(--muted); line-height: 1.5; }
.detail-body { padding: 24px 30px 30px; }
.detail-product { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: #fafbfb; }
.detail-product-copy { min-width: 0; flex: 1 1 auto; }
.detail-product-image { width: 150px; height: 150px; flex: 0 0 150px; object-fit: contain; border-radius: 10px; background: #fff; }
.detail-product + .detail-product { margin-top: 12px; }
.detail-product h3 { margin: 0 0 6px; font-size: 17px; }
.detail-product p { margin: 5px 0; color: var(--muted); font-size: 14px; }
@media (max-width: 600px) {
  .detail-product { align-items: flex-start; gap: 12px; padding: 14px; }
  .detail-product-image { width: 92px; height: 92px; flex-basis: 92px; }
}
.verified-line { color: var(--green) !important; font-weight: 750; }
.navigate-link, .inline-link-button { display: inline-flex; margin-top: 20px; padding: 11px 16px; border-radius: 9px; background: var(--blue); color: white; text-decoration: none; font-weight: 800; border: 0; }
.inline-link-button { margin-left: 8px; background: var(--red); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.availability-note { margin: 20px 0 0; padding: 13px 15px; border-left: 3px solid #b8d1de; background: #eef6fa; color: #335569; font-size: 13px; line-height: 1.5; }

.review-section { margin-top: 20px; }
.review-section h3 { margin: 0 0 12px; font-size: 18px; }
.review-list { display: grid; gap: 12px; }
.review-card { border: 1px solid var(--line); background: white; border-radius: 13px; padding: 14px; }
.review-card p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.review-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.review-stars { color: var(--gold); font-weight: 900; }
.review-photo { display: block; width: 100%; max-width: 280px; border-radius: 10px; margin-top: 10px; }
.no-reviews { padding: 14px; border: 1px dashed #c4ced2; border-radius: 12px; color: var(--muted); font-size: 14px; }

.community-form { display: grid; gap: 14px; }
.community-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 700; }
.community-form input,
.community-form textarea,
.community-form select {
  min-height: 44px; padding: 11px 12px; border: 1px solid #c9d1d4; border-radius: 10px; background: white; color: var(--ink);
}
.community-form textarea { min-height: 110px; resize: vertical; }
.field-grid.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-preview { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.photo-preview img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.form-hint { color: var(--muted); font-size: 13px; }

@media (max-width: 980px) {
  .topbar-actions { gap: 8px; }
  .outline-button { display: none; }
}

@media (max-width: 860px) {
  body { overflow: auto; }
  .topbar { height: 66px; padding: 0 16px; }
  .topbar-actions { margin-left: 24px; }
  .social-follow { gap: 4px; }
  .social-follow-title { font-size: 8px; }
  .social-follow-links { gap: 5px; }
  .social-chip { min-height: 30px; gap: 5px; padding: 3px 8px 3px 4px; font-size: 10px; }
  .social-icon { width: 21px; height: 21px; flex-basis: 21px; border-radius: 6px; }
  .instagram-icon svg { width: 15px; height: 15px; }
  .about-button { display: none; }
  .stats-ribbon { padding: 8px 14px; align-items: flex-start; text-align: left; flex-direction: column; gap: 4px; }
  .workspace { height: auto; display: flex; flex-direction: column; }
  .sidebar { padding: 24px 18px 28px; overflow: visible; border-right: 0; }
  .intro h1 { font-size: 42px; }
  .map-panel { order: -1; height: 42vh; min-height: 320px; }
  .map-key { bottom: 30px; }
  .field-grid.two-col { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .topbar-actions { margin-left: 12px; }
  .social-follow { flex-direction: column; align-items: flex-end; justify-content: center; gap: 3px; }
  .brand small { display: none; }
  .brand strong { font-size: 17px; }
  .social-follow-links { gap: 4px; }
  .social-chip { min-height: 28px; gap: 4px; padding-right: 6px; font-size: 9px; }
  .social-icon { width: 19px; height: 19px; flex-basis: 19px; }
  .stats-ribbon { font-size: 12px; }
  .search-field { grid-template-columns: 24px 1fr; }
  .search-field button { grid-column: 1 / -1; width: 100%; }
  .intro h1 { font-size: 38px; }
  .cta-row { flex-direction: column; }
}


/* Marker + logo reliability fix: no external image is required. */
.canada-inline-pin { background: transparent !important; border: 0 !important; }
.canada-inline-pin svg { display: block; filter: drop-shadow(0 6px 8px rgba(63, 20, 25, .34)); }
.brand-mark-inline { width: 44px; height: 48px; display: grid; place-items: center; flex: 0 0 44px; }
.brand-mark-inline svg { display: block; }


/* === Minimal rollback-safe polish === */
.brand-image-only {
  display: flex;
  align-items: center;
  min-width: 250px;
}
.brand-logo-full {
  display: block;
  width: 250px;
  max-width: 34vw;
  height: auto;
}
.stats-ribbon {
  min-height: 46px !important;
  padding: 8px 24px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  background: #f7f3ea !important;
  border-bottom: 1px solid #e2ddd0 !important;
  color: #17324a !important;
  font-size: 13px !important;
}
.stats-ribbon strong {
  font-size: 15px !important;
  font-weight: 800 !important;
  letter-spacing: -.01em !important;
}
.stats-ribbon span {
  color: #66757c !important;
}
@media (max-width: 860px) {
  .brand-logo-full { width: 205px; max-width: 58vw; }
  .stats-ribbon {
    justify-content: flex-start !important;
    overflow-x: auto;
    white-space: nowrap;
  }
}


/* === CANADANEAR FINAL FIX: logo + slim stats only === */
.brand-final-logo {
  display: flex !important;
  align-items: center !important;
  min-width: 246px;
  text-decoration: none;
}
.brand-final-logo-img {
  display: block !important;
  width: 246px !important;
  height: 70px !important;
  object-fit: contain !important;
  object-position: left center !important;
}
.stats-ribbon {
  min-height: 44px !important;
  padding: 7px 24px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  background: #f7f4ec !important;
  border-bottom: 1px solid #e4ded1 !important;
  color: #17324a !important;
  white-space: nowrap;
}
.stats-ribbon strong {
  font-size: 14px !important;
  font-weight: 800 !important;
  letter-spacing: -.01em !important;
}
.stats-ribbon span {
  color: #6b787e !important;
  font-size: 13px !important;
}
@media (max-width: 860px) {
  .brand-final-logo { min-width: 205px; }
  .brand-final-logo-img { width: 205px !important; height: 58px !important; }
  .stats-ribbon {
    justify-content: flex-start !important;
    overflow-x: auto !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}


/* STEP 1: original v0.5 logo + markers */
.brand-pin-image {
  width: 44px !important;
  height: 44px !important;
  display: block !important;
  object-fit: contain !important;
  flex: 0 0 44px !important;
  filter: drop-shadow(0 4px 7px rgba(72, 13, 22, .24));
}
.brand-mark {
  width: 38px !important;
  height: 38px !important;
  display: grid !important;
  place-items: center !important;
  color: white !important;
  background: var(--red) !important;
  border-radius: 50% 50% 48% 52% / 45% 48% 52% 55% !important;
  font-size: 22px !important;
  transform: rotate(-7deg) !important;
  flex: 0 0 38px !important;
}
.brand-mark svg,
.brand-final-logo-img,
.brand-logo-full {
  display: none !important;
}
.brand > span:not(.brand-mark) {
  display: block !important;
}
.brand > span:not(.brand-mark) strong,
.brand > span:not(.brand-mark) small {
  display: block !important;
}
.canada-marker {
  width: 27px !important;
  height: 27px !important;
  margin-left: -13px !important;
  margin-top: -13px !important;
  display: grid !important;
  place-items: center !important;
  color: white !important;
  background: var(--red) !important;
  border: 3px solid white !important;
  border-radius: 50% 50% 48% 52% !important;
  box-shadow: 0 5px 14px rgba(92,13,24,.35) !important;
  font-size: 12px !important;
  font-weight: 900 !important;
}

.canada-cluster {
  background: rgba(181, 31, 46, .18);
  border-radius: 50%;
}
.canada-cluster span {
  width: 34px;
  height: 34px;
  margin: 4px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #b51f2e;
  color: #fff;
  box-shadow: 0 4px 12px rgba(92, 13, 24, .32);
  font: 800 12px/1 system-ui, sans-serif;
}

/* === v0.8 MOBILE PASS — 2026-09-30 ===
   Final responsive layer. Keeps desktop behavior unchanged and optimizes
   header, search, filters, map, results and dialogs for touch screens. */
@media (max-width: 860px) {
  html { height: auto; }
  body { min-height: 100%; overflow-x: hidden; overflow-y: auto; }

  .topbar {
    height: 62px;
    padding: 0 14px;
    gap: 10px;
  }
  .brand { min-width: 0; gap: 9px; }
  .brand-pin-image {
    width: 38px !important;
    height: 38px !important;
    flex-basis: 38px !important;
  }
  .brand strong { font-size: 18px; }
  .brand small { margin-top: 2px; font-size: 9px; letter-spacing: .09em; }
  .topbar-actions { min-width: 0; margin-left: auto; flex: 0 1 auto; }
  .social-follow { flex-direction: row; gap: 0; }
  .social-follow-title { display: none; }
  .social-follow-links { gap: 6px; }
  .social-chip {
    width: 34px;
    min-height: 34px;
    padding: 3px;
    justify-content: center;
    border-radius: 10px;
  }
  .social-chip > span:last-child { display: none; }
  .social-icon {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
    border-radius: 7px;
  }

  .stats-ribbon {
    min-height: 38px !important;
    padding: 7px 14px !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    overflow: hidden !important;
    white-space: normal !important;
    text-align: left;
  }
  .stats-ribbon strong {
    font-size: 12px !important;
    line-height: 1.25;
  }
  .stats-ribbon span {
    display: none;
  }

  .workspace {
    width: 100%;
    height: auto;
    min-height: 0;
    display: block;
  }
  .sidebar {
    width: 100%;
    padding: 20px 16px 30px;
    overflow: visible;
    border-right: 0;
  }
  .intro .eyebrow {
    margin-bottom: 7px;
    font-size: 10px;
    line-height: 1.35;
    letter-spacing: .09em;
  }
  .intro h1 {
    font-size: clamp(34px, 10vw, 44px);
    line-height: .96;
  }
  .intro > p:last-of-type {
    margin: 13px 0 16px;
    font-size: 14px;
    line-height: 1.48;
  }
  .cta-row { margin-bottom: 18px; }
  .primary-action, .secondary-action { min-height: 44px; }

  .search label, .filters legend { margin-bottom: 7px; font-size: 12px; }
  .search-field {
    min-height: 50px;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 4px;
    padding: 4px 5px 4px 11px;
    border-radius: 11px;
  }
  .search-field span { font-size: 20px; }
  .search-field input { height: 40px; font-size: 16px; }
  .search-field button {
    grid-column: auto;
    width: auto;
    height: 40px;
    padding: 0 13px;
    border-radius: 8px;
    font-size: 13px;
  }

  .filters { margin: 17px 0 16px; }
  .filter-row {
    flex-wrap: nowrap;
    gap: 7px;
    margin: 0 -16px;
    padding: 0 16px 5px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-chip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 9px 13px;
    font-size: 12px;
    touch-action: manipulation;
  }

  /* JS moves the existing map here, between filters and results. */
  .sidebar > .map-panel {
    width: calc(100% + 32px);
    height: clamp(300px, 44svh, 430px);
    min-height: 300px;
    margin: 0 -16px 20px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  @supports (height: 1dvh) {
    .sidebar > .map-panel { height: clamp(300px, 44dvh, 430px); }
  }
  .map-key {
    left: 12px;
    bottom: 28px;
    padding: 7px 9px;
    font-size: 11px;
  }
  .map-attribution-note { font-size: 9px; }
  .leaflet-control-zoom { margin-top: 12px !important; margin-right: 12px !important; }
  .leaflet-control-zoom a { width: 34px !important; height: 34px !important; line-height: 34px !important; }

  .results-heading {
    padding-top: 0;
    border-top: 0;
    gap: 10px;
  }
  .results-heading h2 { font-size: 20px; }
  .results-heading span { flex: 0 0 auto; font-size: 12px; }
  .results { gap: 9px; margin-top: 12px; }
  .result-card { padding: 14px; border-radius: 12px; }
  .result-card:hover { transform: none; }
  .result-card:active { transform: scale(.995); }

  .detail-dialog,
  .about-dialog {
    width: calc(100vw - 16px);
    max-width: none;
    max-height: calc(100dvh - 16px);
    margin: auto 8px 8px;
    border-radius: 18px 18px 12px 12px;
  }
  .about-dialog { padding: 24px 18px 22px; }
  .about-dialog h2 { font-size: 28px; }
  .dialog-close {
    top: 8px;
    width: 42px;
    height: 42px;
    margin: 8px;
    touch-action: manipulation;
  }
  .detail-hero { padding: 4px 18px 20px; }
  .detail-hero h2 { font-size: 27px; }
  .detail-body { padding: 18px 18px 24px; }
  .detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .navigate-link, .inline-link-button {
    justify-content: center;
    margin: 16px 0 0;
    min-height: 44px;
    align-items: center;
    padding: 10px 12px;
    text-align: center;
  }
  .field-grid.two-col { grid-template-columns: 1fr; }
  .community-form input,
  .community-form textarea,
  .community-form select { font-size: 16px; }
}

@media (max-width: 420px) {
  .topbar { padding: 0 10px; }
  .brand-pin-image {
    width: 34px !important;
    height: 34px !important;
    flex-basis: 34px !important;
  }
  .brand strong { font-size: 16px; }
  .brand small { display: none !important; }
  .social-follow-links { gap: 4px; }
  .social-chip { width: 31px; min-height: 31px; }
  .social-icon { width: 22px; height: 22px; flex-basis: 22px; }
  .sidebar { padding-left: 14px; padding-right: 14px; }
  .filter-row { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
  .sidebar > .map-panel { width: calc(100% + 28px); margin-left: -14px; margin-right: -14px; }
  .intro h1 { font-size: 36px; }
  .search-field button { padding: 0 11px; }
  .detail-product { flex-direction: column-reverse; }
  .detail-product-image { width: 100%; height: 150px; flex-basis: auto; }
  .detail-actions { grid-template-columns: 1fr; }
  .inline-link-button { margin-top: 0; }
}

/* === v0.8 MOBILE HORIZONTAL SCROLL FIX — 2026-09-30 ===
   Prevent the document itself from being dragged sideways on mobile.
   Horizontal scrolling remains enabled only inside the category chip row. */
@media (max-width: 860px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
  }

  .app-shell,
  .workspace,
  .sidebar {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Keep categories independently swipeable without widening the page. */
  .filter-row {
    overflow-x: auto !important;
    overflow-y: hidden;
    max-width: calc(100% + 32px);
  }
}

@media (max-width: 420px) {
  .filter-row {
    max-width: calc(100% + 28px);
  }
}

@supports (overflow: clip) {
  @media (max-width: 860px) {
    html,
    body,
    .app-shell,
    .workspace,
    .sidebar {
      overflow-x: clip !important;
    }

    /* Explicitly restore scrolling for category chips. */
    .filter-row {
      overflow-x: auto !important;
    }
  }
}

/* === MOBILE CATEGORY WRAP FIX — 2026-09-30 === */
@media (max-width: 860px) {
  .filter-row {
    display: flex;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    max-width: none !important;

    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;

    gap: 8px;
  }

  .filter-chip {
    flex: 0 0 auto;
  }
}
