/* Mind Map — 3D Knowledge Graph Styles */
body.mindmap-page { margin: 0; overflow: hidden; background: var(--black); }
#mindmapCanvas { width: 100vw; height: 100vh; display: block; }

/* HUD overlay */
.mm-hud { position: fixed; top: 0; left: 0; right: 0; z-index: 100; pointer-events: none; }
.mm-hud > * { pointer-events: auto; }
.mm-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1.5rem; background: rgba(10,10,10,0.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(245,197,24,0.15);
}
.mm-logo { color: #f8f7f4; font-weight: 700; font-size: 1rem; text-decoration: none; letter-spacing: 0.05em; }
.mm-logo span { color: #f5c518; }
.mm-title { color: #f5c518; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.15em; }
.mm-controls { display: flex; gap: 0.4rem; }
.mm-btn {
  padding: 0.35rem 0.8rem; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.05);
  color: #f8f7f4; border-radius: 4px; cursor: pointer; font-size: 0.7rem; transition: all 0.2s;
}
.mm-btn:hover { border-color: #f5c518; color: #f5c518; }
.mm-btn.active { background: #f5c518; color: #0a0a0a; border-color: #f5c518; }

/* Sidebar */
.mm-sidebar {
  position: fixed; top: 52px; left: 0; bottom: 0; width: 280px; background: rgba(10,10,10,0.92);
  backdrop-filter: blur(10px); border-right: 1px solid rgba(245,197,24,0.1); z-index: 90;
  overflow-y: auto; padding: 1rem; transform: translateX(-100%); transition: transform 0.3s ease;
}
.mm-sidebar.open { transform: translateX(0); }
.mm-sidebar-title { color: #f5c518; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.5rem; font-weight: 600; }
.mm-sidebar-item {
  padding: 0.4rem 0.6rem; border-radius: 4px; cursor: pointer; font-size: 0.78rem;
  color: #ccc; transition: all 0.15s; margin-bottom: 0.15rem;
}
.mm-sidebar-item:hover { background: rgba(245,197,24,0.08); color: #f5c518; }
.mm-sidebar-item.active { background: rgba(245,197,24,0.15); color: #f5c518; font-weight: 500; }
.mm-sidebar-item .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.5rem; }
.mm-search {
  width: 100%; padding: 0.5rem; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: #f8f7f4; border-radius: 4px; font-size: 0.8rem; margin-bottom: 0.8rem;
}
.mm-search:focus { outline: none; border-color: #f5c518; }

/* Tooltip */
.mm-tooltip {
  position: fixed; pointer-events: none; z-index: 200; background: rgba(10,10,10,0.95);
  border: 1px solid rgba(245,197,24,0.3); border-radius: 8px; padding: 0.8rem 1rem;
  max-width: 320px; display: none; backdrop-filter: blur(8px);
}
.mm-tooltip.visible { display: block; }
.mm-tooltip .tt-name { color: #f5c518; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; }
.mm-tooltip .tt-type { color: #888; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; }
.mm-tooltip .tt-desc { color: #ccc; font-size: 0.8rem; line-height: 1.4; margin-top: 0.3rem; }
.mm-tooltip .tt-keywords { color: #f5c518; font-size: 0.65rem; margin-top: 0.4rem; opacity: 0.7; }

/* Link insight popup */
.mm-insight {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 150;
  background: rgba(10,10,10,0.95); border: 1px solid #f5c518; border-radius: 8px;
  padding: 1rem 1.5rem; max-width: 500px; display: none; text-align: center;
}
.mm-insight.visible { display: block; }
.mm-insight .insight-title { color: #f5c518; font-weight: 600; margin-bottom: 0.3rem; }
.mm-insight .insight-text { color: #ccc; font-size: 0.85rem; }

/* Performance indicator */
.mm-perf {
  position: fixed; bottom: 10px; right: 10px; z-index: 100;
  font-size: 0.6rem; color: #555; font-family: monospace;
}

/* Legend */
.mm-legend {
  position: fixed; bottom: 20px; left: 20px; z-index: 100; background: rgba(10,10,10,0.9);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; padding: 0.6rem 0.8rem;
}
.mm-legend-title { color: #888; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.3rem; }
.mm-legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.7rem; color: #aaa; margin-bottom: 0.15rem; }
.mm-legend-color { width: 10px; height: 10px; border-radius: 2px; }

/* Breadcrumb */
.mm-breadcrumb {
  position: fixed; top: 55px; left: 50%; transform: translateX(-50%); z-index: 100;
  display: flex; gap: 0.3rem; align-items: center; padding: 0.3rem 0.8rem;
  background: rgba(10,10,10,0.8); border-radius: 4px; border: 1px solid rgba(255,255,255,0.05);
}
.mm-breadcrumb span { color: #888; font-size: 0.7rem; cursor: pointer; }
.mm-breadcrumb span:hover { color: #f5c518; }
.mm-breadcrumb span.current { color: #f5c518; font-weight: 600; }
.mm-breadcrumb .sep { color: #444; font-size: 0.6rem; }

/* ─── Light Theme ─── */
.mindmap-light { background: #f0f0f0; }
.mindmap-light .mm-topbar { background: rgba(240,240,240,0.9); border-bottom-color: rgba(0,0,0,0.1); }
.mindmap-light .mm-logo { color: #1a1a1a; }
.mindmap-light .mm-title { color: #6b4c00; }
.mindmap-light .mm-btn { border-color: rgba(0,0,0,0.15); color: #1a1a1a; background: rgba(0,0,0,0.03); }
.mindmap-light .mm-btn:hover { border-color: #6b4c00; color: #6b4c00; }
.mindmap-light .mm-sidebar { background: rgba(245,245,245,0.95); border-right-color: rgba(0,0,0,0.08); }
.mindmap-light .mm-sidebar-title { color: #6b4c00; }
.mindmap-light .mm-sidebar-item { color: #333; }
.mindmap-light .mm-sidebar-item:hover { background: rgba(107,76,0,0.08); color: #6b4c00; }
.mindmap-light .mm-search { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); color: #1a1a1a; }
.mindmap-light .mm-tooltip { background: rgba(255,255,255,0.96); border-color: rgba(0,0,0,0.15); }
.mindmap-light .mm-tooltip .tt-name { color: #6b4c00; }
.mindmap-light .mm-tooltip .tt-type { color: #888; }
.mindmap-light .mm-tooltip .tt-desc { color: #333; }
.mindmap-light .mm-insight { background: rgba(255,255,255,0.96); border-color: #6b4c00; }
.mindmap-light .mm-insight .insight-title { color: #6b4c00; }
.mindmap-light .mm-insight .insight-text { color: #333; }
.mindmap-light .mm-legend { background: rgba(255,255,255,0.9); border-color: rgba(0,0,0,0.1); }
.mindmap-light .mm-legend-title { color: #888; }
.mindmap-light .mm-legend-item { color: #555; }
.mindmap-light .mm-breadcrumb { background: rgba(255,255,255,0.85); border-color: rgba(0,0,0,0.05); }
.mindmap-light .mm-breadcrumb span { color: #888; }
.mindmap-light .mm-breadcrumb span.current { color: #6b4c00; }
.mindmap-light .mm-perf { color: #aaa; }

@media (max-width: 768px) {
  .mm-sidebar { width: 100%; }
  .mm-tooltip { max-width: 250px; }
}

/* Focus mode: hides HUD chrome and the citations footer so the 3D map fills
   the viewport. The Focus button itself stays accessible via a small floating
   exit pill in the corner. Triggered by JS on body when user clicks Focus
   (regardless of whether the browser grants Fullscreen API — older webviews
   without permission still get a clean view). */
body.mm-focus .mm-hud,
body.mm-focus .mm-breadcrumb,
body.mm-focus .mm-legend,
body.mm-focus .mm-perf { display: none !important; }
body.mm-focus #mmFocusExit {
  position: fixed; top: 0.6rem; right: 0.6rem; z-index: 200;
  background: rgba(20,20,20,0.7); color: #f5c518;
  border: 1px solid rgba(245,197,24,0.4); border-radius: 999px;
  padding: 0.3rem 0.7rem; font-size: 0.7rem; letter-spacing: 0.08em;
  cursor: pointer; backdrop-filter: blur(6px);
}
body.mm-focus #mmFocusExit:hover { background: rgba(245,197,24,0.15); }
