/* [us_state_map] -- loaded only on pages using the shortcode.
   Override colors by redefining the --wg-sm-* variables on .wg-sm. */
.wg-sm {
    --wg-sm-fill: var(--wolmart-primary-color, #7d52a6);
    --wg-sm-fill-hover: var(--wolmart-primary-color-darker-3, #4f346f);
    --wg-sm-stroke: #fff;
    --wg-sm-soon: #dfe5e3;
    --wg-sm-soon-text: #7b8a86;
    --wg-sm-ink: #1c2b27;
    --wg-sm-focus: #f2a900;
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    color: var(--wg-sm-ink);
}

.wg-sm *, .wg-sm *::before, .wg-sm *::after { box-sizing: border-box; }

/* ---------- Desktop SVG map (>=1024px) ---------- */
.wg-sm__map { display: none; width: 100%; height: auto; }

.wg-sm__state path {
    fill: var(--wg-sm-fill);
    stroke: var(--wg-sm-stroke);
    stroke-width: 1;
    stroke-linejoin: round;
    transition: fill .15s ease;
}
.wg-sm__state { cursor: pointer; outline: none; }
.wg-sm a, .wg-sm a:hover, .wg-sm a:focus, .wg-sm a:active,
.wg-sm__state, .wg-sm__state:hover, .wg-sm__state *,
.wg-sm__callout-text { text-decoration: none !important; }
.wg-sm__state.is-soon { cursor: default; }
.wg-sm__state.is-soon path { fill: var(--wg-sm-soon); }

.wg-sm__leader { stroke: var(--wg-sm-fill); stroke-width: 1; pointer-events: none; }
.wg-sm__leader-dot { fill: var(--wg-sm-fill); pointer-events: none; }
.wg-sm__callout { fill: var(--wg-sm-fill); stroke: var(--wg-sm-stroke); stroke-width: 1; transition: fill .15s ease; }
.wg-sm__callout-text { fill: #fff; font: 600 13px/1 var(--wg-sans, system-ui, sans-serif); pointer-events: none; }
.is-soon .wg-sm__leader { stroke: #b9c4c0; }
.is-soon .wg-sm__leader-dot { fill: #b9c4c0; }
.is-soon .wg-sm__callout { fill: var(--wg-sm-soon); }
.is-soon .wg-sm__callout-text { fill: var(--wg-sm-soon-text); }

/* Keyboard focus: always on (not gated by hover media). */
a.wg-sm__state:focus-visible path,
a.wg-sm__state:focus-visible .wg-sm__callout { fill: var(--wg-sm-fill-hover); stroke: var(--wg-sm-focus); stroke-width: 2.5; }
a.wg-sm__state:focus-visible .wg-sm__callout-text { fill: #fff; }

@media (hover: hover) {
    a.wg-sm__state:hover path,
    a.wg-sm__state:hover .wg-sm__callout { fill: var(--wg-sm-fill-hover); }
    a.wg-sm__state:hover .wg-sm__leader { stroke: var(--wg-sm-fill-hover); }
    a.wg-sm__state:hover .wg-sm__leader-dot { fill: var(--wg-sm-fill-hover); }
}

/* Tooltip (positioned by state-map.js; hover devices and keyboard focus only) */
.wg-sm__tip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--wg-sm-ink);
    color: #fff;
    font: 600 14px/1.2 var(--wg-sans, system-ui, sans-serif);
    white-space: nowrap;
    transform: translate(-50%, -100%);
}
.wg-sm__tip small { font-weight: 400; opacity: .8; margin-left: 4px; }

/* ---------- Tablet / mobile (<1024px): search + tile grid + A-Z list ---------- */
.wg-sm__search { margin: 0 0 16px; }
.wg-sm__search[hidden] { display: none; }
.wg-sm__search-label { display: block; margin-bottom: 6px; font-weight: 700; font-size: 1rem; }
.wg-sm__search-input {
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    font-size: 16px; /* >=16px stops iOS zooming on focus */
    border: 2px solid var(--wg-sm-fill);
    border-radius: 10px;
    background: #fff;
    color: var(--wg-sm-ink);
}
.wg-sm__search-input:focus-visible { outline: 3px solid var(--wg-sm-focus); outline-offset: 2px; }
.wg-sm__search-status { min-height: 1.4em; margin: 6px 0 0; font-size: .9rem; color: var(--wg-sm-soon-text); }

/* 11-col cartogram. Tiles are >=44px tall; width is fluid (~29px on a 360px phone). */
.wg-sm__tiles {
    display: grid;
    grid-template-columns: repeat(11, minmax(0, 1fr));
    grid-auto-rows: 44px;
    gap: 3px;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}
.wg-sm__tiles li { grid-column: var(--c); grid-row: var(--r); margin: 0; padding: 0; }
.wg-sm__tile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background: var(--wg-sm-fill);
    color: #fff;
    font: 700 12px/1 var(--wg-sans, system-ui, sans-serif);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.wg-sm__tile:active { background: var(--wg-sm-fill-hover); }
.wg-sm__tile.is-soon { background: var(--wg-sm-soon); color: var(--wg-sm-soon-text); }
.wg-sm__tiles li.is-match .wg-sm__tile:not(.is-soon) { background: var(--wg-sm-focus); color: var(--wg-sm-ink); }
.wg-sm--filtering .wg-sm__tiles li:not(.is-match) { opacity: .35; }
@media (min-width: 600px) {
    .wg-sm__tiles { grid-auto-rows: 56px; gap: 5px; }
    .wg-sm__tile { font-size: 15px; }
}

/* A-Z list: big, thumb-friendly buttons */
.wg-sm__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.wg-sm__list li { margin: 0; padding: 0; }
.wg-sm__list li[hidden] { display: none; }
.wg-sm__item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 6px 12px;
    border: 1px solid #cfd8d5;
    border-radius: 10px;
    background: #fff;
    color: var(--wg-sm-ink);
    font-size: 1rem;
    line-height: 1.2;
    text-decoration: none;
}
a.wg-sm__item:active, a.wg-sm__item:focus-visible { background: var(--wg-sm-fill); color: #fff; border-color: var(--wg-sm-fill); }
a.wg-sm__item:focus-visible { outline: 3px solid var(--wg-sm-focus); outline-offset: 2px; }
.wg-sm__item-abbr {
    flex: 0 0 2.4em;
    font-weight: 700;
    color: var(--wg-sm-fill);
}
.wg-sm__item.is-soon { background: #f4f6f5; color: var(--wg-sm-soon-text); border-style: dashed; }
.wg-sm__item.is-soon .wg-sm__item-abbr { color: var(--wg-sm-soon-text); }
.wg-sm__item small { display: block; font-size: .75rem; }
@media (min-width: 640px) { .wg-sm__list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 840px) { .wg-sm__list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Desktop switch ---------- */
@media (min-width: 1024px) {
    .wg-sm__map { display: block; }
    .wg-sm__tiles, .wg-sm__list, .wg-sm__search { display: none !important; }
}
@media (max-width: 1023.98px) {
    .wg-sm__tip { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    .wg-sm__state path, .wg-sm__callout { transition: none; }
}
