/* ============================================================
   The3dogs — living map
   ============================================================ */

.map-page {
  padding: 0 !important;
  height: calc(100vh - 66px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.map-strip {
  flex: 0 0 44px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 9, 0.9);
}
.map-strip-title { font-family: var(--font-display); font-size: 13px; color: var(--text); font-weight: 550; }
.map-strip-meta { font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .11em; }
.map-strip-link { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); }
.map-strip-link:hover { color: var(--green); }

.map-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 30% 20%, rgba(85,209,140, 0.07), transparent 65%),
    radial-gradient(700px 500px at 80% 80%, rgba(147,182,235, 0.05), transparent 65%),
    #080d0a;
  border-radius: 0;
}
.map-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(233,245,237, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.5;
  pointer-events: none;
}
.map-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(4,7,5, 0.55) 100%);
  pointer-events: none;
}
.map-toolbar {
  position: absolute;
  top: 13px;
  left: 13px;
  right: 13px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  pointer-events: none;
}
.map-toolbar > * { pointer-events: auto; }
.map-toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  background: rgba(10,15,12, 0.78);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 4px;
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0,0,0, 0.25);
}
.map-toolbar .filter-chip { height: 26px; font-size: 9.5px; padding: 0 8px; }
.map-toolbar .filter-chip .count { font-size: 8px; }
.map-toolbar .filter-chip i.swatch { width: 5px; height: 5px; border-radius: 50%; }
.map-focus {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10,15,12, 0.8);
  color: var(--muted);
  font-size: 9.5px;
  padding: 0 26px 0 9px;
  max-width: 180px;
  backdrop-filter: blur(16px);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2385918a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.map-canvas { position: absolute; inset: 0; z-index: 2; }
.map-canvas svg { width: 100%; height: 100%; display: block; touch-action: none; }
.map-canvas .viewport { will-change: transform; }
.map-canvas .bg-hit { fill: transparent; cursor: grab; }
.map-canvas .bg-hit:active { cursor: grabbing; }

.map-legend {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: calc(100% - 170px);
  background: rgba(10,15,12, 0.72);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 10px;
  backdrop-filter: blur(14px);
}
.map-legend span { display: inline-flex; align-items: center; gap: 4px; font-size: 7.5px; color: var(--faint); white-space: nowrap; }
.map-legend i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.map-legend i.sq { border-radius: 2px; }
.map-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 7;
  font-size: 8px;
  color: #5d5d5d;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: rgba(10,10,10, 0.6);
  padding: 5px 9px;
  border-radius: 20px;
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.map-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(10,15,12, 0.8);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  backdrop-filter: blur(14px);
}
.map-controls button {
  width: 27px; height: 27px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; color: var(--muted);
  transition: background 150ms ease, color 150ms ease;
}
.map-controls button:hover { background: rgba(255,255,255, 0.055); color: var(--text); }
.map-controls button .ic { width: 14px; height: 14px; }
.map-controls hr { border: 0; height: 1px; background: var(--line); margin: 2px 3px; }

.map-panel {
  position: absolute;
  top: 65px;
  right: 14px;
  width: 292px;
  z-index: 11;
  background: rgba(15,15,15, 0.92);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0, 0.4);
  backdrop-filter: blur(20px);
  padding: 15px;
  max-height: calc(100% - 140px);
  overflow-y: auto;
  animation: panelIn 180ms ease both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.map-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.map-panel-head .icon-btn { width: 24px; height: 24px; border-radius: 6px; margin: -3px -5px 0 0; }
.map-panel-head .icon-btn .ic { width: 14px; height: 14px; }
.map-panel-title { font-size: 15px; font-weight: 520; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.3; }
.map-panel-sub { font-size: 9px; color: var(--faint); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.1em; }
.map-panel-desc { font-size: 10px; color: var(--muted); line-height: 1.55; margin-top: 9px; }
.map-panel-stats { display: flex; gap: 14px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.map-panel-stats div strong { display: block; font-size: 15px; font-weight: 500; letter-spacing: -0.02em; color: var(--text); }
.map-panel-stats div span { display: block; font-size: 7.5px; color: var(--faint); margin-top: 1px; }
.map-panel-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.map-panel-label { font-size: 7.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); margin-bottom: 6px; }
.map-link-row {
  display: flex; align-items: center; gap: 7px; width: 100%; text-align: left;
  padding: 5px 6px; margin: 0 -6px; border-radius: 5px; font-size: 9.5px; color: var(--muted);
}
.map-link-row:hover { background: rgba(255,255,255, 0.04); color: var(--text-2); }
.map-link-dot { width: 5px; height: 5px; border-radius: 50%; flex: 0 0 auto; }
.map-panel .btn { margin-top: 12px; width: 100%; }
.map-panel-note { font-size: 8.5px; color: var(--faint); line-height: 1.5; margin-top: 10px; }

/* ------------------------------------------------------------ svg nodes */
.gedge {
  fill: none;
  stroke: rgba(241,241,241, 0.075);
  stroke-width: 0.8;
  transition: stroke 150ms ease, opacity 150ms ease;
}
.gedge.edge-project { stroke: rgba(241,241,241, 0.11); stroke-width: 0.9; }
.gedge.edge-task { stroke: rgba(241,241,241, 0.055); }
.gedge.edge-knowledge { stroke: rgba(178,178,178, 0.1); stroke-dasharray: 2 4; }
.gedge.is-related { stroke: rgba(189,189,189, 0.32); stroke-width: 1; }
.gedge.is-dim { opacity: 0.12; }
.gnode { cursor: pointer; }
.gnode .node-hit { fill: transparent; }
.gnode .node-shape {
  transition: opacity 160ms ease, stroke 160ms ease, filter 160ms ease;
  stroke-width: 1;
}
.gnode .node-label {
  fill: #d9e2dc;
  font-family: var(--font);
  font-size: 9px;
  font-weight: 500;
  pointer-events: none;
  letter-spacing: 0.01em;
}
.gnode .node-sublabel {
  fill: #75827a;
  font-family: var(--font);
  font-size: 7.5px;
  pointer-events: none;
}
.gnode .node-task-label {
  fill: #a2a2a2;
  font-family: var(--font);
  font-size: 7px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease;
}
.gnode:hover .node-shape { filter: brightness(1.22); }
.gnode.is-selected .node-shape { stroke-width: 1.6; filter: drop-shadow(0 0 7px rgba(123,227,168, 0.35)); }
.gnode.is-related .node-shape { stroke-width: 1.3; }
.gnode.is-dim { opacity: 0.22; }
.gnode.is-dim .node-label { opacity: 0.5; }
.gnode.show-task-label .node-task-label { opacity: 1; }
.gnode-project .node-shape { fill: #121a15; }
.gnode-person .node-shape { fill: #121a15; }
.gnode-task .node-shape { stroke: rgba(233,186,124, 0.32); }
.gnode-knowledge .node-shape { fill: #15131c; }
.gnode-knowledge .node-label { font-size: 8px; fill: #c3b2e8; opacity: 0; transition: opacity 140ms ease; }
.gnode-knowledge .node-sublabel { opacity: 0; transition: opacity 140ms ease; }
.gnode-knowledge:hover .node-label, .gnode-knowledge:hover .node-sublabel,
.gnode-knowledge.is-selected .node-label, .gnode-knowledge.is-selected .node-sublabel,
.gnode-knowledge.is-related .node-label { opacity: 1; }
.gnode-person .node-label { fill: #bcd4f2; font-size: 8.5px; font-weight: 600; }
.gnode-person .node-sublabel { fill: #8493a6; }
.gnode-project .node-label { fill: #edf3ef; font-size: 10px; font-weight: 550; }
.gnode-project .node-sublabel { fill: #7b8b80; font-size: 7px; letter-spacing: 0.04em; }
.gnode-task .node-label { fill: #e9ba7c; font-size: 7px; }
.gnode .selection-halo {
  fill: none;
  stroke: rgba(123,227,168, 0.28);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0;
}
.gnode.is-selected .selection-halo { opacity: 1; }

.map-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; color: var(--faint); font-size: 11px; z-index: 5;
}
.map-empty .ic { color: var(--muted); }

@media (max-width: 960px) {
  .map-page { height: calc(100vh - 61px); }
  .map-strip { flex-basis: 40px; height: 40px; padding: 0 14px; }
  .map-shell { height: auto; min-height: 0; }
  .map-panel { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; max-height: 46%; }
  .map-legend { display: none; }
  .map-hint { bottom: 12px; left: 14px; transform: none; }
  .map-controls { bottom: 12px; right: 12px; flex-direction: row; }
}
@media (max-width: 700px) {
  .map-page { height: calc(100dvh - 61px); }
  .map-shell { height: auto; min-height: 0; border-radius: 0; }
  .map-toolbar { top: 9px; left: 9px; right: 9px; gap: 6px; }
  .map-toolbar-group { border-radius: 9px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .map-toolbar .filter-chip { font-size: 8.5px; height: 24px; padding: 0 6px; }
  .map-focus { height: 27px; font-size: 8.5px; max-width: 130px; }
  .map-hint { display: none; }
  .map-controls button { width: 25px; height: 25px; }
  .map-panel { max-height: 52%; padding: 13px; }
  .map-panel-title { font-size: 14px; }
}
@media (max-width: 430px) {
  .map-toolbar .filter-chip[data-node-filter="knowledge"] { display: none; }
  .map-strip-meta { display: none; }
}
