/* ============================================================
   The Disclosure Files — WEF Transformation Map Styles
   140 nodes · 8 branches
   ============================================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111111;
  color: #ffffff;
  font-family: "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Skip Link ---- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #4a9eff;
  color: #0a0a0f;
  padding: 8px 16px;
  z-index: 10000;
  text-decoration: none;
  font-size: 14px;
}
.skip-link:focus {
  top: 0;
}

/* ---- SVG Canvas ---- */
#map-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  position: absolute;
  top: 0;
  left: 0;
}

#map-svg:active {
  cursor: grabbing;
}

#map-svg text {
  pointer-events: none;
  user-select: none;
}

/* ---- Header / Title ---- */
.map-header {
  position: fixed;
  top: 24px;
  left: 32px;
  z-index: 100;
  pointer-events: none;
}

.map-header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  margin-bottom: 4px;
}

.map-header p {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
}

/* ---- Legend (top-right) ---- */
.legend {
  position: fixed;
  top: 24px;
  right: 32px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(17,17,17,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px 18px;
}

.legend-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 2px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Bottom Toolbar ---- */
.toolbar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(30,30,30,0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 8px 12px;
}

.toolbar button {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.toolbar button:hover {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
}

.toolbar button.active {
  background: rgba(0,101,242,0.3);
  border-color: rgba(0,101,242,0.5);
  color: #ffffff;
}

.toolbar .separator {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.1);
  margin: 0 4px;
}

/* ---- Search ---- */
.search-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: none;
}

.search-container.open {
  display: block;
}

.search-input-wrap {
  position: relative;
  width: 420px;
}

.search-input-wrap input {
  width: 100%;
  background: rgba(30,30,30,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 12px 18px 12px 42px;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s;
}

.search-input-wrap input::placeholder {
  color: rgba(255,255,255,0.55);
}

.search-input-wrap input:focus {
  border-color: rgba(0,101,242,0.6);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.55);
  font-size: 16px;
  pointer-events: none;
}

.search-results {
  margin-top: 6px;
  background: rgba(25,25,25,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}

.search-results.has-results {
  display: block;
}

.search-result-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(255,255,255,0.06);
}

.search-result-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.search-result-title {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}

.search-result-branch {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  margin-left: auto;
}

/* ---- Content Panel (right sidebar) ---- */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100%;
  background: rgba(18,18,18,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 400;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  overflow-x: hidden;
}

.panel.open {
  transform: translateX(0);
}

.panel-inner {
  padding: 32px 28px 80px;
}

.panel-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
}

.panel-close:hover {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
}

.panel-branch-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.panel-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 16px;
  color: #ffffff;
}

.panel-subtitle {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  margin-top: -10px;
  margin-bottom: 18px;
  font-style: italic;
}

.panel-description {
  font-size: 14px;
  line-height: 1.65;
  color: rgba(255,255,255,0.8);
  margin-bottom: 28px;
  white-space: pre-wrap;
}

.panel-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 12px;
}

/* Evidence items */
.evidence-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.evidence-item {
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  padding: 12px 14px;
  border-left: 3px solid #888;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255,255,255,0.75);
}

.evidence-item[data-tier="documented"] {
  border-left-color: #34d399;
}
.evidence-item[data-tier="credible"] {
  border-left-color: #fbbf24;
}
.evidence-item[data-tier="inference"] {
  border-left-color: #fb923c;
}
.evidence-item[data-tier="speculative"] {
  border-left-color: #f87171;
}

.evidence-source {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  font-style: italic;
}

/* Connected nodes chips */
.connected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 28px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* Sources links */
.source-link {
  display: block;
  padding: 8px 0;
  font-size: 13px;
  color: #4a9eff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: color 0.2s;
}

.source-link:hover {
  color: #7cb8ff;
}

.source-link:last-child {
  border-bottom: none;
}

.source-toggle-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  background: rgba(74, 158, 255, 0.08);
  border: 1px solid rgba(74, 158, 255, 0.2);
  color: #4a9eff;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.source-toggle-btn:hover {
  background: rgba(74, 158, 255, 0.16);
  border-color: rgba(74, 158, 255, 0.35);
  color: #7cb8ff;
}

/* ---- Intel Entities Section ---- */
.entity-section {
  margin-top: 28px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 20px;
}

.entity-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
}

.entity-pill {
  padding: 4px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.entity-pill:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
}

.entity-pill.active {
  background: rgba(0,101,242,0.2);
  border-color: rgba(0,101,242,0.4);
  color: #4a9eff;
}

.entity-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}

.entity-item:hover {
  background: rgba(255,255,255,0.05);
}

.entity-type-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.entity-type-dot[data-type="person"] { background: #60a5fa; }
.entity-type-dot[data-type="organization"] { background: #f472b6; }
.entity-type-dot[data-type="agency"] { background: #f87171; }
.entity-type-dot[data-type="program"] { background: #a78bfa; }
.entity-type-dot[data-type="event"] { background: #fbbf24; }
.entity-type-dot[data-type="facility"] { background: #34d399; }
.entity-type-dot[data-type="legislation"] { background: #fb923c; }
.entity-type-dot[data-type="publication"] { background: #94a3b8; }
.entity-type-dot[data-type="foundation"] { background: #c084fc; }

.entity-name {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-item:hover .entity-name {
  color: #ffffff;
}

.entity-conn-count {
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  flex-shrink: 0;
}

.entity-link-icon {
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  flex-shrink: 0;
}

.entity-item:hover .entity-link-icon {
  color: #4a9eff;
}

.entity-show-more {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.entity-show-more:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
}

/* Description auto-links (keyword cross-references) */
.desc-link {
  color: #d4b85c;
  cursor: pointer;
  border-bottom: 1px dotted rgba(212, 184, 92, 0.4);
  transition: border-color 0.2s, color 0.2s;
}
.desc-link:hover {
  color: #e8d5a0;
  border-bottom-color: rgba(232, 213, 160, 0.7);
}

/* ---- Scrollbar ---- */
.panel::-webkit-scrollbar {
  width: 6px;
}
.panel::-webkit-scrollbar-track {
  background: transparent;
}
.panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

.search-results::-webkit-scrollbar {
  width: 4px;
}
.search-results::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
  .panel {
    width: 100%;
    top: auto;
    bottom: 0;
    right: 0;
    height: 65vh;
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .panel.open {
    transform: translateY(0);
  }

  .map-header {
    top: 14px;
    left: 16px;
  }
  .map-header h1 {
    font-size: 16px;
  }
  .map-header p {
    font-size: 10px;
  }

  .legend {
    top: 14px;
    right: 16px;
    padding: 10px 12px;
    gap: 5px;
  }
  .legend-item {
    font-size: 9px;
  }
  .legend-dot {
    width: 6px;
    height: 6px;
  }

  .toolbar {
    bottom: 16px;
    padding: 6px 8px;
    gap: 4px;
  }
  .toolbar button {
    font-size: 11px;
    padding: 6px 10px;
  }

  .toolbar #btn-zoom-in,
  .toolbar #btn-zoom-out {
    display: none;
  }

  .search-input-wrap {
    width: 300px;
  }
  .search-container {
    top: 60px;
  }
}

@media (max-width: 480px) {
  .legend {
    display: none !important;
  }
  .toolbar {
    bottom: 12px;
    padding: 5px 8px;
    gap: 3px;
  }
  .toolbar button {
    font-size: 10px;
    padding: 5px 10px;
  }
}

/* Accessibility: focus indicators */
.toolbar button:focus-visible,
.panel-close:focus-visible {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

.search-result-item:focus-visible {
  outline: 2px solid #4a9eff;
  outline-offset: -1px;
}

.chip:focus-visible {
  outline: 2px solid #4a9eff;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  .legend-item, .search-result-branch, .chip {
    color: rgba(255, 255, 255, 0.9);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
