/* =========================================================================
   Shared Help modal styling (paired with /scripts/helpModal.js).
   Self-contained: relies only on the GRAIPH design tokens in /graiph-tokens.css
   (loaded by every interface), so it themes light/dark automatically.
   Ported from the Field Describer help (public/field/styles/overlays.css),
   rebranded from .fd-* to neutral .help-* classes for cross-interface reuse.
   ========================================================================= */

/* ── Dialog chrome ─────────────────────────────────────────────────────── */
.help-modal {
  /* Center explicitly (fixed + inset + margin:auto) so a global `dialog`
     reset in styles.css can't pin us to the corner. */
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(600px, calc(100vw - 32px));
  max-height: min(82vh, 760px);
  padding: 0;
  border: var(--graiph-border-default);
  border-radius: var(--graiph-radius-lg, 8px);
  background: var(--graiph-bg-secondary);
  color: var(--graiph-text-primary);
  box-shadow: var(--graiph-shadow-lg);
  overflow: hidden;
  /* native <dialog> lays out as a flex column so the body scrolls, header pins */
  flex-direction: column;
}
.help-modal[open] { display: flex; }
.help-modal::backdrop { background: var(--graiph-overlay, rgba(20, 20, 24, 0.9)); }

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: var(--graiph-border-default);
  background: var(--graiph-bg-tertiary);
  flex: 0 0 auto;
}
.help-modal-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font: 700 15px/1.2 var(--graiph-font);
  color: var(--graiph-text-primary);
}
.help-modal-title svg { width: 18px; height: 18px; color: var(--graiph-accent-text); }
.help-modal-close { flex: 0 0 auto; }

.help-modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* ── Text + lists ──────────────────────────────────────────────────────── */
.help-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--graiph-text-secondary);
  margin: 0 0 14px;
}
.help-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--graiph-text-secondary);
}
.help-list li { margin: 3px 0; }
.help-list b { color: var(--graiph-text-primary); font-weight: 700; }
.help-muted {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--graiph-text-muted);
}

/* ── Collapsible sections (accordion) ──────────────────────────────────── */
.help-details {
  margin: 0 0 10px;
  border: var(--graiph-border-default);
  border-radius: var(--graiph-radius-md, 6px);
  overflow: hidden;
}
.help-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  list-style: none;
  padding: 11px 13px;
  background: var(--graiph-bg-tertiary);
  font: 700 12px/1.2 var(--graiph-font);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--graiph-text-primary);
  transition: background 0.12s ease;
}
.help-summary:hover { background: var(--graiph-bg-hover); }
.help-summary::-webkit-details-marker { display: none; }
.help-summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  opacity: 0.5;
}
.help-details[open] > .help-summary { border-bottom: var(--graiph-border-default); }
.help-details[open] > .help-summary::after { transform: rotate(45deg); }
.help-details-body { padding: 12px 13px 4px; }
.help-details-body > .help-list { margin-bottom: 8px; }

/* ── Two-column cards ──────────────────────────────────────────────────── */
.help-cols { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.help-card {
  flex: 1 1 190px;
  min-width: 0;
  padding: 10px 12px;
  border: var(--graiph-border-default);
  border-radius: var(--graiph-radius-sm, 4px);
  background: var(--graiph-bg-tertiary);
}
.help-card h6 {
  margin: 0 0 9px;
  font: 700 10.5px/1.2 var(--graiph-font);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--graiph-text-secondary);
}
.help-card .help-list { padding-left: 16px; }

/* ── Inline icon badge — mirrors real header / toolbar buttons ─────────── */
.help-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 5px;
  background: var(--graiph-bg-elevated);
  border: var(--graiph-border-default);
  color: var(--graiph-text-primary);
  vertical-align: -5px;
}
.help-ic svg { width: 12px; height: 12px; }
.help-summary .help-ic { vertical-align: 0; }

/* ── Keyboard shortcut list ────────────────────────────────────────────── */
.help-kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  font: 600 11px/1.5 var(--graiph-font);
  text-align: center;
  color: var(--graiph-text-primary);
  background: var(--graiph-bg-tertiary);
  border: var(--graiph-border-default);
  border-bottom-width: 2px;
  border-radius: 5px;
}
.help-kbdlist { list-style: none; margin: 0; padding: 0; }
.help-kbdlist li {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--graiph-text-secondary);
}
.help-kbd-plus { color: var(--graiph-text-muted); font-size: 11px; }
.help-kbd-desc { margin-left: 8px; flex: 1 1 auto; }
.help-kbd-desc b { color: var(--graiph-text-primary); }
