/* ══ Help centre: light and dark (Nov 15 2026) ═════════════════════════════════════════════════════
   Billy: "make the help center dark mode completely ... and a way to change it at the bottom". Added to
   help.html and every help/<slug>/ page at build (scripts/lib/help-theme.js), after help-article.css and
   help-extras.css, so it has the last word.

   html[data-theme] is "light" or "dark", set before the page paints from the visitor's choice (System,
   Light or Dark, in the footer). Every colour here is an --hc-* token with a value for each theme, so a
   rule is written once and is right in both. The help stylesheet underneath was a dark theme turned
   light with !important on almost everything (even "body * { color: #1a1a2e !important }"), so these
   rules carry !important and at least two classes to win over it in both themes.

   Contrast: body text and links are at 7:1 or more in both themes (AAA), muted text at 7:1 or close
   to it on its own ground. The header, phone menu, Billy's assistant and the banner take their dark
   colours from css/help-chrome-dark.css, written at build from the site's css/theme.css. */

html {
  color-scheme: light;
  --hc-bg: #ffffff;        /* the page */
  --hc-raise: #f5f4f9;     /* a soft band: "Was this helpful?", code, the pinned search */
  --hc-field: #ffffff;     /* inputs and buttons that sit on the page */
  --hc-ink: #14141f;       /* headings */
  --hc-body: #262836;      /* article text */
  --hc-muted: #4f5468;     /* dates, counts, captions (7.4:1 on white) */
  --hc-line: #e4e6ee;      /* hairlines */
  --hc-line-2: #cdd0dc;    /* fields, buttons, image frames */
  --hc-link: #5f3f8a;      /* links and the brand's text colour (8.4:1) */
  --hc-link-h: #3f2862;
  --hc-fill: #643aa8;      /* behind white text (7.7:1 with white) */
  --hc-tint: rgba(120, 81, 169, .08);
  --hc-tint-2: rgba(120, 81, 169, .14);
  --hc-tint-line: rgba(120, 81, 169, .24);
  --hc-warn: rgba(217, 119, 6, .08);
  --hc-warn-line: rgba(217, 119, 6, .30);
  --hc-code: #f1eff7;
  --hc-code-ink: #3a2560;
  --hc-focus: #6b4896;
  --hc-shot: 0 1px 2px rgba(15, 18, 40, .05), 0 12px 30px -18px rgba(15, 18, 40, .28);
}
/* The help stylesheet's own grey (#6b7280) is 4.8:1 on white; in light it takes the same 7:1 grey. */
html:root:not([data-theme="dark"]) { --muted: #4f5468; --muted2: #5b6074; }
html[data-theme="dark"] {
  color-scheme: dark;
  --hc-bg: #0e1016;
  --hc-raise: #171a22;
  --hc-field: #161921;
  --hc-ink: #f2f3f7;
  --hc-body: #d8dbe5;
  --hc-muted: #a9afc2;
  --hc-line: #252935;
  --hc-line-2: #363b4b;
  --hc-link: #c9b0f2;
  --hc-link-h: #e4d6fb;
  --hc-fill: #643aa8;
  --hc-tint: rgba(167, 127, 224, .10);
  --hc-tint-2: rgba(167, 127, 224, .17);
  --hc-tint-line: rgba(167, 127, 224, .30);
  --hc-warn: rgba(251, 191, 36, .08);
  --hc-warn-line: rgba(251, 191, 36, .28);
  --hc-code: #1d2029;
  --hc-code-ink: #e6dcf7;
  --hc-focus: #c3a4f0;
  --hc-shot: 0 0 0 1px rgba(255, 255, 255, .04), 0 14px 34px -20px rgba(0, 0, 0, .8);
  /* The help stylesheet's own names, so its few var() rules follow too. */
  --dark: #0e1016; --dark-2: #171a22; --dark-3: #1d2029; --dark-4: #252935;
  --line: #252935; --muted: #a9afc2; --brand: #c3a4f0; --black: #f2f3f7; --text: #e8eaf2;
  --border: #252935; --surface: #0e1016; --muted2: #9aa0b4;
}

/* ── The page and its text ── */
html, body { background: var(--hc-bg) !important; color: var(--hc-ink) !important; }
body * { color: var(--hc-ink) !important; }
::selection { background: var(--hc-tint-2); }

/* Every control shows where focus is, in both themes. */
.help-article-main a:focus-visible, .help-article-main button:focus-visible, .help-article-main summary:focus-visible,
.hero a:focus-visible, .hero button:focus-visible, main a:focus-visible, main button:focus-visible, .wf-theme button:focus-visible {
  outline: 2px solid var(--hc-focus) !important; outline-offset: 3px; border-radius: 6px;
}

/* ── An article ── */
.help-article-main .article-breadcrumb a, .help-article-main .article-breadcrumb a span { color: var(--hc-muted) !important; }
.help-article-main .article-breadcrumb a:hover, .help-article-main .article-breadcrumb a:hover span { color: var(--hc-link) !important; }
.help-article-main .article-breadcrumb .sep, .help-article-main .article-breadcrumb i { color: var(--hc-muted) !important; opacity: .7; }
.help-article-main .article-breadcrumb .crumb-current { color: var(--hc-ink) !important; }
.help-article-main .article-header h1 { color: var(--hc-ink) !important; }
.help-article-main .article-header .meta, .help-article-main .article-header .meta * { color: var(--hc-muted) !important; }
.help-article-main .article-toc .toc-label { color: var(--hc-ink) !important; }
.help-article-main .article-toc a { color: var(--hc-muted) !important; }
.help-article-main .article-toc a:hover, .help-article-main .article-toc a.is-here { color: var(--hc-link) !important; }
.help-article-main .article-body, .help-article-main .article-body p, .help-article-main .article-body li,
.help-article-main .article-body span:not(.ui-icon), .help-article-main .article-body em, .help-article-main .article-body td { color: var(--hc-body) !important; }
.help-article-main .article-body :is(h2, h3, h4, strong, b, th) { color: var(--hc-ink) !important; }
.help-article-main .article-body li::marker { color: var(--hc-link); }
.help-article-main .article-body a:not(.btn-brand):not(.btn-ghost):not(.btn) { color: var(--hc-link) !important; text-decoration: underline !important;
  text-decoration-color: color-mix(in srgb, var(--hc-link) 45%, transparent) !important; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.help-article-main .article-body a:not(.btn-brand):not(.btn-ghost):not(.btn):hover { color: var(--hc-link-h) !important; text-decoration-color: currentColor !important; }
.help-article-main .article-body a:not(.btn-brand):not(.btn-ghost):not(.btn) * { color: inherit !important; }
.help-article-main .article-body code, .help-article-main .article-body kbd { background: var(--hc-code) !important; color: var(--hc-code-ink) !important;
  border: 1px solid var(--hc-line) !important; }
.help-article-main .article-body pre { background: var(--hc-code) !important; border: 1px solid var(--hc-line) !important; }
.help-article-main .article-body img:not(.inline-icon) { border: 1px solid var(--hc-line-2) !important; box-shadow: var(--hc-shot); background: #fff; }
.help-article-main .article-body hr { border-color: var(--hc-line) !important; }
.help-article-main .article-body .alert, .help-article-main .article-body .alert-info { background: var(--hc-tint) !important; border-color: var(--hc-tint-line) !important; }
.help-article-main .article-body .alert-warning { background: var(--hc-warn) !important; border-color: var(--hc-warn-line) !important; }
.help-article-main .article-body .alert *, .help-article-main .article-body .alert { color: var(--hc-body) !important; }
.help-article-main .article-body .alert strong, .help-article-main .article-body .alert b { color: var(--hc-ink) !important; }
.help-article-main .article-body details { background: var(--hc-tint) !important; border-color: var(--hc-tint-line) !important; }
.help-article-main .article-body details summary, .help-article-main .article-body details summary * { color: var(--hc-ink) !important; }
.help-article-main .article-body details summary::after { color: var(--hc-link) !important; }
.help-article-main .article-body details[open] summary { background: var(--hc-tint-2) !important; border-bottom-color: var(--hc-tint-line) !important; }
.help-article-main .article-body details:hover summary { background: var(--hc-tint-2) !important; }
.help-article-main .article-body .ui-icon { background: var(--hc-tint-2) !important; }
.help-article-main .article-body .ui-icon, .help-article-main .article-body .ui-icon i { color: var(--hc-link) !important; }
/* Buttons in an article: the brand fill with white words, in both themes. */
.help-article-main .article-body .btn-brand, .help-article-main .btn-brand { background: var(--hc-fill) !important; border-color: var(--hc-fill) !important; }
.help-article-main .btn-brand, .help-article-main .btn-brand * { color: #fff !important; }
.help-article-main .btn-ghost { background: transparent !important; border: 1px solid var(--hc-line-2) !important; }
.help-article-main .btn-ghost, .help-article-main .btn-ghost * { color: var(--hc-ink) !important; }
.help-article-main .btn-ghost:hover { background: var(--hc-tint) !important; border-color: var(--hc-link) !important; }
/* The few article blocks with their own frames: errors, terms, tiers and the plan comparison. */
.help-article-main .article-body :is(.error-item, .tier-item, .plan-col) { border-color: var(--hc-line-2) !important; background: transparent !important; }
.help-article-main .article-body :is(.term-item, .plan-col__feats li, .phase-step) { border-bottom-color: var(--hc-line) !important; }
.help-article-main .article-body .plan-col__head { background: var(--hc-raise) !important; border-bottom-color: var(--hc-line) !important; }
.help-article-main .article-body .error-item__action { background: var(--hc-tint) !important; }
.help-article-main .article-body .feat-no .feat-icon { color: var(--hc-muted) !important; }
.help-article-main .article-body .feat-yes, .help-article-main .article-body .feat-yes .feat-icon { color: var(--hc-body) !important; }
.help-article-main .article-body .feat-note { color: var(--hc-muted) !important; }
/* The keyboard's "Skip to main content", when it shows. */
a.skip-nav, a.skip-nav:focus { background: var(--hc-fill) !important; color: #fff !important; }

.help-article-main .article-related h3 { color: var(--hc-ink) !important; }
.help-article-main .article-related a { color: var(--hc-ink) !important; border-bottom-color: var(--hc-line) !important; }
.help-article-main .article-related a:hover { color: var(--hc-link) !important; }
.help-article-main .hx-next a { border-color: var(--hc-line-2) !important; }
.help-article-main .hx-next a:hover { border-color: var(--hc-link) !important; }
.help-article-main .hx-next small { color: var(--hc-muted) !important; }
.help-article-main .hx-next a:hover b { color: var(--hc-link) !important; }
.help-article-main .hx-helpful { background: var(--hc-raise) !important; }
.help-article-main .hx-helpful button, .help-article-main .hx-helpful .hx-helpful-ta { background: var(--hc-field) !important; border-color: var(--hc-line-2) !important; color: var(--hc-ink) !important; }
.help-article-main .hx-helpful button:hover { border-color: var(--hc-link) !important; color: var(--hc-link) !important; }
.help-article-main .hx-helpful .hx-helpful-acts a, .help-article-main .hx-stuck a { color: var(--hc-link) !important; }
.help-article-main .hx-stuck { color: var(--hc-muted) !important; }
.help-article-main .article-header, .help-article-main .article-footer { border-color: var(--hc-line) !important; }

/* ── The help home ── */
.help-hero, section.categories-section, #categoriesSection, .contact-cta { background: var(--hc-bg) !important; }
.help-hero { border-bottom-color: var(--hc-line) !important; }
.help-hero h1, .help-hero h1 * { color: var(--hc-ink) !important; }
/* Fields. The help stylesheet whitens every input with a selector four :not()s long, so this one matches it.
   Only the page's own fields: Billy's assistant keeps its own. */
html[data-theme] :is(main, .hero) input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]),
html[data-theme] :is(main, .hero) textarea, html[data-theme] :is(main, .hero) select {
  background: var(--hc-field) !important; color: var(--hc-ink) !important; border-color: var(--hc-line-2) !important; }
html[data-theme] :is(main, .hero) :is(input, textarea)::placeholder { color: var(--hc-muted) !important; opacity: 1; }
.hero .search-wrap .icon, .hero .search-wrap .clear, .hero .search-wrap .clear i { color: var(--hc-muted) !important; }
.hero .help-popular .help-popular-h { color: var(--hc-muted) !important; }
.hero .help-popular .quick-link { color: var(--hc-link) !important; }
.hero .hx-recent.help-popular .quick-link { color: var(--hc-ink) !important; }
.hero .hx-recent.help-popular .quick-link:hover, .hero .help-popular .quick-link:hover { color: var(--hc-link-h) !important; }
.hero-search-wrap.is-pinned { background: color-mix(in srgb, var(--hc-bg) 94%, transparent) !important; border-bottom-color: var(--hc-line) !important; }
.search-typeahead { background: var(--hc-field) !important; border-color: var(--hc-line-2) !important; }
.search-typeahead * { color: var(--hc-ink) !important; }
#categoriesGrid .cat-col-h, #categoriesGrid .category-card h3 { color: var(--hc-ink) !important; }
#categoriesGrid .category-card p { color: var(--hc-muted) !important; }
#categoriesGrid .category-card .count { color: var(--hc-muted) !important; }
#categoriesGrid .category-card, #categoriesGrid .cat-col > .category-card:last-child { border-color: var(--hc-line) !important; }
#categoriesGrid .category-card:hover h3 { color: var(--hc-link) !important; }
#categoriesGrid .cat-go { border-color: var(--hc-line-2) !important; color: var(--hc-ink) !important; }
#categoriesGrid .category-card:hover .cat-go, #categoriesGrid .category-card:focus-visible .cat-go { background: var(--hc-fill) !important; border-color: var(--hc-fill) !important; color: #fff !important; }
#categoriesGrid .category-card .icon, #categoriesGrid .category-card .icon i { color: var(--hc-link) !important; }
.results-header h2, #results .results-header h2 { color: var(--hc-ink) !important; }
.results-count, .topic-head .results-count { color: var(--hc-muted) !important; }
.result-card { border-color: var(--hc-line) !important; background: transparent !important; }
.result-card .title { color: var(--hc-ink) !important; }
.result-card:hover .title { color: var(--hc-link) !important; }
.result-card .meta, .result-card .meta *, .result-card .excerpt, .result-card .excerpt * { color: var(--hc-muted) !important; }
.result-card mark, .result-card .excerpt mark { background: var(--hc-tint-2) !important; color: var(--hc-ink) !important; }
.topic-head .results-header h2 { color: var(--hc-ink) !important; }
.topic-head .topic-desc-line, .topic-breadcrumb, .topic-breadcrumb * { color: var(--hc-muted) !important; }
.topic-breadcrumb a:hover { color: var(--hc-link) !important; }
.help-stuck { border-top-color: var(--hc-line) !important; color: var(--hc-muted) !important; }
.help-stuck a { color: var(--hc-link) !important; }
.no-results, .no-results * { color: var(--hc-muted) !important; }

/* ── The switch: light, dark or the device's setting, in the footer's bottom row ── */
.wf .wf-theme { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; }
.wf .wf-theme-l { padding: 0 8px 0 10px; font-size: 13.2px; color: #a9a5b8 !important; }
.wf .wf-theme button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 13px; border: 0; border-radius: 999px; background: none;
  font: inherit; font-size: 13.2px; font-weight: 500; line-height: 1; color: #c9c6d6 !important; cursor: pointer; transition: background .2s, color .2s; }
.wf .wf-theme button * { color: inherit !important; }
.wf .wf-theme button svg { flex: none; }
.wf .wf-theme button:hover { background: rgba(255, 255, 255, .08); color: #fff !important; }
.wf .wf-theme button[aria-pressed="true"] { background: #f2f0f8; color: #14121c !important; }
.wf .wf-theme button:focus-visible { outline: 2px solid #c3a4f0; outline-offset: 2px; }
@media (pointer: coarse) { .wf .wf-theme button { min-height: 44px; padding: 0 14px; } }
/* On a phone the row stacks; the switch takes the full width so each choice is easy to hit. */
@media (max-width: 700px) {
  .wf .wf-theme { order: -1; display: flex; width: 100%; }
  .wf .wf-theme-l { display: none; }
  .wf .wf-theme button { flex: 1 1 0; justify-content: center; }
}

/* A choice in the footer recolours the page with a short fade, never a flash. */
@media (prefers-reduced-motion: no-preference) {
  html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
    transition: background-color .3s ease, color .3s ease, border-color .3s ease, box-shadow .3s ease !important;
  }
}

/* Hover, selected and focus states (Nov 15, Billy on a topic page in dark: "this isn't fixed"). The help
   stylesheet gives these light literals with !important (#eceef8, #f1f3f8, #e8eaf0), so in dark the chosen
   topic was a light bar with light text and a hovered article turned into a light slab. Tokens here, in
   both themes, with html in front to outrank the :hover rules underneath. */
/* Rows in a hairline list (articles, topics on the home) get no box on hover: they have no inner padding,
   so a shaded box sat flush against the words with square corners and the arrow poking out (Billy, Nov 15:
   "the highlighted version is misaligned, no nice smooth borders"). The title turns the link colour instead. */
html .result-card:hover, html .result-card:focus-visible, html .result-card.compact:hover,
html .category-card:hover, html .quick-link:hover { background: transparent !important; box-shadow: none !important; }
html .result-card:hover .title span, html .result-card:hover .title i { color: var(--hc-link) !important; }
html .topic-row:hover, html .topic-row.is-current { background: var(--hc-raise) !important; color: var(--hc-ink) !important; }
html .topic-row:hover span, html .topic-row.is-current span { color: var(--hc-ink) !important; }
html .topic-row .topic-row-count { color: var(--hc-muted) !important; }
html .info-btn:hover, html .sc-btn:hover, html .saved-link:hover, html .btn-bookmark:hover,
html .btn-ghost:hover, html .problem-btn:hover, html .stuck-link:hover, html .gs-modal-close:hover, html .h-pill--portal:hover { background: var(--hc-raise) !important; }
html .search-wrap .clear { background: var(--hc-raise) !important; }
html .search-wrap input:focus { background: var(--hc-field) !important; }

/* ── Polish pass (Nov 15, Billy: "Please optimize the Help Center for Desktop and Mobile") ── */
/* The line between rows in a topic's article list is a 1px ::after in a faint dark tint, invisible on the
   dark page, so the list ran together in dark only. The theme's own hairline in both. */
html .result-card.compact::after { background: var(--hc-line) !important; }
/* "On this page" folded on a phone or tablet was a row with a lone 2px bar down its left edge (the
   desktop side column's rule). Folded, it sits between two hairlines like the lists around it. */
@media (max-width: 999px) {
  html .help-article-main .article-toc.hx-toc-fold { border: 0 !important; border-top: 1px solid var(--hc-line) !important; border-bottom: 1px solid var(--hc-line) !important; border-radius: 0 !important; padding: 2px 0 !important; }
}
/* The buttons at the end of an article were 10px-radius rectangles beside the round "Yes", "Not really"
   and "Back to Help Center"; round like them, a 48px target, and full width on a phone so a pair lines up
   instead of two ragged widths. */
html .article-body .cta-row > a, html .article-body .cta-row > button { display: inline-flex !important; align-items: center; justify-content: center; min-height: 48px; border-radius: 999px !important; text-align: center; }
@media (max-width: 560px) { html .article-body .cta-row > a, html .article-body .cta-row > button { flex: 1 1 100%; } }
/* The "Popular" links were 20px tall, too small to hit on a phone. On touch screens each is a 44px target;
   the row is pulled back 12px top and bottom so the words stay exactly where they were. */
@media (hover: none) {
  html .hero .help-popular { row-gap: 0 !important; align-items: center; margin-top: 4px !important; margin-bottom: -12px !important; }
  html .hero .help-popular .quick-link { display: inline-flex !important; align-items: center; min-height: 44px; }
}

/* Spoilers written in the help editor put their list or text straight inside <details>, without the padded
   .details-body wrapper the older articles have, so the bullets sat against the border (Billy, Nov 15: "this
   doesn't align properly with the spoiler border"). Whatever sits in a spoiler gets the same inset as its
   title: the bullets line up under the title's first letter, with room above and below. */
html .help-article-main .article-body details > :not(summary):not(.details-body) { margin-left: 20px !important; margin-right: 20px !important; }
html .help-article-main .article-body details > summary + :not(.details-body) { margin-top: 16px !important; }
html .help-article-main .article-body details > :not(summary):not(.details-body):last-child { margin-bottom: 18px !important; }
html .help-article-main .article-body details > ul, html .help-article-main .article-body details > ol { padding-left: 1.15em !important; }
html .help-article-main .article-body details > ul > li, html .help-article-main .article-body details > ol > li { padding-left: .2em; }

/* Phones, while a search answer is showing: the answer sits right under the box. The task links make way
   (the visitor is past them), and the empty sidebar row and the hero's padding stop adding ~75px of blank
   space above the answer card. Nothing changes until something is typed. */
@media (max-width: 760px) {
  html body:has(#results .hc-answer) .hero .help-tasks { display: none !important; }
  html body:has(#results .hc-answer) .main-grid { row-gap: 0 !important; }
  html body:has(#results .hc-answer) main { padding-top: 4px !important; }
}

/* The common tasks as outlined buttons with an icon (Billy, Nov 15: the five bare links in two uneven lines
   "don't look very good"). One row: it fits on a computer; on phones and tablets it scrolls sideways from
   edge to edge, with a soft fade at the right saying there's more. */
html .hero .help-tasks { display: flex !important; flex-wrap: nowrap !important; align-items: center !important; gap: 8px !important; overflow-x: auto !important;
  scrollbar-width: none; margin: 18px 0 0 !important; padding: 2px 0 4px !important; row-gap: 0 !important; }
html .hero .help-tasks::-webkit-scrollbar { display: none; }
html .hero .help-tasks .quick-link { flex: none; display: inline-flex !important; align-items: center; gap: 9px; min-height: 44px; padding: 0 17px 0 15px !important;
  border: 1px solid var(--hc-line-2) !important; border-radius: 999px !important; background: var(--hc-field) !important; color: var(--hc-ink) !important;
  font-size: 14.5px !important; font-weight: 600 !important; line-height: 1 !important; white-space: nowrap; text-decoration: none !important; }
html .hero .help-tasks .quick-link i { display: inline-block !important; font-size: 13px; color: var(--hc-link); }
html .hero .help-tasks .quick-link:hover { border-color: var(--hc-link) !important; color: var(--hc-link) !important; text-decoration: none !important; }
html .hero .help-tasks .quick-link:focus-visible { outline: 3px solid var(--hc-focus) !important; outline-offset: 2px; }
@media (max-width: 900px) {
  html .hero .help-tasks { margin-left: -20px !important; margin-right: -20px !important; padding-left: 20px !important; padding-right: 20px !important;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
}
