.text-action,
.icon-action,
.segmented button,
.link-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms var(--ease-out);
}

.text-action,
.icon-action {
  background: transparent;
  color: inherit;
}

.text-action {
  padding: 0.5rem 0.75rem;
  font-family: var(--display);
  font-size: 1rem;
}

.action-symbol {
  display: none;
  font-family: var(--sans);
  font-size: 1.25rem;
  line-height: 1;
}

.icon-action {
  min-width: 44px;
  padding: 0.5rem;
  font-size: 1.5rem;
}

.icon-action.dark {
  color: var(--ink);
}

.text-action:active,
.icon-action:active,
.segmented button:active,
.link-action:active {
  transform: scale(0.97);
}

.segmented {
  display: inline-flex;
  min-height: 44px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-bright);
}

.segmented button {
  min-height: 36px;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.segmented button[aria-pressed="true"] {
  background: var(--accent);
  color: white;
}

.scope-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.link-action {
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  background: transparent;
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.time-basis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1rem;
  align-items: center;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.time-basis strong {
  color: var(--accent);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.time-basis span + span {
  border-left: 1px solid var(--line);
  padding-left: 1rem;
}

.map-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.75rem, 2.4vw, 2.6rem);
  line-height: 1;
}

.map-title.latam {
  color: var(--latam);
}

.map-title.africa {
  color: var(--africa);
}

.map-coverage {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.map-wrap {
  position: relative;
  min-height: 500px;
}

.region-map {
  width: 100%;
  height: 500px;
  overflow: visible;
}

.country-shape {
  stroke: var(--paper-bright);
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition:
    opacity 160ms ease,
    fill 160ms ease,
    stroke 160ms ease;
}

.country-shape.latam {
  fill: var(--latam-pale);
}

.country-shape.africa {
  fill: var(--africa-pale);
}

.country-shape[data-has-contracts="false"] {
  fill: #e9e4da;
  opacity: 0.65;
}

.country-shape.latam[data-covered="false"] {
  fill: url(#missing-hatch-latam);
}

.country-shape.africa[data-covered="false"] {
  fill: url(#missing-hatch-africa);
}

.country-shape[data-selected="true"] {
  stroke: var(--accent);
  stroke-width: 2.6;
}

.country-bubble {
  fill-opacity: 0.86;
  stroke: white;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
}

.map-hit {
  pointer-events: fill;
}

.map-focus-ring {
  fill: none;
  stroke: transparent;
  stroke-width: 3.5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

body[data-transition="view"] .country-bubble {
  animation: bubble-enter 240ms var(--ease-out) both;
}

.country-bubble.selected {
  stroke: var(--paper-bright);
  stroke-width: 2;
}

.country-halo {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  transition:
    opacity 160ms ease,
    transform 160ms var(--ease-in-out);
}

.map-country:focus-visible {
  outline: none;
}

.map-country:focus-visible .country-bubble,
.map-country:focus-visible .country-halo,
.map-country:focus-visible .map-focus-ring {
  stroke: var(--accent);
  stroke-width: 3.5;
}

.mobile-map-picker {
  display: none;
}

.map-label {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 650;
  pointer-events: none;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.map-label.selected {
  fill: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.country-readout {
  min-height: 7rem;
  margin: 0 0 0.35rem;
}

.country-readout-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
}

.country-readout-detail {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.inline-record-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0.35rem 0;
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.scale-chart {
  width: 100%;
  height: 380px;
}

.scale-visual {
  min-width: 0;
}

.scale-context-note {
  margin: -0.55rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.scale-label {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.05em;
}

.scale-value {
  fill: var(--ink);
  font-size: 23px;
  font-weight: 700;
}

.scale-ratio {
  fill: var(--accent);
  font-family: var(--display);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.scale-ratio-note {
  fill: var(--ink);
  font-family: var(--display);
  font-size: 16px;
}

.scale-bar {
  transform-box: fill-box;
  transform-origin: bottom;
}

body[data-transition="view"] .scale-bar {
  animation: scale-enter 260ms var(--ease-in-out) both;
}

.scale-chart.horizontal .scale-bar {
  transform-origin: left;
}

body[data-transition="view"] .scale-chart.horizontal .scale-bar {
  animation-name: horizontal-scale-enter;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.2rem;
  align-items: center;
  color: #39363a;
  font-family: var(--display);
  font-size: 0.88rem;
}

.encoding-legend {
  display: grid;
  gap: 0.7rem;
}

.legend-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 0.35rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  vertical-align: -2px;
}

.legend-dot.latam {
  background: var(--latam);
  color: var(--latam);
}

.legend-dot.africa {
  background: var(--africa);
  color: var(--africa);
}

.legend-dot.missing {
  border-radius: 2px;
  background: repeating-linear-gradient(135deg, transparent 0 2px, #8e8b86 2px 3px);
  color: #8e8b86;
}

.legend-dot.no-contracts {
  border-color: #c5beb2;
  border-radius: 2px;
  background: #e9e4da;
  color: #e9e4da;
}

.magnitude-key {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  white-space: nowrap;
}

.legend-dot.magnitude {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-color: white;
  background: var(--key-colour);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--key-colour) 72%, black);
}

.size-key {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.size-dot {
  display: inline-block;
  width: var(--bubble-size);
  height: var(--bubble-size);
  flex: 0 0 auto;
  border: 1.5px solid #6f6a65;
  border-radius: 50%;
  background: rgb(111 106 101 / 12%);
}

.provenance {
  margin: 0;
  max-width: 44rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.page-break span:first-child {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page-break .arrow {
  font-family: var(--display);
  font-size: 2rem;
  transition: transform 120ms var(--ease-out);
}

.tooltip {
  position: fixed;
  z-index: 80;
  max-width: min(20rem, calc(100vw - 2rem));
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--accent);
  background: var(--paper-bright);
  box-shadow: 0 12px 30px rgb(49 30 27 / 16%);
  font-size: 0.82rem;
  line-height: 1.35;
  pointer-events: none;
  transform: translateY(0);
  transition:
    opacity 140ms var(--ease-out),
    transform 140ms var(--ease-out);
}

.tooltip strong {
  display: block;
  margin-bottom: 0.15rem;
  font-family: var(--display);
  font-size: 1rem;
}

.toast {
  position: fixed;
  z-index: 90;
  right: 1rem;
  bottom: 1rem;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.8rem 1rem;
  background: var(--ink);
  color: white;
  box-shadow: 0 12px 30px rgb(0 0 0 / 18%);
}

.search-dialog {
  width: min(46rem, calc(100vw - 2rem));
  max-height: min(42rem, calc(100vh - 2rem));
  padding: 0;
  border: 1px solid var(--line);
  background: var(--paper-bright);
  color: var(--ink);
}

.search-dialog::backdrop {
  background: rgb(23 23 25 / 48%);
}

.dialog-frame {
  padding: 1.25rem;
}

.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.dialog-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.75rem;
}

.search-field input {
  width: 100%;
  min-height: 48px;
  margin-top: 1rem;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  background: white;
}

.search-results {
  max-height: 26rem;
  overflow: auto;
  margin-top: 0.5rem;
}

.search-result {
  width: 100%;
  min-height: 58px;
  padding: 0.7rem 0.4rem;
  display: grid;
  gap: 0.15rem;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}

.search-result strong {
  font-family: var(--display);
  font-size: 1rem;
}

.search-result span,
.empty-result {
  color: var(--muted);
  font-size: 0.8rem;
}

.search-result span {
  overflow-wrap: anywhere;
}

@keyframes bubble-enter {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
}

@keyframes scale-enter {
  from {
    opacity: 0;
    transform: scaleY(0.06);
  }
}

@keyframes horizontal-scale-enter {
  from {
    opacity: 0;
    transform: scaleX(0.06);
  }
}

@media (hover: hover) and (pointer: fine) {
  .text-action:hover,
  .icon-action:hover {
    background: rgb(255 255 255 / 12%);
  }

  .primary-nav a:hover {
    color: var(--accent-dark);
  }

  .country-shape:hover {
    opacity: 0.78;
    stroke: var(--accent);
    stroke-width: 2;
  }

  .page-break:hover .arrow {
    transform: translateX(4px);
  }
}
