/* Styles for the help centre (help.html).
 *
 * A separate stylesheet, like share.css, because the site's CSP is `style-src 'self'` and stays that
 * way — there are no inline styles anywhere on this origin.
 *
 * Self-contained rather than built on style.css: that sheet is the app's design system, laid out
 * around a feed column, a rail and a sidebar, and none of that fits a document. What IS shared is
 * the palette — the same custom-property names and values as style.css, so the help centre reads as
 * the same product, and the same `faithy_theme` pin from theme_stamp.js applies to both.
 *
 * A document wants a wider measure and looser leading than a feed does, so the type scale here is
 * its own: 17px at a 1.65 line-height, over a column capped near 74 characters. */

:root {
  color-scheme: light dark;

  --bg: #edeef0;
  --surface: #ffffff;
  --surface-2: #f9f9f9;
  --surface-3: #f0f2f5;
  --border: #e7e8ec;
  --border-strong: #d7d8d9;
  --text: #000000;
  --muted: #818c99;
  --faint: #99a2ad;

  --primary: #0077ff;
  --primary-strong: #0062cc;
  --primary-soft: #e7f0fa;
  --on-primary: #ffffff;
  --tint: #e5ebf1;
  --tint-text: #55677d;
  --ok: #4bb34b;
  --warn: #a76a00;
  --mark: #ffe27a;
  --mark-text: #2b2417;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-lg: 0 4px 32px rgba(0, 0, 0, .16), 0 0 4px rgba(0, 0, 0, .08);

  --head-h: 60px;
  --page-w: 1180px;
  --col-toc: 244px;
  --sans: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0f;
    --surface: #1c1c1d;
    --surface-2: #232324;
    --surface-3: #2c2d2e;
    --border: #2a2a2b;
    --border-strong: #3a3a3b;
    --text: #e1e3e6;
    --muted: #818c99;
    --faint: #6b6d70;
    --primary: #529ef4;
    --primary-strong: #7cb9f7;
    --primary-soft: #1d3d63;
    --tint: #2c2d2e;
    --tint-text: #e1e3e6;
    --warn: #d9a03c;
    --mark: #6b5a1d;
    --mark-text: #f5efdd;
    --shadow-lg: 0 4px 32px rgba(0, 0, 0, .6), 0 0 4px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #1c1c1d;
  --surface-2: #232324;
  --surface-3: #2c2d2e;
  --border: #2a2a2b;
  --border-strong: #3a3a3b;
  --text: #e1e3e6;
  --muted: #818c99;
  --faint: #6b6d70;
  --primary: #529ef4;
  --primary-strong: #7cb9f7;
  --primary-soft: #1d3d63;
  --tint: #2c2d2e;
  --tint-text: #e1e3e6;
  --warn: #d9a03c;
  --mark: #6b5a1d;
  --mark-text: #f5efdd;
  --shadow-lg: 0 4px 32px rgba(0, 0, 0, .6), 0 0 4px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); }
a:hover { color: var(--primary-strong); }

.skip-link {
  position: fixed;
  inset-inline-start: 16px;
  inset-block-start: 0;
  transform: translateY(-120%);
  z-index: 20;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  background: var(--primary);
  color: var(--on-primary);
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

/* ---- header ------------------------------------------------------------------- */

.head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.head-inner {
  max-width: var(--page-w);
  margin: 0 auto;
  height: var(--head-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  flex: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.2px;
}

.brand-sub {
  margin-inline-start: 7px;
  padding-inline-start: 8px;
  border-inline-start: 1px solid var(--border-strong);
  color: var(--muted);
  font-weight: 500;
}

/* The language picker is a GET form so translated pages remain reachable without script. */
.public-language {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin-inline-start: auto;
}
.public-language label {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.public-language select,
.public-language button {
  min-block-size: 36px;
  max-inline-size: 132px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.public-language select:focus-visible,
.public-language button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.head-inner .search { min-inline-size: 0; }
.head-inner .search + .icon-button + .public-language { margin-inline-start: 0; }

/* ---- search ------------------------------------------------------------------- */

.search {
  position: relative;
  flex: 1;
  max-width: 460px;
  margin-inline-start: auto;
}

.search input {
  width: 100%;
  height: 36px;
  padding-block: 0;
  padding-inline: 13px 34px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
}

.search input::placeholder { color: var(--muted); }

.search input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-key {
  position: absolute;
  inset-inline-end: 9px;
  top: 8px;
  min-width: 19px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

.search input:focus ~ .search-key { display: none; }

.results {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  inset-inline-end: 0;
  max-height: min(66vh, 520px);
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.result {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.result:hover,
.result.active { background: var(--surface-3); }

.result-crumb {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.result-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.result-snippet {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result mark,
.doc mark {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--mark);
  color: var(--mark-text);
}

.results-empty {
  padding: 16px 12px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ---- header buttons ------------------------------------------------------------ */

.icon-button {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover { background: var(--surface-3); color: var(--text); }

/* A CSS-drawn half-filled circle: the contrast mark used for "switch theme" everywhere, and one
   less image to ship. */
.icon-theme {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 0 50%, transparent 50% 100%);
}

/* ---- shell -------------------------------------------------------------------- */

.shell {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 0 16px 64px;
  display: grid;
  grid-template-columns: var(--col-toc) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* ---- table of contents --------------------------------------------------------- */

.toc {
  position: sticky;
  top: calc(var(--head-h) + 20px);
  max-height: calc(100vh - var(--head-h) - 40px);
  overflow-y: auto;
  padding: 20px 0;
}

.toc-toggle { display: none; }

.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc-list a {
  display: block;
  padding: 6px 12px 6px 14px;
  border-inline-start: 2px solid transparent;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.4;
  text-decoration: none;
}

.toc-list a:hover { color: var(--text); }

.toc-list a.current {
  border-inline-start-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* ---- document ------------------------------------------------------------------ */

.doc {
  min-width: 0;
  padding: 20px 0 0;
  outline: none;
}

.doc-hero { padding: 20px 0 8px; }

.doc h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -.5px;
}

.lede {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 18px;
}

.doc-section {
  margin-top: 28px;
  padding: 26px 30px 30px;
  border-radius: var(--radius);
  background: var(--surface);
}

/* Every anchor the page can be navigated to, held clear of the sticky header. The contents rail
   links at the SECTION, while search results and deep links land on a heading or a FAQ question, so
   all four have to carry the offset — miss one and that link alone arrives with its title hidden
   behind the bar. */
.doc-section,
.doc h2,
.doc h3,
.faq summary {
  scroll-margin-top: calc(var(--head-h) + 16px);
}

.doc-section > *:last-child { margin-bottom: 0; }

.doc h2 {
  margin: 0 0 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: -.3px;
}

.doc h3 {
  margin: 30px 0 8px;
  font-size: 18px;
  line-height: 1.35;
}

.doc p,
.doc ul,
.doc ol {
  max-width: 74ch;
  margin: 0 0 14px;
}

.doc ul,
.doc ol { padding-inline-start: 22px; }

.doc li { margin-bottom: 6px; }

.doc li > ul { margin-top: 6px; }

.doc strong { font-weight: 650; }

/* An inline key or glyph — the ⋯ button, Enter, @ — set apart from the prose without shouting. */
.kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface-2);
  font-size: .88em;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
}

/* ---- callouts ------------------------------------------------------------------ */

.callout {
  max-width: 74ch;
  margin: 18px 0;
  padding: 14px 16px;
  border-inline-start: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
}

.callout p { margin: 0; max-width: none; }
.callout p + p { margin-top: 8px; }

.callout-key {
  border-inline-start-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, var(--surface));
}

/* ---- tables -------------------------------------------------------------------- */

.ref {
  width: 100%;
  max-width: 74ch;
  margin: 4px 0 18px;
  border-collapse: collapse;
  font-size: 15.5px;
}

.ref th,
.ref td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
}

.ref thead th {
  border-bottom: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ref tbody tr:last-child td { border-bottom: 0; }

.ref td:first-child { font-weight: 600; white-space: nowrap; }

/* Wide tables scroll inside their own box rather than pushing the page sideways. */
@media (max-width: 560px) {
  .ref { display: block; overflow-x: auto; white-space: nowrap; }
  .ref td, .ref th { white-space: normal; min-width: 140px; }
}

/* ---- FAQ ----------------------------------------------------------------------- */

.faq { max-width: 74ch; margin-top: 18px; }

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq details:first-child { border-top: 1px solid var(--border); }

.faq summary {
  padding-block: 14px;
  padding-inline: 2px 30px;
  position: relative;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "";
  position: absolute;
  inset-inline-end: 8px;
  top: 22px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
}

.faq details[open] summary::after {
  top: 25px;
  transform: rotate(-135deg);
}

.faq summary:hover { color: var(--primary); }

.faq details p {
  margin: 0 0 16px;
  padding-inline-end: 30px;
  color: var(--muted);
}

/* ---- search highlight ---------------------------------------------------------- */

/* Where a search result lands, so the eye finds it after the jump. */
.flash {
  animation: flash 2.2s ease-out;
  border-radius: var(--radius-sm);
}

@keyframes flash {
  0%, 35% { background: var(--primary-soft); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .flash { animation: none; outline: 2px solid var(--primary); outline-offset: 4px; }
}

/* ---- foot ---------------------------------------------------------------------- */

.doc-foot {
  margin-top: 28px;
  padding: 22px 30px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 14.5px;
  text-align: center;
}

.doc-foot p { margin: 0 0 4px; max-width: none; }

/* ---- narrow screens ------------------------------------------------------------ */

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-bottom: 48px;
  }

  .toc {
    position: static;
    max-height: none;
    overflow: visible;
    margin-top: 16px;
    padding: 0;
    border-radius: var(--radius);
    background: var(--surface);
  }

  .toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 18px;
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
  }

  .chev {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform .15s ease;
  }

  .toc-toggle[aria-expanded="true"] .chev { transform: rotate(-135deg); }

  .toc-list { display: none; padding: 0 8px 12px; }
  .toc-toggle[aria-expanded="true"] + .toc-list { display: block; }

  .toc-list a { border-inline-start: 0; padding-inline-start: 10px; }
  .toc-list a.current { border-inline-start: 0; }

  .doc { padding-top: 8px; }
  .doc h1 { font-size: 28px; }
  .lede { font-size: 17px; }

  .doc-section { padding: 22px 18px 26px; }
  .doc-foot { padding: 20px 18px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }

  .head-inner { gap: 8px; padding: 0 12px; }
  .brand-sub { display: none; }
  .search { max-width: none; }
  .search-key { display: none; }

  .shell { padding-inline-start: 12px; padding-inline-end: 12px; }
}

@media (max-width: 480px) {
  .head-inner { height: auto; min-block-size: var(--head-h); flex-wrap: wrap; padding-block: 10px; }
}

/* Under 620px the app goes edge to edge; the help centre follows, so the two feel like one product
   on a phone. */
@media (max-width: 620px) {
  .shell { padding-inline-start: 0; padding-inline-end: 0; }
  .doc-hero { padding: 20px 16px 4px; }
  .doc-section,
  .doc-foot,
  .toc { border-radius: 0; }
  .toc { margin-top: 12px; }
}

/* ---- print --------------------------------------------------------------------- */

@media print {
  .head, .toc, .skip-link, .doc-foot { display: none; }
  .shell { display: block; padding: 0; }
  body { background: #ffffff; color: #000000; font-size: 11pt; }
  .doc-section { padding: 0; margin-top: 18pt; break-inside: auto; }
  .doc h2 { break-after: avoid; }
  .doc h3 { break-after: avoid; }
  .faq details { display: block; }
  .faq details p { display: block; color: #000000; }
  .callout { border: 1px solid #999999; background: none; }
}
