/* Clear Map Styles */
.clear-map-3-container {
    position: relative;
    width: 100%;
    height: 60vh; /* Default height, overridden by JS for responsive values */
    min-height: 400px;
    background: #f5f5f0;
    font-family: 'Area Normal', -apple-system, BlinkMacSystemFont, sans-serif;
}

.clear-map-3 {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

/* Screen-reader-only text (standard WP clip pattern), scoped to plugin
   markup — the frontend stylesheet doesn't otherwise define this class, so
   without it the .cm3-filter-toggle / .cm3-detail-close / .cm3-detail-edge
   sr-only spans render as real flex siblings and shove their icons off-center. */
.clear-map-3-container .screen-reader-text,
.cm3-detail-panel .screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}

/* ============================================
   Stage layout: map region + POI detail panel
   The filter panel floats absolutely over .cm3-map-region regardless of
   mode; the detail panel either overlays it (position:absolute) or pushes
   it (a real flex sibling that shrinks .cm3-map-region), per data-panel-mode
   on the outer container.
   ============================================ */
.cm3-stage {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
}

.cm3-map-region {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
}

.cm3-map-region .clear-map-3 {
    width: 100%;
    height: 100%;
}

/* ============================================
   Filter Panel — floating chip-grid card
   ============================================ */
.cm3-filter-panel {
    position: absolute;
    top: 16px;
    left: 16px;
    /* Content-driven width: as wide as the chip grid needs (both columns,
       full one-line labels), never a fixed 340px — with a floor so it
       doesn't look cramped when there are few/short categories, and a
       ceiling so it can't swallow the map on a narrow embed. */
    width: fit-content;
    min-width: 340px;
    max-width: min(560px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    background: #FBF8F1;
    border-radius: 14px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.15);
    z-index: 900;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Area Normal', -apple-system, BlinkMacSystemFont, sans-serif;
}

.cm3-filter-panel.cm3-panel-frosted {
    background: rgba(251, 248, 241, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.cm3-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    flex-shrink: 0;
}

/* The panel heading carries a class so its heading LEVEL can be set for a
   valid document outline (WCAG 1.3.1) independent of its appearance. The
   !important keeps it a compact panel label regardless of the host theme's
   hN font-size rules (e.g. Salient child themes set h2 font-size !important,
   which would otherwise blow this title up to multi-line heading size). */
.cm3-filter-title {
    margin: 0 !important;
    font-size: 15px !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;
    color: #333 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
}

.cm3-filter-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}

.cm3-filter-toggle:hover {
    color: #333;
}

.cm3-filter-panel.collapsed .cm3-filter-toggle {
    transform: rotate(180deg);
}

.cm3-filter-panel.collapsed .cm3-filter-body {
    display: none;
}

.cm3-filter-body {
    padding: 0 18px 18px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.cm3-drag-handle {
    display: none;
}

/* Chip grid — each column sizes to its own widest chip (max-content), but
   can still be compressed by the grid algorithm if the panel's max-width
   cap is hit (min 0), which is what lets long labels ellipsize below
   instead of forcing a horizontal scrollbar. */
.cm3-chip-grid {
    display: grid;
    grid-template-columns: repeat(var(--cm3-chip-cols, 2), minmax(0, max-content));
    gap: 10px;
    margin-bottom: 6px;
}

/* Optional fixed panel width (--cm3-panel-width set inline by the renderer).
   Desktop/tablet only — the ≤768px bottom sheet keeps its own sizing. */
@media (min-width: 769px) {
    .cm3-filter-panel.cm3-panel-custom-width {
        width: var(--cm3-panel-width);
        min-width: 0;
        max-width: calc(100% - 32px);
    }
}

.cm3-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    text-align: left;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.cm3-chip:hover {
    border-color: rgba(0, 0, 0, 0.18);
}

.cm3-filter-panel.cm3-chips-frosted .cm3-chip {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.cm3-chip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--chip-color, #888);
    flex-shrink: 0;
}

.cm3-chip-icon {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Button Width = "Full width": chips stretch to fill their grid column, label
   centered with the icon/dot immediately to its left. */
.cm3-chip-grid.cm3-chips-full {
    grid-template-columns: repeat(var(--cm3-chip-cols, 2), minmax(0, 1fr));
}

.cm3-chip-grid.cm3-chips-full .cm3-chip {
    width: 100%;
    /* Left-aligned, not centered: the color icon/dot reads as a legend swatch,
       so every row's icon+label must start at the same x position. */
    justify-content: flex-start;
}

/* The label normally grows (flex: 1) to fill the chip — in full-width mode it
   must hug its text so the icon/dot + label pair centers as one unit. It still
   shrinks and ellipsizes when the column is narrower than the text. */
.cm3-chip-grid.cm3-chips-full .cm3-chip-label {
    flex: 0 1 auto;
}

.cm3-chip-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm3-chip.active {
    background: var(--chip-color, #888);
    border-color: var(--chip-color, #888);
    color: #fff;
}

.cm3-chip.active .cm3-chip-dot {
    background: #fff;
}

.cm3-chip.active .cm3-chip-icon {
    filter: brightness(0) invert(1);
}

/* The frosted-chip rule above is more specific than `.cm3-chip.active`, so the
   active chip would otherwise keep a near-transparent background while its
   label turned white — invisible. Restate the fill here so the selected chip
   always has its category colour behind the white text. */
.cm3-filter-panel.cm3-chips-frosted .cm3-chip.active {
    background: var(--chip-color, #888);
    border-color: var(--chip-color, #888);
    color: #fff;
}

/* Pinned Home POI row (show_home_in_filters) — sits above the chip grid,
   always visible, never part of a category accordion. */
.cm3-home-row {
    margin-bottom: 6px;
}

/* POI list accordion (one per category, opened by its chip) */
.cm3-poi-list {
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease; /* fallback when GSAP is unavailable; GSAP normally drives this inline */
}

.cm3-poi-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px;
    margin: 2px 0;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background-color 0.15s ease;
}

.cm3-poi-row:hover,
.cm3-poi-row.active {
    background: rgba(0, 0, 0, 0.05);
}

/* POI rows are buttons too — when "buttons" frosted glass is on they get the
   same glass treatment as the category chips instead of sitting bare on the
   map. */
.cm3-filter-panel.cm3-chips-frosted .cm3-poi-row {
    margin: 6px 0;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.cm3-filter-panel.cm3-chips-frosted .cm3-poi-row:hover,
.cm3-filter-panel.cm3-chips-frosted .cm3-poi-row.active {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.18);
}

.cm3-poi-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--thumb-color, #ccc);
}

.cm3-poi-thumb img {
    /* !important defeats host-theme global img resets (e.g. height:auto)
       that would otherwise letterbox the photo inside the circle. */
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block;
}

.cm3-poi-thumb--empty {
    opacity: 0.85;
}

/* poi_row_icon = "marker": the thumb shows the POI's map marker (custom icon
   or baked shape) instead of a photo — no circle mask, no color fill. */
.cm3-poi-thumb.cm3-thumb-marker {
    width: 34px;
    height: 34px;
    background: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cm3-poi-thumb.cm3-thumb-marker img {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

.cm3-poi-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.cm3-poi-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.cm3-poi-address {
    font-size: 12px;
    color: #888;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Filter Panel Position = "above" — a full-width header bar sits in normal
   flow above the map; expanding drops the filter body down over the map.
   All selectors here are ≥0,2,0 specificity, so they beat the ≤768/≤480
   mobile repositioning and chevron-hide rules without touching those blocks.
   ============================================ */
.clear-map-3-container.cm3-pos-above { display: flex; flex-direction: column; }
.cm3-pos-above .cm3-stage { flex: 1 1 auto; min-height: 0; height: auto; }

.cm3-pos-above .cm3-filter-panel {
    position: relative;
    top: auto; left: auto; right: auto; bottom: auto;
    width: auto; min-width: 0; max-width: none; max-height: none;
    flex: 0 0 auto;
    overflow: visible;               /* lets the absolute body escape */
    border-radius: 14px 14px 0 0;
    z-index: 900;                    /* must beat the later .cm3-stage sibling */
}
.cm3-pos-above .cm3-filter-panel.cm3-panel-custom-width { width: auto; min-width: 0; max-width: none; }

.cm3-pos-above .cm3-filter-body {
    position: absolute;
    top: 100%; left: 0; right: 0;
    z-index: 900;
    max-height: min(65vh, 520px);
    overflow-y: auto;
    background: inherit;             /* picks up default #FBF8F1, custom bg, or frosted rgba */
    border-radius: 0 0 14px 14px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.15);
    padding: 10px 18px 18px;
}
/* backdrop-filter doesn't inherit — re-apply for frosted */
.cm3-pos-above .cm3-panel-frosted .cm3-filter-body {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.cm3-pos-above .cm3-filter-header { cursor: pointer; padding: 12px 18px; }
.cm3-pos-above .cm3-drag-handle { display: none !important; }
.cm3-pos-above .cm3-filter-toggle { display: inline-flex; }  /* re-shows chevron on mobile */

/* ============================================
   Surroundings-aware panel — `cm3-on-dark` is added by JS when the basemap
   under a see-through panel is dark (satellite imagery). Dark-on-light text
   and white glass become light-on-dark so the controls stay readable. A panel
   with a solid background colour never gets the class.
   ============================================ */
.cm3-filter-panel.cm3-on-dark .cm3-filter-title {
    color: #fff !important;
}

.cm3-filter-panel.cm3-on-dark .cm3-filter-toggle {
    color: rgba(255, 255, 255, 0.8);
}

.cm3-filter-panel.cm3-on-dark .cm3-filter-toggle:hover {
    color: #fff;
}

.cm3-filter-panel.cm3-on-dark .cm3-chip,
.cm3-filter-panel.cm3-on-dark.cm3-chips-frosted .cm3-chip {
    background: rgba(16, 18, 16, 0.45);
    border-color: rgba(255, 255, 255, 0.22);
    color: #f4f4f4;
}

.cm3-filter-panel.cm3-on-dark .cm3-chip:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Selected chips keep their category fill — it reads on either surface. */
.cm3-filter-panel.cm3-on-dark .cm3-chip.active,
.cm3-filter-panel.cm3-on-dark.cm3-chips-frosted .cm3-chip.active {
    background: var(--chip-color, #888);
    border-color: var(--chip-color, #888);
    color: #fff;
}

.cm3-filter-panel.cm3-on-dark .cm3-poi-row,
.cm3-filter-panel.cm3-on-dark.cm3-chips-frosted .cm3-poi-row {
    background: rgba(16, 18, 16, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.cm3-filter-panel.cm3-on-dark .cm3-poi-row:hover,
.cm3-filter-panel.cm3-on-dark .cm3-poi-row.active,
.cm3-filter-panel.cm3-on-dark.cm3-chips-frosted .cm3-poi-row:hover,
.cm3-filter-panel.cm3-on-dark.cm3-chips-frosted .cm3-poi-row.active {
    background: rgba(16, 18, 16, 0.65);
    border-color: rgba(255, 255, 255, 0.4);
}

.cm3-filter-panel.cm3-on-dark .cm3-poi-name {
    color: #f4f4f4;
}

.cm3-filter-panel.cm3-on-dark .cm3-poi-address {
    color: rgba(255, 255, 255, 0.72);
}

/* ============================================
   XO-style hover card — floats near the pin when hovering a POI row
   in the open list. Positioned in JS (left/top px against .cm3-map-region).
   Desktop + hover-capable pointers only (gated in JS); doesn't intercept
   pointer events so it can never steal the row's mouseleave.
   ============================================ */
.cm3-hover-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    z-index: 850;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    font-family: 'Area Normal', -apple-system, BlinkMacSystemFont, sans-serif;
}

.cm3-hover-card.open {
    opacity: 1;
    transform: translateY(0);
}

/* Caret pointing at the pin — left edge by default, right edge when flipped */
.cm3-hover-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -6px;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: translateY(-50%) rotate(45deg);
    box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.06);
}

.cm3-hover-card--flip::before {
    left: auto;
    right: -6px;
    box-shadow: 2px -2px 4px rgba(0, 0, 0, 0.06);
}

.cm3-hover-card-img {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #eee;
}

.cm3-hover-card-img img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block;
}

.cm3-hover-card-body {
    padding: 10px 12px 12px;
}

.cm3-hover-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    margin-bottom: 2px;
}

.cm3-hover-card-address {
    font-size: 11.5px;
    color: #888;
    line-height: 1.3;
}

/* ============================================
   POI Detail Panel — overlay or push, per data-panel-mode
   ============================================ */
.cm3-detail-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: clamp(320px, 40%, 480px);
    background: #fff;
    box-shadow: -6px 0 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 950;
    overflow: hidden;
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.35s ease, opacity 0.3s ease;
    font-family: 'Area Normal', -apple-system, BlinkMacSystemFont, sans-serif;
}

.cm3-detail-panel.open {
    transform: translateX(0);
    opacity: 1;
}

/* Mobile-only modal backdrop for the detail sheet (JS inserts it as the
   panel's previous sibling and toggles .open at the mobile breakpoint).
   Sibling placement is load-bearing: it shares the panel's stacking context,
   so its lower z-index (1190 vs the sheet's 1200) always paints under the
   sheet even when theme wrappers create their own stacking contexts. */
.cm3-detail-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1190;
    background: rgba(0, 0, 0, 0.3);
    touch-action: none;
}

/* Page scroll lock while the mobile detail sheet is open. */
html.cm3-scroll-lock,
html.cm3-scroll-lock body {
    overflow: hidden;
}

/* Push mode: the panel is a real flex sibling of .cm3-map-region and
   animates its own width, shrinking the map region alongside it. */
.clear-map-3-container[data-panel-mode="push"] .cm3-detail-panel {
    position: relative;
    top: auto;
    right: auto;
    height: auto;
    flex: 0 0 0;
    width: 0;
    min-width: 0;
    transform: none;
    transition: flex-basis 0.35s ease, width 0.35s ease, opacity 0.3s ease;
}

.clear-map-3-container[data-panel-mode="push"] .cm3-detail-panel.open {
    flex: 0 0 clamp(320px, 40%, 480px);
    width: clamp(320px, 40%, 480px);
}

.cm3-detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    padding: 0;
    box-sizing: border-box;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    cursor: pointer;
    z-index: 5;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.cm3-detail-close svg {
    /* Absolutely centered so no theme button styling (padding, line-height,
       text-indent, stray whitespace nodes) can nudge the icon off-center. */
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.cm3-detail-close:hover {
    background: #333;
    color: #fff;
    transform: scale(1.05);
}

.cm3-detail-edge {
    position: absolute;
    top: 50%;
    left: -18px;
    transform: translateY(-50%);
    width: 22px;
    height: 52px;
    border-radius: 8px 0 0 8px;
    background: #fff;
    border: none;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    cursor: pointer;
}

.cm3-detail-edge:hover {
    color: #333;
}

.cm3-detail-drag-handle {
    display: none;
}

.cm3-detail-content {
    padding: 20px 22px 26px;
    overflow-y: auto;
    flex: 1 1 auto;
    /* Reaching the end of the panel's own scroll must not chain into
       scrolling the page/map behind it (mobile modal sheet). */
    overscroll-behavior: contain;
}

.cm3-detail-name {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 600;
    color: #333;
}

.cm3-detail-address {
    font-size: 13px;
    color: #777;
    margin-bottom: 14px;
}

.cm3-detail-desc {
    font-size: 14px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 18px;
    white-space: pre-line;
}

.cm3-detail-website {
    display: inline-block;
    font-size: 13px;
    color: #2271b1;
    text-decoration: none;
    margin-bottom: 18px;
}

.cm3-detail-website:hover {
    text-decoration: underline;
}

.cm3-detail-directions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 18px;
    background: #D4A574;
    color: #fff;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.cm3-detail-directions:hover {
    background: #c2925f;
}

/* Carousel */
.cm3-carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #eee;
    overflow: hidden;
    flex: 0 0 auto;
}

.cm3-carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
    touch-action: pan-y;
}

.cm3-carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
}

.cm3-carousel-slide img {
    /* !important defeats host-theme global img resets (e.g. height:auto)
       that would otherwise shrink the photo to the top of the slide. */
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block;
}

/* Logo fallback (no gallery, no photo): must not be crop-mangled — contain
   the logo with breathing room on a neutral background instead. */
.cm3-carousel--logo {
    background: #f4f3ef;
}

.cm3-carousel--logo .cm3-carousel-slide img {
    width: calc(100% - 48px) !important;
    height: calc(100% - 48px) !important;
    max-width: none !important;
    margin: 24px;
    object-fit: contain !important;
    object-position: center !important;
}

.cm3-carousel-count {
    position: absolute;
    left: 12px;
    bottom: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 20px;
}

.cm3-carousel-prev,
.cm3-carousel-next,
.cm3-carousel-expand {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.cm3-carousel-prev:hover,
.cm3-carousel-next:hover,
.cm3-carousel-expand:hover {
    background: #fff;
}

.cm3-carousel-prev {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.cm3-carousel-next {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.cm3-carousel-expand {
    /* Bottom-right, NOT top-right: the panel's close button (.cm3-detail-close,
       top 12/right 12) sits directly over the carousel's top-right corner and
       the two buttons would stack. The count badge owns bottom-left. */
    bottom: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
}

/* Fullscreen lightbox */
.cm3-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
}

.cm3-lightbox.open {
    display: flex;
}

.cm3-lightbox-img {
    max-width: 88vw;
    max-height: 84vh;
    object-fit: contain;
}

.cm3-lightbox-close,
.cm3-lightbox-prev,
.cm3-lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}

.cm3-lightbox-close:hover,
.cm3-lightbox-prev:hover,
.cm3-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cm3-lightbox-close {
    top: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
}

.cm3-lightbox-prev,
.cm3-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 30px;
    line-height: 1;
}

.cm3-lightbox-prev {
    left: 20px;
}

.cm3-lightbox-next {
    right: 20px;
}

.cm3-lightbox-count {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
}

/* Map Tooltip */
.clear-map-3-tooltip {
    position: absolute;
    background: #ffffff;
    color: #333;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid rgba(212, 165, 116, 0.3);
    font-size: 13px;
    pointer-events: none;
    z-index: 10000;
    max-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: 'Area Normal', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.4;
}

.tooltip-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: #222;
    font-size: 14px;
}

.tooltip-address {
    color: #666;
    font-size: 12px;
    line-height: 1.3;
}

/* ============================================
   Mobile Responsive (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    .clear-map-3-container {
        min-height: 360px;
    }

    /* Clips the bottom-sheet drawer to the map region so its collapsed peek
       and expanded body can never paint over page content below the map.
       `clip` avoids turning the region into a scroll container; `hidden` is
       the fallback for browsers without it. */
    .cm3-map-region {
        overflow: hidden;
        overflow: clip;
    }

    /* Hover card is desktop/hover-capable only — belt-and-suspenders
       against a card left open across a resize into this breakpoint. */
    .cm3-hover-card {
        display: none !important;
    }

    /* Filter panel becomes a bottom sheet, peeking via the same .collapsed
       class the desktop chevron uses — here it's a translateY reveal
       instead of a height collapse. */
    .cm3-filter-panel {
        top: auto;
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
        min-width: 0; /* the desktop 340px floor would overflow a narrow phone's 10px/10px margins */
        max-width: none;
        max-height: min(70vh, calc(100% - 20px)); /* keeps the open sheet inside a short mobile map region */
        border-radius: 16px;
    }

    .cm3-filter-panel.cm3-mobile-hidden {
        display: none !important;
    }

    .cm3-filter-panel.cm3-mobile-drawer {
        transform: translateY(calc(100% - 58px));
        transition: transform 0.3s ease;
    }

    .cm3-filter-panel.cm3-mobile-drawer:not(.collapsed) {
        transform: translateY(0);
    }

    /* The body must stay laid out (not display:none) so the translateY
       reveal works — overrides the desktop .collapsed rule. */
    .cm3-filter-panel.cm3-mobile-drawer .cm3-filter-body {
        display: block !important;
    }

    .cm3-filter-header {
        cursor: pointer;
        padding: 10px 18px 4px;
    }

    .cm3-filter-toggle {
        display: none;
    }

    .cm3-drag-handle {
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: rgba(0, 0, 0, 0.2);
        margin: 0 auto 8px;
        cursor: pointer;
    }

    /* Detail panel becomes a full-width bottom sheet regardless of
       overlay/push mode. */
    .cm3-detail-panel {
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        height: 75vh;
        max-height: 88vh;
        width: 100% !important;
        flex: none !important;
        border-radius: 18px 18px 0 0;
        transform: translateY(100%);
        opacity: 1;
        transition: transform 0.35s ease;
        z-index: 1200;
    }

    .cm3-detail-panel.open {
        transform: translateY(0);
    }

    /* Backdrop only ever shows at the mobile breakpoint (JS also guards). */
    .cm3-detail-backdrop.open {
        display: block;
    }

    .cm3-detail-edge {
        display: none;
    }

    .cm3-detail-drag-handle {
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: rgba(0, 0, 0, 0.25);
        margin: 10px auto 0;
        flex-shrink: 0;
        cursor: pointer;
    }
}

@media (max-width: 480px) {
    /* Mobile columns = min(configured, 2): honors 1 column; caps 3/4 at 2.
       --cm3-chip-cols-mobile is inlined by the renderer alongside
       --cm3-chip-cols; the `, 2` fallback keeps cached old markup at the
       previous forced-2 behavior. */
    .cm3-chip-grid {
        grid-template-columns: repeat(var(--cm3-chip-cols-mobile, 2), minmax(0, max-content));
    }

    .cm3-chip-grid.cm3-chips-full {
        grid-template-columns: repeat(var(--cm3-chip-cols-mobile, 2), minmax(0, 1fr));
    }

    .cm3-carousel {
        aspect-ratio: 4 / 3;
    }

    .cm3-filter-title {
        font-size: 13px !important;
    }

    .cm3-chip-label {
        font-size: 12px;
    }

    .cm3-poi-name {
        font-size: 12.5px;
    }

    .cm3-detail-name {
        font-size: 17px;
    }
}

/* Map Controls Override */
.mapboxgl-ctrl-attrib {
    font-size: 10px !important;
    background: rgba(255, 255, 255, 0.8) !important;
}

/* Cluster Animations */
.mapboxgl-marker {
    transition: transform 0.2s ease;
}

.mapboxgl-marker:hover {
    transform: scale(1.1);
}

/* Custom scrollbar for scrollable panel regions */
.cm3-filter-body::-webkit-scrollbar,
.cm3-detail-content::-webkit-scrollbar {
    width: 4px;
}

.cm3-filter-body::-webkit-scrollbar-track,
.cm3-detail-content::-webkit-scrollbar-track {
    background: rgba(212, 165, 116, 0.1);
}

.cm3-filter-body::-webkit-scrollbar-thumb,
.cm3-detail-content::-webkit-scrollbar-thumb {
    background: rgba(212, 165, 116, 0.4);
    border-radius: 2px;
}

.cm3-filter-body::-webkit-scrollbar-thumb:hover,
.cm3-detail-content::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 165, 116, 0.6);
}

/* Subway Toggle Switch */
.subway-toggle-section {
    border-bottom: 1px solid rgba(212, 165, 116, 0.15);
    padding: 16px 24px;
    margin-bottom: 8px;
}

.subway-toggle-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.subway-toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #8B7355;
    gap: 12px;
    user-select: none;
}

.subway-toggle-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.subway-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #E5E5E5;
    border-radius: 12px;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 2px;
}

.subway-toggle-switch::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subway-toggle-checkbox:checked + .subway-toggle-switch {
    background: #D4A574;
}

.subway-toggle-checkbox:checked + .subway-toggle-switch::before {
    transform: translateX(20px);
}

.subway-toggle-text {
    color: #8B7355;
    font-weight: 500;
}

/* Mobile responsive styles for subway toggle */
@media (max-width: 768px) {
    .subway-toggle-section {
        padding: 12px 20px;
    }

    .subway-toggle-label {
        font-size: 13px;
        gap: 10px;
    }

    .subway-toggle-switch {
        width: 40px;
        height: 22px;
    }

    .subway-toggle-switch::before {
        width: 18px;
        height: 18px;
    }

    .subway-toggle-checkbox:checked + .subway-toggle-switch::before {
        transform: translateX(18px);
    }
}

/* ============================================
   Building hover popup (mapboxgl.Popup base styles)
   The POI detail is now the .cm3-detail-panel below, not a map popup —
   these rules only style the building marker's hover popup.
   ============================================ */

.mapboxgl-popup-content {
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.mapboxgl-popup-close-button {
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: #fff;
    color: #333;
    font-size: 20px;
    line-height: 1;
    font-weight: 400;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    z-index: 2;
}

.mapboxgl-popup-close-button:hover,
.mapboxgl-popup-close-button:focus {
    background: #333;
    color: #fff;
    transform: scale(1.05);
}

/* ============================================
   Building Popup (hover tooltip)
   The global .mapboxgl-popup-content has padding:0, so the inner
   wrapper supplies its own padding — matches the POI popup look.
   ============================================ */
.building-popup {
    font-family: 'Area Normal', -apple-system, BlinkMacSystemFont, sans-serif;
}

.building-popup-content {
    padding: 18px 22px;
    text-align: center;
    max-width: 260px;
}

.building-popup-name {
    font-size: 15px;
    font-weight: 400;
    color: #5a4a3a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.35;
}

.building-popup-divider {
    width: 40px;
    height: 2px;
    background: #5a4a3a;
    margin: 12px auto 14px;
}

.building-popup-description {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 10px;
}

.building-popup-contact {
    font-size: 13px;
    line-height: 1.5;
    color: #666;
}

.building-popup-contact a {
    color: #2271b1;
    text-decoration: none;
}

.building-popup-contact a:hover {
    text-decoration: underline;
}

/* ===== CM3 Map Options control ===== */

.cm3-map-options-ctl {
    position: relative;
    /* Sit above the navigation/fullscreen control groups so the options card
       is never drawn beneath the zoom buttons. */
    z-index: 5;
}

.cm3-map-options-ctl button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 29px;
    height: 29px;
    padding: 0;
    background: #fff;
    border: none;
    cursor: pointer;
    color: #333;
}

.cm3-map-options-ctl button:hover {
    background: #f2f2f2;
}

.cm3-map-options-pop {
    display: none;
    position: absolute;
    /* Opens to the LEFT of the button, aligned to its top — clear of the
       zoom / fullscreen buttons stacked below it. */
    top: 0;
    right: calc(100% + 8px);
    width: 220px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    padding: 12px;
    z-index: 10;
}

.cm3-map-options-pop.open {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cm3-map-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    padding: 4px 2px;
    user-select: none;
}

.cm3-map-options-row-label {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.cm3-toggle-checkbox {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
}

.cm3-toggle-switch {
    position: relative;
    flex-shrink: 0;
    width: 36px;
    height: 20px;
    background: #E5E5E5;
    border-radius: 10px;
    transition: background 0.3s ease;
    display: block;
}

.cm3-toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cm3-toggle-checkbox:checked + .cm3-toggle-switch {
    background: #D4A574;
}

.cm3-toggle-checkbox:checked + .cm3-toggle-switch::before {
    transform: translateX(16px);
}

@media (max-width: 480px) {
    .cm3-map-options-pop {
        width: 200px;
    }
}