/* WOH Shipping Flags widget — overlay + tooltip */

.woh-shipping-flags {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.woh-shipping-flags--overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
}

.woh-shipping-flags--inline {
    position: relative;
}

.woh-shipping-flags__flag {
    position: relative;
    display: inline-block;
    width: 24px;
    height: 24px;
    pointer-events: auto;
    line-height: 0;
    border-radius: 2px;
    overflow: visible;
    cursor: help;
}

/* Flags wired to a filter URL show a pointer cursor and gain a small lift on
   hover/focus to signal clickability without overpowering the card. */
.woh-shipping-flags__flag[data-href] {
    cursor: pointer;
}

.woh-shipping-flags__flag img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 2px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.woh-shipping-flags__flag[data-href]:hover img,
.woh-shipping-flags__flag[data-href]:focus-visible img {
    transform: scale(1.08);
}

/* Active filter — when ?filter_ships_to=... is set the body gets a class.
   Outline the matching flag on every visible card so it's obvious which
   region is being filtered. */
body.woh-ships-to-uk .woh-shipping-flags__flag[data-region="uk"] img,
body.woh-ships-to-usa .woh-shipping-flags__flag[data-region="usa"] img {
    box-shadow: 0 0 0 2px currentColor, 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* CSS-only tooltip — appears above the flag on hover/focus */
.woh-shipping-flags__flag::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: rgba(20, 20, 20, 0.92);
    color: #fff;
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    border-radius: 3px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 10;
}

.woh-shipping-flags__flag:hover::after,
.woh-shipping-flags__flag:focus-visible::after {
    opacity: 1;
}

.woh-shipping-flags__flag:focus {
    outline: none;
}

.woh-shipping-flags__flag:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Make the Elementor loop-item card a positioning context for the overlay.
   Loop Grid wraps each item in .e-loop-item; carousels use .e-loop-item too.
   :has() is supported in all current evergreen browsers. If a card stays
   un-relative for some reason, set Position: Relative on it via Elementor's
   Advanced tab. */
.e-loop-item:has(.woh-shipping-flags--overlay),
.elementor-loop-container > * .woh-shipping-flags--overlay {
    /* The :has() rule applies to the loop-item itself */
}

.e-loop-item:has(.woh-shipping-flags--overlay) {
    position: relative;
}
