﻿.ai-map-page {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.ai-map-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 360px);
  gap: var(--spacing-xl);
  align-items: center;
}

.ai-map-hero-card,
.atlas-detail-card,
.atlas-node-card,
.atlas-reset,
.atlas-search input,
.atlas-stage-current-card {
  backdrop-filter: blur(12px);
}

.ai-map-hero-card {
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.06), rgba(255, 0, 255, 0.08));
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  padding: var(--spacing-xl);
}

.ai-map-hero-label {
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--spacing-md);
}

.ai-map-mini-list {
  list-style: none;
  display: grid;
  gap: var(--spacing-md);
  color: var(--color-text-secondary);
}

.ai-map-mini-list li {
  position: relative;
  padding-left: 1.1rem;
}

.ai-map-mini-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary);
}

.ai-map-shell {
  padding: var(--spacing-xl);
}

.ai-map-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}

.ai-map-tools {
  display: flex;
  gap: var(--spacing-md);
  align-items: end;
}

.atlas-search {
  display: grid;
  gap: 0.45rem;
  min-width: 280px;
}

.atlas-search span {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.atlas-search input {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill-lg);
  background: var(--color-bg-overlay);
  color: var(--color-text-primary);
  padding: 0.9rem 1rem;
}

.atlas-reset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill-lg);
  background: var(--color-bg-overlay);
  color: var(--color-text-primary);
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.atlas-reset:hover,
.atlas-search input:focus {
  border-color: var(--color-primary);
  outline: none;
}

.atlas-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: var(--spacing-sm);
}

.atlas-breadcrumb button,
.atlas-breadcrumb span {
  background: none;
  border: none;
  color: var(--color-primary);
  font: inherit;
  padding: 0;
}

.atlas-breadcrumb button {
  cursor: pointer;
}

.atlas-breadcrumb button + button::before,
.atlas-breadcrumb button + span::before,
.atlas-breadcrumb span + button::before,
.atlas-breadcrumb span + span::before {
  content: "/";
  margin-right: 0.6rem;
  color: var(--color-text-tertiary);
}

.ai-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, 0.85fr);
  gap: var(--spacing-xl);
}

.atlas-map-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-lg);
}

.atlas-current-title {
  font-size: clamp(1.45rem, 2vw, 2rem);
  margin-bottom: var(--spacing-sm);
}

.atlas-current-summary {
  color: var(--color-text-secondary);
  max-width: 72ch;
  line-height: var(--line-height-relaxed);
}

.atlas-depth-badge {
  color: var(--color-accent-light);
  background: var(--color-accent-bg-lighter);
  border: 1px solid var(--color-accent-border);
  border-radius: var(--radius-pill);
  padding: 0.55rem 0.8rem;
  white-space: nowrap;
  font-size: var(--font-size-sm);
}

.atlas-map-hint {
  margin: var(--spacing-lg) 0;
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

.atlas-stage {
  position: relative;
  min-height: 760px;
  border-radius: calc(var(--card-radius) + 6px);
  border: 1px solid var(--color-primary-border-light);
  background:
    radial-gradient(circle at 10% 10%, rgba(0, 245, 255, 0.1), transparent 26%),
    radial-gradient(circle at 100% 0%, rgba(255, 0, 255, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(10, 16, 28, 0.92), rgba(19, 26, 43, 0.96));
  overflow: hidden;
  padding: 2rem 1.4rem 2rem 1.6rem;
}

.atlas-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 245, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
}

.atlas-stage-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.atlas-tree-trunk {
  position: absolute;
  left: 17%;
  top: 12%;
  bottom: 10%;
  width: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0, 245, 255, 0.9), rgba(168, 85, 247, 0.4) 55%, rgba(196, 136, 15, 0.28));
  box-shadow: 0 0 24px rgba(0, 245, 255, 0.24);
}

.atlas-tree-branch {
  position: absolute;
  left: 17%;
  width: 45%;
  height: 2px;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(0, 245, 255, 0.55), rgba(255, 0, 255, 0.22), transparent 92%);
}

.atlas-tree-branch-a {
  top: 24%;
  transform: rotate(-18deg);
}

.atlas-tree-branch-b {
  top: 48%;
  transform: rotate(0deg);
}

.atlas-tree-branch-c {
  top: 70%;
  transform: rotate(18deg);
}

.atlas-tree-leaf {
  position: absolute;
  right: 18%;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(0, 245, 255, 0.2);
  border: 1px solid rgba(0, 245, 255, 0.28);
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.18);
}

.atlas-tree-leaf-a { top: 15%; }
.atlas-tree-leaf-b { top: 46%; }
.atlas-tree-leaf-c { top: 77%; }

.atlas-grid-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.22;
}

.atlas-grid-glow-a {
  background: rgba(0, 245, 255, 0.35);
  top: -30px;
  right: -40px;
}

.atlas-grid-glow-b {
  background: rgba(255, 0, 255, 0.25);
  bottom: 10px;
  left: -40px;
}

.atlas-stage-current {
  position: relative;
  z-index: 2;
  width: min(300px, 42%);
  margin-top: 12rem;
}

.atlas-stage-current-card {
  display: grid;
  gap: var(--spacing-md);
  background: linear-gradient(180deg, rgba(19, 26, 43, 0.98), rgba(10, 16, 28, 0.92));
  border: 1px solid rgba(0, 245, 255, 0.34);
  border-radius: 26px;
  padding: 1.2rem 1.15rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255,255,255,0.04) inset;
}

.atlas-stage-current-card .atlas-node-title {
  font-size: clamp(1.35rem, 1.7vw, 1.8rem);
}

.atlas-node-map--stage {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.atlas-node-map--stage .atlas-node-card {
  position: absolute;
  width: min(290px, 32%);
  min-height: 190px;
}

.atlas-node-map--stage .atlas-node-card:nth-child(1) {
  right: 8%;
  top: 8%;
}

.atlas-node-map--stage .atlas-node-card:nth-child(2) {
  right: 5%;
  top: 38%;
}

.atlas-node-map--stage .atlas-node-card:nth-child(3) {
  right: 8%;
  bottom: 8%;
}

.atlas-node-card {
  text-align: left;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.8), rgba(19, 26, 43, 0.92));
  border: 1px solid var(--color-primary-border-light);
  border-radius: calc(var(--card-radius) + 4px);
  padding: 1rem 1rem 1.05rem;
  color: var(--color-text-primary);
  display: grid;
  gap: 0.85rem;
  align-content: start;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.atlas-node-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: var(--color-primary);
  box-shadow: 0 18px 40px rgba(0, 245, 255, 0.14);
}

.atlas-node-card.is-leaf {
  border-color: var(--color-accent-border);
}

.atlas-node-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.atlas-node-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--color-primary);
}

.atlas-node-icon svg {
  width: 1.4rem;
  height: 1.4rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.atlas-node-kicker {
  color: var(--color-accent-light);
  font-size: var(--font-size-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: right;
}

.atlas-node-title {
  font-size: 1.12rem;
  line-height: 1.35;
}

.atlas-node-meta {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.atlas-node-brands,
.atlas-brand-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.atlas-brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.36rem 0.56rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--color-text-secondary);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.atlas-brand-mark {
  display: inline-flex;
  width: 1.45rem;
  height: 1.45rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0,245,255,0.22), rgba(255,0,255,0.18));
  color: var(--color-text-primary);
  font-size: 0.64rem;
  font-weight: 700;
}

.atlas-detail-panel {
  display: grid;
  gap: var(--spacing-lg);
}

.atlas-detail-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  padding: var(--spacing-xl);
}

.atlas-detail-card--visual {
  overflow: hidden;
}

.atlas-scene-card {
  display: grid;
  gap: 1rem;
}

.atlas-scene-art {
  position: relative;
  min-height: 148px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(0,245,255,0.08), rgba(255,0,255,0.08), rgba(196,136,15,0.08));
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
}

.atlas-scene-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 45%, rgba(0,0,0,0.12));
}

.atlas-scene-orb,
.atlas-scene-line {
  position: absolute;
  display: block;
}

.atlas-scene-orb {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 0 22px rgba(0,245,255,0.18);
}

.atlas-scene-orb-a {
  width: 68px;
  height: 68px;
  left: 16%;
  top: 24%;
  background: radial-gradient(circle, rgba(0,245,255,0.38), rgba(0,245,255,0.06));
}

.atlas-scene-orb-b {
  width: 96px;
  height: 96px;
  right: 14%;
  bottom: 12%;
  background: radial-gradient(circle, rgba(255,0,255,0.32), rgba(255,0,255,0.05));
}

.atlas-scene-line {
  height: 2px;
  background: linear-gradient(90deg, rgba(0,245,255,0.3), rgba(255,0,255,0.28), transparent);
  transform-origin: left center;
}

.atlas-scene-line-a {
  width: 44%;
  left: 24%;
  top: 38%;
  transform: rotate(-12deg);
}

.atlas-scene-line-b {
  width: 34%;
  left: 38%;
  bottom: 30%;
  transform: rotate(18deg);
}

.atlas-scene-copy strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--color-text-primary);
}

.atlas-scene-copy p {
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  font-size: var(--font-size-sm);
}

.atlas-text-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--color-text-secondary);
  display: grid;
  gap: var(--spacing-sm);
  line-height: var(--line-height-relaxed);
}

.atlas-news-list {
  display: grid;
  gap: var(--spacing-md);
}

.atlas-news-item {
  background: var(--color-bg-overlay);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
}

.atlas-news-item strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--color-text-primary);
}

.atlas-news-item span {
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  font-size: var(--font-size-sm);
}

.atlas-empty {
  position: absolute;
  inset: 2rem;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--card-radius);
  color: var(--color-text-secondary);
  padding: var(--spacing-xl);
}

.atlas-scene-card[data-scene="upstream"] .atlas-scene-art {
  background: linear-gradient(135deg, rgba(0,245,255,0.08), rgba(29,78,216,0.12));
}

.atlas-scene-card[data-scene="midstream"] .atlas-scene-art {
  background: linear-gradient(135deg, rgba(0,245,255,0.08), rgba(168,85,247,0.11));
}

.atlas-scene-card[data-scene="downstream"] .atlas-scene-art {
  background: linear-gradient(135deg, rgba(255,0,255,0.08), rgba(196,136,15,0.12));
}

.atlas-scene-card[data-scene="leaf"] .atlas-scene-art {
  background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(0,245,255,0.08));
}

[data-theme="light"] .atlas-stage {
  background:
    radial-gradient(circle at 10% 10%, rgba(196, 136, 15, 0.12), transparent 26%),
    radial-gradient(circle at 100% 0%, rgba(184, 85, 85, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(229, 224, 213, 0.96));
}

[data-theme="light"] .atlas-node-card,
[data-theme="light"] .atlas-stage-current-card {
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.98), rgba(229, 224, 213, 0.96));
  color: var(--color-text-primary);
}

[data-theme="light"] .atlas-node-card:hover {
  box-shadow: 0 18px 38px rgba(196, 136, 15, 0.16);
}

@media (max-width: 1100px) {
  .ai-map-layout,
  .ai-map-hero,
  .ai-map-topbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .ai-map-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .atlas-search {
    min-width: 0;
  }
}

@media (max-width: 860px) {
  .atlas-stage {
    min-height: 980px;
    padding: 1.2rem;
  }

  .atlas-stage-current {
    width: 100%;
    margin-top: 0;
    margin-bottom: 1rem;
  }

  .atlas-tree-trunk,
  .atlas-tree-branch,
  .atlas-tree-leaf {
    display: none;
  }

  .atlas-node-map--stage {
    position: relative;
    display: grid;
    gap: 1rem;
    inset: auto;
  }

  .atlas-node-map--stage .atlas-node-card {
    position: relative;
    width: 100%;
    right: auto;
    top: auto;
    bottom: auto;
  }
}

@media (max-width: 640px) {
  .ai-map-shell,
  .atlas-detail-card,
  .ai-map-hero-card {
    padding: var(--spacing-lg);
  }
}


.atlas-stage.is-transitioning .atlas-stage-current-card,
.atlas-stage.is-transitioning .atlas-node-card {
  opacity: 0;
  transform: translateY(16px) scale(0.96);
}

.atlas-stage-current-card,
.atlas-node-card {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.36s ease, border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.atlas-stage-current-card.is-entered,
.atlas-node-card.is-entered {
  animation: atlasCardReveal 0.44s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--enter-delay, 0ms);
}

@keyframes atlasCardReveal {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.atlas-node-card.is-expandable {
  overflow: visible;
}

.atlas-node-preview {
  position: absolute;
  right: -34px;
  bottom: 18px;
  width: 88px;
  height: 48px;
  pointer-events: none;
  opacity: 0.72;
}

.atlas-node-preview-line {
  position: absolute;
  right: 14px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0,245,255,0.42), rgba(255,0,255,0.22), transparent 92%);
  transform-origin: right center;
}

.atlas-node-preview-line-a {
  top: 14px;
  width: 52px;
  transform: rotate(-18deg);
}

.atlas-node-preview-line-b {
  top: 29px;
  width: 66px;
  transform: rotate(10deg);
}

.atlas-node-preview-dot {
  position: absolute;
  right: 0;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(0,245,255,0.85), rgba(0,245,255,0.18));
  box-shadow: 0 0 14px rgba(0,245,255,0.42);
}

.atlas-node-card.is-expandable:hover .atlas-node-preview {
  opacity: 1;
  transform: translateX(4px);
}

.atlas-node-map--stage .atlas-node-card:nth-child(4) {
  right: 21%;
  bottom: 18%;
}

/* Full-screen showcase priority */
.container:has(.ai-map-page) {
  max-width: min(1800px, calc(100vw - 32px));
}

.container:has(.ai-map-page) .content {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.ai-map-page {
  gap: 1rem;
}

.ai-map-hero {
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 420px);
  gap: 1rem;
}

.ai-map-workspace {
  width: 100%;
}

.ai-map-shell {
  padding: 1.25rem;
  margin-bottom: 0;
}

.ai-map-layout {
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.atlas-map-panel {
  display: grid;
  gap: 0.9rem;
}

.atlas-map-head {
  align-items: end;
}

.atlas-current-summary {
  max-width: 96ch;
}

.atlas-stage {
  min-height: calc(100vh - 220px);
  padding: 2rem 2rem 2rem 2.2rem;
  border-radius: 28px;
}

.atlas-tree-trunk {
  left: 14%;
  top: 8%;
  bottom: 8%;
  width: 12px;
}

.atlas-tree-branch {
  left: 14%;
  width: 52%;
}

.atlas-tree-branch-a {
  top: 21%;
}

.atlas-tree-branch-b {
  top: 48%;
}

.atlas-tree-branch-c {
  top: 75%;
}

.atlas-tree-leaf {
  right: 12%;
  width: 20px;
  height: 20px;
}

.atlas-stage-current {
  width: min(360px, 28%);
  margin-top: 14rem;
  margin-left: 0.5rem;
}

.atlas-stage-current-card {
  padding: 1.5rem 1.35rem;
  border-radius: 30px;
}

.atlas-stage-current-card .atlas-node-title {
  font-size: clamp(1.5rem, 1.9vw, 2rem);
}

.atlas-node-map--stage .atlas-node-card {
  width: min(360px, 26%);
  min-height: 230px;
  padding: 1.15rem 1.1rem 1.2rem;
}

.atlas-node-map--stage .atlas-node-card:nth-child(1) {
  right: 9%;
  top: 6%;
}

.atlas-node-map--stage .atlas-node-card:nth-child(2) {
  right: 6%;
  top: 36%;
}

.atlas-node-map--stage .atlas-node-card:nth-child(3) {
  right: 9%;
  bottom: 6%;
}

.atlas-node-title {
  font-size: 1.3rem;
}

.atlas-node-meta {
  font-size: 0.92rem;
}

.atlas-detail-panel {
  grid-template-columns: 1.2fr 1fr 1fr;
  align-items: start;
}

.atlas-detail-card--visual {
  grid-column: 1 / -1;
}

.atlas-detail-card {
  min-height: 100%;
}

.atlas-scene-card {
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1fr);
  gap: 1.25rem;
  align-items: center;
}

.atlas-scene-art {
  min-height: 240px;
  border-radius: 26px;
}

.atlas-scene-copy strong {
  font-size: 1.35rem;
}

.atlas-scene-copy p {
  font-size: 0.98rem;
}

.atlas-brand-rail {
  grid-column: 1 / -1;
}

/* Scroll stability */
html,
body {
  min-height: 100%;
  overflow-x: clip;
  overflow-y: auto;
}

body:has(.ai-map-page) {
  overflow-y: auto;
}

.container:has(.ai-map-page),
.ai-map-page,
.ai-map-workspace,
.ai-map-shell,
.ai-map-layout,
.atlas-map-panel,
.atlas-detail-panel {
  overflow: visible;
}

.atlas-stage {
  overflow: hidden;
  overscroll-behavior: auto;
}
