/* help.css — collapsible, context-sensitive help panel (see help.js).
   The same file is used in every Elko app; app-specific placement rules go at the end.
   Uses the dashboard's --elko-* theme tokens, so light / dark / high-contrast follow automatically. */

:root {
  --elko-help-w: 380px; --elko-help-edge: 26px;
  --h-bg: #e6f0fb; --h-text: #0b1b2e; --h-head: #062a57; --h-link: #073a75; --h-border: #4a6a94;
  --h-code-bg: #d3e3f6; --h-tab-bg: #d3e3f6; --h-tab-sel-bg: #ffffff; --h-tab-sel-text: #062a57;
  --h-hot-bg: #ffb000; --h-hot-text: #1b1100; --h-green: #0a5c20; --h-green-text: #ffffff;
  --h-flash: #fff0a0; --h-flash-edge: #0a4a94; --h-note: #33475f;
}

.elko-help {
  position: relative;
  flex-shrink: 0;
  display: flex;
  width: var(--elko-help-edge);
  border-left: 2px solid var(--h-border);
  background: var(--h-bg);
  color: var(--h-text);
  min-height: 0;
}
html[data-help="open"] .elko-help { width: var(--elko-help-w); }

/* Edge tab: a full-height strip; the only part showing when collapsed. */
.elko-help-edge {
  flex: 0 0 var(--elko-help-edge);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border: 0;
  border-right: 1px solid var(--h-border);
  background: var(--h-green);
  color: var(--h-green-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.elko-help-edge:hover { filter: brightness(1.15); }
.elko-help-edge:focus-visible { outline: 3px solid var(--h-hot-bg); outline-offset: -3px; }
.elko-help-edge-label { writing-mode: vertical-rl; letter-spacing: .08em; }
html[data-help="open"] .elko-help-edge-label { display: none; }

.elko-help-resize {
  position: absolute;
  left: -3px; top: 0; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 2;
  touch-action: none;
}
html:not([data-help="open"]) .elko-help-resize { display: none; }
.elko-help-resize:hover, .elko-help-resize:focus-visible, .elko-help--dragging .elko-help-resize {
  background: var(--h-green);
  outline: none;
}
.elko-help--dragging { user-select: none; }

.elko-help-inner {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.elko-help-inner[hidden] { display: none; } /* display:flex above would otherwise override [hidden] */

.elko-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 0 10px;
  border-bottom: 1px solid var(--h-border);
}
.elko-help-tabs { display: flex; gap: 2px; }
.elko-help-tab {
  border: 0;
  border: 1px solid var(--h-border);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: var(--h-tab-bg);
  color: var(--h-text);
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
}
.elko-help-tab[aria-selected="true"] {
  background: var(--h-tab-sel-bg);
  color: var(--h-tab-sel-text);
  box-shadow: inset 0 3px 0 var(--h-hot-bg);
  font-weight: 700;
}
.elko-help-tab:focus-visible { outline: 3px solid var(--h-head); outline-offset: 1px; }
.elko-help-close {
  border: 0;
  background: none;
  color: var(--h-head);
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}
.elko-help-close:hover { color: #000; }

.elko-help-panes { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.elko-help-pane { padding: 12px 16px 24px; font-size: 13px; line-height: 1.55; }
.elko-help-pane:focus { outline: none; }

.elko-help-toc ul { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.elko-help-toc a {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--h-tab-bg);
  color: var(--h-head);
  border: 1px solid var(--h-border);
  text-decoration: none;
  font-size: 12px;
}
.elko-help-toc a:hover { background: var(--h-hot-bg); color: var(--h-hot-text); }

.elko-help-section {
  margin: 0 -8px 6px;
  padding: 4px 8px 2px;
  border-radius: 6px;
  scroll-margin-top: 8px;
  transition: background-color .3s;
}
.elko-help-section:focus { outline: none; }
.elko-help-flash { background: var(--h-flash); box-shadow: inset 4px 0 0 var(--h-flash-edge); }
.elko-help-section h3, .elko-help-ctx h3 { font-size: 14px; margin: 10px 0 6px; color: var(--h-head); }
.elko-help-pane h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin: 16px 0 6px; color: var(--h-head); }
.elko-help-pane p, .elko-help-pane ul { margin: 0 0 8px; }
.elko-help-pane ul { padding-left: 18px; }
.elko-help-pane code, .elko-help-pane kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--h-code-bg);
  color: var(--h-text);
  border-radius: 3px;
  padding: 0 4px;
}
.elko-help-pane kbd { border: 1px solid var(--h-border); }
.elko-help-pane pre { background: var(--h-code-bg); border-radius: 4px; padding: 8px; overflow-x: auto; margin: 0 0 8px; }
.elko-help-pane pre code { background: none; padding: 0; }
.elko-help-pane a { color: var(--h-link); font-weight: 600; }
.elko-help-note { color: var(--h-note); font-size: 12px; }
.elko-help-q { display: inline-block; width: 16px; height: 16px; border-radius: 50%; text-align: center; line-height: 16px; font-size: 11px; font-weight: 700; background: var(--h-green); color: var(--h-green-text); }

/* "This tool" tab */
.elko-help-ctx-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.elko-help-ctx-meta { color: var(--h-note); font-size: 12px; margin-top: -4px; }
.elko-help-params { margin: 0; }
.elko-help-params dt { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.elko-help-params dd { margin: 2px 0 0 0; }
.elko-help-type { font-size: 11px; color: var(--h-note); }
.elko-help-req { font-size: 10px; font-weight: 700; text-transform: uppercase; color: #8f1307; }
.elko-help-keys { list-style: none; padding-left: 0 !important; }
.elko-help-ok  { color: #0a5c20; font-weight: 600; }
.elko-help-bad { color: #8f1307; font-weight: 600; }

/* "?" help badges placed around the dashboard (v0.6.4: bright green, made to stand out).
   Fill #15803d with white bold "?" = 5.02:1 (WCAG AA); the rim and glow carry the brightness.
   Defaults suit a dark page; apps remap the tokens for a light theme (see regime-help.css). */
:root {
  --elko-help-badge-bg: #15803d;          /* white text 5.02:1 */
  --elko-help-badge-text: #ffffff;
  --elko-help-badge-ring: #4ade80;        /* 9.9:1 against a dark panel */
  --elko-help-badge-glow: rgba(34, 197, 94, 0.55);
  --elko-help-badge-ring-hot: #bbf7d0;    /* hover / focus */
  --elko-help-badge-glow-hot: rgba(74, 222, 128, 0.85);
}
.elko-help-btn {
  flex-shrink: 0;
  box-sizing: border-box;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--elko-help-badge-ring);
  background: var(--elko-help-badge-bg);
  color: var(--elko-help-badge-text);
  font: 800 12px/16px system-ui, sans-serif;
  text-align: center;
  padding: 0;
  cursor: pointer;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 8px 1px var(--elko-help-badge-glow);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.elko-help-btn:hover, .elko-help-btn:focus-visible {
  background: var(--elko-help-badge-bg);
  color: var(--elko-help-badge-text);
  border-color: var(--elko-help-badge-ring-hot);
  box-shadow: 0 0 0 2px var(--elko-help-badge-ring-hot), 0 0 14px 4px var(--elko-help-badge-glow-hot);
  transform: scale(1.15);
  outline: none;
}
@media (prefers-reduced-motion: reduce) { .elko-help-btn { transition: none; } .elko-help-btn:hover, .elko-help-btn:focus-visible { transform: none; } }
@media print { .elko-help-btn { display: none !important; } }

.elko-help-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.elko-help-link {
  border: 0; background: none; padding: 0;
  color: var(--elko-accent, #7c6af7);
  font: inherit; font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}
.elko-help-toggle {
  border: 1px solid var(--elko-border, #e1e4e8);
  background: none;
  color: var(--elko-accent, #7c6af7);
  font: inherit; font-size: 11px;
  border-radius: 3px;
  padding: 0 6px;
  cursor: pointer;
}
.elko-help-toggle[aria-expanded="true"] { background: var(--h-green); color: var(--h-green-text); border-color: var(--h-green); }

/* Narrow screens: the open panel overlays the dashboard as a drawer. */
.elko-help-scrim { display: none; }
@media (max-width: 900px) {
  html[data-help="open"] .elko-help {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(92vw, var(--elko-help-w));
    z-index: 50;
    box-shadow: -8px 0 24px rgba(0,0,0,.25);
  }
  html[data-help="open"] .elko-help-scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 49;
  }
}

@media (prefers-reduced-motion: reduce) { .elko-help-section { transition: none; } }

/* API-key notes in the guide and "This tool" tab */
.elko-help-callout { background: #fff0a0; color: #171100; border-left: 4px solid #8f1307; border-radius: 4px; padding: 8px 10px; margin: 4px 0 10px; }
.elko-help-key-actions { display: flex; gap: 12px; align-items: center; margin-top: 2px; }
.elko-help-keys li { margin-bottom: 8px; }
.elko-help-table { width: 100%; border-collapse: collapse; margin: 0 0 10px; font-size: 12px; table-layout: fixed; overflow-wrap: anywhere; }
.elko-help-table th, .elko-help-table td { text-align: left; vertical-align: top; padding: 4px 6px; border-bottom: 1px solid var(--h-border); }
.elko-help-table th { color: var(--h-head); }
.elko-help-table th:nth-child(1) { width: 19%; }
.elko-help-table th:nth-child(2) { width: 39%; }
.elko-help-table td:nth-child(2) code { font-size: 10px; overflow-wrap: normal; word-break: keep-all; white-space: nowrap; }

/* layout: 'fixed' — panel pinned to the right edge, page body padded to make room. */
.elko-help--fixed { position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; }
html.elko-help-fixed body { padding-right: var(--elko-help-edge); }
@media (min-width: 901px) { html.elko-help-fixed[data-help="open"] body { padding-right: var(--elko-help-w); } }
