/* SAINTel correlation map: builds on the dashboard theme in ../css/jarvis.css */
[hidden] { display: none !important; }
body.mapview { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body.mapview > * { position: relative; z-index: 1; }

.map-header {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.2rem;
  padding: .6rem 1.2rem .5rem; border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, rgba(4,30,48,.75), rgba(4,30,48,.15));
}
.map-header .brand { display: flex; align-items: center; gap: .9rem; text-decoration: none; }
.map-header .brand h1 { font-size: 1.7rem; }
.map-header .brand-sub { color: var(--amber); }
.map-stats { display: flex; gap: 1.6rem; justify-content: center; font-family: var(--f-mono); font-size: .8rem; color: var(--text-2); letter-spacing: .1em; }
.map-stats b { font-family: var(--f-display); font-size: 1.15rem; color: var(--text); margin-right: .35rem; font-weight: 700; }
.map-tools { display: flex; gap: .5rem; align-items: center; }
.map-tools .hud-btn { text-decoration: none; }
.map-tools #mfilter { width: 13rem; padding: .45rem .6rem .45rem 1.8rem; font-family: var(--f-mono); font-size: .9rem; color: var(--text);
  background: rgba(41,225,255,.06); border: 1px solid var(--line-2); outline: none;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.map-tools #mfilter:focus { border-color: var(--amber); box-shadow: var(--glow-amber); width: 17rem; }

.legend { display: flex; flex-wrap: wrap; gap: .45rem; padding: .45rem 1.2rem; border-bottom: 1px solid var(--line); background: rgba(2,14,24,.55); }
.legend button {
  display: inline-flex; align-items: center; gap: .45rem; padding: .25rem .65rem; cursor: pointer;
  font-family: var(--f-mono); font-size: .8rem; letter-spacing: .06em; color: var(--text);
  background: rgba(41,225,255,.04); border: 1px solid var(--line);
}
.legend button svg { width: 14px; height: 14px; flex: none; }
.legend button b { color: var(--text-2); font-weight: 400; }
.legend button.off { opacity: .35; text-decoration: line-through; }
.legend button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.legend .sep { width: 1px; background: var(--line); margin: 0 .3rem; }

.map-stage { flex: 1; min-height: 0; position: relative; }
#graph { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#graph.grabbing { cursor: grabbing; }
#graph.over-node { cursor: pointer; }
.map-hint { position: absolute; left: 1rem; bottom: .7rem; font-family: var(--f-mono); font-size: .72rem; color: var(--muted); letter-spacing: .08em; pointer-events: none; }
.lod { position: absolute; right: 1rem; bottom: .6rem; font-family: var(--f-mono); font-size: .74rem; color: var(--muted); letter-spacing: .1em; pointer-events: none; display: flex; align-items: center; gap: .3rem; }
.lod i { display: inline-block; width: .55rem; height: .55rem; border: 1px solid var(--cyan-dim); }
.lod i.on { background: var(--cyan); box-shadow: var(--glow); }
.lod b { color: var(--text); font-weight: 400; margin-left: .25rem; }
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-mono); color: var(--text-2); }

.info {
  position: absolute; top: .8rem; right: .8rem; bottom: .8rem; width: min(30rem, 42vw);
  display: flex; flex-direction: column; gap: .5rem; padding: .7rem .9rem;
  background: linear-gradient(160deg, rgba(6,44,68,.94), rgba(2,14,24,.94)); border: 1px solid var(--line-2);
  box-shadow: 0 0 30px rgba(41,225,255,.12);
}
.info .ph h2 { white-space: normal; line-height: 1.25; font-size: .95rem; flex: 1; }
.info #info-close { margin-left: auto; padding: .25rem .55rem; }
.info-body { overflow: auto; display: flex; flex-direction: column; gap: .8rem; scrollbar-width: thin; scrollbar-color: var(--cyan-dim) transparent; }
.info-body h3 { margin: 0 0 .3rem; font-family: var(--f-mono); font-weight: 400; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.info-body p { margin: 0; color: var(--text); line-height: 1.35; }
.info-body .kv { display: grid; grid-template-columns: minmax(7rem, max-content) 1fr; gap: .25rem .8rem; margin: 0; }
.info-body .kv dt { font-family: var(--f-mono); font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.info-body .kv dd { margin: 0; }
.conn { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.conn li { padding: .3rem .45rem; border-left: 3px solid var(--c, var(--line-2)); background: rgba(41,225,255,.03); }
.conn button { background: none; border: 0; padding: 0; font: inherit; color: var(--text); font-weight: 600; cursor: pointer; text-align: left; }
.conn button:hover { color: var(--cyan-2); }
.conn .ev { display: block; font-family: var(--f-mono); font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.conn .kind { font-family: var(--f-mono); font-size: .66rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .08em; margin-left: .4rem; }
.info-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.info-links a { text-decoration: none; }
.badge { display: inline-block; font-family: var(--f-mono); font-size: .7rem; padding: .05rem .4rem; border: 1px solid currentColor; margin-right: .3rem; }

@media (max-width: 1100px) {
  .map-header { grid-template-columns: 1fr; }
  .map-stats { justify-content: flex-start; }
  .info { width: auto; left: .8rem; top: auto; height: 55%; }
  .map-hint { display: none; }
}
