.scatter-svg { display: block; }
.bar { transition: fill-opacity .15s; }
.bar-val { font-family: var(--font); font-variant-numeric: tabular-nums; }

/* ── Scatter: plot area background ──────────────────────────────────────────── */
.scatter-bg {
  fill: #f8fafc;
  rx: 4;
}

/* ── Scatter dots: type-colored, no fill override ───────────────────────────── */
/* fill is set via JS using typeColor() — CSS only controls opacity/stroke/effects */
.scatter-dots .dot {
  fill-opacity: .52;
  stroke: rgba(255,255,255,.7);
  stroke-width: .7;
  cursor: pointer;
  transition: fill-opacity .15s, r .12s;
}

/* Highlighted (notable) dots: brighter, subtle glow applied via JS filter */
.scatter-dots .dot-hi {
  fill-opacity: .88;
  stroke: rgba(255,255,255,.95);
  stroke-width: 1.4;
}

/* Hover state */
.scatter-dots .dot.is-hover {
  fill-opacity: 1;
  stroke: #fff;
  stroke-width: 2.2;
}

/* Pinned (clicked) state */
.scatter-dots .dot.is-pinned {
  fill-opacity: 1;
  stroke: #fff;
  stroke-width: 3;
  /* JS also scales r to 10 */
}

/* ── Direct labels ───────────────────────────────────────────────────────────── */
.scatter-labels .scatter-label {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 600;
  /* fill set by JS using typeColor() */
}
.scatter-labels .label-leader {
  /* stroke set by JS using typeColor() */
  stroke-width: 1;
  stroke-opacity: .6;
}

/* ── Axes ─────────────────────────────────────────────────────────────────────── */
.axis-label-editorial {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 12.5px;
  fill: var(--gray-400);
}
.editorial-grid line { stroke: #e8ecf0; stroke-dasharray: 0; }
.editorial-grid .domain { display: none; }
.axis-x .tick text, .axis-y .tick text { fill: #8a9097; font-size: 11px; }
.axis-x .domain { stroke: #dde1e6; }
.axis-y .domain { display: none; }

/* X-axis row 1 — Log(f): actual count labels */
.axis-x-log .tick text { fill: #8a9097; font-size: 10.5px; }
.axis-x-log .domain { stroke: #dde1e6; }

/* X-axis row-label ("Log(f)" / "Absolute") */
.axis-x-row-label {
  font-family: var(--font);
  font-size: 9.5px;
  font-style: italic;
  fill: #8a9097;
}

/* Quadrant annotation */
.quadrant-label {
  font-family: var(--font);
  font-size: 10.5px;
  fill: var(--gray-400);
  font-style: italic;
}

/* ── Zoom controls ───────────────────────────────────────────────────────────── */
.zoom-controls {
  position: absolute;
  bottom: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 20;
}
.zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: rgba(255,255,255,.96);
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  font-family: var(--font);
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
  transition: border-color .15s, box-shadow .15s, background .15s;
  line-height: 1;
}
.zoom-btn:hover {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.14);
  color: var(--blue);
}
.zoom-btn:active { transform: scale(.93); }
.zoom-btn-reset {
  width: auto;
  padding: 0 .75em;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .01em;
}

/* ── Zoom hint text ──────────────────────────────────────────────────────────── */
.zoom-hint {
  font-family: var(--font);
  font-size: 10.5px;
  fill: var(--gray-400);
  pointer-events: none;
}

/* ── Rich tooltip additions ──────────────────────────────────────────────────── */
.tt-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  padding: .16em .72em;
  border-radius: 100px;
  margin-bottom: .4em;
}
.tt-type-res         { background: #1e40af; color: #bfdbfe; }
.tt-type-npo         { background: #5b21b6; color: #ddd6fe; }
.tt-type-uni_public  { background: #065f46; color: #a7f3d0; }
.tt-type-uni_fh      { background: #0f766e; color: #99f6e4; }
.tt-type-uni_private { background: #92400e; color: #fde68a; }
.tt-type-gov         { background: #155e75; color: #a5f3fc; }
.tt-type-med         { background: #991b1b; color: #fecaca; }
.tt-type-comp        { background: #374151; color: #d1d5db; }
.tt-divider { border-top: 1px solid rgba(255,255,255,.14); margin: .4em 0; }
.tt-section {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.38);
  margin: .45em 0 .12em;
}

/* ── Pin Panel ───────────────────────────────────────────────────────────────── */
.pin-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 272px;
  background: rgba(13,18,32,.97);
  color: #fff;
  border-radius: 13px;
  padding: 1rem;
  font-family: var(--font);
  font-size: .81rem;
  line-height: 1.7;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.07);
  z-index: 30;
  opacity: 0;
  transform: translateX(10px) scale(.98);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.pin-panel.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: all;
}
.pin-close {
  position: absolute;
  top: 9px;
  right: 9px;
  background: rgba(255,255,255,.1);
  border: none;
  color: rgba(255,255,255,.65);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: .8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  transition: background .15s, color .15s;
  padding: 0;
  line-height: 1;
}
.pin-close:hover { background: var(--red); color: #fff; }
.pin-body .tt-title { font-weight: 700; font-size: .9rem; margin-bottom: .28em; padding-bottom: .28em; padding-right: 1.6em; border-bottom: 1px solid rgba(255,255,255,.13); }
.pin-body .tt-row { display: flex; justify-content: space-between; gap: 1em; }
.pin-body .tt-row span:first-child { color: rgba(255,255,255,.5); }
.pin-body .tt-row span:last-child { font-weight: 600; }
.pin-body .tt-section { font-size: .66rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: rgba(255,255,255,.32); margin: .4em 0 .1em; }
.pin-body .tt-divider { border-top: 1px solid rgba(255,255,255,.1); margin: .38em 0; }
.pin-body .tt-badge { margin-bottom: .3em; }

/* ── Chart outer (chart + legend) ────────────────────────────────────────────── */
.chart-outer { display: flex; gap: 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.chart-outer .chart-container { flex: 1 1 0; min-width: 0; }
.legend-wrap { display: flex; flex-direction: column; gap: .45rem; min-width: 155px; padding: .5rem 0; }
.legend-item { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--gray-700); }
.legend-swatch { width: 11px; height: 11px; flex-shrink: 0; border-radius: 2px; }

/* ── Map section ─────────────────────────────────────────────────────────────── */
.map-controls { display: flex; gap: 1.25rem; margin-bottom: 1.5rem; flex-wrap: wrap; align-items: flex-end; }
.chart-container-map { padding: 0; overflow: hidden; }
.map-svg { display: block; border-radius: var(--radius); }

/* State polygons — fill/stroke set by JS per Bundesland */
.state-path {
  stroke-linejoin: round;
  transition: fill-opacity .15s;
}
.state-path:hover { fill-opacity: .8; }

/* State name labels */
.state-label {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
  letter-spacing: .01em;
}

/* Institution bubbles */
.map-dot {
  stroke: rgba(255,255,255,.65);
  stroke-width: .8;
  fill-opacity: .75;
  cursor: pointer;
  transition: fill-opacity .14s, stroke-width .14s;
}
.map-dot.is-hover {
  fill-opacity: 1;
  stroke: #fff;
  stroke-width: 2;
}
.map-dot.is-pinned {
  fill-opacity: 1;
  stroke: #fff;
  stroke-width: 3;
}

/* ── Map legend ──────────────────────────────────────────────────────────────── */
.map-legend-wrap { display: flex; flex-direction: column; gap: 1.25rem; min-width: 155px; padding: .5rem 0; }
.legend-block {}
.legend-title {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sublabel);
  margin-bottom: .55rem;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .chart-outer { flex-direction: column; }
  .pin-panel { position: fixed; top: auto; bottom: 1rem; right: 1rem; left: 1rem; width: auto; max-height: 60vh; overflow-y: auto; }
  .section-sub-nowrap { white-space: normal; max-width: 920px; }
}

.section-sub-nowrap { white-space: nowrap; max-width: none; }
