.map-collection {
  --map-ink: #202326;
  --map-muted: #69716c;
  --map-line: rgba(100, 105, 102, .22);
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 5rem;
  color: var(--map-ink);
}

body.dark .map-collection {
  --map-ink: #f4f1e8;
  --map-muted: #b7b3aa;
  --map-line: rgba(235, 232, 223, .2);
}

.map-collection__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1rem;
  padding: .25rem 0 1.25rem;
  border-bottom: 1px solid var(--map-line);
  text-align: center;
}

.map-collection__intro h1 {
  max-width: none;
  margin: 0 auto;
  font-size: clamp(2rem, 3vw, 2.6rem);
  font-weight: 480;
  letter-spacing: -.05em;
  line-height: 1.1;
  text-wrap: balance;
}

.map-collection__description {
  max-width: 680px;
}

.map-collection__description p {
  margin: 0;
  color: var(--map-muted);
  font-size: .9rem;
  line-height: 1.55;
}

.map-collection__description p + p {
  margin-top: .65rem;
}

.map-collection__description a {
  text-decoration: underline;
  text-underline-offset: .15em;
}

.map-collection__hint {
  flex-shrink: 0;
  margin: 0 0 .1rem;
  color: var(--map-muted);
  font-size: .78rem;
}

.map-gallery {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
}

.map-piece {
  flex: 0 0 var(--map-width, calc(50% - .5rem));
  min-width: 0;
  max-width: 100%;
  margin: 0;
  scroll-margin-top: 6rem;
}

.map-piece__image {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(120, 120, 120, .055);
  color: #fff;
  cursor: zoom-in;
}

.map-piece__image img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
}

.map-piece__open {
  position: absolute;
  right: .6rem;
  bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .35rem .6rem;
  border-radius: 2px;
  background: #122140;
  color: #fff;
  font-size: .65rem;
  line-height: 1.4;
  opacity: 0;
  transition: opacity .15s ease;
}

.map-piece__open > span {
  font-size: 1rem;
}

.map-piece__image:hover .map-piece__open,
.map-piece__image:focus-visible .map-piece__open {
  opacity: 1;
}

.map-piece__image:focus-visible,
.map-collection__description a:focus-visible {
  outline: 3px solid var(--primary, #0f6876);
  outline-offset: 5px;
}

body.map-viewer-open {
  overflow: hidden;
}

.map-viewer {
  --pswp-bg: #16191d;
  --pswp-icon-color: #fff;
  --pswp-icon-color-secondary: #16191d;
  font-family: 'Satoshi', sans-serif;
}

.map-viewer .pswp__top-bar {
  height: 64px;
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
  background: #16191d;
}

.map-viewer .pswp__counter {
  align-self: center;
  height: auto;
  margin: 0 auto 0 .5rem;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  text-shadow: none;
}

.map-viewer .pswp__button {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  margin: 0 2px;
  border-radius: 3px;
  color: #fff;
  opacity: 1;
  cursor: pointer;
}

.map-viewer .pswp__button:hover,
.map-viewer .pswp__button:active {
  background: #343b43;
}

.map-viewer .pswp__button:focus-visible,
.map-viewer__caption a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -3px;
}

.map-viewer .pswp__button:disabled {
  opacity: .35;
  cursor: default;
}

.map-viewer .pswp__button--map-in,
.map-viewer .pswp__button--map-out {
  width: 44px;
  font: 400 28px/1 'Satoshi', sans-serif;
}

.map-viewer .pswp__button--map-fit,
.map-viewer .pswp__button--map-share {
  width: auto;
  padding: 0 12px;
  font: 500 14px/1 'Satoshi', sans-serif;
  white-space: nowrap;
}

.map-viewer .pswp__button--arrow {
  width: 52px;
  height: 80px;
  background: rgba(22, 25, 29, .85);
}

.map-viewer .pswp__button--arrow--prev { left: 0; }
.map-viewer .pswp__button--arrow--next { right: 0; }
.map-viewer .pswp__button--arrow .pswp__icn { left: 10px; }
.map-viewer.pswp--touch .pswp__button--arrow { visibility: visible; }

.map-viewer__caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  max-height: 30%;
  overflow-y: auto;
  padding: 14px max(20px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: #16191d;
  color: #fff;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
}

.map-viewer__caption h2 {
  margin: 0 0 4px;
  color: #fff;
  font-size: 18px;
  font-weight: 550;
  line-height: 1.35;
}

.map-viewer__caption p { margin: 0; }
.map-viewer__caption a { display: inline-block; padding: 6px 0; color: #9ae3eb; text-decoration: underline; }
.map-viewer__status { min-height: 1.5em; color: #c2c9d1; font-size: 12px; }

@media (max-width: 640px) {
  .map-collection { padding: .75rem 0 4rem; }
  .map-collection__intro { gap: .6rem; padding: .25rem 0 1rem; }
  .map-collection__intro h1 { max-width: none; font-size: clamp(1.85rem, 7vw, 2.25rem); }
  .map-piece { flex-basis: 100%; }
  .map-piece__open { opacity: 1; }
  .map-viewer .pswp__button--map-share { padding: 0 7px; font-size: 12px; }
  .map-viewer .pswp__button--map-fit { padding: 0 7px; font-size: 12px; }
  .map-viewer .pswp__button { margin: 0; }
  .map-viewer .pswp__counter { margin-left: 0; font-size: 12px; }
  .map-viewer .pswp__button--arrow { width: 44px; height: 64px; }
  .map-viewer .pswp__button--arrow .pswp__icn { left: 6px; }
  .map-viewer__caption { padding: 10px 16px max(10px, env(safe-area-inset-bottom)); font-size: 12px; }
  .map-viewer__caption h2 { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .map-piece__open { transition: none; }
}
