/* Public map listings */
html body.compass-app #app .map-gallery .map-gallery-heading {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 0 0 8px; padding: 0;
}
html body.compass-app #app .map-gallery .map-gallery-heading h1 {
  margin: 0; font-size: clamp(32px, 3vw, 42px) !important;
}
.map-gallery-heading .cc-library-count { white-space: nowrap; }
.map-gallery-heading .cc-library-count small { margin-inline-start: 5px; font-size: inherit; }
html body.compass-app #app .map-gallery .base-level-nav {
  margin: 0; padding: 2px 0 8px; gap: 4px;
}
html body.compass-app #app .map-gallery .base-level-nav a { min-height: 44px; padding: 8px 12px; }
html body.compass-app #app .map-gallery .base-layout-toolbar {
  padding: 8px 0 0; gap: 8px; border: 0;
}
html body.compass-app #app .map-gallery .base-filter-row {
  display: flex; align-items: end; gap: 10px; margin: 0 0 14px; padding: 8px 0 0;
}
.map-gallery .base-filter-row label { min-width: 0; }
.map-gallery .base-filter-row label:first-child { flex: 2; }
.map-gallery .base-filter-row :is(input, select, button) { min-height: 44px; }
html body.compass-app #app .map-gallery .map-gallery-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 24px;
}
html body.compass-app #app .map-gallery .map-gallery-card {
  display: flex; flex-direction: column; min-width: 0; overflow: visible;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; transform: none;
}
.map-gallery .map-gallery-media { position: relative; min-width: 0; }
html body.compass-app #app .map-gallery .base-layout-image {
  position: relative; display: block; overflow: hidden; aspect-ratio: auto; border-radius: 6px;
  background: var(--cc-soft);
}
.map-gallery .base-layout-image img { display: block; width: 100%; height: auto; object-fit: contain; }
.map-gallery .base-layout-image .base-level-badge { top: 9px; bottom: auto; left: 9px; right: auto; }
.map-gallery .base-layout-image .base-pro-badge { top: auto; right: auto; bottom: 9px; left: 9px; color: #fff; background: #65431f; }
html body.compass-app #app .map-gallery .map-gallery-star {
  position: absolute; z-index: 1; top: 8px; right: 8px; display: grid; place-items: center;
  width: 44px; height: 44px; min-height: 44px; padding: 0; border: 1px solid #d8d0bd;
  border-radius: 50%; color: #493923; background: #fffaf0; font-size: 25px; line-height: 1;
}
html body.compass-app #app .map-gallery .map-gallery-star[aria-pressed="true"] {
  color: #fff; background: #704329; border-color: #704329;
}
html body.compass-app #app .map-gallery .map-gallery-star:focus-visible {
  outline: 3px solid #fff !important; outline-offset: 2px; box-shadow: 0 0 0 5px #493923;
}
html body.compass-app #app .map-gallery .map-gallery-copy {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 0 0;
}
html body.compass-app #app .map-gallery .map-gallery-copy :is(h2, h3) {
  order: 2; display: block; min-height: 0; margin: 2px 0 0; overflow: visible;
  font-size: 20px; line-height: 1.2;
}
.map-gallery .map-gallery-copy :is(h2, h3) a { text-decoration: none; }
.map-gallery .map-gallery-copy :is(h2, h3) a:hover { text-decoration: underline; }
html body.compass-app #app .map-gallery .map-gallery-caption {
  order: 3; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--cc-muted); font-size: 14px; line-height: 1.4;
}
html body.compass-app #app .map-gallery .base-copy-link {
  order: 1; display: flex; align-items: center; justify-content: space-between; min-height: 44px;
  margin: 0; padding: 10px 14px; border-radius: 6px; color: #fff !important;
  background: #78432b; font-size: 16px; font-weight: 700; text-decoration: none;
}
html body.compass-app #app .map-gallery .base-copy-link:hover { color: #fff !important; background: #62351f; }
@media (max-width: 900px) {
  html body.compass-app #app .map-gallery .map-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 18px; }
}
@media (max-width: 600px) {
  html body.compass-app #app .map-gallery .map-gallery-heading { flex-wrap: wrap; gap: 4px 12px; }
  html body.compass-app #app .map-gallery .base-layout-toolbar { flex-direction: row; flex-wrap: wrap; }
  html body.compass-app #app .map-gallery .base-filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-gallery .base-filter-row label:first-child { grid-column: 1 / -1; }
  .map-gallery .base-filter-row button { grid-column: 1 / -1; }
  html body.compass-app #app .map-gallery .map-gallery-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}

/* Filters collapse on narrow screens while level and layout type stay visible. */
html body.compass-app #app .map-gallery .map-gallery-filter-toggle { display: none; }
@media (min-width: 601px) {
  .map-gallery .map-gallery-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 12px; }
  .map-gallery .base-level-nav { grid-column: 1 / -1; }
  .map-gallery .base-layout-toolbar { grid-column: 1; grid-row: 2; }
  .map-gallery .map-gallery-extra-controls { display: contents; }
  .map-gallery .base-sort-switch { grid-column: 2; grid-row: 2; }
  .map-gallery .base-filter-row { grid-column: 1 / -1; grid-row: 3; }
}
@media (max-width: 600px) {
  html body.compass-app #app .map-gallery .base-layout-toolbar { flex-wrap: nowrap; align-items: center; gap: 6px; }
  html body.compass-app #app .map-gallery .base-kind-switch { min-width: 0; gap: 2px; }
  html body.compass-app #app .map-gallery .base-kind-switch button { padding-inline: 8px; font-size: 14px; }
  html body.compass-app #app .map-gallery .map-gallery-filter-toggle {
    display: inline-flex; flex: none; align-items: center; justify-content: center; min-height: 44px;
    padding: 8px 10px; border: 1px solid var(--cc-line); border-radius: 6px;
    color: var(--cc-ink); background: var(--cc-surface); font-size: 14px; font-weight: 600;
  }
  html body.compass-app #app .map-gallery .map-gallery-filter-toggle[aria-expanded="true"] { background: var(--cc-soft); }
  .map-gallery .map-gallery-extra-controls { display: none; }
  .map-gallery.filters-open .map-gallery-extra-controls { display: block; }
  .map-gallery .base-sort-switch { padding-top: 8px; }
  .map-gallery .map-gallery-controls { margin-bottom: 14px; }
  .map-gallery .base-filter-row { margin-bottom: 0 !important; }
}
@media (max-width: 360px) {
  html body.compass-app #app .map-gallery .base-kind-switch button { padding-inline: 5px; font-size: 13px; }
  html body.compass-app #app .map-gallery .map-gallery-filter-toggle { padding-inline: 6px; font-size: 13px; }
}

/* Server-rendered favorites become available after enhancement. */
html body.compass-app #app .map-gallery .map-gallery-star[hidden] { display: none; }
