/* Sales territory map */

:root {
  --territory-tom: #2f6fa5;
  --territory-cyrus: #d5a43a;
  --territory-line: #d6dde4;
  --territory-muted: #5d6975;
}

.territory-section > h2 {
  margin-top: 0;
}

.territory-intro {
  max-width: 48rem;
  line-height: 1.55;
}

/*
  The map occupies the full width of the main content area.
  The two representative cards appear in two columns beneath it.
*/
.map-layout {
  display: block;
}

.map-panel {
  position: relative;
  width: 100%;
  min-width: 0;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  border: 1px solid var(--territory-line);
  background: #f8fafb;
  box-sizing: border-box;
}

#territory-map {
  display: block;
  width: 100%;
  height: auto;
}

.territory-state {
  stroke: #fff;
  stroke-width: 1.2;
  cursor: pointer;
  transition: filter 0.12s ease;
}

.territory-state:hover,
.territory-state:focus {
  filter: brightness(0.88);
  outline: none;
}

.territory-state-borders {
  fill: none;
  stroke: #fff;
  stroke-width: 1.1;
  pointer-events: none;
}

.map-status {
  margin: 0.5rem 0 0;
  color: var(--territory-muted);
  font-size: 0.8rem;
}

.territory-tooltip {
  position: absolute;
  z-index: 3;
  display: none;
  max-width: 15.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--territory-line);
  background: #fff;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
  font-size: 0.875rem;
  line-height: 1.35;
  pointer-events: auto;
}

.territory-tooltip strong {
  display: block;
  margin-bottom: 0.2rem;
}

/*
  Representative cards span the width beneath the map.
*/
.territory-reps,
.rep-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
}

.rep-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--territory-line);
  background: #fff;
  box-sizing: border-box;
}

.rep-heading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.territory-swatch {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.rep-card--tom .territory-swatch {
  background: var(--territory-tom);
}

.rep-card--cyrus .territory-swatch {
  background: var(--territory-cyrus);
}

.rep-phone {
  margin: 0 0 0.65rem;
  font-weight: 600;
}

.rep-phone a {
  text-decoration: none;
}

.rep-phone a:hover,
.rep-phone a:focus {
  text-decoration: underline;
}

.rep-card .states {
  margin: 0;
  color: var(--territory-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

/*
  Stack the representative cards on narrower screens.
*/
@media (max-width: 700px) {
  .territory-reps,
  .rep-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .map-panel {
    padding: 0.5rem;
  }

  .rep-card {
    padding: 0.85rem;
  }
}