/* ==========================================================================
   Help center — dark editorial surface built on the v3 marketing tokens.

   Loads AFTER homepage.css, which supplies :root, the reset, the fixed nav
   and the footer. Everything here is scoped under `body.help-page` so none
   of it can reach the product app or the other marketing pages.

   Palette is not invented: the ground is --color-dark (#030712) and the
   three accents are the homepage hero's own gradient stops —
   blue #93c5fd, rose #fca5a5, amber #fde68a.
   ========================================================================== */

body.help-page {
  /* Ground and surfaces.
     The reading ground sits a step BELOW the hero so the two read as separate
     surfaces rather than one flat field — the hero is lit, the article is not. */
  --help-bg: #01040b;
  --help-hero-bg: #070e20;
  --help-surface: rgba(255, 255, 255, 0.035);
  --help-surface-hover: rgba(255, 255, 255, 0.06);
  --help-line: rgba(255, 255, 255, 0.1);
  --help-line-soft: rgba(255, 255, 255, 0.06);

  /* Text */
  --help-text: #f9fafb;
  --help-body: #d1d5db;
  --help-muted: #9ca3af;
  --help-faint: #6b7280;

  /* Accents — the hero gradient stops, used as semantic colors */
  --help-blue: #93c5fd;
  --help-rose: #fca5a5;
  --help-amber: #fde68a;
  --help-green: #86efac;

  --help-max: 992px;

  background: var(--help-bg);
  color: var(--help-body);
  font-family: 'Roboto Flex', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* The legacy chat/support bubble sits on a light ground by default. */
body.help-page .help-shell {
  min-height: 60vh;
}

body.help-page .help-container {
  max-width: var(--help-max);
  margin: 0 auto;
  padding-inline: 1.25rem;
}

/* Keep hero content above the fade that softens the band's bottom edge. */
body.help-page .help-hero .help-container {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Hero band
   The fixed nav paints a dark gradient over the top 80px, so this band has to
   be dark for the nav to read at all. Ambient radials echo the homepage hero.
   -------------------------------------------------------------------------- */

/* Soft orbs, blue-led, with one faint rose so it doesn't read as a cold wash.
   Sized in rem rather than percentages so they keep their shape at any width. */
body.help-page .help-hero {
  position: relative;
  background: var(--help-hero-bg);
  background-image:
    radial-gradient(38rem 26rem at 10% 14%, rgba(59, 130, 246, 0.22), transparent 62%),
    radial-gradient(32rem 22rem at 76% 4%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(28rem 20rem at 56% 96%, rgba(56, 189, 248, 0.13), transparent 62%),
    radial-gradient(24rem 18rem at 26% 92%, rgba(139, 92, 246, 0.11), transparent 60%),
    radial-gradient(20rem 16rem at 94% 66%, rgba(252, 165, 165, 0.07), transparent 62%);
  padding-top: calc(var(--nav-height) + 2.5rem);
  padding-bottom: 2.75rem;
  overflow: hidden;
}

/* The step down to the reading ground. A hairline alone was too quiet, so the
   edge is a short fade into the darker surface below it. */
body.help-page .help-hero::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 5rem;
  background: linear-gradient(to bottom, transparent, var(--help-bg));
  pointer-events: none;
}

body.help-page .help-hero--tall {
  padding-bottom: 4rem;
}

/* Eyebrow: "Help Center" — also the link home from a deeper page. */
body.help-page .help-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--help-blue);
  text-decoration: none;
  margin-bottom: 1.25rem;
}

body.help-page a.help-eyebrow:hover {
  color: #bfdbfe;
}

/* homepage.css fills every h1 with the hero gradient. Titles here are set solid
   — the color in this band comes from the orbs behind them, not the type. */
body.help-page .help-hero h1 {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 400;
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  line-height: 1.14;
  letter-spacing: -0.015em;
  margin: 0;
  max-width: 20ch;
  text-wrap: balance;
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: currentColor;
  color: var(--help-text);
}

body.help-page .help-hero--article h1 {
  max-width: 24ch;
}

body.help-page .help-hero-meta {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--help-faint);
}

body.help-page .help-hero-lede {
  margin-top: 1.25rem;
  max-width: 60ch;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--help-body);
}

body.help-page .help-hero-lede p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Breadcrumbs
   -------------------------------------------------------------------------- */

body.help-page .help-crumbs {
  margin-bottom: 1.5rem;
}

body.help-page .help-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--help-faint);
}

body.help-page .help-crumbs a {
  color: var(--help-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

body.help-page .help-crumbs a:hover {
  color: var(--help-blue);
}

body.help-page .help-crumbs .help-crumb-sep {
  color: rgba(255, 255, 255, 0.22);
}

body.help-page .help-crumbs [aria-current='page'] {
  color: var(--help-faint);
}

/* --------------------------------------------------------------------------
   Article layout — body column plus a sticky related rail
   -------------------------------------------------------------------------- */

body.help-page .help-body {
  padding-block: 3rem 5rem;
}

body.help-page .help-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: start;
}

@media (min-width: 900px) {
  body.help-page .help-layout {
    grid-template-columns: minmax(0, 1fr) 17rem;
    gap: 3.5rem;
  }
}

/* --------------------------------------------------------------------------
   Prose
   Long-form reading on a dark ground: generous leading, body text one step
   down from white, headings in Newsreader to echo the hero.
   -------------------------------------------------------------------------- */

body.help-page .help-prose {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--help-body);
  max-width: 68ch;
}

body.help-page .help-prose > *:first-child {
  margin-top: 0;
}

body.help-page .help-prose p {
  margin: 0 0 1.35rem;
}

body.help-page .help-lede {
  font-size: 1.1875rem;
  line-height: 1.65;
  color: var(--help-text);
  margin-bottom: 2.25rem;
  max-width: 62ch;
}

body.help-page .help-lede p:last-child {
  margin-bottom: 0;
}

/* Headings.

   Articles are written with either h2 or h3 as their top level — Wagtail's
   rich text keeps whichever the author pasted — so both get the section
   treatment and h4 is the quiet subhead underneath. The short gradient rule
   marks where a section starts; it is structural, not decorative. */
body.help-page .help-prose h2,
body.help-page .help-prose h3,
body.help-page .help-block-heading {
  position: relative;
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--help-text);
  margin: 2.75rem 0 1rem;
  padding-top: 1.25rem;
  text-wrap: balance;
}

body.help-page .help-prose h2,
body.help-page .help-block-heading {
  font-size: 1.625rem;
}

body.help-page .help-prose h3 {
  font-size: 1.4375rem;
}

/* An h3 directly under its own h2 is a sub-section, not a new one — drop the
   rule so the page doesn't read as two starts in a row. */
body.help-page .help-prose h2 + h3 {
  margin-top: 1.75rem;
  padding-top: 0;
}

body.help-page .help-prose h2::before,
body.help-page .help-prose h3::before,
body.help-page .help-block-heading::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--help-blue), var(--help-rose) 60%, var(--help-amber));
}

body.help-page .help-prose h2 + h3::before {
  display: none;
}

body.help-page .help-prose h4 {
  font-family: 'Roboto Flex', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.005em;
  color: var(--help-text);
  margin: 1.75rem 0 0.6rem;
}

body.help-page .help-prose strong,
body.help-page .help-prose b {
  color: var(--help-text);
  font-weight: 600;
}

body.help-page .help-prose em {
  color: var(--help-muted);
}

body.help-page .help-prose a {
  color: var(--help-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(147, 197, 253, 0.4);
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

body.help-page .help-prose a:hover {
  color: #bfdbfe;
  text-decoration-color: currentColor;
}

body.help-page .help-prose hr {
  border: 0;
  height: 1px;
  background: var(--help-line-soft);
  margin: 2.5rem 0;
}

/* Unordered lists — a small accent dot instead of a browser bullet. */
body.help-page .help-prose ul {
  list-style: none;
  margin: 0 0 1.35rem;
  padding: 0;
}

body.help-page .help-prose ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.6rem;
}

body.help-page .help-prose ul li::before {
  content: '';
  position: absolute;
  left: 0.25rem;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--help-rose);
}

body.help-page .help-prose ul ul {
  margin: 0.6rem 0 0;
}

body.help-page .help-prose ul ul li::before {
  background: transparent;
  border: 1px solid var(--help-muted);
}

/* Ordered lists — numbered badges. Nearly every help article is a sequence of
   steps, so the number is worth showing properly. */
body.help-page .help-prose ol {
  list-style: none;
  counter-reset: help-step;
  margin: 0 0 1.35rem;
  padding: 0;
}

body.help-page .help-prose ol > li {
  position: relative;
  counter-increment: help-step;
  padding-left: 2.5rem;
  margin-bottom: 0.85rem;
  min-height: 1.75rem;
}

body.help-page .help-prose ol > li::before {
  content: counter(help-step);
  position: absolute;
  left: 0;
  top: 0.15em;
  width: 1.625rem;
  height: 1.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(147, 197, 253, 0.12);
  border: 1px solid rgba(147, 197, 253, 0.3);
  color: var(--help-blue);
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* A nested list inside a step keeps the dot treatment, not more numbers. */
body.help-page .help-prose ol ul {
  margin: 0.6rem 0 0;
}

body.help-page .help-prose code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.875em;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--help-line-soft);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--help-text);
}

body.help-page .help-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--help-line);
  margin: 2rem 0;
}

/* Wide content must scroll inside itself, never the page. */
body.help-page .help-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

body.help-page .help-table-scroll {
  overflow-x: auto;
  margin: 0 0 1.5rem;
}

body.help-page .help-prose th,
body.help-page .help-prose td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--help-line-soft);
}

body.help-page .help-prose th {
  color: var(--help-text);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Callouts

   Two sources feed these:
     1. Wagtail's Callout block  → .callout-block[data-callout]
     2. A blockquote in rich text → .help-prose blockquote[data-callout]

   CSS cannot select on text content, so help-callouts.js reads the leading
   <strong> of each blockquote ("Note.", "Tip.", "Worth knowing.") and stamps
   the data-callout attribute. Everything below is plain attribute matching,
   and the un-stamped default is a perfectly good info callout — so the styling
   holds even if the script never runs.
   -------------------------------------------------------------------------- */

body.help-page .help-prose blockquote,
body.help-page .callout-block {
  --callout-accent: var(--help-blue);
  --callout-tint: rgba(147, 197, 253, 0.08);

  position: relative;
  margin: 1.75rem 0;
  padding: 1.15rem 1.35rem;
  background: var(--callout-tint);
  border: 1px solid var(--help-line-soft);
  border-left: 3px solid var(--callout-accent);
  border-radius: 0 10px 10px 0;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--help-body);
}

body.help-page .help-prose blockquote > *:last-child,
body.help-page .callout-block > *:last-child {
  margin-bottom: 0;
}

body.help-page .help-prose blockquote p,
body.help-page .callout-block p {
  margin-bottom: 0.75rem;
}

/* The leading "Note." / "Tip." reads as the callout's label. */
body.help-page .help-prose blockquote > p:first-child > strong:first-child,
body.help-page .callout-block .callout-title {
  color: var(--callout-accent);
  font-weight: 600;
}

body.help-page .callout-block .callout-title {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

body.help-page .help-prose blockquote[data-callout='tip'],
body.help-page .callout-block[data-callout='tip'] {
  --callout-accent: var(--help-green);
  --callout-tint: rgba(134, 239, 172, 0.07);
}

body.help-page .help-prose blockquote[data-callout='note'],
body.help-page .callout-block[data-callout='note'] {
  --callout-accent: var(--help-amber);
  --callout-tint: rgba(253, 230, 138, 0.07);
}

body.help-page .help-prose blockquote[data-callout='warning'],
body.help-page .callout-block[data-callout='warning'] {
  --callout-accent: var(--help-rose);
  --callout-tint: rgba(252, 165, 165, 0.08);
}

/* A blockquote with no bold label isn't a callout — it's a quotation.
   Stamped by the same script; styled as a pull quote instead. */
body.help-page .help-prose blockquote[data-callout='quote'] {
  background: transparent;
  border: 0;
  border-left: 2px solid var(--help-line);
  border-radius: 0;
  padding: 0.25rem 0 0.25rem 1.5rem;
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--help-text);
}

/* --------------------------------------------------------------------------
   Wagtail block wrappers
   -------------------------------------------------------------------------- */

body.help-page .text-with-heading-block,
body.help-page .image-with-caption-block,
body.help-page .button-block {
  margin-bottom: 1.5rem;
}

body.help-page .image-with-caption-block figure {
  margin: 0;
}

body.help-page .image-with-caption-block figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--help-faint);
  text-align: center;
}

body.help-page .help-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast), box-shadow var(--transition-fast);
}

body.help-page .help-btn--primary {
  background: var(--gradient-primary);
  color: var(--color-white);
  box-shadow: var(--shadow-sm);
}

body.help-page .help-btn--primary:hover {
  background: var(--gradient-primary-hover);
  box-shadow: var(--shadow-md);
}

body.help-page .help-btn--secondary {
  background: var(--help-surface-hover);
  color: var(--help-text);
  border: 1px solid var(--help-line);
}

body.help-page .help-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

body.help-page .help-btn--outline {
  border: 1px solid rgba(147, 197, 253, 0.45);
  color: var(--help-blue);
}

body.help-page .help-btn--outline:hover {
  background: rgba(147, 197, 253, 0.1);
}

/* --------------------------------------------------------------------------
   Related articles rail
   -------------------------------------------------------------------------- */

body.help-page .help-rail {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
}

body.help-page .help-rail-card {
  background: var(--help-surface);
  border: 1px solid var(--help-line-soft);
  border-radius: 12px;
  padding: 1.35rem;
}

body.help-page .help-rail-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--help-faint);
  margin: 0 0 1rem;
}

body.help-page .help-rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

body.help-page .help-rail-list li + li {
  border-top: 1px solid var(--help-line-soft);
}

body.help-page .help-rail-list a {
  display: block;
  padding: 0.85rem 0;
  text-decoration: none;
  color: var(--help-body);
  font-size: 0.9375rem;
  line-height: 1.4;
  transition: color var(--transition-fast);
}

body.help-page .help-rail-list li:first-child a {
  padding-top: 0;
}

body.help-page .help-rail-list li:last-child a {
  padding-bottom: 0;
}

body.help-page .help-rail-list a:hover {
  color: var(--help-blue);
}

/* --------------------------------------------------------------------------
   Index — category grid
   -------------------------------------------------------------------------- */

body.help-page .help-cat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 620px) {
  body.help-page .help-cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  body.help-page .help-cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

body.help-page .help-cat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.5rem;
  background: var(--help-surface);
  border: 1px solid var(--help-line-soft);
  border-radius: 12px;
  text-decoration: none;
  overflow: hidden;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    transform var(--transition-fast);
}

body.help-page .help-cat::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--help-blue), var(--help-rose) 55%, var(--help-amber));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

body.help-page .help-cat:hover {
  background: var(--help-surface-hover);
  border-color: var(--help-line);
  transform: translateY(-2px);
}

body.help-page .help-cat:hover::after {
  opacity: 1;
}

body.help-page .help-cat-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(147, 197, 253, 0.1);
  border: 1px solid rgba(147, 197, 253, 0.2);
  color: var(--help-blue);
  padding: 0.6rem;
}

body.help-page .help-cat-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Category icons are pasted into Wagtail as raw SVG, so they arrive with
   hard-coded fills or strokes. Recolor only the attributes that are actually
   painted — never blanket `fill: none`, which erases fill-based icons. */
body.help-page .help-cat-icon svg [stroke]:not([stroke='none']) {
  stroke: currentColor;
}

body.help-page .help-cat-icon svg [fill]:not([fill='none']) {
  fill: currentColor;
}

body.help-page .help-cat-name {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--help-text);
  margin: 0;
}

body.help-page .help-cat-count {
  margin-top: auto;
  font-size: 0.8125rem;
  color: var(--help-faint);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Category — article list
   -------------------------------------------------------------------------- */

body.help-page .help-article-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--help-line-soft);
}

body.help-page .help-article-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.35rem 0.75rem 1.35rem 0;
  border-bottom: 1px solid var(--help-line-soft);
  text-decoration: none;
  transition: background var(--transition-fast), padding-left var(--transition-fast);
}

body.help-page .help-article-row:hover {
  background: var(--help-surface);
  padding-left: 0.75rem;
}

body.help-page .help-article-row-text {
  flex: 1;
  min-width: 0;
}

body.help-page .help-article-row-title {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--help-text);
  margin: 0;
  line-height: 1.4;
}

body.help-page .help-article-row:hover .help-article-row-title {
  color: var(--help-blue);
}

body.help-page .help-article-row-intro {
  margin: 0.35rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--help-muted);
}

body.help-page .help-article-row-arrow {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--help-faint);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

body.help-page .help-article-row:hover .help-article-row-arrow {
  color: var(--help-blue);
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   Empty states and the foot of an article
   -------------------------------------------------------------------------- */

body.help-page .help-empty {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--help-muted);
  background: var(--help-surface);
  border: 1px dashed var(--help-line);
  border-radius: 12px;
}

body.help-page .help-footnote {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--help-line-soft);
  font-size: 0.9375rem;
  color: var(--help-muted);
}

body.help-page .help-footnote a {
  color: var(--help-blue);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* --------------------------------------------------------------------------
   Focus and motion
   -------------------------------------------------------------------------- */

body.help-page a:focus-visible,
body.help-page button:focus-visible {
  outline: 2px solid var(--help-blue);
  outline-offset: 3px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  body.help-page *,
  body.help-page *::before,
  body.help-page *::after {
    transition: none !important;
    animation: none !important;
  }
}
