/*
SoVery maps in the theme's look (inc/sovery.php loads this on pages with a map).
SoVery draws inside the element, where the page's CSS can't reach; it reads the
--sovery-* properties set here, so every colour comes from the theme's palette
(theme.json: ccPrimary, ccSecondary, ccInfo, ccOrange, ccText) in this one place.
A page can still reach a few parts: ::part(legend), ::part(map), and a note's
::part(tip), ::part(tip-name) and ::part(tip-text).
The older state-* class names (tt-amone's Florida figure) are styled the same way.
*/
sovery-atlas {
    display: block;
    --sovery-font: var(--wp--preset--font-family--open-sans, 'Open Sans', sans-serif);
    --sovery-font-display: var(--wp--preset--font-family--open-sans, 'Open Sans', sans-serif);
    --sovery-display-weight: 700;
    --sovery-text: var(--wp--preset--color--cc-primary, #004e8e);
    --sovery-strong: var(--wp--preset--color--cc-primary, #004e8e);
    --sovery-heading: var(--wp--preset--color--cc-primary, #004e8e);
    --sovery-muted: color-mix(in srgb, var(--wp--preset--color--cc-text, #090909) 60%, white);
    --sovery-accent: var(--wp--preset--color--cc-orange, #e8730b);
    --sovery-focus: var(--wp--preset--color--cc-orange, #e8730b);
    --sovery-surface: #ffffff;
    --sovery-border: color-mix(in srgb, var(--wp--preset--color--cc-secondary, #287dad) 30%, white);
    --sovery-tip-radius: 8px;
    --sovery-tip-shadow: 0 10px 28px rgb(0 78 142 / 0.15);

    /* Dot maps: pale, see-through land (the page's background shows through,
       as on the Flourish maps), its edges, and dots from light to dark. */
    --sovery-land: rgb(150 210 248 / 0.6);
    --sovery-land-active: rgb(110 185 240 / 0.7);
    --sovery-boundary: rgb(62 122 183 / 0.3);
    --sovery-dot-1: rgb(59 160 232 / 0.7);
    --sovery-dot-2: rgb(52 140 222 / 0.85);
    --sovery-dot-3: var(--wp--preset--color--cc-secondary, #287dad);
    --sovery-dot-4: color-mix(in srgb, var(--wp--preset--color--cc-secondary, #287dad) 50%, var(--wp--preset--color--cc-primary, #004e8e));
    --sovery-dot-5: var(--wp--preset--color--cc-primary, #004e8e);
    --sovery-ring: var(--wp--preset--color--cc-primary, #004e8e);

    /* Shaded maps: five shades, lightest first, and the page's key uses the same ones. */
    --sovery-shade-1: color-mix(in srgb, var(--wp--preset--color--cc-secondary, #287dad) 25%, white);
    --sovery-shade-2: color-mix(in srgb, var(--wp--preset--color--cc-secondary, #287dad) 60%, white);
    --sovery-shade-3: var(--wp--preset--color--cc-secondary, #287dad);
    --sovery-shade-4: var(--wp--preset--color--cc-primary, #004e8e);
    --sovery-shade-5: color-mix(in srgb, var(--wp--preset--color--cc-primary, #004e8e) 60%, black);
    --sovery-shade-none: var(--wp--preset--color--cc-gray, #f8f8f8);
    --sovery-shade-focus: var(--wp--preset--color--cc-orange, #e8730b);
    --sovery-mark-edge: var(--wp--preset--color--cc-primary, #004e8e);
    --sovery-mark-active: var(--wp--preset--color--cc-yellow, #fbb138);
}

/* The figure: title, map, the page's key, and the figures in a table. */
.sovery-viz,
.state-viz {
    margin: 0 0 40px;
    color: var(--wp--preset--color--cc-primary, #004e8e);
}
.sovery-viz-title,
.state-viz-title {
    margin-bottom: 16px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}
.sovery-fallback,
.state-fallback {
    font-size: 15px;
}
:is(.sovery-viz, .state-viz) .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* The ranked list of places beside a state or regional map (slot="list"). */
:is(.sovery-places, .state-places) {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}
:is(.sovery-place, .state-place) {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 16px;
}
:is(.sovery-place, .state-place) a {
    color: inherit;
}
:is(.sovery-count, .state-count) {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
:is(.sovery-bar, .state-bar) {
    display: block;
    width: 100%;
    height: 6px;
    margin-top: 6px;
    border-radius: 3px;
}
:is(.sovery-bar-track, .state-bar-track) {
    fill: color-mix(in srgb, var(--wp--preset--color--cc-secondary, #287dad) 15%, transparent);
}
:is(.sovery-bar-fill, .state-bar-fill) {
    fill: var(--wp--preset--color--cc-secondary, #287dad);
}

/* A shaded map's key: the page keeps it, in the same shades as the map. */
.sovery-key {
    margin-top: 16px;
    font-size: 14px;
}
.sovery-key p {
    margin: 0 0 8px;
    font-weight: 600;
}
.sovery-key ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.sovery-key li {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sovery-swatch {
    width: 16px;
    height: 16px;
    flex: none;
    border-radius: 3px;
}
.sovery-shade-1 { background: color-mix(in srgb, var(--wp--preset--color--cc-secondary, #287dad) 25%, white); }
.sovery-shade-2 { background: color-mix(in srgb, var(--wp--preset--color--cc-secondary, #287dad) 60%, white); }
.sovery-shade-3 { background: var(--wp--preset--color--cc-secondary, #287dad); }
.sovery-shade-4 { background: var(--wp--preset--color--cc-primary, #004e8e); }
.sovery-shade-5 { background: color-mix(in srgb, var(--wp--preset--color--cc-primary, #004e8e) 60%, black); }

/* The same figures in a table, behind a disclosure. */
:is(.sovery-data, .state-data) {
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--cc-secondary, #287dad) 25%, transparent);
}
:is(.sovery-data, .state-data) summary {
    cursor: pointer;
    font-weight: 600;
}
:is(.sovery-table-wrap, .state-table-wrap) {
    overflow-x: auto;
    margin-top: 12px;
}
:is(.sovery-data, .state-data) table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
:is(.sovery-data, .state-data) :is(th, td) {
    padding: 6px 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--cc-secondary, #287dad) 15%, transparent);
    text-align: left;
    font-weight: 400;
    vertical-align: top;
}
:is(.sovery-data, .state-data) thead th {
    font-weight: 700;
}
:is(.sovery-data, .state-data) .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* note_title="no": a state's note opens with its text, as on the Flourish maps,
   with no state name above it (the note names the state). */
.sovery-no-note-title sovery-atlas::part(tip-name) {
    display: none;
}
.sovery-no-note-title sovery-atlas::part(tip-text) {
    margin-top: 0;
}

/* key="no": the map's own key (a dot map's sizes) is left out, and while the
   map loads only its own shape is held (the shortcode sets --sovery-ratio). */
.sovery-no-key sovery-atlas::part(legend) {
    display: none;
}
.sovery-no-key[style*="--sovery-ratio"] sovery-atlas::part(panel) {
    aspect-ratio: var(--sovery-ratio);
}
