/* Research atlas on the homepage. Colours follow the site theme variables. */
.research-atlas {
  --atlas-line: var(--global-divider-color, #ddd);
  --atlas-muted: var(--global-text-color-light, #666);
  --atlas-zone-label: #5f6e68;
  margin: 4.5rem 0 1rem;
  font-size: 0.92rem;
}
.atlas-heading {
  margin: 0 0 1.5rem;
}
.atlas-heading h2 {
  font-size: 1.75rem;
  margin: 0 0 0.75rem;
  font-weight: 500;
}
.atlas-heading-text {
  max-width: 72ch;
}
.atlas-heading-text p {
  margin: 0;
  color: var(--atlas-muted);
  line-height: 1.6;
  text-wrap: pretty;
}
.atlas-heading-text .atlas-lead {
  margin-bottom: 0.4rem;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--global-text-color);
}
.atlas-tools {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.atlas-search {
  flex: 1;
  margin: 0;
  min-width: 0;
}
.atlas-tools input,
.atlas-tools button {
  font: inherit;
  font-size: 0.85rem;
  background: var(--global-bg-color, #fff);
  color: var(--global-text-color, #222);
  border: 1px solid var(--atlas-line);
  border-radius: 6px;
  min-height: 40px;
  padding: 0.45rem 0.75rem;
  width: 100%;
}
.atlas-tools button {
  width: auto;
  white-space: nowrap;
  cursor: pointer;
}
.atlas-tools button:hover {
  border-color: var(--global-theme-color);
}
.atlas-tools input:focus-visible,
.atlas-tools button:focus-visible {
  outline: 2px solid var(--global-theme-color);
  outline-offset: 2px;
}
/* Both views share one frame; base-map switches and the details card float over it. */
.atlas-frame {
  position: relative;
}
.atlas-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.atlas-use-mark {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--atlas-muted);
}
.atlas-use-case {
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--global-bg-color);
  box-shadow: 0 0 0 1px var(--atlas-muted);
}
.atlas-base {
  margin: 0;
  padding: 0.5rem 0.7rem 0.4rem;
  border: 1px solid var(--atlas-line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--global-bg-color) 88%, transparent);
  backdrop-filter: blur(4px);
  font-size: 0.74rem;
}
.atlas-base legend {
  float: left;
  width: 100%;
  margin: 0 0 0.2rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--atlas-muted);
}
.atlas-base label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  min-height: 24px;
  cursor: pointer;
  clear: both;
}
.atlas-base input {
  margin: 0;
  accent-color: var(--global-theme-color);
}
.atlas-detail {
  position: absolute;
  left: 10px;
  bottom: 44px;
  z-index: 6;
  width: min(360px, calc(100% - 20px));
  max-height: calc(100% - 64px);
  overflow-y: auto;
  padding: 0.9rem 1rem 0.6rem;
  border: 1px solid var(--atlas-line);
  border-left: 3px solid var(--layer-color);
  border-radius: 8px;
  background: var(--global-bg-color);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  font-size: 0.8rem;
}
.atlas-detail-close {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--atlas-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.atlas-detail-close:hover {
  background: var(--global-divider-color);
}
.atlas-detail h3 {
  font-size: 1.05rem;
  margin: 0.2rem 1.6rem 0.35rem 0;
}
.atlas-detail p {
  margin: 0 0 0.55rem;
  line-height: 1.5;
}
.atlas-detail .atlas-type {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--layer-color);
}
.atlas-detail .atlas-region {
  margin-bottom: 0.4rem;
  color: var(--atlas-muted);
}
.atlas-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.15rem 0.7rem;
  margin: 0 0 0.6rem;
  font-size: 0.74rem;
  line-height: 1.4;
}
.atlas-facts dt {
  font-weight: 600;
  color: var(--atlas-muted);
}
.atlas-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.atlas-detail .atlas-precision {
  font-size: 0.72rem;
  color: var(--atlas-muted);
  border-left: 2px solid var(--atlas-line);
  padding-left: 0.6rem;
}
.atlas-detail .atlas-precision strong {
  font-weight: 600;
}
.atlas-detail h4 {
  font-size: 0.8rem;
  margin: 0.7rem 0 0.4rem;
}
.atlas-detail ul {
  padding-left: 1.1rem;
  margin-bottom: 0.5rem;
}
.atlas-detail li {
  margin-bottom: 0.45rem;
}
.atlas-species {
  font-size: 0.74rem;
  line-height: 1.5;
}
.atlas-detail .atlas-species-note {
  font-size: 0.68rem;
  color: var(--atlas-muted);
}
.atlas-detail summary {
  cursor: pointer;
  color: var(--atlas-muted);
}

/* Layered / flat switch. */
.atlas-views {
  display: flex;
  border: 1px solid var(--atlas-line);
  border-radius: 6px;
  overflow: hidden;
  flex: none;
}
.atlas-tools .atlas-views button {
  border: 0;
  border-radius: 0;
  min-height: 38px;
}
.atlas-tools .atlas-views button + button {
  border-left: 1px solid var(--atlas-line);
}
.atlas-tools .atlas-views button[aria-pressed="true"] {
  background: var(--global-text-color);
  color: var(--global-bg-color);
}
/* Layered view: canvases stacked over a soft backdrop. */
.atlas-network-wrap {
  border-radius: 8px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, rgba(128, 160, 150, 0.12), transparent 70%), var(--global-bg-color);
  border: 1px solid var(--atlas-line);
}
.atlas-network {
  position: relative;
  width: 100%;
  min-height: 200px;
}
.atlas-network canvas {
  position: absolute;
  inset: 0;
  display: block;
  touch-action: pan-y;
  cursor: grab;
}
.atlas-network.is-dragging canvas {
  cursor: grabbing;
}
.atlas-hint {
  margin-left: auto;
  font-style: italic;
}
.atlas-map-key .atlas-hint-touch {
  display: none;
}
@media (hover: none) and (pointer: coarse) {
  .atlas-map-key .atlas-hint-mouse {
    display: none;
  }
  .atlas-map-key .atlas-hint-touch {
    display: flex;
  }
}
.atlas-net-tip {
  position: absolute;
  max-width: 220px;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  background: var(--global-text-color);
  color: var(--global-bg-color);
  font-size: 0.72rem;
  line-height: 1.3;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atlas-link-intra,
.atlas-link-inter {
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 1.5px solid var(--atlas-muted);
}
.atlas-link-inter {
  height: 12px;
  width: 8px;
  border-top: 0;
  border-left: 1.5px solid var(--atlas-muted);
  transform: skewX(-25deg);
}
html[data-theme="dark"] .atlas-network-wrap {
  background: radial-gradient(ellipse at 50% 30%, rgba(120, 170, 150, 0.12), transparent 70%), var(--global-bg-color);
}
.atlas-map-wrap {
  border: 1px solid var(--atlas-line);
  border-radius: 8px;
  overflow: hidden;
}
/* The equirectangular world (56° S to 80° N) is about 2.3 times wider than tall. */
#research-map {
  width: 100%;
  height: auto;
  aspect-ratio: 2.15 / 1;
  min-height: 260px;
  max-height: 560px;
  background: #f1f5f6;
  z-index: 0;
}
.atlas-map-key {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
  color: var(--atlas-muted);
  background: var(--global-bg-color, #fff);
  border-top: 1px solid var(--atlas-line);
}
.atlas-map-key span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.atlas-solid,
.atlas-ring {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--atlas-muted);
}
.atlas-ring {
  background: transparent;
  border: 2px solid var(--atlas-muted);
}
.atlas-cluster {
  font-style: normal;
  background: var(--atlas-muted);
  color: var(--global-bg-color, #fff);
  width: 17px;
  height: 17px;
  border-radius: 50%;
  text-align: center;
  line-height: 17px;
  font-size: 10px;
}
.atlas-status {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--atlas-muted);
}
/* Reference lines on the base map. */
.atlas-zone-label span {
  position: absolute;
  transform: translateY(-115%);
  white-space: nowrap;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--atlas-zone-label);
  pointer-events: none;
}
.atlas-methods summary {
  cursor: pointer;
}
.atlas-stage-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0 0.4rem;
  border: 1px dashed var(--atlas-muted);
  border-radius: 999px;
  font-size: 0.66rem;
  color: var(--atlas-muted);
  vertical-align: 1px;
}
.atlas-source-note {
  display: block;
  color: var(--atlas-muted);
  font-size: 0.73rem;
}
.atlas-credit {
  margin: 0.3rem 0 0;
  font-size: 0.68rem;
  color: var(--atlas-muted);
}
.atlas-credit a {
  color: inherit;
  text-decoration: underline;
}
.atlas-methods {
  margin: 1.5rem 0 0;
  border-top: 1px solid var(--atlas-line);
  padding-top: 0.8rem;
  font-size: 0.8rem;
}
.atlas-methods p {
  max-width: 90ch;
  margin-top: 0.8rem;
  line-height: 1.6;
}
.atlas-methods summary {
  color: var(--atlas-muted);
}
.atlas-patch-button {
  background: transparent;
  color: var(--global-theme-color);
  border: 1px solid var(--atlas-line);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
/* Leaflet markers and popups. */
.atlas-pin {
  background: none;
  border: 0;
}
.atlas-pin span {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--pin-color);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px #0003;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.atlas-pin.atlas-approx span {
  background: #fff;
  border: 3px solid var(--pin-color);
}
.atlas-pin:focus {
  outline: 2px solid #222;
  outline-offset: 3px;
  border-radius: 50%;
}
.atlas-pin.atlas-selected span {
  box-shadow:
    0 0 0 4px #fff,
    0 0 0 6px var(--pin-color);
}
.atlas-popup {
  max-height: 220px;
  overflow: auto;
}
.atlas-popup strong {
  display: block;
  margin-bottom: 0.3rem;
}
.atlas-popup button {
  display: block;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #ddd;
  width: 100%;
  padding: 0.55rem 0;
  text-align: left;
  color: #222;
  font-size: 12px;
  cursor: pointer;
}
.research-atlas .leaflet-container {
  font-family: inherit;
}
.research-atlas .leaflet-container a {
  color: var(--global-theme-color);
}
.research-atlas .leaflet-control-attribution {
  font-size: 10px !important;
}
html[data-theme="dark"] .atlas-pin span {
  border-color: #273234;
}
html[data-theme="dark"] .atlas-pin.atlas-approx span {
  background: #273234;
  border-color: var(--pin-color);
}
html[data-theme="dark"] .atlas-pin.atlas-selected span {
  box-shadow:
    0 0 0 4px #273234,
    0 0 0 6px var(--pin-color);
}
@media (max-width: 600px) {
  .atlas-overlay {
    position: static;
    margin-top: 0.5rem;
  }
  .atlas-base {
    position: static;
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0 1rem;
    background: none;
    backdrop-filter: none;
  }
  .atlas-base legend {
    float: none;
  }
  .atlas-base label {
    clear: none;
  }
  .atlas-detail {
    position: relative;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: none;
    margin-top: 0.6rem;
    box-shadow: none;
  }
  .atlas-tools {
    flex-wrap: wrap;
  }
  .atlas-search {
    flex-basis: 100%;
  }
}
@media (max-width: 600px) {
  .atlas-heading h2 {
    font-size: 1.4rem;
  }
  .atlas-heading-text p {
    font-size: 0.88rem;
  }
  .atlas-heading-text .atlas-lead {
    font-size: 0.98rem;
  }
  #research-map {
    aspect-ratio: 2 / 1;
    min-height: 180px;
  }
  .research-atlas .atlas-zone-label {
    display: none;
  }
  /* The credit line under the atlas carries the attribution, so the map itself stays clear. */
  .research-atlas .leaflet-control-attribution {
    display: none;
  }
  .research-atlas .leaflet-control-zoom a {
    width: 26px;
    height: 26px;
    line-height: 26px;
    font-size: 16px;
  }
  .atlas-pin span {
    font-size: 9px;
    border-width: 1.5px;
  }
  .atlas-map-key {
    gap: 0.6rem;
    font-size: 0.65rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .research-atlas * {
    scroll-behavior: auto !important;
  }
}
