/* ai.ch — interactive Switzerland map on swiss.html.
   Builds on css/style.css tokens ONLY (works in dark + light + data-theme). */

.sw-map { margin: 1.4rem 0 .4rem; }
.sw-map h2 { font-size: 1.15rem; margin: 0 0 .35rem; }
.sw-map__lead { color: var(--text-dim); font-size: .9rem; margin: 0 0 .75rem; }

.sw-map__box {
  position: relative;          /* anchors the zoom controls */
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius-s);
  padding: .9rem;
  overflow: hidden;            /* zoomed map stays inside the card */
}
.sw-map__box svg { display: block; width: 100%; height: auto; }
.sw-map__box svg.swm-zoomed { cursor: grab; }
.sw-map__box svg.swm-zoomed:active { cursor: grabbing; }

/* zoom controls overlay */
.swm-controls {
  position: absolute; top: .7rem; right: .7rem;
  display: flex; flex-direction: column; gap: .3rem; z-index: 2;
}
.swm-btn {
  width: 2.1rem; height: 2.1rem;
  display: grid; place-items: center;
  font: 700 1.05rem/1 'Inter', ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--card-edge);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.swm-btn:hover { background: color-mix(in srgb, var(--accent) 16%, var(--bg-soft)); }
.swm-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.swm-btn:disabled { opacity: .35; cursor: default; box-shadow: none; }
.swm-btn:disabled:hover { background: var(--bg-soft); }

/* base layers (2026-08-22): swissALTI3D relief (one raster per theme) + lakes + city anchors */
.swm-relief { opacity: .95; }
.swm-relief--dark { display: none; }
:root[data-theme="dark"] .swm-relief--light { display: none; }
:root[data-theme="dark"] .swm-relief--dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .swm-relief--light { display: none; }
  :root:not([data-theme="light"]) .swm-relief--dark { display: block; }
}
.swm-lakes path { fill: #b9d3e6; stroke: #9dbdd6; stroke-width: .6; vector-effect: non-scaling-stroke; }
:root[data-theme="dark"] .swm-lakes path { fill: #1f3a52; stroke: #2c5f8a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .swm-lakes path { fill: #1f3a52; stroke: #2c5f8a; }
}
.swm-cities { pointer-events: none; font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; font-weight: 600; letter-spacing: .02em; }
.swm-cities circle { fill: var(--text-dim); stroke: var(--card); stroke-width: 1; vector-effect: non-scaling-stroke; }
.swm-cities text { fill: var(--text-dim); paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

/* canton shapes — transparent over the relief, subtle borders */
.swm-canton {
  fill: color-mix(in srgb, var(--card) 10%, transparent);
  stroke: color-mix(in srgb, var(--text) 42%, var(--card));
  stroke-width: 1;
  transition: fill .15s ease;
}
.swm-canton--has {
  fill: color-mix(in srgb, var(--accent) 13%, transparent);
  cursor: pointer;
}
.swm-canton--has:hover,
.swm-canton--has:focus-visible {
  fill: color-mix(in srgb, var(--accent) 26%, transparent);
  outline: none;
}
.swm-canton--on { fill: color-mix(in srgb, var(--accent) 34%, transparent); }

/* city dots — sized by entry count, site accent */
.swm-dot { cursor: pointer; outline: none; }
.swm-dot circle {
  fill: var(--accent-2);
  fill-opacity: .72;
  stroke: var(--card);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;   /* stroke stays px-true at any zoom */
  transition: fill-opacity .15s ease;
}
.swm-dot:hover circle,
.swm-dot:focus circle,
.swm-dot:focus-visible circle { fill-opacity: 1; }
.swm-dot:focus-visible circle { stroke: var(--text); stroke-width: 2.5; }
.swm-dot--on circle { fill-opacity: 1; stroke: var(--text); stroke-width: 2; }

/* cluster bubbles — numbered, MarkerClusterer-style; activate to zoom-split */
.swm-cluster { cursor: pointer; outline: none; }
.swm-cluster circle {
  fill: var(--accent);
  fill-opacity: .88;
  stroke: var(--card);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  transition: fill-opacity .15s ease;
}
.swm-cluster:hover circle,
.swm-cluster:focus circle,
.swm-cluster:focus-visible circle { fill-opacity: 1; }
.swm-cluster:focus-visible circle { stroke: var(--text); stroke-width: 2.5; }
.swm-cluster--on circle { stroke: var(--text); stroke-width: 2; }
.swm-cluster text {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  fill: #fff;
  pointer-events: none;
}

/* dot labels — own top layer (nothing can cover them), shown on
   hover/focus/selection via .swm-label--show (toggled by swiss-map.js) */
.swm-labels { pointer-events: none; }
.swm-label {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;                     /* font-size set per render (zoom-true px) */
  fill: var(--text);
  stroke: var(--card); stroke-width: 4; paint-order: stroke;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  transition: opacity .15s ease;
}
.swm-label--show { opacity: 1; }

/* attribution (swisstopo licence) + hint */
.sw-map__attr {
  color: var(--text-dim); font-size: .78rem; margin: .55rem 0 0;
}
.sw-map__attr a { color: var(--text-dim); text-decoration: underline; }
.sw-map__attr a:hover { color: var(--text); }

/* "showing N entries in X — reset" line above the card grid */
.sw-map__filter {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--card-edge));
  border-radius: var(--radius-s);
  padding: .5rem .8rem; margin: 0 0 .9rem;
  font-size: .88rem; color: var(--text);
}
.sw-map__filter[hidden] { display: none !important; }
.sw-map__filter button {
  font: inherit; font-weight: 600; color: var(--accent-2);
  background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline;
}
.sw-map__filter button:hover { color: var(--text); }

/* card-visibility toggling must beat the grid display */
.sw-list > li[hidden] { display: none !important; }
