/* ============================================================
   16-help.css — In-app documentation
   ------------------------------------------------------------
   Shared engine styling (js/help.js's TOC/search/print, rendered
   into three different hosts) plus the floating help icon + overlay
   used by guests and no-org signed-in visitors. All three hosts are
   dark surfaces already (Admin Board, client portal, marketing site),
   so one look works everywhere; only the accent color is retargeted
   per host below.
   ============================================================ */

.dts-help {
  --dts-help-accent: var(--gold, #c49a2a);
  --dts-help-line: rgba(255, 255, 255, .14);
  --dts-help-dim: rgba(255, 255, 255, .62);
}
.adm-pane .dts-help { --dts-help-accent: var(--adm-gold); }

.dts-help-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px; flex-wrap: wrap;
}
.dts-help-search {
  flex: 1 1 220px; min-width: 160px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--dts-help-line);
  border-radius: 999px;
  padding: 9px 16px;
  color: inherit; font: inherit; font-size: 13.5px;
}
.dts-help-search:focus { outline: none; border-color: var(--dts-help-accent); }
.dts-help-print {
  appearance: none; cursor: pointer; flex: none;
  background: transparent; color: var(--dts-help-accent);
  border: 1px solid var(--dts-help-accent);
  border-radius: 999px; padding: 8px 16px;
  font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  transition: background .15s, color .15s;
}
.dts-help-print:hover { background: var(--dts-help-accent); color: #1a1408; }

.dts-help-body {
  display: grid;
  grid-template-columns: minmax(150px, 200px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.dts-help-toc {
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0;
}
.dts-help-toclink {
  display: block; text-align: left; text-decoration: none;
  appearance: none; cursor: pointer; background: none; border: 0;
  color: var(--dts-help-dim); font: inherit; font-size: 13px;
  padding: 7px 10px; border-radius: 7px; line-height: 1.3;
}
.dts-help-toclink:hover { background: rgba(255, 255, 255, .06); color: inherit; }
.dts-help-toclink.is-active {
  background: rgba(255, 255, 255, .08); color: var(--dts-help-accent); font-weight: 700;
}
.dts-help-toclink[hidden] { display: none; }

.dts-help-panes { min-width: 0; }
.dts-help-pane[hidden] { display: none; }
.dts-help-panetitle {
  margin: 0 0 8px; font-size: 17px; font-weight: 700; color: var(--dts-help-accent);
}
.dts-help-panebody { font-size: 14px; line-height: 1.6; color: inherit; }
.dts-help-panebody p { margin: 0 0 12px; }
.dts-help-panebody strong { color: inherit; }
.dts-help-panebody code {
  background: rgba(255, 255, 255, .09); border-radius: 4px;
  padding: 1px 6px; font-size: .92em;
}
.dts-help-panebody h4 {
  margin: 20px 0 8px; font-size: 13px; font-weight: 700;
  color: var(--dts-help-accent); letter-spacing: .03em; text-transform: uppercase;
}
.dts-help-panebody h4:first-child { margin-top: 0; }
.dts-help-panebody ol {
  margin: 0 0 14px; padding-left: 22px;
}
.dts-help-panebody ol li { margin: 0 0 8px; padding-left: 2px; }
.dts-help-panebody ol li::marker {
  color: var(--dts-help-accent); font-weight: 700;
}
.dts-help-panebody ul { margin: 0 0 14px; padding-left: 20px; }
.dts-help-panebody ul li { margin: 0 0 6px; }
.dts-help-panebody .help-note {
  margin: 0 0 14px; padding: 10px 12px;
  background: rgba(255, 255, 255, .05);
  border-left: 3px solid var(--dts-help-accent);
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
}
.dts-help-panebody .help-note strong:first-child { color: var(--dts-help-accent); }

.help-diagram {
  margin: 4px 0 16px; padding: 8px;
  border: 1px solid var(--dts-help-line); border-radius: 10px;
  overflow-x: auto; color: var(--dts-help-dim);
}
.help-diagram svg { display: block; width: 100%; height: auto; min-width: 480px; }

@media (max-width: 640px) {
  .dts-help-body { grid-template-columns: 1fr; }
  .dts-help-toc {
    position: static; flex-direction: row; flex-wrap: wrap; gap: 6px;
    padding-bottom: 10px; border-bottom: 1px solid var(--dts-help-line); margin-bottom: 12px;
  }
  .dts-help-toclink { padding: 6px 10px; }
}

/* ============================================================
   FLOATING HELP ICON — guests + no-org signed-in visitors.
   Fixed left, cleared above the dockbar so it can never sit under the
   question bar; opposite the bottom-right .cookie card so neither can
   ever overlap the other.
   --dockbar-real-h is js/help.js's own live measurement of #dockbar's
   actual rendered height (a ResizeObserver, kept current across resize/
   orientation change/content changes) -- --dock-h alone is just the grid
   row's nominal single-row height and badly undershoots on phone, where
   css/08-responsive.css stacks three rows (dock-tabs, sector-pager,
   question bar) inside that same footer. --dock-h stays as the fallback
   for the brief window before JS has run its first measurement.
   ============================================================ */
.dts-help-fab {
  position: fixed; left: 14px; bottom: calc(var(--dockbar-real-h, var(--dock-h, 64px)) + 14px);
  z-index: 25;
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  appearance: none; cursor: pointer;
  background: rgba(10, 14, 24, .58);
  border: 1px solid rgba(255, 255, 255, .18);
  color: var(--gold-bright, #e3b855);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.dts-help-fab:hover { transform: translateY(-2px); border-color: var(--gold-bright, #e3b855); }
.dts-help-fab svg { width: 20px; height: 20px; }
body.twin-active .dts-help-fab,
body.portal-open .dts-help-fab,
body.adm-lock .dts-help-fab { display: none; }

.dts-help-fab-tip {
  position: absolute; left: calc(100% + 10px); bottom: 6px;
  white-space: nowrap;
  background: rgba(10, 14, 24, .92); color: #fff;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px; padding: 6px 10px; font-size: 12px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.dts-help-fab.has-hint::after {
  content: ""; position: absolute; top: -2px; right: -2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--gold-bright, #e3b855);
  box-shadow: 0 0 0 rgba(227, 184, 85, .6);
  animation: dtsHelpPulse 1.8s ease-in-out infinite;
}
.dts-help-fab.has-hint .dts-help-fab-tip { opacity: 1; }
@keyframes dtsHelpPulse {
  0%   { box-shadow: 0 0 0 0 rgba(227, 184, 85, .55); }
  70%  { box-shadow: 0 0 0 9px rgba(227, 184, 85, 0); }
  100% { box-shadow: 0 0 0 0 rgba(227, 184, 85, 0); }
}

.dts-help-overlay {
  position: fixed; inset: 0; z-index: 150;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 12, .66);
  opacity: 0; visibility: hidden;
  transition: opacity .22s ease;
}
.dts-help-overlay.is-open { opacity: 1; visibility: visible; }
.dts-help-overlay-window {
  position: relative;
  width: min(880px, 96vw); max-height: 88vh; overflow-y: auto;
  background: #12141c; color: #fff;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  padding: clamp(20px, 3vw, 34px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .45);
}
.dts-help-overlay-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  appearance: none; cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
}
.dts-help-overlay-close:hover { border-color: var(--gold-bright, #e3b855); }
.dts-help-overlay-title {
  margin: 0 40px 16px 0; font-size: 20px; font-weight: 700;
}

@media (max-width: 640px) {
  .dts-help-fab { left: 10px; bottom: calc(var(--dockbar-real-h, var(--dock-h, 110px)) + 10px); }
  .dts-help-overlay-window { padding: 18px; max-height: 92vh; }
}

/* ============================================================
   PRINT / SAVE AS PDF — a real, anchor-linked TOC (js/help.js's
   TOC items are <a href="#dts-help-...">, kept as real links here)
   followed by every topic in one flowing document, regardless of
   which of the three hosts is currently mounted.
   ============================================================ */
@media print {
  body * { visibility: hidden; }
  .dts-help, .dts-help * { visibility: visible; }
  .dts-help {
    position: absolute; left: 0; top: 0; width: 100%;
    color: #000; background: #fff;
  }
  .dts-help-search, .dts-help-print { display: none !important; }
  .dts-help-body { display: block; }
  .dts-help-toc {
    display: block; margin-bottom: 28px; page-break-after: always;
    position: static;
  }
  .dts-help-toclink {
    display: block; color: #000; text-decoration: underline; padding: 3px 0;
  }
  .dts-help-toclink[hidden] { display: block !important; }
  .dts-help-pane[hidden] { display: block !important; }
  .dts-help-pane { page-break-inside: avoid; margin-bottom: 26px; }
  .dts-help-panetitle { color: #000; }
  .help-diagram { color: #000; border-color: #999; }
}
