/* help.css — Author's Guide panel styles */

/* ── Overlay & panel ─────────────────────────────────────────────────── */

#help-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 510;
  background: rgba(0, 0, 0, 0.55);
}

#help-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 511;
  background: var(--bg);
  flex-direction: column;
  overflow: hidden;
}

#help-panel.open,
#help-overlay.open {
  display: flex;
}

/* ── Header ──────────────────────────────────────────────────────────── */

.help-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.help-header h2 {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  flex-shrink: 0;
}

#help-search {
  flex: 1;
  min-width: 160px;
  max-width: 360px;
  padding: 0.4rem 0.75rem;
  font-size: 0.88rem;
  font-family: var(--font-ui);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
}

#help-search:focus {
  border-color: var(--accent);
}

#help-search::placeholder {
  color: var(--muted);
}

#help-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius);
  line-height: 1;
  flex-shrink: 0;
  margin-left: auto;
}

#help-close-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* ── Body layout ─────────────────────────────────────────────────────── */

.help-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── TOC sidebar ─────────────────────────────────────────────────────── */

.help-toc {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem 0;
  background: var(--surface);
}

.help-toc-heading {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.6rem 1rem 0.25rem;
  font-family: var(--font-ui);
}

.help-toc a {
  display: block;
  padding: 0.3rem 1rem;
  font-size: 0.82rem;
  font-family: var(--font-ui);
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  line-height: 1.4;
}

.help-toc a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.help-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* When a TOC group has no visible links during search, hide the heading */
.help-toc-group.hidden {
  display: none;
}

/* ── Content area ────────────────────────────────────────────────────── */

.help-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  max-width: 860px;
}

/* ── Sections ────────────────────────────────────────────────────────── */

.help-section {
  margin-bottom: 3.5rem;
  scroll-margin-top: 1rem;
}

.help-section.hidden {
  display: none;
}

.help-section h2 {
  font-family: var(--font-ui);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.help-section h3 {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 1.4rem 0 0.4rem;
}

.help-section p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 0.75rem;
  font-family: var(--font-ui);
}

.help-section ul,
.help-section ol {
  margin: 0 0 0.75rem 1.2rem;
  padding: 0;
}

.help-section li {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 0.3rem;
  font-family: var(--font-ui);
}

/* ── Tip boxes ───────────────────────────────────────────────────────── */

.help-tip {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.65rem 0.9rem;
  margin: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.6;
}

.help-tip strong {
  color: var(--accent);
  font-weight: 700;
}

/* ── Keyboard shortcut table ─────────────────────────────────────────── */

.help-kbd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  font-family: var(--font-ui);
  margin: 0.5rem 0 1rem;
}

.help-kbd-table th {
  text-align: left;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.help-kbd-table td {
  padding: 0.45rem 0.75rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.help-kbd-table tr:last-child td {
  border-bottom: none;
}

.help-kbd-table tr:hover td {
  background: var(--surface);
}

kbd {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.45em;
  font-size: 0.8em;
  font-family: var(--font-mono);
  color: var(--text);
  white-space: nowrap;
}

/* ── Search: highlight matched text ─────────────────────────────────── */

.help-highlight {
  background: rgba(255, 200, 0, 0.35);
  color: inherit;
  border-radius: 2px;
}

/* ── No results notice ───────────────────────────────────────────────── */

#help-no-results {
  display: none;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-family: var(--font-ui);
}

/* ── Index ───────────────────────────────────────────────────────────── */

.help-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.3rem 1rem;
  margin-top: 0.5rem;
}

.help-index-grid a {
  font-size: 0.84rem;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-ui);
  padding: 0.1rem 0;
}

.help-index-grid a:hover {
  text-decoration: underline;
}

/* ── Mobile ──────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .help-toc {
    display: none;
  }

  .help-content {
    padding: 1.25rem 1rem;
  }

  .help-header {
    gap: 0.5rem;
  }

  #help-search {
    max-width: none;
    flex: 1 1 100%;
    order: 3;
  }
}
