/*
 * mls-switchboard.css  v1.0.6
 * MLS Compliance Switchboard — Visibility Control
 *
 * Naming convention (defined in MLS-GROUNDING.md §3):
 *   .idx-footer-default    — Beaver Builder row: generic compliance footer
 *   .idx-footer-{slug}     — Beaver Builder row: one per MLS board (e.g. .idx-footer-mls1)
 *   body.mls-active        — Added by mls-brain.js whenever ANY provider is detected
 *   body.show-{slug}       — Added by mls-brain.js for the specific matched provider
 *
 * Body class is derived from the mls_provider term slug:
 *   term slug "mls1"  → body classes: mls-active  show-mls1
 *   term slug "mls2"  → body classes: mls-active  show-mls2
 *   term slug "crmls" → body classes: mls-active  show-crmls
 *
 * WP Engine / Varnish note: all display switching is CSS-class-based so no
 * server-rendered variation ever reaches the cache layer.
 */


/* ══ SECTION 1: Default (no MLS detected) ══════════════════════════════════ */

/*
 * .idx-footer-default is visible when no MLS is active.
 * Its computed display value comes from the Beaver Builder row — we only
 * need to ensure MLS-specific rows start hidden.
 */

.idx-footer-mls1,
.idx-footer-mls2 {
    display: none;
}

/*
 * Extend the hidden-by-default list as new MLS boards are onboarded.
 * One line per provider, matching its Beaver Builder row class.
 *
 * Example:
 *   .idx-footer-crmls,
 *   .idx-footer-ntreis { display: none; }
 */


/* ══ SECTION 2: Active MLS state ═══════════════════════════════════════════ */

/*
 * When mls-brain.js detects a provider it adds body.mls-active first.
 * This single rule suppresses the generic footer across ALL providers
 * without duplicating a hide rule for every show-{slug} variant.
 */

body.mls-active .idx-footer-default {
    display: none;
}


/* ══ SECTION 3: Provider-specific reveal rules ══════════════════════════════ */

/*
 * Each rule below reveals exactly one MLS footer row.
 * The selector specificity intentionally mirrors the hide rule above so
 * both fire at the same cascade weight — the last one wins only because
 * show rules appear after hide rules in source order.
 */

/* MLS Provider: mls1 (body class: show-mls1) */
body.show-mls1 .idx-footer-mls1 {
    display: block;
}

/* MLS Provider: mls2 (body class: show-mls2) */
body.show-mls2 .idx-footer-mls2 {
    display: block;
}

/*
 * ── Template for additional providers ───────────────────────────────────────
 * Copy the two-line block below for each new mls_provider term you create.
 * Set {slug} to the exact WP term slug.
 *
 * .idx-footer-{slug}               { display: none; }   ← add to Section 1
 * body.show-{slug} .idx-footer-{slug} { display: block; }  ← add here
 */


/* ══ SECTION 4: IDX full-width layout ══════════════════════════════════════ */

/*
 * Astra's alignfull block adds 60px left/right padding, shrinking the IDX
 * widget by 120px. These rules zero that padding so the Showcase IDX search
 * renders edge-to-edge within the site container on location pages.
 */

.wp-block-group.alignfull:has(.sidx-container) {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.wp-block-group.alignfull .sidx-container {
    width: 100% !important;
}


/* ══ SECTION 4b: IDX full-width layout — Beaver Builder pages ══════════════ */

/*
 * Reorder BB rows so the IDX search widget always appears above the broker
 * info section. The BB layout has broker info first in source order; flex
 * column + order values visually swap them without touching BB's saved data.
 *
 * Add each franchise page's fl-builder-content-{id} as it goes live.
 */

.fl-builder-content-14094 {
    display: flex !important;
    flex-direction: column !important;
    padding-top: 55px !important;
}

.fl-row:has(.sidx-container) { order: 1 !important; }
.fl-row:has(.mls-broker-info) { order: 2 !important; }

/* Hide the h2 from its position inside the broker info row */
.fl-node-evhlrf1yo h2 {
    display: none !important;
}

/* Re-inject it as a constrained flex item directly above the IDX search.
 * order: 1 matches the IDX row — pseudo-elements sort before children at the
 * same order value, so ::before lands just above the IDX widget. */
.fl-builder-content-14094::before {
    content: "Browse active NWMLS listings below.";
    order: 1;
    display: block;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 40px 8px;
    font-size: 1.3em;
    font-weight: 600;
}




/*
 * On pages built with Beaver Builder, the IDX shortcode sits inside a
 * fl-module-html column. These rules mirror Astra's alignfull technique
 * (calc(-50vw + 50%) margins + width: 100vw) to break the BB row out of
 * the 1200px content container and reach true viewport width.
 */

/*
 * Primary: target by specific BB node class (page 14094 IDX row).
 * Fallback: :has(.sidx-container) catches any future page where the BB node
 * class changes or the shortcode moves to a different row.
 */
.fl-node-vsgq5fjuc39k,
.fl-row.fl-row-full-width:has(.sidx-container) {
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    max-width: 100vw !important;
    width: 100vw !important;
}

.fl-node-vsgq5fjuc39k .fl-row-content-wrap,
.fl-row-content-wrap:has(.sidx-container) {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: none !important;
}

.fl-node-vsgq5fjuc39k .fl-module-html,
.fl-module-html:has(.sidx-container) {
    margin: 0 !important;
}

/* 5px side padding on the IDX search widget */
.fl-node-vsgq5fjuc39k .sidx-main-app-body,
.sidx-main-app-body {
    padding-left: 5px !important;
    padding-right: 5px !important;
}


/* ══ SECTION 5: Astra header logo swap support ══════════════════════════════ */

/*
 * mls-brain.js swaps .site-logo-img img src synchronously.
 * This rule adds a short opacity fade to soften the swap on fast connections.
 * Remove or set to 0s if the flash is acceptable or causes layout issues.
 */

.site-logo-img img {
    transition: opacity 0.12s ease-in-out;
}
