/* Zen Reader help site (ZR-956). Layered on top of styles.css — this file adds only
   what the help pages need (the sidebar layout, article typography, the gate overlay)
   and reuses the site's palette, fonts and header/footer wholesale. */

.help-main { padding: 40px 0 72px; }

.help-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ---------- Sidebar ---------- */
.help-sidebar {
  position: sticky;
  top: 96px;                 /* clears the 72px sticky site header */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  font-size: .95rem;
  padding-right: 8px;
}
.help-sidebar-home {
  display: block; font-weight: 800; color: var(--water);
  padding-bottom: 12px; margin-bottom: 6px;
  border-bottom: 1px solid rgba(44, 94, 126, .14);
}
.help-sidebar h4 {
  margin: 20px 0 6px; color: var(--stone);
  font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.help-sidebar ul { list-style: none; margin: 0; padding: 0; }
.help-sidebar li { margin: 0 0 2px; }
.help-sidebar li a {
  display: block; padding: 5px 10px; border-radius: 8px;
  color: var(--ink); font-weight: 600; line-height: 1.35;
}
.help-sidebar li a:hover { background: var(--water-softer); text-decoration: none; }
.help-sidebar li a.on { background: var(--water); color: var(--white); }

/* ---------- Article ---------- */
.help-article { max-width: 68ch; }
.help-article h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: .3em; }
.help-article h2 {
  font-size: 1.5rem; margin: 1.9em 0 .5em;
  padding-top: .5em; border-top: 1px solid rgba(44, 94, 126, .12);
}
.help-article h2:first-of-type { border-top: 0; padding-top: 0; }
.help-article h3 { font-size: 1.12rem; margin: 1.5em 0 .4em; }
.help-article ul, .help-article ol { margin: 0 0 1.1em; padding-left: 1.3em; }
.help-article li { margin-bottom: .45em; }
.help-article code {
  background: var(--sand); border-radius: 5px; padding: .1em .38em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em;
}
.help-summary { font-size: 1.1rem; font-weight: 600; color: #4a565f; margin-bottom: 1.6em; }

kbd {
  display: inline-block; background: var(--white); color: var(--water);
  border: 1px solid rgba(44, 94, 126, .3); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 7px; font-family: inherit; font-size: .85em; font-weight: 800;
}

.help-note {
  background: var(--paper2); border-left: 4px solid var(--water);
  border-radius: var(--radius-sm); padding: 14px 18px; margin: 1.4em 0;
}
.help-note p { margin: 0; }
.help-stub { background: rgba(226,168,78,.14); border-left-color: var(--gold); }

.help-foot {
  margin-top: 3em; padding-top: 1.2em;
  border-top: 1px solid rgba(44, 94, 126, .14);
  color: var(--stone); font-size: .95rem;
}
.help-foot p { margin: 0; }

/* ---------- Index ---------- */
.help-section { margin-top: 40px; }
.help-section h2 { font-size: 1.45rem; margin-bottom: .6em; }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.help-card {
  display: block; background: var(--white); border: 1px solid rgba(44, 94, 126, .12);
  border-radius: var(--radius-sm); padding: 16px 18px; box-shadow: var(--shadow-sm);
  transition: transform .14s ease, box-shadow .14s ease;
}
.help-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.help-card strong { display: block; color: var(--water); margin-bottom: 3px; }
.help-card span { display: block; color: var(--stone); font-size: .92rem; font-weight: 600; line-height: 1.45; }

.help-search-label {
  display: block; font-weight: 800; color: var(--water); margin: 26px 0 8px;
}
.help-search {
  width: 100%; max-width: 520px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 15px; font: inherit;
}
.help-results { margin-top: 20px; }
.help-results .help-cards { margin-top: 10px; }
.help-results-none { color: var(--stone); font-weight: 600; }

/* ---------- The sign-in gate ----------
   Fail CLOSED: a gated page hides its article in CSS from the very first paint, and
   only zr-help.js reveals it. If the script is blocked or throws, the reader sees the
   gate rather than the content — which is the correct way round for a gate, and means
   there is never a flash of the article before the check completes. */
.help-gated .help-article,
.help-gated #helpIndexBody,
.help-gated .help-search,
.help-gated .help-search-label,
.help-gated .help-sidebar { visibility: hidden; }
.help-ready .help-article,
.help-ready #helpIndexBody,
.help-ready .help-search,
.help-ready .help-search-label,
.help-ready .help-sidebar { visibility: visible; }

.help-gate[hidden] { display: none; }
.help-gate {
  max-width: 520px; margin: 8px auto 80px; padding: 0 24px;
}
.help-gate-card {
  background: var(--white); border: 1px solid rgba(44, 94, 126, .12);
  border-radius: var(--radius); padding: 28px 28px 32px; box-shadow: var(--shadow);
}
.help-gate-card h1 { font-size: 1.7rem; }
.help-gate-lead { color: #4a565f; font-weight: 600; }
.help-gate-public {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(44, 94, 126, .14);
  font-size: .95rem;
}
.help-gate-public h2 { font-size: 1rem; margin-bottom: .4em; }
.help-gate-public ul { margin: 0; padding-left: 1.2em; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .help-layout { grid-template-columns: 1fr; gap: 24px; }
  .help-sidebar {
    position: static; max-height: none; overflow: visible;
    border-bottom: 1px solid rgba(44, 94, 126, .14); padding-bottom: 12px;
  }
  /* On a phone the full topic list above every article is a wall to scroll past, so
     collapse it to the section headings' links only once the article is in view. */
  .help-sidebar h4 { margin-top: 14px; }
  .help-article { max-width: none; }
}
