/* ---------- Traffic analytics (web/traffic.js) and its world map (web/traffic-map.js) ---------- */
/* The online tab: figures, the map with its country list and the live list in one column with the section rhythm. */
.traffic-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-section); }
.traffic-stack > * { min-width: 0; margin: 0; }
.traffic-stack h2 { margin: 0; }
.traffic-map-block { margin-top: 16px; }
.traffic-funnels + .field-hint { margin-top: 10px; }
.section > .field-hint + details { margin-top: 10px; }
.traffic-pager { margin-top: 12px; }
/* Sortable headers sit exactly over their column; the last column is right-aligned like its numbers. */
.table-wrap th:last-child { text-align: right; }
.table-wrap td.traffic-empty-row { color: var(--muted); text-align: center; }
.table-wrap.dense td.traffic-empty-row { max-width: none; overflow: visible; white-space: normal; }

/* The map: graphite land, countries with data in one restrained blue (the hue of the AI spend chart), five steps. */
.tmap { --tmap-accent: 57 135 229; display: grid; gap: 0; }
.tmap figcaption { margin-bottom: 14px; }
.tmap-total { font-size: 13px; }
.tmap-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.tmap-stage { position: relative; min-width: 0; overflow: hidden; border-radius: var(--radius-md); background: var(--bg-deep); touch-action: pan-y; }
.tmap-stage.is-zoomed { touch-action: none; cursor: grab; }
.tmap-stage.is-dragging { cursor: grabbing; }
.tmap-svg { display: block; width: 100%; height: auto; aspect-ratio: 5 / 2; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.tmap-svg:focus-visible { outline: 2px solid var(--text-2); outline-offset: -2px; border-radius: var(--radius-md); }
.tmap-country { fill: var(--panel-3); stroke: var(--bg-deep); stroke-width: .6; cursor: pointer; transition: fill .12s var(--ease); }
.tmap-country.l1 { fill: rgb(var(--tmap-accent) / .34); }
.tmap-country.l2 { fill: rgb(var(--tmap-accent) / .52); }
.tmap-country.l3 { fill: rgb(var(--tmap-accent) / .72); }
.tmap-country.l4 { fill: rgb(var(--tmap-accent) / .95); }
.tmap-country.l0:hover, .tmap-country.l0.is-hot { fill: #45454b; }
.tmap-country:hover, .tmap-country.is-hot { stroke: var(--text); stroke-width: 1.4; }
.tmap-tools { position: absolute; top: 10px; right: 10px; display: grid; gap: 6px; }
.tmap-tool { min-width: 40px; min-height: 40px; padding: 0; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: rgb(35 35 38 / .92); color: var(--text); font-size: 18px; font-weight: 500; line-height: 1; }
.tmap-tool:hover { background: var(--panel-3); }
.tmap-tip { position: absolute; z-index: 2; top: 0; left: 0; display: grid; gap: 2px; max-width: 240px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel-2); box-shadow: var(--shadow-pop); color: var(--text); font-size: 13px; line-height: 1.45; pointer-events: none; }
.tmap-tip[hidden] { display: none; }
.tmap-tip strong { font-size: 14px; font-weight: 600; }
.tmap-tip span { color: var(--text-2); }

/* The countries beside the map: every row is a button (focus or hover highlights the country, a press zooms to it). */
.tmap-list { min-width: 0; }
.tmap-list h3 { margin: 0 0 8px; color: var(--text-2); font-size: 14px; font-weight: 600; }
.tmap-list > p { margin: 0; font-size: 14px; }
.tmap-items { display: grid; gap: 2px; max-height: 260px; margin: 0; padding: 0; overflow: auto; list-style: none; scrollbar-width: thin; }
.tmap-item { width: 100%; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 4px 12px; padding: 8px 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text); font-size: 14px; font-weight: 400; text-align: left; }
.tmap-item:hover, .tmap-item.is-hot { background: var(--panel-2); }
.tmap-item.is-hot { border-color: var(--line-2); }
.tmap-item[aria-disabled="true"] { cursor: default; }
.tmap-item strong { font-variant-numeric: tabular-nums; font-weight: 600; }
.tmap-item .meter { grid-column: 1 / -1; height: 4px; margin: 0; }
.tmap-item .meter::-webkit-meter-bar { height: 4px; }
.tmap-item .meter::-webkit-meter-optimum-value { background: rgb(var(--tmap-accent) / .8); }
.tmap-item .meter::-moz-meter-bar { background: rgb(var(--tmap-accent) / .8); }
.tmap-item-name { min-width: 0; overflow-wrap: anywhere; }
.tmap-unknown { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; color: var(--muted); font-size: 14px; }
.tmap-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-top: 12px; }
.tmap-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; }
.tmap-legend li { display: inline-flex; align-items: center; gap: 4px; }
.tmap-swatch { width: 14px; height: 10px; border-radius: 2px; background: var(--panel-3); }
.tmap-swatch.l1 { background: rgb(var(--tmap-accent) / .34); }
.tmap-swatch.l2 { background: rgb(var(--tmap-accent) / .52); }
.tmap-swatch.l3 { background: rgb(var(--tmap-accent) / .72); }
.tmap-swatch.l4 { background: rgb(var(--tmap-accent) / .95); }
.tmap-help { max-width: 640px; margin: 0; }

@media (min-width: 960px) {
  .tmap-body { grid-template-columns: minmax(0, 1fr) 248px; align-items: start; }
  .tmap-items { max-height: 320px; }
}
/* Phones: the map is short, so the buttons leave it and stand in a row under it, still inside its frame. */
@media (max-width: 619px) {
  .tmap { padding: var(--space-card-sm); }
  .tmap-tools { position: static; display: flex; justify-content: flex-end; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  .tmap-country { transition: none; }
}
@media (forced-colors: active) {
  .tmap-country.is-hot, .tmap-country:hover { stroke: Highlight; }
  .tmap-item.is-hot { border-color: Highlight; }
}
