/* ============================================================
   WP Map Lens — Public Stylesheet v1.2.0
   Breakpoints:
     smartphone       : 0 – 479px
     tablet-portrait  : 480px – 767px
     tablet-landscape : 768px – 1023px
     laptop           : 1024px – 1279px
     desktop          : 1280px – 1599px
     wide-desktop     : 1600px+
   ============================================================ */

:root {
    --wml-bp-sm:   479px;
    --wml-bp-tp:   767px;
    --wml-bp-tl:  1023px;
    --wml-bp-lp:  1279px;
    --wml-bp-dt:  1599px;

    /* Toolbar design tokens */
    --wml-toolbar-gap:       8px;
    --wml-btn-padding:       8px 16px;
    --wml-btn-radius:        6px;
    --wml-btn-font-size:     0.875rem;
    --wml-btn-bg:            #1a1a1a;
    --wml-btn-color:         #ffffff;
    --wml-btn-hover-bg:      #333333;
    --wml-btn-icon-gap:      6px;
    --wml-btn-border:        none;
    --wml-btn-transition:    background-color 0.2s ease, box-shadow 0.2s ease;

    /* PDF button gets its own blue scheme, kept distinct from --wml-btn-*
       so it stands out as the primary "download" action. */
    --wml-btn-pdf-bg:            #1a73e8;
    --wml-btn-pdf-color:         #ffffff;
    --wml-btn-pdf-hover-bg:      #1558b0;
    --wml-btn-pdf-hover-color:   #ffffff;
}

/* ── Outer Wrapper ─────────────────────────────────────────── */
.wml-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    /* Page builders (Elementor Containers, flex columns, etc.) often wrap
       this in their own flex layout with align-items: stretch. Without
       flex-shrink: 0 the browser is free to compress our fixed-height map
       container down to fit whatever cross-axis space the parent computed,
       clipping it instead of honouring the shortcode's height attribute. */
    flex-shrink: 0;
}

/* ── Map Container ─────────────────────────────────────────── */
.wml-map-container {
    position: relative;
    overflow: hidden;
    cursor: crosshair;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    width: 100%;
    flex-shrink: 0;
}

/* ── Map Image ─────────────────────────────────────────────── */
.wml-map-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* ── Lens Circle ───────────────────────────────────────────── */
.wml-lens {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    will-change: left, top, background-position;
    background-repeat: no-repeat;
    transform: translate(-50%, -50%);
    z-index: 10;
    /* width, height, border, box-shadow applied via JS from data-* attributes */
}

.wml-lens.wml-lens--active {
    opacity: 1;
}

/* ── Toolbar ───────────────────────────────────────────────── */
.wml-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--wml-toolbar-gap);
    padding: 8px 0;
}

.wml-toolbar--above { order: -1; }
.wml-toolbar--below { order:  1; }

.wml-toolbar--left   { justify-content: flex-start; }
.wml-toolbar--center { justify-content: center; }
.wml-toolbar--right  { justify-content: flex-end; }

/* ── Toolbar Buttons & Links ───────────────────────────────── */
.wml-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--wml-btn-icon-gap);
    padding: var(--wml-btn-padding);
    background: var(--wml-btn-bg);
    color: var(--wml-btn-color) !important;
    border: var(--wml-btn-border);
    border-radius: var(--wml-btn-radius);
    font-size: var(--wml-btn-font-size);
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: var(--wml-btn-transition);
    white-space: nowrap;
}

/* !important on color/background here (and on .wml-btn--pdf below) because
   this is a plain <a>, and most themes ship a global a:hover { color: … }
   rule with higher selector specificity than .wml-btn:hover — without a
   forced override, the hover text color silently loses to the theme's and
   can end up matching the background (invisible label). */
.wml-btn:hover,
.wml-btn:focus-visible {
    background: var(--wml-btn-hover-bg) !important;
    color: var(--wml-btn-color) !important;
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.wml-btn svg {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

/* ── PDF Button — blue, distinct from the default dark toolbar style ── */
.wml-btn--pdf {
    background: var(--wml-btn-pdf-bg) !important;
    color: var(--wml-btn-pdf-color) !important;
}

.wml-btn--pdf:hover,
.wml-btn--pdf:focus-visible {
    background: var(--wml-btn-pdf-hover-bg) !important;
    color: var(--wml-btn-pdf-hover-color) !important;
}

/* ── SMARTPHONE (max-width: 479px) ─────────────────────────── */
@media (max-width: 479px) {
    .wml-map-container {
        height: 260px !important;
        touch-action: pan-y;
        cursor: default;
    }

    .wml-toolbar {
        justify-content: stretch;
        gap: 6px;
    }

    .wml-btn {
        flex: 1 1 100%;
        justify-content: center;
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}

/* ── TABLET PORTRAIT (480px – 767px) ───────────────────────── */
@media (min-width: 480px) and (max-width: 767px) {
    .wml-map-container {
        height: 340px !important;
    }

    .wml-btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}

/* ── TABLET LANDSCAPE (768px – 1023px) ─────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
    .wml-map-container {
        height: 420px !important;
    }

    .wml-toolbar {
        padding: 10px 0;
    }
}

/* ── LAPTOP (1024px – 1279px) ──────────────────────────────── */
@media (min-width: 1024px) and (max-width: 1279px) {
    /* Map height: honour shortcode value — no override */
}

/* ── DESKTOP (1280px – 1599px) ─────────────────────────────── */
@media (min-width: 1280px) and (max-width: 1599px) {
    /* Map height: honour shortcode value — no override */
}

/* ── WIDE DESKTOP (1600px+) ────────────────────────────────── */
@media (min-width: 1600px) {
    .wml-btn {
        font-size: 1rem;
        padding: 10px 20px;
    }
}

/* ── Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .wml-lens,
    .wml-btn {
        transition: none;
    }
}

/* ── Print Styles ───────────────────────────────────────────── */
@media print {
    .wml-lens,
    .wml-toolbar {
        display: none !important;
    }
    .wml-map-container {
        overflow: visible;
        height: auto !important;
        cursor: default;
    }
    .wml-map-image {
        width: 100%;
        height: auto;
    }
}
