.interactive-map-page {
  overflow: clip;
  padding-bottom: 2.5rem;
}

.interactive-map-page > .section-inner {
  width: 100%;
  max-width: none;
  padding-inline: 0;
}

.constellation-heading {
  width: min(100% - 2rem, 78rem);
  max-width: 78rem;
  margin: 0 auto 1.4rem;
}

.constellation-heading h1 {
  font-size: clamp(2.2rem, 5vw, 4.8rem);
}

.atlas-constellation-name {
  margin: 0.7rem 0 0;
  color: var(--brand-emphasis);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(0.78rem, 1.2vw, 0.98rem);
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.atlas-constellation-shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  border-block: 1px solid var(--border-subtle);
  background: var(--canvas-2);
}

.atlas-constellation-toolbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto auto auto;
  gap: 0.65rem;
  align-items: center;
  width: min(100% - 2rem, 94rem);
  margin: 0 auto;
  padding: 0.7rem 0;
}

.atlas-constellation-toolbar .atlas-search input {
  min-height: 2.6rem;
  background: var(--surface-panel);
  backdrop-filter: blur(14px);
}

.atlas-branch-count {
  color: var(--text-muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.74rem;
  white-space: nowrap;
}

.atlas-icon-button {
  display: inline-grid;
  width: 2.65rem;
  min-width: 2.65rem;
  height: 2.65rem;
  min-height: 2.65rem;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--surface-panel);
  color: var(--text-primary);
  font-size: 1.05rem;
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.atlas-icon-button:hover {
  border-color: var(--border-strong);
  color: var(--brand-emphasis);
}

.atlas-scene-frame {
  position: relative;
  min-height: 42rem;
  height: clamp(42rem, 82dvh, 68rem);
  overflow: hidden;
  outline: none;
  background:
    linear-gradient(180deg, transparent 64%, color-mix(in srgb, var(--canvas) 72%, transparent)),
    var(--canvas);
}

.atlas-scene-frame::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--canvas) 26%, transparent), transparent 10%, transparent 90%, color-mix(in srgb, var(--canvas) 26%, transparent)),
    radial-gradient(circle at 50% 45%, transparent 0 38%, color-mix(in srgb, var(--canvas) 22%, transparent) 100%);
}

.atlas-scene-frame:focus-visible {
  box-shadow: inset 0 0 0 3px var(--focus-ring);
}

.atlas-webgl-mount,
.atlas-webgl-canvas,
.atlas-label-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.atlas-webgl-mount {
  z-index: 0;
  touch-action: none;
}

.atlas-webgl-canvas {
  display: block;
}

.atlas-label-layer {
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.atlas-3d-label {
  --label-accent: var(--brand);
  position: absolute;
  z-index: var(--label-depth, 1);
  left: var(--label-x, -1000px);
  top: var(--label-y, -1000px);
  display: grid;
  max-width: min(13rem, 24vw);
  min-width: 6.5rem;
  gap: 0.12rem;
  padding: 0.42rem 0.58rem;
  transform: translate(-50%, -50%);
  border: 1px solid color-mix(in srgb, var(--label-accent) 44%, var(--border-subtle));
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface-panel) 90%, transparent);
  color: var(--text-primary);
  text-align: left;
  box-shadow: 0 0.5rem 1.6rem rgba(0, 0, 0, 0.18);
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.atlas-3d-label::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.55rem;
  width: 1px;
  height: 0.55rem;
  background: color-mix(in srgb, var(--label-accent) 70%, transparent);
}

.atlas-3d-label[hidden] {
  display: none;
}

.atlas-3d-label span {
  overflow-wrap: anywhere;
  font-size: clamp(0.68rem, 0.9vw, 0.82rem);
  font-weight: 760;
  line-height: 1.2;
}

.atlas-3d-label strong {
  color: var(--label-accent);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(0.67rem, 0.85vw, 0.78rem);
  font-weight: 720;
  line-height: 1.2;
}

.atlas-3d-label[data-node-type="domain"] {
  min-width: 8rem;
  border-color: color-mix(in srgb, var(--label-accent) 72%, var(--border-subtle));
  background: color-mix(in srgb, var(--surface-panel) 94%, transparent);
}

.atlas-3d-label[data-node-type="domain"] span {
  font-size: clamp(0.78rem, 1vw, 0.95rem);
}

.atlas-domain-animals { --label-accent: #d3a03f; }
.atlas-domain-climate { --label-accent: #c98450; }
.atlas-domain-land { --label-accent: #7e9c70; }
.atlas-domain-water { --label-accent: #6296a2; }
.atlas-domain-pollution { --label-accent: #aa8179; }
.atlas-domain-efficiency { --label-accent: #baa45f; }
.atlas-domain-health { --label-accent: #a3889a; }
.atlas-domain-aquatic { --label-accent: #4f8691; }

.atlas-loading,
.atlas-webgl-error {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  max-width: min(30rem, calc(100% - 2rem));
  transform: translate(-50%, -50%);
  color: var(--text-secondary);
  text-align: center;
}

.atlas-loading {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82rem;
}

.atlas-webgl-error {
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
}

.atlas-gesture-help {
  position: absolute;
  z-index: 5;
  left: 1rem;
  bottom: 0.85rem;
  max-width: min(34rem, calc(100% - 2rem));
  margin: 0;
  padding: 0.4rem 0.62rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: color-mix(in srgb, var(--surface-panel) 88%, transparent);
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.35;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.constellation-search-results {
  position: absolute;
  z-index: 30;
  top: 4.1rem;
  left: max(1rem, calc((100% - 94rem) / 2));
  width: min(31rem, calc(100% - 2rem));
  max-height: min(68dvh, 38rem);
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow);
}

.atlas-bottom-dock {
  position: absolute;
  z-index: 12;
  right: max(1rem, calc((100% - 94rem) / 2));
  bottom: 0.85rem;
  left: max(1rem, calc((100% - 94rem) / 2));
  max-height: calc(100% - 5.5rem);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--label-accent, var(--brand)) 52%, var(--border-subtle));
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-panel) 91%, transparent);
  box-shadow: 0 1rem 3.2rem rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(20px) saturate(1.08);
}

.atlas-dock-handle {
  display: none;
}

.atlas-dock-compact {
  display: grid;
  grid-template-columns: minmax(15rem, 1.5fr) minmax(10rem, 0.75fr) auto;
  gap: 1.1rem;
  align-items: center;
  min-height: 6.8rem;
  padding: 0.85rem 1rem;
}

.atlas-dock-copy small {
  color: var(--label-accent, var(--brand));
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.67rem;
  font-weight: 760;
  text-transform: uppercase;
}

.atlas-dock-copy h2 {
  margin: 0.14rem 0;
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  line-height: 1.15;
}

.atlas-dock-copy p {
  display: -webkit-box;
  max-width: 68ch;
  margin: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.atlas-dock-metric {
  display: grid;
  gap: 0.15rem;
}

.atlas-dock-metric strong {
  color: var(--label-accent, var(--brand-emphasis));
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(1.1rem, 2vw, 1.65rem);
  line-height: 1;
}

.atlas-dock-metric span {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.3;
}

.atlas-dock-actions {
  display: flex;
  gap: 0.45rem;
}

.atlas-dock-primary,
.atlas-collapse-branch {
  min-height: 2.65rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--brand);
  color: var(--ink);
  font-weight: 780;
  cursor: pointer;
}

.atlas-bottom-dock.is-expanded {
  overflow: auto;
}

.atlas-dock-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  max-height: min(58dvh, 36rem);
  overflow: auto;
  border-top: 1px solid var(--border-subtle);
}

.atlas-dock-detail > section {
  padding: 1rem;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.atlas-dock-detail h3 {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
}

.atlas-dock-detail p {
  max-width: 72ch;
  margin: 0.45rem 0 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.atlas-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.atlas-detail-meta span {
  padding: 0.22rem 0.42rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
}

.atlas-dock-sources {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.atlas-dock-sources a {
  display: grid;
  gap: 0.15rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border-subtle);
}

.atlas-dock-sources strong {
  font-size: 0.78rem;
  line-height: 1.35;
}

.atlas-dock-sources span {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.atlas-collapse-branch {
  align-self: center;
  justify-self: start;
  margin: 1rem;
  background: transparent;
  color: var(--text-primary);
}

.atlas-structured-host {
  position: absolute;
  z-index: 8;
  inset: 0;
  overflow: auto;
  padding: clamp(1rem, 3vw, 2.5rem);
  background: var(--canvas);
}

.atlas-scene-frame.is-structured {
  height: min(78dvh, 58rem);
  min-height: 38rem;
}

.atlas-structured-view {
  width: min(100%, 78rem);
  margin: 0 auto;
}

.atlas-structured-view .atlas-tree-list,
.atlas-structured-view .atlas-tree-list ul {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.atlas-structured-view .atlas-tree-list ul {
  margin-top: 0.45rem;
  margin-left: 1.1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border-subtle);
}

.atlas-tree-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: stretch;
}

.atlas-tree-disclosure,
.atlas-tree-select {
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  background: var(--surface-panel-subtle);
  color: var(--text-primary);
  cursor: pointer;
}

.atlas-tree-disclosure {
  min-height: 3.8rem;
  color: var(--label-accent, var(--brand));
  font-size: 1rem;
}

.atlas-tree-select {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-width: 0;
  padding: 0.65rem 0.8rem;
  text-align: left;
}

.atlas-tree-select > span {
  display: grid;
  min-width: 0;
}

.atlas-tree-select strong {
  font-size: 0.88rem;
}

.atlas-tree-select small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-tree-select b {
  color: var(--label-accent, var(--brand));
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
}

.atlas-tree-row.is-selected .atlas-tree-select {
  border-color: var(--label-accent, var(--border-strong));
  background: color-mix(in srgb, var(--label-accent, var(--brand)) 10%, var(--surface-panel));
}

.atlas-keyboard-hint {
  width: min(100% - 2rem, 94rem);
  margin: 0 auto;
  border-top: 0;
}

.atlas-constellation-shell:fullscreen {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100vw;
  height: 100dvh;
  background: var(--canvas);
}

.atlas-constellation-shell:fullscreen .atlas-scene-frame {
  height: auto;
  min-height: 0;
}

@media (max-width: 900px) {
  .atlas-constellation-toolbar {
    grid-template-columns: minmax(10rem, 1fr) auto auto;
  }

  .atlas-branch-count {
    display: none;
  }

  .atlas-dock-compact {
    grid-template-columns: minmax(0, 1fr) minmax(8rem, auto);
  }

  .atlas-dock-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 680px) {
  .interactive-map-page {
    padding-top: calc(var(--header-height) + 1rem);
  }

  .constellation-heading {
    width: min(100% - 1.25rem, 78rem);
  }

  .constellation-heading h1 {
    font-size: clamp(2rem, 12vw, 3.4rem);
  }

  .atlas-constellation-toolbar {
    grid-template-columns: 1fr auto;
    width: calc(100% - 1rem);
    padding-block: 0.5rem;
  }

  .atlas-constellation-toolbar .atlas-search {
    grid-column: 1 / -1;
  }

  .atlas-view-toggle button {
    min-height: 2.5rem;
    padding-inline: 0.6rem;
    font-size: 0.74rem;
  }

  .atlas-navigation-tools {
    justify-self: end;
  }

  .atlas-icon-button {
    width: 2.5rem;
    min-width: 2.5rem;
    height: 2.5rem;
    min-height: 2.5rem;
  }

  .atlas-scene-frame {
    min-height: 38rem;
    height: calc(100dvh - var(--header-height) - 7.8rem);
  }

  .atlas-3d-label {
    max-width: 9.5rem;
    min-width: 5.8rem;
  }

  .atlas-3d-label span {
    font-size: 0.68rem;
  }

  .atlas-gesture-help {
    top: 0.55rem;
    bottom: auto;
    font-size: 0.66rem;
  }

  .atlas-bottom-dock {
    right: 0.5rem;
    bottom: 0.5rem;
    left: 0.5rem;
    max-height: calc(100% - 1rem);
    border-radius: 8px 8px 4px 4px;
  }

  .atlas-dock-handle {
    display: block;
    width: 3rem;
    height: 0.24rem;
    margin: 0.42rem auto 0;
    border-radius: 999px;
    background: var(--border-strong);
  }

  .atlas-dock-compact {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 0;
    padding: 0.55rem 0.7rem 0.7rem;
  }

  .atlas-dock-copy p {
    -webkit-line-clamp: 1;
  }

  .atlas-dock-metric {
    text-align: right;
  }

  .atlas-dock-actions {
    justify-content: stretch;
  }

  .atlas-dock-primary {
    flex: 1;
  }

  .atlas-dock-detail {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - var(--header-height) - 13rem);
  }

  .atlas-dock-detail > section {
    border-right: 0;
  }

  .atlas-scene-frame.is-structured {
    height: calc(100dvh - var(--header-height) - 7.8rem);
    min-height: 34rem;
  }

  .atlas-structured-host {
    padding: 0.75rem;
  }

  .atlas-tree-select {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }

  .atlas-tree-select small {
    display: none;
  }

  .atlas-tree-select b {
    justify-self: start;
  }

  .atlas-keyboard-hint {
    display: none;
  }

  .constellation-search-results {
    top: 7.2rem;
    left: 0.5rem;
    width: calc(100% - 1rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-3d-label,
  .atlas-bottom-dock,
  .atlas-scene-frame {
    transition: none;
  }
}


.atlas-arguments-intro {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: center;
  padding: clamp(1rem, 2.5vw, 1.6rem);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: linear-gradient(115deg, color-mix(in srgb, var(--tone-analysis) 12%, var(--surface-1)), var(--surface-1));
}

.atlas-arguments-intro h3 {
  margin: 0.2rem 0 0.35rem;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.atlas-arguments-intro p:last-child {
  max-width: 70ch;
  margin: 0;
  color: var(--text-secondary);
}

.atlas-arguments-intro .button-link {
  white-space: nowrap;
}

@media (max-width: 680px) {
  .atlas-arguments-intro {
    grid-template-columns: 1fr;
  }

  .atlas-arguments-intro .button-link {
    justify-self: start;
    white-space: normal;
  }
}


.atlas-3d-label.is-path {
  border-color: color-mix(in srgb, var(--label-accent) 78%, var(--text-primary));
}

.atlas-3d-label.is-selected {
  border-color: var(--brand-emphasis);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 24%, transparent), 0 0.65rem 1.8rem rgba(0, 0, 0, 0.22);
}

.atlas-scene-frame.is-structured .atlas-structured-host {
  padding-bottom: 9.5rem;
}
