/* Map Explorer styles: the map frame, legend, side panel, breakdown bars and organisation lists. */

.hub-map {
  --hub-map-green: var(--brand, #eb4d4f);
  --hub-map-green-dark: var(--brand-d, #234a94);
  --hub-map-green-soft: var(--accent-l, #e8eefa);
  --hub-map-ink: var(--ink, #1e1e1e);
  --hub-map-muted: var(--muted, #6f6a65);
  --hub-map-line: var(--line, #e8e4df);
  --hub-map-surface: var(--card, #fff);
  min-width: 0;
  color: var(--hub-map-ink);
}

.hub-map [hidden] {
  display: none !important;
}

.hub-map button,
.hub-map input {
  font: inherit;
}

.hub-map__section-head > p {
  color: var(--hub-map-muted);
  line-height: 1.55;
}

.hub-map__eyebrow {
  margin: 0;
  color: var(--hub-map-green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hub-map__workspace-title {
  margin: 0;
  color: var(--hub-map-green);
}

.hub-map__section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 0.8rem;
}

.hub-map__section-head h2,
.hub-map__toolbar h2 {
  margin: 0.18rem 0 0;
  font-size: 1.18rem;
}

.hub-map__section-head > p {
  max-width: 390px;
  margin: 0;
  font-size: 0.84rem;
  text-align: right;
}

.hub-map__stat-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.72rem;
}

.hub-map__stat-card {
  min-width: 0;
  min-height: 168px;
  padding: 0.9rem;
  border: 1px solid var(--hub-map-line);
  border-radius: 14px;
  background: var(--hub-map-surface);
  color: inherit;
  box-shadow: var(--shadow, 0 5px 18px rgba(42, 89, 166, 0.07));
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.hub-map__stat-card:hover {
  border-color: rgba(42, 89, 166, 0.35);
  box-shadow: var(--shadow-hover, 0 8px 26px rgba(42, 89, 166, 0.12));
  transform: translateY(-2px);
}

.hub-map__stat-card[aria-pressed="true"] {
  border-color: var(--hub-map-green);
  box-shadow: inset 0 0 0 1px var(--hub-map-green), var(--shadow, none);
}

.hub-map__stat-card:focus-visible,
.hub-map__map-actions button:focus-visible {
  outline: 3px solid rgba(45, 148, 116, 0.38);
  outline-offset: 3px;
}

.hub-map__stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.hub-map__stat-icon {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: var(--hub-map-green-soft);
  color: var(--hub-map-green);
  font-size: 0.95rem;
}

.hub-map__stat-period {
  overflow: hidden;
  color: var(--hub-map-muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: right;
  text-overflow: ellipsis;
}

.hub-map__stat-value,
.hub-map__stat-label,
.hub-map__stat-note {
  display: block;
}

.hub-map__stat-value {
  overflow-wrap: anywhere;
  font-size: clamp(1.42rem, 1.8vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
}

.hub-map__stat-label {
  min-height: 2.5em;
  margin-top: 0.48rem;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.25;
}

.hub-map__stat-note {
  margin-top: 0.42rem;
  color: var(--hub-map-muted);
  font-size: 0.68rem;
  line-height: 1.3;
}

.hub-map__workspace {
  margin-top: 1.5rem;
  overflow: visible;
  border: 1px solid var(--hub-map-line);
  border-radius: 18px;
  background: var(--hub-map-surface);
  box-shadow: var(--shadow, 0 5px 18px rgba(42, 89, 166, 0.07));
}

.hub-map__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--hub-map-line);
}

.hub-map__workspace-subtitle {
  max-width: 34rem;
  margin: 0.2rem 0 0;
  color: var(--hub-map-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.hub-map__toolbar-actions {
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
}

.hub-map__layout {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(300px, 0.85fr);
  min-width: 0;
}

.hub-map__map-column {
  min-width: 0;
  padding: 1rem;
  background: #f7f8f6;
}

.hub-map__map-mount {
  position: relative;
  z-index: 0;
  min-height: 590px;
  overflow: hidden;
  border: 1px solid #dfe5e1;
  border-radius: 14px;
  background: #eef1ef;
}

.hub-map__legend-mount {
  position: absolute;
  z-index: 750;
  left: 0.85rem;
  bottom: 0.85rem;
  width: min(350px, calc(100% - 1.7rem));
  padding: 0.7rem 0.75rem;
  border: 1px solid rgba(28, 47, 43, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 5px 18px rgba(22, 50, 45, 0.16);
  pointer-events: none;
}

.hub-map__legend-mount strong {
  display: block;
  overflow: hidden;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-map__legend-scale-wrap {
  position: relative;
  margin-top: 0.52rem;
}

.hub-map__legend-scale {
  height: 10px;
  border: 1px solid rgba(27, 38, 49, 0.18);
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #e3edb7,
    #beddb3,
    #a9bde4,
    #69b2ad,
    #4795a5,
    #347590,
    #285575,
    #253b61,
    #211f50
  );
}

.hub-map__legend-marker {
  position: absolute;
  top: -8px;
  left: var(--hub-map-marker-position, 50%);
  width: 0;
  height: 0;
  border-top: 8px solid #050505;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  filter: drop-shadow(0 0 1px #fff);
  transform: translateX(-50%);
}

.hub-map__legend-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  margin-top: 0.28rem;
  color: #435149;
  font-size: 0.67rem;
  font-weight: 650;
}

.hub-map__legend-range span:last-child {
  text-align: right;
}

.hub-map__legend-selected {
  margin: 0.38rem 0 0;
  color: #27332f;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.25;
}

.hub-map__map-actions {
  position: absolute;
  z-index: 800;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  max-width: calc(100% - 5rem);
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.hub-map__map-actions button {
  min-height: 34px;
  padding: 0.38rem 0.62rem;
  border: 1px solid #46534e;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #26332e;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  cursor: pointer;
}

.hub-map__map-actions button:disabled {
  border-color: #b7bfbb;
  color: #7a8580;
  cursor: not-allowed;
}

.hub-map__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hub-map__side-panel {
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border-left: 1px solid var(--hub-map-line);
}

.hub-map__geography-header {
  padding: 1.2rem 1.15rem 1.25rem;
  background: linear-gradient(135deg, var(--hub-map-green-dark), var(--hub-map-green));
  color: #fff;
}

.hub-map__geography-kicker {
  margin: 0 0 0.48rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.hub-map__area-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.hub-map__area-heading h2 {
  margin: 0;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: 1.25rem;
}

.hub-map__indicator-identity {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  margin: 0 1.15rem;
  padding: 1rem 0 0.85rem;
  border-bottom: 1px solid var(--hub-map-line);
}

.hub-map__indicator-mark {
  display: inline-flex;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--hub-map-green-soft);
  color: var(--hub-map-green-dark);
  font-size: 1.05rem;
  font-weight: 850;
}

.hub-map__side-indicator {
  margin: 0;
  color: var(--hub-map-ink);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.3;
}

.hub-map__primary-metric {
  margin: 0 1.15rem;
  padding: 1rem 0 0;
}

.hub-map__primary-value {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.hub-map__measure {
  margin: 0.48rem 0 0;
  color: var(--hub-map-muted);
  font-size: 0.82rem;
}

.hub-map__breakdowns {
  margin: 1.1rem 1.15rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--hub-map-line);
}

.hub-map__breakdowns h3 {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
}

.hub-map__breakdown-family + .hub-map__breakdown-family {
  margin-top: 0.9rem;
}

.hub-map__breakdown-family h4 {
  margin: 0 0 0.42rem;
  color: var(--hub-map-muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.hub-map__breakdown-row {
  padding: 0.4rem 0;
  font-size: 0.75rem;
}

.hub-map__breakdown-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.26rem;
}

.hub-map__breakdown-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.hub-map__breakdown-heading span {
  flex: 0 0 auto;
  font-weight: 850;
}

.hub-map__breakdown-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eeeb;
}

.hub-map__breakdown-fill {
  display: block;
  width: var(--hub-breakdown-width, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #69b2ad, var(--hub-map-green));
}

.hub-map__source {
  margin: 0.2rem 0 0;
  color: var(--hub-map-muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.hub-map__about {
  margin: 0.95rem 1.15rem 1.15rem;
  border: 1px solid var(--hub-map-line);
  border-radius: 10px;
}

.hub-map__about summary {
  padding: 0.72rem 0.8rem;
  color: var(--hub-map-green-dark);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.hub-map__about dl {
  margin: 0;
  padding: 0 0.8rem 0.75rem;
}

.hub-map__about-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) minmax(0, 1.4fr);
  gap: 0.6rem;
  padding: 0.38rem 0;
  border-top: 1px solid #f0eeeb;
  font-size: 0.72rem;
}

.hub-map__about-row dt {
  color: var(--hub-map-muted);
  font-weight: 700;
}

.hub-map__about-row dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

@media (max-width: 1380px) {
  .hub-map__stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .hub-map__layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .hub-map__side-panel {
    border-top: 1px solid var(--hub-map-line);
    border-left: 0;
  }

  .hub-map__map-mount {
    min-height: 480px;
  }
}

@media (max-width: 760px) {
  .hub-map__section-head,
  .hub-map__toolbar,
  .hub-map__toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hub-map__section-head > p {
    text-align: left;
  }

  .hub-map__stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hub-map__map-column {
    padding: 0.75rem;
  }

  .hub-map__side-panel {
    padding: 0;
  }

  .hub-map__map-mount {
    min-height: 400px;
  }

  .hub-map__legend-mount {
    width: min(305px, calc(100% - 1.4rem));
    left: 0.7rem;
    bottom: 1.35rem;
  }
}

@media (max-width: 430px) {
  .hub-map__stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hub-map__stat-card {
    min-height: 148px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-map *,
  .hub-map *::before,
  .hub-map *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
