/* ==========================================================================
   Quaderno — mappe concettuali (js/nb/mappa.js)
   ========================================================================== */
.mm-host { position: relative; flex: 1; display: flex; min-width: 0; min-height: 0; }
.mm-stage {
  position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; overflow: clip; outline: none;
  background-color: var(--app);
  background-image: radial-gradient(circle, var(--ink-4) 1px, transparent 1.4px);
  touch-action: none; cursor: default;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.mm-stage.mm-grab { cursor: grabbing; }
.mm-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: hidden; color: var(--ink); }
.mm-svg text { pointer-events: none; }

/* nodi */
.mm-node { cursor: pointer; }
.mm-dragging .mm-node.sel { cursor: grabbing; }
.mm-dragging .mm-node.sel .mm-in { filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.22)); }
.mm-in { transform-box: fill-box; transform-origin: center; }
.mm-pop .mm-in { animation: mmPop 0.34s var(--ease) both; }
@keyframes mmPop { from { opacity: 0; transform: scale(0.55); } }
.mm-linking .mm-node { cursor: copy; }
.mm-dash { animation: mmDash 0.9s linear infinite; }
@keyframes mmDash { to { stroke-dashoffset: -22; } }

/* collegamenti */
.mm-edge { cursor: pointer; }
.mm-ehit { pointer-events: stroke; }

/* "+" ai lati del nodo selezionato */
.mm-ui { position: absolute; inset: 0; pointer-events: none; transition: opacity 0.12s; }
.mm-ui.mm-hide { opacity: 0; }
.mm-ui.mm-hide > * { pointer-events: none !important; }
.mm-plus {
  position: absolute; left: 0; top: 0; margin: -15px 0 0 -15px; width: 30px; height: 30px; padding: 0; touch-action: none;
  display: grid; place-items: center; pointer-events: auto; cursor: pointer;
  border: 1px solid var(--stroke-2); border-radius: 50%;
  background: var(--raised); color: var(--ink-2);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
  animation: mmIn 0.22s var(--ease) both;
  transition: background 0.15s, color 0.15s;
}
.mm-ui.mm-plusdrag .mm-bar, .mm-ui.mm-plusdrag .mm-plus { opacity: 0.25; transition: opacity 0.15s; }
.mm-ghost { pointer-events: none; }
.mm-plus::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; } /* bersaglio più grande per il dito */
.mm-plus svg { width: 16px; height: 16px; }
.mm-plus:hover { background: var(--solid); color: var(--on-solid); }
.mm-plus:active { background: var(--solid); color: var(--on-solid); }
@keyframes mmIn { from { opacity: 0; scale: 0.6; } }

/* barra del nodo / del collegamento */
.mm-bar {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px; max-width: calc(100% - 16px);
  padding: 4px; border-radius: 14px;
  background: var(--raised); border: 1px solid var(--stroke-2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  animation: pop 0.18s var(--ease) both;
}
.mm-sws { display: flex; align-items: center; padding: 0 2px; }
.mm-sw {
  width: 26px; height: 26px; margin: 5px 3px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s var(--ease), box-shadow 0.15s;
}
.mm-sw:active { transform: scale(0.88); }
.mm-sw.active { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--ink-2); }
.mm-sep { width: 1px; align-self: stretch; margin: 6px 3px; background: var(--stroke-2); }
.mm-b {
  min-width: 38px; height: 38px; padding: 0 7px; gap: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: 14px; white-space: nowrap;
  transition: background 0.15s, color 0.15s, transform 0.15s var(--ease);
}
.mm-b svg { width: 21px; height: 21px; flex: none; }
.mm-b:hover { background: var(--fill-2); color: var(--ink); }
.mm-b:active { transform: scale(0.92); }
.mm-b.active { background: var(--fill-3); color: var(--ink); }
.mm-b.danger:hover { color: var(--ko); background: var(--ko-fill); }

/* testo in modifica */
.mm-edit {
  position: absolute; z-index: 2; margin: 0; padding: 0; border: 0; outline: none; resize: none; overflow: hidden;
  background: transparent; color: var(--ink); caret-color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  text-align: center; white-space: pre-wrap; overflow-wrap: anywhere;
  -webkit-user-select: text; user-select: text; touch-action: manipulation;
}
.mm-edit::placeholder { color: var(--ink-3); }

/* "Collega a…" */
.mm-banner {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 999px;
  background: var(--solid); color: var(--on-solid); font-size: 14px; white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); animation: rise 0.2s var(--ease) both;
}
.mm-banner[hidden] { display: none; }
.mm-banner-x { border: 0; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13.5px; cursor: pointer; background: rgba(127, 127, 127, 0.25); color: inherit; }

/* barra degli strumenti (si appoggia a .ink-tools / .ink-btn di notebook.css) */
.mm-tl span { font-size: 14px; white-space: nowrap; }
@media (max-width: 700px) { .mm-tl span { display: none; } }

/* anteprima (NB.mapSVG) */
.mm-out { display: block; width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) {
  .mm-pop .mm-in, .mm-plus, .mm-bar, .mm-dash, .mm-banner { animation: none; }
}
