/* ══════════════════════════════════════════════════════════════
   Explore Archive — mobile (≤767px).
   Renders teleported filters as a vertical stack of dropdowns
   above the listings, instead of the mobile drawer pattern.
   The horizontal filter-bar at ≥768px is handled in explore.css.
   ══════════════════════════════════════════════════════════════ */

/* ── Active filter chips (mobile) ───────────────────────────── */
body.xp-explore .xp-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
}

body.xp-explore .xp-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    background: #014783;
    border-radius: 4px;
    white-space: nowrap;
}

body.xp-explore .xp-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: rgba(1, 37, 69, .15);
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    color: #fff;
    cursor: pointer;
    transition: background .15s;
}

body.xp-explore .xp-chip-remove:hover {
    background: rgba(1, 37, 69, .3);
}

/* Hide load-prev/next batch arrow icons in archive head — events-style head
   only shows the count text. */
body.xp-explore .xp-flhead-target .fl-head .load-previews-batch,
body.xp-explore .xp-flhead-target .fl-head .load-next-batch,
body.xp-explore .explore-type-2 .fl-head .load-previews-batch,
body.xp-explore .explore-type-2 .fl-head .load-next-batch {
    display: none !important;
}

/* Force teleport targets to remain visible even when empty.
   Elementor's shortcode wrapper can collapse them otherwise. */
body.xp-explore .xp-filters-target,
body.xp-explore .xp-flhead-target {
    display: block !important;
}

@media (max-width: 1024px) {

    /* Hide source + native mobile drawer / sticky head */
    body.xp-explore .xp-filters-source,
    body.xp-explore .xp-flhead-source,
    body.xp-explore .no-map-tmpl .mobile-explore-head-top,
    body.xp-explore .no-map-tmpl .mobile-explore-head,
    body.xp-explore .finder-overlay,
    body.xp-explore .form-group.fc-search,
    body.xp-explore .finder-tabs .sidebar-tabs {
        display: none !important;
    }

    /* Hide MyListing's bottom mobile nav (filters/results toggles) */
    body.xp-explore .no-map-tmpl .mobile-nav-wrapper,
    body.xp-explore .mobile-explore-nav {
        display: none !important;
    }

    /* Force results section + flhead visible regardless of Vue mobileTab state.
       Bootstrap's .visible-lg normally hides at <1200px; we override since the
       mobile tab toggle is removed. */
    body.xp-explore .i-section.explore-type-2.visible-lg,
    body.xp-explore .xp-flhead-source .visible-lg {
        display: block !important;
    }

    /* Teleport target — show as static vertical stack */
    body.xp-explore .xp-filters-target,
    body.xp-explore .xp-flhead-target,
    body.xp-explore .xp-filters-target .finder-container.fc-type-2,
    body.xp-explore .xp-filters-target .finder-search {
        position: static !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        opacity: 1 !important;
        visibility: visible !important;
        box-shadow: none !important;
        transform: none !important;
        overflow: visible !important;
        float: none !important;
    }

    body.xp-explore .xp-filters-target .finder-tabs-wrapper,
    body.xp-explore .xp-filters-target .finder-tabs,
    body.xp-explore:not(.page-slug-explore-all):not(.page-slug-explore-craftperson-map) .xp-filters-target .tab-content,
    body.xp-explore .xp-filters-target .search-tab {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Multi-type pages (explore-all): don't force every tab-content visible —
       each listing type has its OWN filter-wrapper, so let Vue's v-show keep
       only the active type's filters shown (otherwise filters duplicate). */
    body.page-slug-explore-all .xp-filters-target .tab-content {
        opacity: 1 !important;
        visibility: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Filter wrapper — vertical column */
    body.xp-explore .xp-filters-target .search-filters {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    body.xp-explore .xp-filters-target .search-filters .filter-wrapper {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        padding: 16px 0 !important;
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        background: none !important;
        border: none !important;
        overflow: visible !important;
    }

    body.xp-explore .xp-filters-target .search-filters .filter-wrapper > .form-group {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: none !important;
        border: none !important;
        float: none !important;
    }

    /* Reset floating labels (MyListing .md-group default) */
    body.xp-explore .xp-filters-target .search-filters .md-group label,
    body.xp-explore .xp-filters-target .search-filters .md-group select:required:valid ~ label,
    body.xp-explore .xp-filters-target .search-filters .md-group select[multiple] ~ label,
    body.xp-explore .xp-filters-target .search-filters .md-group select[multiple] ~ .select2-container ~ label,
    body.xp-explore .xp-filters-target .search-filters .md-group input:required:valid ~ label {
        position: static !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        animation: none !important;
        background: none !important;
        border: none !important;
        pointer-events: none !important;
    }

    /* Search input — full width pill */
    body.xp-explore .xp-filters-target .filter-wrapper > .form-group.wp-search-filter {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        height: 48px !important;
        padding: 0 16px 0 48px !important;
        background: #f0f1f3 !important;
        border: 1px solid var(--listing-color-border-input, #e2e5ea) !important;
        border-radius: var(--listing-radius, 8px) !important;
    }

    body.xp-explore .xp-filters-target .filter-wrapper > .wp-search-filter::before {
        content: "search";
        font-family: "Material Icons";
        font-feature-settings: "liga";
        font-size: 22px;
        color: var(--listing-color-primary, #012545);
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
    }

    body.xp-explore .xp-filters-target .filter-wrapper > .wp-search-filter input {
        width: 100% !important;
        height: 100% !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        font-size: 15px !important;
        color: #012545 !important;
        padding: 0 !important;
    }

    body.xp-explore .xp-filters-target .filter-wrapper > .wp-search-filter.md-group label {
        position: absolute !important;
        left: 48px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        font-size: 15px !important;
        font-weight: 400 !important;
        color: #6b7d92 !important;
    }

    body.xp-explore .xp-filters-target .wp-search-filter.md-group input:required:valid ~ label {
        display: none !important;
    }

    /* Taxonomy dropdowns — full-width vertical pills */
    body.xp-explore .xp-filters-target .filter-wrapper > .form-group.dropdown-filter {
        display: block !important;
        position: relative !important;
        width: 100% !important;
    }

    body.xp-explore .xp-filters-target .form-group.dropdown-filter .main-term {
        position: relative !important;
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
    }

    body.xp-explore .xp-filters-target .form-group.dropdown-filter .main-term > select {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        opacity: 0 !important;
        overflow: hidden !important;
    }

    body.xp-explore .xp-filters-target .search-filters .filter-wrapper > .dropdown-filter.form-group.md-group label {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        height: 48px !important;
        padding: 0 40px 0 16px !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        color: #012545 !important;
        background: #fff !important;
        border: 1.5px solid var(--listing-color-border-input, #e2e5ea) !important;
        border-radius: var(--listing-radius, 8px) !important;
        cursor: pointer !important;
        z-index: 1 !important;
        margin: 0 !important;
    }

    body.xp-explore .xp-filters-target .search-filters .filter-wrapper > .dropdown-filter.form-group.md-group label::after {
        content: "expand_more";
        font-family: "Material Icons";
        font-feature-settings: "liga";
        font-size: 22px;
        color: #012545;
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
    }

    body.xp-explore .xp-filters-target .search-filters .filter-wrapper > .dropdown-filter.form-group:hover label {
        border-color: var(--listing-color-primary, #012545) !important;
    }

    /* Select2 overlay — invisible clickable area on top of label */
    body.xp-explore .xp-filters-target .form-group.dropdown-filter .select2-container {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        opacity: 0 !important;
        z-index: 2 !important;
        cursor: pointer !important;
    }

    body.xp-explore .xp-filters-target .form-group.dropdown-filter .select2-container .selection,
    body.xp-explore .xp-filters-target .form-group.dropdown-filter .select2-container .selection .select2-selection {
        width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
        cursor: pointer !important;
    }

    body.xp-explore .xp-filters-target .form-group.dropdown-filter .select2-selection__rendered {
        visibility: hidden !important;
        height: 0 !important;
    }

    /* Hide buttons that belong inside the drawer (reset / close) */
    body.xp-explore .xp-filters-target .reset-results-27,
    body.xp-explore .xp-filters-target .close-filters-27 {
        display: none !important;
    }

    /* Date filter (vertical) */
    body.xp-explore .xp-date-filter {
        width: 100% !important;
        margin-top: 0px !important;
    }
    body.xp-explore .xp-date-filter .xp-loop-toggle {
        width: 100% !important;
        text-align: left !important;
        height: 48px !important;
    }

    /* Results header — count + sort vertically aligned */
    body.xp-explore .xp-flhead-target .fl-head,
    body.xp-explore .explore-type-2 .container > .fl-head {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 0px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.xp-explore .explore-type-2 .fl-head .explore-desktop-head,
    body.xp-explore .xp-flhead-target .fl-head .explore-desktop-head {
        flex: 1 1 auto !important;
        color: #012545 !important;
        margin-top: 40px !important;
    }

    body.xp-explore .xp-orderby-inline {
        flex: 0 0 auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Sort dropdown — render as a full-width pill matching the
       taxonomy dropdowns (single-select; selected label visible). */
    body.xp-explore .xp-filters-target .filter-wrapper > .form-group.xp-orderby-inline,
    body.xp-explore .xp-filters-target .xp-orderby-inline,
    body.xp-explore .xp-flhead-target .xp-orderby-inline {
        position: relative !important;
        display: block !important;
        width: 100% !important;
        height: 48px !important;
        background: #fff !important;
        border: 1.5px solid var(--listing-color-border-input, #e2e5ea) !important;
        border-radius: var(--listing-radius, 8px) !important;
        margin: 0 !important;
    }

    body.xp-explore .xp-filters-target .xp-orderby-inline > select,
    body.xp-explore .xp-flhead-target .xp-orderby-inline > select {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        opacity: 0 !important;
        overflow: hidden !important;
    }

    body.xp-explore .xp-filters-target .xp-orderby-inline > label,
    body.xp-explore .xp-flhead-target .xp-orderby-inline > label {
        display: none !important;
    }

    body.xp-explore .xp-filters-target .xp-orderby-inline .select2-container,
    body.xp-explore .xp-flhead-target .xp-orderby-inline .select2-container {
        position: static !important;
        width: 100% !important;
        height: 100% !important;
        opacity: 1 !important;
    }

    body.xp-explore .xp-filters-target .xp-orderby-inline .select2-selection--single,
    body.xp-explore .xp-flhead-target .xp-orderby-inline .select2-selection--single {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        height: 100% !important;
        padding: 0 40px 0 16px !important;
        background: transparent !important;
        border: none !important;
        outline: none !important;
        cursor: pointer !important;
    }

    body.xp-explore .xp-filters-target .xp-orderby-inline .select2-selection__rendered,
    body.xp-explore .xp-flhead-target .xp-orderby-inline .select2-selection__rendered {
        visibility: visible !important;
        height: auto !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        color: #012545 !important;
        line-height: 1 !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    body.xp-explore .xp-filters-target .xp-orderby-inline .select2-selection__clear,
    body.xp-explore .xp-flhead-target .xp-orderby-inline .select2-selection__clear {
        display: none !important;
    }

    /* Hide select2's native arrow entirely; render chevron on the pill itself
       so it matches the taxonomy dropdown chevrons (same size, same position). */
    body.xp-explore .xp-filters-target .xp-orderby-inline .select2-selection__arrow,
    body.xp-explore .xp-flhead-target .xp-orderby-inline .select2-selection__arrow {
        display: none !important;
    }

    body.xp-explore .xp-filters-target .filter-wrapper > .form-group.xp-orderby-inline::after,
    body.xp-explore .xp-filters-target .xp-orderby-inline::after,
    body.xp-explore .xp-flhead-target .xp-orderby-inline::after {
        content: "expand_more";
        font-family: "Material Icons";
        font-feature-settings: "liga";
        font-size: 22px;
        line-height: 1;
        color: #012545;
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        pointer-events: none;
    }

    /* Results section spacing */
    body.xp-explore .i-section.explore-type-2 {
        padding-top: 0 !important;
    }
}

/* ══════════════════════════════════════════════════════════════
   Result grid spacing — ALL widths (explore archive pages).
   Horizontal gap 20px (10px column padding each side),
   vertical gap 30px, and 0px flush to the content edges
   (row pulled out -10px to match the column padding).
   Scoped to the listed archive pages only.
   ══════════════════════════════════════════════════════════════ */
body.page-slug-explore-craftperson .results-view.grid,
body.page-slug-explore-award .results-view.grid,
body.page-slug-explore-laboratory .results-view.grid,
body.page-slug-explore-artwork .results-view.grid,
body.page-slug-explore-draseis .results-view.grid,
body.page-slug-explore-all .results-view.grid {
    margin-left: -10px !important;
    margin-right: -10px !important;
}

/* Horizontal 20px gap + 0px outer edges (10px padding per side).
   High specificity (+ col classes) to beat the ≤767px zero-padding
   rule in explore-archive-responsive.css for these pages. */
body.page-slug-explore-craftperson .results-view.grid .col-md-4.col-sm-6.grid-item,
body.page-slug-explore-award .results-view.grid .col-md-4.col-sm-6.grid-item,
body.page-slug-explore-laboratory .results-view.grid .col-md-4.col-sm-6.grid-item,
body.page-slug-explore-artwork .results-view.grid .col-md-4.col-sm-6.grid-item,
body.page-slug-explore-draseis .results-view.grid .col-md-4.col-sm-6.grid-item,
body.page-slug-explore-all .results-view.grid .col-md-4.col-sm-6.grid-item {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* Vertical 30px gap between rows */
body.page-slug-explore-craftperson .results-view.grid .grid-item > .lf-item-container,
body.page-slug-explore-award .results-view.grid .grid-item > .lf-item-container,
body.page-slug-explore-laboratory .results-view.grid .grid-item > .lf-item-container,
body.page-slug-explore-artwork .results-view.grid .grid-item > .lf-item-container,
body.page-slug-explore-draseis .results-view.grid .grid-item > .lf-item-container,
body.page-slug-explore-all .results-view.grid .grid-item > .lf-item-container {
    margin-bottom: 30px !important;
}
