/* Personalisation Hub Help Center — public FAQ site.
   Palette/type/icon choices follow the PH brand tokens (teal primary,
   Roboto, Material Symbols Outlined) documented in this repo's ph-designer
   skill, adapted for a standalone public page rather than an HQ/Retail
   Admin prototype. Icons are inline SVG (js/icons.js) rather than the
   Material Symbols web font, which the public site no longer loads. */
:root {
  --bg: #ffffff;
  --surface: #fafbfb;
  --surface-2: #f2f4f5;
  --text: #333333;
  --text-muted: rgba(0, 0, 0, .45);
  --border: #d9d9d9;
  --divider: rgba(5, 5, 5, .06);
  --primary: #169bc2;
  --primary-accent: #38b0cf;
  --primary-tint: rgba(22, 155, 194, .1);
  --violet: #9747ff;
  --header-bg: #000000;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
svg.icon { vertical-align: middle; flex-shrink: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ──────────────────────────────────────────────────────────── */
.ph-header {
  background: var(--header-bg); color: #fff; height: 64px;
  display: flex; align-items: center; padding: 0 24px; gap: 12px;
}
.ph-header a.brand { color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.ph-header .brand .dot { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--violet)); display: inline-block; }
.ph-header .help-label { color: rgba(255,255,255,.6); font-size: 12.5px; margin-left: 4px; }

/* ── Hero / search ───────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, rgba(22,155,194,.08), rgba(151,71,255,.06));
  padding: 48px 24px 64px; text-align: center;
}
.hero.hero-compact { padding: 28px 24px 40px; }
.hero h1 { margin: 0 0 8px; font-size: 28px; font-weight: 700; color: var(--text); }
.hero .start-here { margin: 18px 0 0; font-size: 13.5px; }
.hero .start-here a { font-weight: 600; }
.hero p { margin: 0 0 24px; color: var(--text-muted); font-size: 15px; }
.search-wrap { max-width: 640px; margin: 0 auto; position: relative; }
.search-box {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--text);
  background: #fff; border: 1px solid var(--border); border-radius: 9999px;
  padding: 14px 20px 14px 46px; box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.search-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.search-icon {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; text-align: left;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.12); max-height: 360px; overflow-y: auto; z-index: 20;
}
.search-results a { display: block; padding: 12px 16px; color: var(--text); border-bottom: 1px solid var(--divider); }
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
.search-results .sr-title { font-weight: 600; font-size: 13.5px; }
.search-results .sr-cat { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.search-results .sr-empty { padding: 14px 16px; color: var(--text-muted); font-style: italic; }
.search-results a.sr-active { background: var(--primary-tint); }
.search-results .sr-more { padding: 10px 16px; font-size: 12.5px; font-weight: 600; text-align: center; border-top: 1px solid var(--divider); }

/* ── Page shell ──────────────────────────────────────────────────────── */
.wrap { max-width: 1080px; margin: 0 auto; padding: 40px 24px 64px; }
.breadcrumb { font-size: 12.5px; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 4px; }
.load-error { color: #c0272a; background: #fff1f0; border: 1px solid #ffccc7; border-radius: 8px; padding: 14px 16px; }

/* ── Category grid (home page) ──────────────────────────────────────── */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: -32px; }
.cat-card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 20px;
  display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.cat-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(22,155,194,.12); text-decoration: none; }
.cat-card .cat-icon {
  width: 40px; height: 40px; border-radius: 8px; background: var(--primary-tint); color: var(--primary);
  display: flex; align-items: center; justify-content: center; margin-bottom: 4px;
}
.cat-card .cat-top { display: flex; align-items: center; justify-content: space-between; }
.cat-card .cat-step { font-size: 11px; font-weight: 700; color: var(--text-muted); border: 1px solid var(--border); border-radius: 9999px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cat-card h2 { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--text); }
.cat-card p { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.cat-card .cat-count { font-size: 11.5px; color: var(--primary); font-weight: 600; margin-top: auto; }

/* ── Article list (category page) ───────────────────────────────────── */
.page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.page-title .cat-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--primary-tint); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.page-title h1 { margin: 0; font-size: 22px; font-weight: 700; }
.page-desc { color: var(--text-muted); margin: 0 0 24px; font-size: 13.5px; }
.article-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.article-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--divider); background: #fff; }
.article-row .row-num { font-size: 12px; font-weight: 700; color: var(--text-muted); min-width: 22px; text-align: right; }
.article-row .row-main { flex: 1; min-width: 0; }
.article-row .row-chevron { color: var(--text-muted); }
.article-row .row-cat { font-weight: 600; color: var(--primary); }
.cat-nav, .article-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 28px; }
.cat-nav a, .article-nav a { display: inline-flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); max-width: 48%; }
.cat-nav a { flex-direction: row; align-items: center; gap: 6px; }
.cat-nav a:hover, .article-nav a:hover { border-color: var(--primary); text-decoration: none; }
.article-nav .nav-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; display: inline-flex; align-items: center; gap: 4px; }
.article-nav .nav-title { font-size: 13.5px; font-weight: 600; }
.article-nav .nav-next { text-align: right; align-items: flex-end; margin-left: auto; }
.article-row:last-child { border-bottom: none; }
.article-row:hover { background: var(--surface-2); text-decoration: none; }
.article-row h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; color: var(--text); }
.article-row p { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.empty-hint { color: var(--text-muted); font-style: italic; padding: 24px; text-align: center; border: 1px dashed var(--border); border-radius: 8px; }

/* ── Article page ────────────────────────────────────────────────────── */
.wrap-article { max-width: 1080px; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
@media (min-width: 960px) { .article-layout.has-toc, .article-layout:has(.toc:not([hidden])) { grid-template-columns: minmax(0, 1fr) 220px; } }
.toc { position: sticky; top: 24px; align-self: start; font-size: 13px; border-left: 2px solid var(--divider); padding-left: 14px; }
.toc-title { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 6px; }
.toc a { color: var(--text); }
.toc a:hover { color: var(--primary); }
.article-header h1 { margin: 0 0 8px; font-size: 26px; font-weight: 700; line-height: 1.25; }
.article-meta { margin: 0; color: var(--text-muted); font-size: 14px; }
.article-updated { margin: 28px 0 0; font-size: 12px; color: var(--text-muted); }
.related-title { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.article-cat-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600;
  color: var(--primary); background: var(--primary-tint); border-radius: 9999px; padding: 3px 10px; margin-bottom: 14px;
}
/* Diátaxis document type (docs/CONTRIBUTING-docs.md §2) — outlined rather
   than filled like .article-cat-badge, so the two badges read as
   distinct kinds of label (category vs. type) without relying on color
   alone to tell them apart; the text itself ("How-to guide", etc.) is
   the actual signal. */
.doctype-badge {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 600;
  color: var(--text-muted); border: 1px solid var(--border); border-radius: 9999px;
  padding: 2px 9px; margin: 0 0 14px 8px; text-transform: uppercase; letter-spacing: .02em;
}
.doctype-badge-inline {
  margin: 0 0 0 8px; vertical-align: middle; text-transform: none; letter-spacing: normal;
  font-size: 10.5px; font-weight: 600;
}
.article-body { font-size: 15px; line-height: 1.75; color: var(--text); margin-top: 20px; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4, .article-body h5, .article-body h6 { font-weight: 700; margin: 24px 0 8px; }
.article-body h2 { font-size: 19px; margin-top: 32px; padding-bottom: 6px; border-bottom: 1px solid var(--divider); }
.article-body h3 { font-size: 16.5px; }
.article-body h4 { font-size: 15px; }
.article-body ol li { padding-left: 4px; }
.article-body li > p { margin: 6px 0 0; font-size: 14px; color: #555; }
.article-body strong { font-weight: 600; }
.article-body p { margin: 0 0 14px; }
.article-body ul, .article-body ol { margin: 0 0 14px; padding-left: 22px; }
.article-body li { margin-bottom: 6px; }
.article-body img { max-width: 100%; height: auto; border-radius: 6px; margin: 0 0 14px; }
.article-body iframe { max-width: 100%; aspect-ratio: 16 / 9; width: 100%; height: auto; border: none; border-radius: 6px; margin: 0 0 14px; }
.article-body blockquote { margin: 0 0 14px; padding: 4px 16px; border-left: 3px solid var(--border, #d9d9d9); color: var(--text-muted, #666); }
.article-body a { color: var(--primary); text-decoration: underline; text-decoration-color: rgba(22,155,194,.4); text-underline-offset: 2px; }
.article-body a:hover { text-decoration-color: var(--primary); }
.article-body h2:target, .article-body h3:target { scroll-margin-top: 16px; }

/* ── Article section picker (faqArticles.sectionPicker) ────────────────────
   Editor-controlled: splits an article's body into one block per H2 and
   lets a reader narrow to just one (e.g. their own industry) via a select,
   right under the introduction. See page-article.js's initSectionPicker. */
.faq-section-picker {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 8px 0 24px; padding: 14px 16px;
  background: var(--surface-2); border-radius: 10px;
}
.faq-section-picker label { font-weight: 600; font-size: 14px; }
.faq-section-picker select {
  font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--divider); background: var(--bg); color: var(--text);
}
/* Quill's own alignment/indent classes — rendered content keeps them as-is */
.article-body .ql-align-center { text-align: center; }
.article-body .ql-align-right { text-align: right; }
.article-body .ql-align-justify { text-align: justify; }
.related-block { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--divider); }
.related-block h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }

/* ── Footer ──────────────────────────────────────────────────────────── */
.ph-footer { border-top: 1px solid var(--divider); padding: 20px 24px; text-align: center; font-size: 12px; color: var(--text-muted); }

[hidden] { display: none !important; }
html.embedded .hero { padding-top: 20px; }
html.embedded .ph-footer { padding: 14px; }
html.embedded .footer-admin { display: none; }
.ph-footer .footer-admin a { color: var(--text-muted); }
.ph-footer .footer-admin a:hover { color: var(--primary); }
@media print { .ph-header, .hero, .toc, .article-nav, .related-block, .ph-footer { display: none !important; } .wrap { padding: 0; } }

@media (max-width: 640px) {
  .hero { padding: 36px 16px 52px; }
  .hero h1 { font-size: 22px; }
  .wrap { padding: 28px 16px 48px; }
  .cat-grid { grid-template-columns: 1fr; margin-top: -24px; }
  .article-header h1 { font-size: 22px; }
  .cat-nav a, .article-nav a { max-width: 100%; }
  .article-row { gap: 10px; padding: 12px 14px; }
  .article-row .row-num { display: none; }
}

/* ── Rich formatting (docs/CONTRIBUTING-docs.md §5.4) ─────────────────
   Tables, code font and the three callout levels the documentation
   standard mandates. Authored in backlog-tracker's FAQ Center editor,
   which registers the matching Quill formats so this markup survives a
   later edit; the class names here are the contract between the two. */
.article-body .faq-table { overflow-x: auto; margin: 0 0 16px; }
.article-body table { border-collapse: collapse; width: 100%; font-size: 14px; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.article-body thead th { background: var(--surface-2); font-weight: 700; }
.article-body tbody tr:nth-child(even) { background: var(--surface); }
.article-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--surface-2); border: 1px solid var(--divider); border-radius: 4px; padding: 1px 5px; }
.article-body pre, .article-body pre.ql-syntax { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; background: #1f2429; color: #f2f4f5; padding: 12px 14px; border-radius: 6px; overflow-x: auto; margin: 0 0 14px; white-space: pre-wrap; }
.article-body pre code { background: none; border: 0; color: inherit; padding: 0; font-size: inherit; }
.article-body .callout { border-left: 4px solid; border-radius: 4px; padding: 10px 14px; margin: 0 0 14px; }
.article-body .callout::before { display: block; font-weight: 700; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.article-body .callout-note { background: var(--primary-tint); border-color: var(--primary); }
.article-body .callout-note::before { content: "Note"; color: #0f7ea1; }
.article-body .callout-important { background: #fff7e6; border-color: #faad14; }
.article-body .callout-important::before { content: "Important"; color: #a86a00; }
.article-body .callout-warning { background: #fff1f0; border-color: #ff4d4f; }
.article-body .callout-warning::before { content: "Warning"; color: #c0272a; }

/* ── Sub-category ("folder") sections on a category page ──────────────────
   A category can hold articles directly and/or group them into folders.
   Loose articles render first with no heading — they are simply the
   category's own articles — then one headed section per folder, in the
   order set by dragging rows in the FAQ admin. */
.folder-section { margin-top: 0; border-top: 6px solid var(--surface-2); }
.folder-section:first-child { border-top: 0; }
.folder-heading {
  display: flex; align-items: center; gap: 8px;
  margin: 0; padding: 16px 18px 4px; font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: #5b6b7a;
}
.folder-heading-icon { color: #5b6b7a; }
.folder-desc { margin: 0; padding: 0 18px 10px; font-size: 13px; color: #5b6b7a; }
