/* Help Center (/help): templates/help.html + static/help/help.js.
 *
 * SRUS dark and matte: no glow, no gradients, the site's usual 8px / 12px corners. Lora with a
 * Georgia fallback (the self-hosted Lora lives at /static/fonts/lora/lora.css).
 * Two columns on a wide screen: the topic list, sticky beside the article, and
 * the article at a reading width. Below 900px the topic list folds into a
 * <details> above the article (help.js opens it only when wide).
 */
:root {
  --hc-bg: #07080c;
  --hc-bg-2: #0d1017;
  --hc-bg-3: #141922;
  --hc-line: rgba(232, 236, 244, 0.09);
  --hc-line-2: rgba(232, 236, 244, 0.16);
  --hc-text: #e8edf6;
  --hc-body: #d3d9e4;
  --hc-muted: #8b95a8;
  --hc-faint: #5d6778;
  --hc-accent: #34d399;
  --hc-violet: #b14dff;
  --hc-violet-2: #c77dff;
  --hc-amber: #fbbf24;
  --hc-blue: #4cc9f0;
  --hc-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --hc-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --hc-top: 56px;
  --hc-radius: 8px;
  --hc-radius-lg: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--hc-top) + 16px); }
body {
  margin: 0; background: var(--hc-bg); color: var(--hc-text);
  font: 17px/1.65 var(--hc-serif);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--hc-violet-2); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible, main:focus-visible {
  outline: 2px solid var(--hc-accent); outline-offset: 2px;
}
main:focus { outline: none; }
.hc-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hc-muted { color: var(--hc-muted); }

.hc-skip { position: absolute; left: 8px; top: -60px; z-index: 20; padding: 8px 12px; background: var(--hc-accent); color: #04110b; font-weight: 700; border-radius: var(--hc-radius); }
.hc-skip:focus { top: 8px; }

/* ---------------------------------------------------------------- top bar */
.hc-top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: var(--hc-top); padding: 0 max(16px, env(safe-area-inset-left));
  background: var(--hc-bg-2); border-bottom: 1px solid var(--hc-line);
}
.hc-brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--hc-text); text-decoration: none; }
.hc-brand img { flex: 0 0 auto; }
.hc-brand-word { font-weight: 700; letter-spacing: .06em; font-size: 15px; }
.hc-brand-sub { padding-left: 10px; border-left: 1px solid var(--hc-line-2); color: var(--hc-muted); font-size: 15px; white-space: nowrap; }
.hc-top-links { display: flex; align-items: center; gap: 16px; font-size: 15px; }
.hc-top-links > a:not(.hc-btn) { color: var(--hc-muted); text-decoration: none; }
.hc-top-links > a:not(.hc-btn):hover { color: var(--hc-text); }

.hc-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--hc-line-2); background: var(--hc-bg-3); color: var(--hc-text);
  font: 600 15px/1 var(--hc-serif); text-decoration: none; white-space: nowrap;
  border-radius: var(--hc-radius);
}
.hc-btn:hover { border-color: var(--hc-muted); }
.hc-btn-primary { background: var(--hc-accent); border-color: var(--hc-accent); color: #04110b; }
.hc-btn-primary:hover { background: #4ee0aa; border-color: #4ee0aa; }

/* ----------------------------------------------------------------- layout */
.hc {
  display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; align-items: start;
  max-width: 1180px; margin: 0 auto; padding: 28px 24px 24px;
}
.hc-side {
  position: sticky; top: calc(var(--hc-top) + 24px);
  max-height: calc(100vh - var(--hc-top) - 48px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--hc-line-2) transparent;
}
.hc-col { min-width: 0; max-width: 760px; }

.hc-searchbar { margin-bottom: 28px; }
.hc-searchbar input {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--hc-bg-2); color: var(--hc-text);
  border: 1px solid var(--hc-line-2); border-radius: var(--hc-radius); font: 16px var(--hc-serif);
  -webkit-appearance: none; appearance: none;
}
.hc-searchbar input::placeholder { color: var(--hc-faint); }
.hc-searchbar input:focus { border-color: var(--hc-accent); outline: none; }

/* topic list */
.hc-browse > summary { display: none; }
.hc-toc-group + .hc-toc-group { margin-top: 20px; }
.hc-toc h2 {
  margin: 0 0 6px; padding: 0 10px;
  font: 700 11px/1.4 var(--hc-serif); letter-spacing: .1em; text-transform: uppercase; color: var(--hc-faint);
}
.hc-toc ul { list-style: none; margin: 0; padding: 0; }
.hc-toc a {
  display: block; padding: 5px 10px; border-radius: var(--hc-radius);
  font-size: 15px; line-height: 1.4; color: var(--hc-muted); text-decoration: none;
}
.hc-toc a:hover { color: var(--hc-text); background: var(--hc-bg-2); }
.hc-toc a.active { color: var(--hc-text); background: var(--hc-bg-3); box-shadow: inset 2px 0 0 var(--hc-accent); font-weight: 600; }
.hc-toc-sub { margin: 2px 0 6px 12px !important; border-left: 1px solid var(--hc-line); }
.hc-toc-sub a { padding: 3px 10px; font-size: 14px; }

.hc-fade { animation: hc-rise .18s ease-out both; }
@keyframes hc-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hc-card { background: var(--hc-bg-2); border: 1px solid var(--hc-line); border-radius: var(--hc-radius-lg); }

/* --------------------------------------------------------------- contents */
.hc-hero { margin-bottom: 28px; }
.hc-kicker { margin: 0 0 4px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--hc-accent); font-weight: 700; }
.hc-hero h1 { margin: 0 0 8px; font-size: 36px; line-height: 1.15; font-weight: 700; }
.hc-hero p { margin: 0 0 16px; max-width: 60ch; }

.hc-news { padding: 14px 18px; margin-bottom: 24px; }
.hc-news h2 { margin: 0 0 6px; font-size: 17px; }
.hc-news ul { list-style: none; margin: 0; padding: 0; }
.hc-news a { display: flex; gap: 16px; padding: 6px 0; color: var(--hc-text); text-decoration: none; }
.hc-news a:hover span { color: var(--hc-accent); }
.hc-news time { flex: 0 0 7.5em; color: var(--hc-muted); font-size: 15px; font-variant-numeric: tabular-nums; }

.hc-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.hc-section { padding: 16px 8px 8px; }
.hc-section h2 { margin: 0 10px 6px; font-size: 18px; }
.hc-section ul, .hc-related ul, .hc-results ul { list-style: none; margin: 0; padding: 0; }
.hc-section a, .hc-related a, .hc-result a {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 10px;
  color: var(--hc-text); text-decoration: none; border-radius: var(--hc-radius);
}
.hc-section a:hover, .hc-related a:hover, .hc-result a:hover, .hc-result a:focus { background: var(--hc-bg-3); }
.hc-section a strong, .hc-related a strong, .hc-result a strong { font-weight: 600; font-size: 16px; }
.hc-section a span, .hc-related a span { font-size: 14px; color: var(--hc-muted); line-height: 1.45; }

/* ----------------------------------------------------------------- search */
.hc-results > p { margin: 0 0 10px; font-size: 15px; }
.hc-result + .hc-result { border-top: 1px solid var(--hc-line); }
.hc-result a { padding: 12px 10px; }
.hc-result-head { color: var(--hc-muted); font-weight: 400; }
.hc-result-section { font-size: 13px; color: var(--hc-faint); }
.hc-result-snippet { font-size: 15px; color: var(--hc-muted); line-height: 1.5; }
.hc-result mark { border-radius: 3px; background: rgba(52, 211, 153, .16); color: var(--hc-text); box-shadow: inset 0 -1px 0 var(--hc-accent); }
.hc-empty { padding: 24px 0; }

/* ---------------------------------------------------------------- article */
.hc-crumbs { display: flex; gap: 8px; font-size: 14px; color: var(--hc-muted); margin-bottom: 6px; }
.hc-crumbs a { color: var(--hc-muted); }
.hc-article h1 { margin: 0; font-size: 34px; line-height: 1.18; font-weight: 700; }
.hc-lead { margin: 8px 0 14px; font-size: 19px; color: var(--hc-muted); max-width: 62ch; }
.hc-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding-bottom: 16px; margin-bottom: 26px; border-bottom: 1px solid var(--hc-line); font-size: 14px;
}
.hc-meta .hc-btn { margin-left: auto; }
.hc-who { padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(52, 211, 153, .4); color: var(--hc-accent); font-size: 13px; font-weight: 600; }

.hc-body { color: var(--hc-body); }
.hc-body > :first-child { margin-top: 0; }
.hc-body h2, .hc-body h3 { position: relative; color: var(--hc-text); scroll-margin-top: calc(var(--hc-top) + 16px); }
.hc-body h2 { margin: 40px 0 10px; font-size: 24px; line-height: 1.3; }
.hc-body h3 { margin: 26px 0 8px; font-size: 19px; }
.hc-anchor { position: absolute; left: -22px; color: var(--hc-faint); text-decoration: none; opacity: 0; font-weight: 400; }
.hc-body h2:hover .hc-anchor, .hc-body h3:hover .hc-anchor, .hc-anchor:focus { opacity: 1; }
.hc-body p, .hc-body ul, .hc-body ol, .hc-body blockquote { margin: 0 0 16px; }
.hc-body ul, .hc-body ol { padding-left: 1.4em; }
.hc-body li + li { margin-top: 5px; }
.hc-body li > ul, .hc-body li > ol { margin: 5px 0 0; }
.hc-body strong { font-weight: 700; color: var(--hc-text); }
.hc-body code {
  font-family: var(--hc-mono); font-size: .82em; padding: 1px 5px;
  background: var(--hc-bg-3); border: 1px solid var(--hc-line); border-radius: 5px; color: var(--hc-text);
}
.hc-body a { text-decoration: underline; text-decoration-color: rgba(199, 125, 255, .4); text-underline-offset: 3px; }
.hc-body a:hover { text-decoration-color: currentColor; }
.hc-missing { color: #ff5d73; text-decoration: underline dotted; }
.hc-body blockquote { padding-left: 16px; border-left: 3px solid var(--hc-line-2); color: var(--hc-muted); }

.hc-code { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--hc-radius); overflow-x: auto; background: var(--hc-bg-2); border: 1px solid var(--hc-line); font-size: 13px; line-height: 1.55; }
.hc-code code { padding: 0; border: 0; background: none; font-size: inherit; }

.hc-callout {
  display: flex; gap: 12px; align-items: baseline; margin: 0 0 18px; padding: 12px 16px;
  background: var(--hc-bg-2); border: 1px solid var(--hc-line); border-left: 3px solid var(--hc-accent); border-radius: var(--hc-radius);
  font-size: 16px; line-height: 1.6;
}
.hc-callout > div { min-width: 0; }
.hc-callout-label { flex: 0 0 auto; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hc-accent); }
.hc-callout-note { border-left-color: var(--hc-muted); }
.hc-callout-note .hc-callout-label { color: var(--hc-muted); }
.hc-callout-careful { border-left-color: var(--hc-amber); background: rgba(251, 191, 36, .05); }
.hc-callout-careful .hc-callout-label { color: var(--hc-amber); }
.hc-callout-bounty-seeker { border-left-color: var(--hc-violet); }
.hc-callout-bounty-seeker .hc-callout-label { color: var(--hc-violet-2); }

.hc-table { margin: 0 0 18px; overflow-x: auto; border: 1px solid var(--hc-line); border-radius: var(--hc-radius-lg); }
.hc-table table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.hc-table th, .hc-table td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hc-line); }
.hc-table th { background: var(--hc-bg-2); color: var(--hc-text); font-weight: 700; white-space: nowrap; }
.hc-table tr:last-child td { border-bottom: 0; }
.hc-table td:first-child { color: var(--hc-text); }

.hc-mark { animation: hc-mark 2.4s ease-out 1; }
.hc-mark, .hc-mark td { background: rgba(52, 211, 153, .10); }
li.hc-mark, p.hc-mark { border-radius: 4px; box-shadow: -10px 0 0 rgba(52, 211, 153, .10), 10px 0 0 rgba(52, 211, 153, .10); }
@keyframes hc-mark { from { outline: 1px solid var(--hc-accent); } to { outline: 1px solid transparent; } }

/* ------------------------------------------------------- related, pager */
.hc-related { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--hc-line); }
.hc-related h2 { margin: 0 0 6px; font-size: 18px; }
.hc-related ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 12px; margin: 0 -10px; }

.hc-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.hc-pager a {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 16px;
  border: 1px solid var(--hc-line); border-radius: var(--hc-radius-lg); background: var(--hc-bg-2); color: var(--hc-text); text-decoration: none;
}
.hc-pager a:hover { border-color: var(--hc-accent); }
.hc-pager span { font-size: 13px; }
.hc-next { text-align: right; grid-column: 2; }

.hc-foot { max-width: 1180px; margin: 0 auto; padding: 18px 24px 40px; border-top: 1px solid var(--hc-line); color: var(--hc-faint); font-size: 14px; }
.hc-foot a { color: var(--hc-muted); }

/* ------------------------------------------------------------- responsive */
@media (max-width: 899px) {
  .hc { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px 16px 8px; }
  .hc-main, .hc-side, .hc-searchbar { min-width: 0; }
  .hc-toc a { overflow-wrap: anywhere; }
  .hc-related ul { grid-template-columns: minmax(0, 1fr); margin: 0; }
  .hc-col { display: contents; }
  .hc-searchbar { order: -1; margin: 0; }
  .hc-side { position: static; max-height: none; overflow: visible; }
  .hc-browse { border: 1px solid var(--hc-line); border-radius: var(--hc-radius-lg); background: var(--hc-bg-2); }
  .hc-browse > summary {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 44px; padding: 0 14px; font-weight: 600; cursor: pointer; list-style: none;
  }
  .hc-browse > summary::-webkit-details-marker { display: none; }
  .hc-browse > summary::after { content: '+'; font-size: 20px; color: var(--hc-muted); }
  .hc-browse[open] > summary::after { content: '−'; }
  .hc-browse[open] .hc-toc { padding: 0 6px 12px; }
  .hc-toc a { padding: 8px 10px; }
  .hc-toc-sub { display: none; }
  .hc-hero h1 { font-size: 28px; }
  .hc-article h1 { font-size: 27px; }
  .hc-lead { font-size: 17px; }
  .hc-meta .hc-btn { margin-left: 0; }
  .hc-sections { grid-template-columns: 1fr; }
  .hc-pager { grid-template-columns: 1fr; }
  .hc-next { grid-column: 1; }
  .hc-anchor { display: none; }
  .hc-foot { padding: 16px 16px 32px; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .hc-brand-word { display: none; }
  .hc-top-links { gap: 12px; }
  .hc-news a { flex-direction: column; gap: 0; }
  /* Tables stack into one card per row on a phone: the first cell as its title,
     the rest labelled with their column heading. */
  .hc-table { overflow: visible; }
  .hc-table table, .hc-table tbody, .hc-table tr, .hc-table td { display: block; width: auto; }
  .hc-table thead { display: none; }
  .hc-table tr { padding: 10px 12px; border-bottom: 1px solid var(--hc-line); }
  .hc-table tr:last-child { border-bottom: 0; }
  .hc-table td { padding: 2px 0; border: 0; }
  .hc-table td:first-child { padding-bottom: 4px; }
  .hc-table td + td::before { content: attr(data-label) ': '; color: var(--hc-faint); font-size: 13px; }
  .hc-table tr.hc-mark { background: rgba(52, 211, 153, .10); }
  .hc-table tr.hc-mark td { background: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hc-fade { animation: none; }
}

/* site links, same set as the app's footer */
.hc-foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-bottom: 10px; font-size: 13px; }
.hc-foot-links a { color: inherit; text-decoration: none; }
.hc-foot-links a:hover { text-decoration: underline; }
