.territory-section {
  --territory-ink: #30006b;
  --territory-muted: #574578;
  --territory-pale: #f4eef6;
  --territory-lavender: #d3b5ec;
  background: var(--territory-pale);
  color: var(--territory-ink);
  padding: clamp(3.5rem, 7vw, 6.5rem) clamp(1.5rem, 6vw, 5.5rem);
  scroll-margin-top: 0;
}
.territory-wrap {
  max-width: 1240px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 1.02fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: center;
}
.territory-intro, .territory-map, .territory-details { min-width: 0; }
.territory-eyebrow, .territory-kicker {
  margin: 0;
  color: #5a2a94;
  font-size: calc(.76rem * var(--body-scale, 1));
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.territory-intro h2 {
  max-width: 11ch;
  margin: 1.05rem 0 1rem;
  font-size: calc(clamp(2.15rem, 3.25vw, 2.9rem) * var(--heading-scale, 1));
  line-height: 1.08;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.territory-copy p {
  margin: 0 0 1rem;
  color: var(--territory-muted);
  font-size: calc(.98rem * var(--body-scale, 1));
  line-height: 1.62;
  text-wrap: pretty;
}
.territory-copy p:last-child { margin-bottom: 0; }
.territory-map {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.territory-map-ring {
  position: absolute;
  left: 0;
  bottom: 8%;
  width: clamp(4.8rem, 9vw, 8rem);
  aspect-ratio: 1;
  border: 2px solid var(--territory-lavender);
  border-radius: 50%;
  opacity: .92;
  pointer-events: none;
  animation: territory-breathe 8s ease-in-out infinite;
}
@keyframes territory-breathe { 50% { transform: scale(1.07); opacity: .65; } }
.peru-map { position: relative; display: block; width: min(100%, 365px); height: auto; overflow: visible; }
.map-department {
  fill: #e6ddeb;
  stroke: var(--territory-pale);
  stroke-width: 3;
  stroke-linejoin: round;
  transition: fill 180ms ease, stroke 180ms ease;
}
.map-department.is-active { fill: var(--department-fill, var(--territory-lavender)); cursor: pointer; }
.map-department.is-active:hover { fill: var(--department-fill, var(--territory-lavender)); filter: brightness(.94); }
.map-department.is-selected,
.map-department.is-selected:hover { fill: var(--department-color, var(--lime, #a6ea2d)); stroke: #fff; stroke-width: 3.5; filter: none; }
.map-department:focus-visible { outline: none; stroke: var(--territory-ink); stroke-width: 5; }
.map-marker { display: none; }
.map-loading {
  position: absolute;
  z-index: 1;
  padding: .55rem .8rem;
  background: #fdfbfe;
  border-radius: .5rem;
  color: var(--territory-muted);
  font-size: .85rem;
}
.map-tooltip {
  position: absolute;
  z-index: 3;
  width: 230px;
  max-width: calc(100% - 16px);
  padding: .65rem .8rem;
  color: var(--territory-ink);
  background: #fdfbfe;
  border-left: 4px solid var(--lime, #a6ea2d);
  border-radius: .5rem;
  box-shadow: 0 10px 30px #30006b22;
  pointer-events: none;
}
.map-tooltip strong { display: block; margin-bottom: .2rem; }
.map-tooltip span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .88rem; line-height: 1.4; }
.territory-details { align-self: center; }
.territory-picker-label {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 .55rem;
  font-size: calc(.84rem * var(--body-scale, 1));
  font-weight: 700;
  line-height: 1.3;
}
.territory-label-dot { width: .7rem; height: .7rem; flex: none; border-radius: 50%; background: var(--lime, #a6ea2d); }
.territory-shortlist {
  max-height: 318px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  list-style: none;
  padding: 0;
  margin: 0;
}
.territory-shortlist button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  min-height: 48px;
  width: 100%;
  padding: .65rem .9rem;
  border: 0;
  border-radius: .75rem;
  color: var(--territory-ink);
  background: transparent;
  font: inherit;
  font-size: calc(.98rem * var(--body-scale, 1));
  text-align: left;
  cursor: pointer;
  transition: background-color 170ms ease, transform 170ms ease;
}
.territory-shortlist button span { flex: none; font-size: 1.1rem; }
.territory-shortlist button:hover { background: #f0d8fc; transform: translateX(3px); }
.territory-shortlist button[aria-pressed="true"],
.territory-shortlist button[aria-pressed="true"]:hover { background: var(--lime, #a6ea2d); font-weight: 700; transform: none; }
.territory-shortlist button:focus-visible, .territory-picker summary:focus-visible, .territory-list button:focus-visible, .territory-resource:focus-visible {
  outline: 3px solid var(--territory-ink);
  outline-offset: 2px;
}
.territory-picker-wrap { display: none; margin-top: .8rem; }
.territory-details.has-many .territory-picker-wrap { display: block; }
.territory-picker { position: relative; }
.territory-picker summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 46px;
  padding: .6rem .9rem;
  border: 1px solid #c9afe0;
  border-radius: .7rem;
  color: var(--territory-ink);
  background: #fdfbfe;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.territory-picker summary::-webkit-details-marker { display: none; }
.territory-picker summary svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.territory-picker[open] summary svg { transform: rotate(180deg); }
.territory-picker-panel {
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  right: 0;
  z-index: 5;
  padding: .8rem;
  border: 1px solid #c9afe0;
  border-radius: .75rem;
  color: var(--territory-ink);
  background: #fdfbfe;
  box-shadow: 0 12px 30px #30006b24;
}
.territory-picker-panel label { display: block; margin-bottom: .4rem; font-size: .86rem; font-weight: 700; }
.territory-picker-panel input { width: 100%; min-height: 44px; padding: .6rem .75rem; border: 1px solid #b69dcc; border-radius: .35rem; color: var(--territory-ink); background: #fff; font: inherit; font-size: 16px; }
.territory-picker-panel input:focus { outline: 2px solid var(--territory-ink); outline-offset: 2px; }
.territory-list { max-height: min(15rem, 32svh); overflow-y: auto; overscroll-behavior: contain; list-style: none; padding: .25rem; margin: .45rem -.25rem 0; scrollbar-width: thin; }
.territory-list button { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; min-height: 44px; padding: .6rem .75rem; border: 0; border-radius: .35rem; color: var(--territory-ink); background: transparent; font: inherit; font-size: 1rem; text-align: left; cursor: pointer; }
.territory-list button span { visibility: hidden; }
.territory-list button[aria-pressed="true"] span { visibility: visible; }
.territory-list button[aria-pressed="true"] { background: #e9d6f7; font-weight: 700; }
.territory-list button:hover { background: #e5f4c6; }
.territory-search-empty { padding: .8rem .2rem .2rem; font-size: .9rem; }
.territory-card {
  margin-top: .95rem;
  padding: 1.15rem 1.2rem 1.25rem;
  border: 0;
  border-radius: 1rem;
  color: var(--territory-ink);
  background: #fdfbfe;
  box-shadow: 0 10px 30px #30006b12;
}
.territory-card-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem; }
.territory-kicker { font-size: .7rem; }
.territory-demo { padding: .2rem .5rem; border: 1px solid #c9afe0; border-radius: 2rem; font-size: .7rem; }
.territory-card h3 { margin: .45rem 0 .65rem; font-size: calc(1.42rem * var(--heading-scale, 1)); line-height: 1.16; }
#territory-summary { margin: 0; color: var(--territory-muted); font-size: calc(.88rem * var(--body-scale, 1)); line-height: 1.55; }
.territory-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: 1.2rem; }
.territory-facts:empty { display: none; }
.territory-facts h4 { margin: 0 0 .4rem; font-size: .77rem; line-height: 1.45; letter-spacing: .04em; text-transform: uppercase; }
.territory-facts ul { padding-left: 1rem; margin: 0; }
.territory-facts li { margin-top: .3rem; font-size: .9rem; line-height: 1.55; overflow-wrap: anywhere; }
.territory-resource { display: inline-block; margin-top: 1.2rem; font-size: .9rem; font-weight: 700; text-decoration: underline; text-underline-offset: .25em; }
.territory-section [hidden] { display: none !important; }
.territory-section .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 1000px) {
  .territory-section { padding-inline: clamp(1.5rem, 4vw, 3rem); }
  .territory-wrap { gap: 1.5rem; }
  .territory-intro h2 { font-size: calc(clamp(2rem, 3.5vw, 2.6rem) * var(--heading-scale, 1)); }
}
@media (max-width: 850px) {
  .territory-wrap { max-width: 680px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "intro intro" "map details"; gap: 1.5rem 2rem; }
  .territory-intro { grid-area: intro; }
  .territory-intro h2 { max-width: 17ch; }
  .territory-map { grid-area: map; }
  .territory-details { grid-area: details; }
}
@media (max-width: 600px) {
  .territory-section { padding-block: 3.25rem; }
  .territory-wrap { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "map" "details"; gap: 1.6rem; }
  .territory-intro h2 { max-width: 12ch; font-size: calc(clamp(2.1rem, 8vw, 2.65rem) * var(--heading-scale, 1)); }
  .peru-map { width: min(100%, 290px); }
  .territory-map-ring { left: 5%; width: 5rem; }
  .territory-shortlist { display: none; }
  .territory-picker-wrap { display: block; }
  .territory-card { scroll-margin-top: 1rem; }
  .territory-facts { gap: .9rem; }
}
@media (max-width: 360px) { .territory-facts { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  .territory-map-ring { animation: none; }
  .territory-shortlist button, .map-department { transition: none; }
}
