/**
 * Flamingo Marine — Dealer Locator section.
 * Two columns: copy left, an interactive flat US map on a looping water video
 * right. White states with a soft lift-shadow (evokes the comp's 3D render),
 * red chevron pins, and a contact card on pin hover/focus.
 */

.flm-dealer__inner {
    display: flex;
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
    max-width: 1280px;
    margin-inline: auto;
    padding-block: clamp(3rem, 7vw, 6.5rem);
    padding-inline: var(--wp--preset--spacing--xl);
}

.flm-dealer__copy { flex: 0 1 38%; }
.flm-dealer__mapwrap { flex: 1 1 62%; }

.flm-dealer__title {
    margin: 0;
    color: var(--wp--preset--color--text-primary);
    font-family: var(--wp--preset--font-family--plex);
    font-weight: 700;
    font-size: clamp(2rem, 3.4vw, 3rem);
    line-height: 1.05;
}

.flm-dealer__lead {
    margin: var(--wp--preset--spacing--lg) 0 0;
    color: var(--wp--preset--color--text-secondary);
    max-width: 38ch;
    line-height: 1.6;
}

.flm-dealer__cta { margin-top: var(--wp--preset--spacing--xl); }

/* --- Map panel: rounded, water video behind, SVG + pins on top ----------- */

.flm-dealer__mapwrap {
    position: relative;
    isolation: isolate;
    /* No overflow clip here: the contact card must be able to extend past the
       panel edge without being cut off. The rounded-corner clip is applied to
       the video + veil layers themselves instead. */
    aspect-ratio: 16 / 10;
    --flm-dealer-radius: clamp(14px, 1.6vw, 22px);
}

.flm-dealer__video {
    position: absolute;
    inset: 0;
    margin: 0; /* cancel flow-layout block-gap (footer bg-strip bug) */
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--flm-dealer-radius);
    z-index: -2;
}

.flm-dealer__veil {
    position: absolute;
    inset: 0;
    margin: 0;
    z-index: -1;
    border-radius: var(--flm-dealer-radius);
    background-color: rgba(11, 17, 26, 0.55); /* darken water so white states pop */
}

.flm-dealer__map {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: clamp(1rem, 4%, 3rem);
}

.flm-dealer__map svg {
    width: 100%;
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.45)); /* lift */
}

/* States: white fill, hairline borders, hover highlight, link cursor.
   Scoped to the states SVG (direct child) so it never restyles the pin
   chevrons, whose SVGs are nested inside .flm-dealer__pin buttons. */
.flm-dealer__map > svg path {
    fill: #ffffff;
    stroke: rgba(20, 30, 42, 0.35);
    stroke-width: 0.75;
    transition: fill 140ms ease;
    cursor: pointer;
}
.flm-dealer__map > svg path:hover,
.flm-dealer__map > svg path.is-active {
    fill: var(--wp--preset--color--accent-pink, #ff4e77);
}

/* --- Pins (red chevrons), placed by JS at each dealer's state centroid --- */

.flm-dealer__pin {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 1.4rem;
    height: 1.4rem;
    color: var(--wp--preset--color--accent-pink, #ff4e77);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    z-index: 2;
}
.flm-dealer__pin svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.flm-dealer__pin svg path { fill: none; stroke: currentColor; } /* pink chevron, not state styling */
.flm-dealer__pin:hover, .flm-dealer__pin:focus-visible { transform: translate(-50%, -50%) scale(1.18); }

/* --- Contact card -------------------------------------------------------- */

.flm-dealer__card {
    position: absolute;
    z-index: 5;
    min-width: 220px;
    max-width: 280px;
    transform: translate(-50%, calc(-100% - 1rem)); /* above the pin (default) */
    background: var(--wp--preset--color--surface-elev-3, #1b2a3a);
    color: var(--wp--preset--color--text-primary, #fff);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: var(--wp--preset--spacing--md);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}
.flm-dealer__card[hidden] { display: none; }
/* Top-row pins (ND, MN, ME…) have no room above: open the card below instead. */
.flm-dealer__card.is-below { transform: translate(-50%, 1rem); }
.flm-dealer__card-name { margin: 0; font-weight: 700; font-size: 1rem; }
.flm-dealer__card-loc  { margin: 0.15rem 0 0; color: var(--wp--preset--color--text-secondary); font-size: 0.85rem; }
.flm-dealer__card-addr { margin: 0.5rem 0 0; font-size: 0.8rem; line-height: 1.4; color: var(--wp--preset--color--text-muted); }
.flm-dealer__card-phone { display: inline-block; margin-top: 0.5rem; color: inherit; font-size: 0.85rem; }
.flm-dealer__card-cta {
    display: block;
    margin-top: 0.75rem;
    text-align: center;
    background: var(--wp--preset--color--accent-pink, #ff4e77);
    color: #fff;
    padding: 0.45rem 0.9rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* Secondary card action — outlined sibling of the pink Get Directions CTA
   (unstyled it rendered as core's big white wp-element-button and overlapped
   the card). */
.flm-dealer__card-contact {
    display: block;
    margin-top: 0.5rem;
    text-align: center;
    background: transparent;
    color: var(--wp--preset--color--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 0.45rem 0.9rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.flm-dealer__card-contact:hover,
.flm-dealer__card-contact:focus-visible {
    color: var(--wp--preset--color--accent-pink);
    border-color: var(--wp--preset--color--accent-pink);
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    .flm-dealer__video { display: none; }
}

/* --- Responsive: stack, text above map ----------------------------------- */

@media (max-width: 767px) {
    /* Pin the full-bleed section's own inline padding to 0 and let the inner
       carry the page's standard 32px gutter — otherwise the section padding and
       the inner padding stacked to ~67px, double-inset vs every other section
       (BugHerd #22). 32px (xxl) matches the rest of the page. */
    .flm-dealer {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .flm-dealer__inner {
        flex-direction: column;
        align-items: stretch;
        gap: var(--wp--preset--spacing--xl);
        padding-inline: var(--wp--preset--spacing--xxl);
    }
    .flm-dealer__copy, .flm-dealer__mapwrap { flex: 1 1 auto; }
    .flm-dealer__lead { max-width: none; }
}

/* --- Location search (dealers page) -------------------------------------- */
.flm-dealer__search {
    display: flex;
    gap: 0.5rem;
    margin-top: var(--wp--preset--spacing--lg);
}
.flm-dealer__search-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 48px;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 4px;
    background: rgba(14, 17, 23, 0.55);
    color: var(--wp--preset--color--text-primary);
    font-size: 1rem;
    font-family: inherit;
}
.flm-dealer__search-input::placeholder { color: var(--wp--preset--color--text-dim); }
.flm-dealer__search-input:focus {
    outline: none;
    border-color: var(--wp--preset--color--accent-pink);
    box-shadow: 0 0 0 2px rgba(223, 110, 140, 0.4);
}
.flm-dealer__search-btn {
    flex: 0 0 auto;
    min-height: 48px;
    padding: 0.7rem 1.6rem;
    border: 0;
    border-radius: 4px;
    background: var(--wp--preset--color--text-primary);
    color: var(--wp--preset--color--surface-deep);
    font-family: var(--wp--preset--font-family--plex);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.15s ease;
}
.flm-dealer__search-btn:hover,
.flm-dealer__search-btn:focus-visible { color: var(--wp--preset--color--accent-pink); }

.flm-dealer__results { margin-top: 1rem; }
.flm-dealer__result {
    display: block;
    width: 100%;
    padding: 0.35rem 0;
    background: none;
    border: 0;
    text-align: left;
    color: var(--wp--preset--color--text-secondary);
    font-size: 0.92rem;
    cursor: pointer;
}
.flm-dealer__result:hover .flm-dealer__result-name,
.flm-dealer__result:focus-visible .flm-dealer__result-name { color: var(--wp--preset--color--accent-pink); }
.flm-dealer__result-name { color: var(--wp--preset--color--text-primary); font-weight: 600; }
.flm-dealer__result-mi { color: var(--wp--preset--color--text-muted); }
.flm-dealer__result-note { margin: 0; color: var(--wp--preset--color--text-muted); font-size: 0.92rem; }

/* --- Search highlight states --------------------------------------------- */
.flm-dealer__pin { transition: opacity 0.2s ease, transform 0.2s ease; }
.flm-dealer__pin.is-dimmed { opacity: 0.35; }
.flm-dealer__pin.is-match {
    transform: translate(-50%, -50%) scale(1.35); /* compose with the base centering transform */
    z-index: 5;
}
.flm-dealer__pin.is-match::after {
    content: "";
    position: absolute;
    inset: -6px;
    border: 2px solid var(--wp--preset--color--accent-pink);
    border-radius: 50%;
    animation: flm-pin-pulse 1.6s ease-out infinite;
}
@keyframes flm-pin-pulse {
    0%   { transform: scale(0.7); opacity: 0.9; }
    100% { transform: scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .flm-dealer__pin.is-match::after { animation: none; opacity: 0.7; transform: none; }
    .flm-dealer__pin { transition: none; }
}

/* --- Use my location ----------------------------------------------------- */
.flm-dealer__geolocate {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    padding: 0;
    background: none;
    border: 0;
    color: var(--wp--preset--color--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.15s ease;
}
.flm-dealer__geolocate:hover,
.flm-dealer__geolocate:focus-visible {
    color: var(--wp--preset--color--accent-pink);
    outline: none;
}
.flm-dealer__geolocate[hidden] { display: none; }
