/* help.css -- shared styling for Apteco Help.
   Palette per C:\Apteco\Branding\AP - Brand Crib sheet.pdf: Navy #232C61, Violet #8600C8,
   Teal #00A5AA, Dark Grey #58595B, Light Grey #E5E5E5.

   Redesigned 2026-08-24 to match the treatment already proven out (and explicitly signed off
   on) in apteco-civicrm-console\Docs\volunteer-*.html -- gradient bar, dotted header
   background, Montserrat/Poppins -- adapted for a persistent multi-page nav header rather
   than copied wholesale: those docs are single-page mastheads (stacked title+subtitle, tall),
   this header stays the SAME compact single row it always was (logo | search | category nav),
   just restyled. Superseded the previous "Arial only, no external fonts" choice (this is
   still an internal staff tool, but the user explicitly wants this exact look) -- Google
   Fonts loaded via @import right here rather than duplicating a <link> in every .tpl/.html
   file this stylesheet is shared across.

   Every rule is scoped under .apteco-help-page. This file is loaded as a real CiviCRM page's
   stylesheet now (CRM_Aptecohelp_Page_Index/Article), sharing a <body> with CiviCRM's own top
   menu bar and chrome -- an unscoped `body{}`/`*{}` rule here would silently restyle THAT too,
   not just our own content. .apteco-help-page is the wrapper div both .tpl files (and, for the
   static-file-preview case, articles/*.html's own <body class="apteco-help-page">) put every
   bit of our markup inside, so nothing here can ever reach outside it. */

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&family=Poppins:wght@400;500;600;700&display=swap");

.apteco-help-page {
  --navy: #232C61;
  --violet: #8600C8;
  --violet-ink: #7000A6;
  --teal: #00A5AA;
  --teal-ink: #00787C;
  --dark-grey: #58595B;
  --light-grey: #E5E5E5;
  --page-bg: #F7F7F9;
  --surface: #FFFFFF;
  --border: #E1E1E6;
  --shadow: 0 1px 2px rgba(35, 44, 97, 0.07), 0 8px 22px rgba(35, 44, 97, 0.06);

  font-family: "Poppins", Arial, Helvetica, sans-serif;
  color: #202020;
  background: var(--page-bg);
  line-height: 1.6;
}

.apteco-help-page,
.apteco-help-page *,
.apteco-help-page *::before,
.apteco-help-page *::after {
  box-sizing: border-box;
}

.apteco-help-page h1,
.apteco-help-page h2,
.apteco-help-page h3 {
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

/* ---- Gradient bar + header ---- */
.apteco-help-page .gradient-bar {
  height: 5px;
  background: linear-gradient(97deg, var(--teal) 0%, var(--violet) 100%);
}

.apteco-help-page .help-header {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

/* Subtle dotted violet pattern, masked to fade out toward the right -- same technique as the
   volunteer guide docs' own header::before, just behind a compact single-row header instead
   of a tall masthead. */
.apteco-help-page .help-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, color-mix(in srgb, var(--violet) 16%, transparent) 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  -webkit-mask-image: linear-gradient(to right, black, transparent 60%);
  mask-image: linear-gradient(to right, black, transparent 60%);
  pointer-events: none;
}

.apteco-help-page .help-header > * { position: relative; }

.apteco-help-page .help-header img { height: 30px; flex-shrink: 0; display: block; }

.apteco-help-page .help-header .kicker {
  font-family: "Montserrat", sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal-ink);
  font-weight: 700;
}

.apteco-help-page .help-header .header-spacer { flex: 1; }

.apteco-help-page .header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 160px;
}

.apteco-help-page .help-search {
  width: 100%;
  max-width: 320px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  font-family: "Poppins", sans-serif;
  outline: none;
  background: var(--page-bg);
  color: #202020;
}
.apteco-help-page .help-search:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 22%, transparent);
}

.apteco-help-page .help-category-nav {
  display: flex;
  gap: 22px;
  flex-shrink: 0;
}
.apteco-help-page .help-category-nav a {
  font-family: "Montserrat", sans-serif;
  color: var(--navy);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
}
.apteco-help-page .help-category-nav a:hover { color: var(--violet-ink); }

.apteco-help-page .help-breadcrumb {
  font-size: 13px;
  color: var(--dark-grey);
  margin: 22px 0 14px;
}
.apteco-help-page .help-breadcrumb a { color: var(--violet-ink); text-decoration: none; }
.apteco-help-page .help-breadcrumb a:hover { text-decoration: underline; }

.apteco-help-page .help-main {
  max-width: 940px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* Article page only (Article.tpl / articles/*.html): body text + "On this page" as two real
   flex columns, not a float. A float let the TOC sit hard against the running text with no
   guaranteed gap and made the paragraph beneath it wrap unpredictably narrow -- exactly what
   read as "interfering". flex + a fixed TOC column width gives a real gap and a stable
   width regardless of how long the text is. Deliberately a separate wrapper from
   .help-main itself: the index/category/search views put unrelated stuff (title, intro,
   tiles) directly in .help-main and must stay a normal single vertical column. */
.apteco-help-page .help-article-layout {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}
.apteco-help-page .help-article-body {
  flex: 1;
  min-width: 0; /* lets long text/code actually wrap inside a flex child instead of overflowing */
}

.apteco-help-page .help-back {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--violet-ink);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
}
.apteco-help-page .help-back:hover { text-decoration: underline; }

.apteco-help-page h1.help-title {
  font-size: 30px;
  line-height: 1.2;
  margin: 0 0 6px;
}

.apteco-help-page .help-subtitle {
  font-family: "Poppins", sans-serif;
  color: var(--teal-ink);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.apteco-help-page .help-meta {
  color: var(--dark-grey);
  font-size: 12.5px;
  font-style: italic;
  margin: 0 0 28px;
}

.apteco-help-page .help-main h2 {
  font-size: 21px;
  margin: 34px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.apteco-help-page .help-main h2:first-of-type { margin-top: 0; }

.apteco-help-page .help-main p { margin: 0 0 12px; max-width: 68ch; }

.apteco-help-page .help-main ul {
  margin: 0 0 12px;
  padding-left: 22px;
}
.apteco-help-page .help-main ul li { margin-bottom: 10px; max-width: 66ch; }

/* Plain (non-.steps) ordered lists still get sane spacing -- not every <ol> in an article is
   a numbered walkthrough worth the full card treatment below. */
.apteco-help-page .help-main > ol:not(.steps) {
  margin: 0 0 12px;
  padding-left: 22px;
}
.apteco-help-page .help-main > ol:not(.steps) li { margin-bottom: 8px; }

/* ---- Numbered step list -- borrowed from the volunteer guide docs' own ol.steps ---- */
.apteco-help-page ol.steps {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.apteco-help-page ol.steps > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  padding: 16px 18px;
}
.apteco-help-page ol.steps > li + li { border-top: 1px solid var(--border); }
.apteco-help-page ol.steps > li::before {
  content: counter(step);
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.apteco-help-page ol.steps .step-body p { margin: 0; }
.apteco-help-page ol.steps .step-body p + p { margin-top: 6px; }

.apteco-help-page code.field {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 0.94em;
  background: color-mix(in srgb, var(--violet) 8%, var(--surface));
  color: var(--violet-ink);
  padding: 1px 7px;
  border-radius: 5px;
}

/* Multi-line command blocks -- no existing CiviCRM-facing article has needed one yet (they're
   all short text steps + screenshots), but kept in sync with areas/apteco/OpsHelp's own copy of
   this file (added there for an ops-style guide with real shell/SQL commands to run) so either
   article system looks right if a future article needs one. Styled distinctly from code.field's
   own short inline pill so a whole command doesn't look like a stray inline mention of one. */
.apteco-help-page pre {
  background: var(--navy);
  color: #E7E9F5;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0 0;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.6;
}
.apteco-help-page pre code {
  font-family: ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
}

/* Dashed "still needs a screenshot" placeholder look by default -- once a real <img> is
   inside (:has(img), supported by every current browser as of when this was written), it
   switches to a plain card frame instead: a real screenshot shouldn't still look like a
   TODO. Authors don't have to remember to change anything -- dropping in an <img> is enough
   to flip the styling on its own. */
.apteco-help-page .help-screenshot {
  border: 2px dashed color-mix(in srgb, var(--dark-grey) 45%, transparent);
  background: var(--surface);
  border-radius: 8px;
  padding: 22px 16px;
  text-align: center;
  color: var(--dark-grey);
  font-size: 13px;
  margin: 10px 0 0;
}
.apteco-help-page .help-screenshot:has(img) {
  border: none;
  background: transparent;
  padding: 0;
}
.apteco-help-page .help-screenshot img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

/* ---- Callouts ---- */
.apteco-help-page .callout,
.apteco-help-page .help-tip {
  padding: 14px 18px;
  border-radius: 10px;
  margin: 20px 0 0;
  font-size: 14.5px;
  line-height: 1.6;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--teal) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--teal) 30%, var(--border));
}
/* .callout is always exactly 2 children (a label span + a p) -- safe to grid. .help-tip is a
   single <p> whose content after the leading label is free-form inline markup (bold, code,
   em, however many of each) -- NEVER grid that: CSS Grid auto-placement treats every inline
   child element as its own separate grid item, not just the label, so a tip mentioning a
   second bold phrase or an inline <code> mid-sentence used to shatter into a scattered,
   unreadable multi-row mess instead of flowing as one paragraph (reported live, 2026-09-26,
   from a real migration guide tip mixing <strong>/<code>/<em>). Plain block flow with just the
   leading label styled inline is what actually stays correct for arbitrary content. */
.apteco-help-page .callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}
.apteco-help-page .callout p { margin: 0; }
.apteco-help-page .help-tip { margin: 0; }
.apteco-help-page .callout .label {
  font-family: "Montserrat", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal-ink);
  padding-top: 2px;
}
.apteco-help-page .help-tip strong:first-child {
  font-family: "Montserrat", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal-ink);
  margin-right: 8px;
}
/* .help-tip is the older, plain <p class="help-tip"><strong>Tip:</strong> ...</p> shape (see
   existing articles) -- kept working as-is (not converted en masse). Only the FIRST <strong>
   gets the label treatment (:first-child above), so a tip that also happens to bold, italicise,
   or inline-code something later in the same sentence renders as normal emphasis, not a second
   mislabelled callout heading. */

/* ---- Article listing (index.html / CRM_Aptecohelp_Page_Index) ---- */
.apteco-help-page .help-intro { margin-bottom: 24px; color: var(--dark-grey); }

/* Default browse view: one tile per category (including a 0-article "planned" category like
   Admins before anyone's written into it yet), rendered by help.js's
   renderCategoryTiles() into #article-list-root. */
.apteco-help-page .category-tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}
.apteco-help-page .category-tile:hover { border-color: var(--violet); }

.apteco-help-page .category-tile-title {
  font-family: "Montserrat", sans-serif;
  color: var(--navy);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 4px;
}

.apteco-help-page .category-tile-meta {
  color: var(--dark-grey);
  font-size: 13px;
}

.apteco-help-page .category-heading {
  font-family: "Montserrat", sans-serif;
  color: var(--navy);
  font-size: 16px;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

.apteco-help-page .article-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
  text-decoration: none;
  color: inherit;
}
.apteco-help-page .article-card:hover { border-color: var(--teal); }

.apteco-help-page .article-card .article-title {
  font-family: "Montserrat", sans-serif;
  color: var(--navy);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}

.apteco-help-page .article-card .article-desc {
  color: var(--dark-grey);
  font-size: 13px;
}

.apteco-help-page .help-empty {
  color: var(--dark-grey);
  font-style: italic;
  padding: 20px 0;
}

/* ---- On this page (TOC) ----
   Deliberately NOT a bordered/background "card" (see git history for the boxed version this
   replaced) -- reported live, 2026-09-26 against areas/apteco/OpsHelp's own copy of this file:
   a card's own border+background around a short 5-7 link list, beside a much longer article
   body, visually reads as "a big empty box you left unused" rather than as ordinary page
   margin. Plain floating links (still sticky, still pinned while scrolling) don't draw a
   frame around the empty space below them, so there's nothing left looking wasted -- it just
   reads as the page's own right margin. Kept in sync here even though this extension's own
   articles are shorter (so the gap is less pronounced) -- same component, same look. */
.apteco-help-page #toc {
  flex: 0 0 200px; /* fixed sidebar width, never shrinks into the body column */
  position: sticky;
  top: 20px; /* stays in view while scrolling a long article */
  font-size: 13px;
}
.apteco-help-page #toc .toc-label {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  color: var(--dark-grey);
  margin-bottom: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.apteco-help-page #toc ul { list-style: none; margin: 0; padding: 0; }
.apteco-help-page #toc li { margin-bottom: 8px; }
.apteco-help-page #toc a { color: var(--violet-ink); text-decoration: none; }
.apteco-help-page #toc a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .apteco-help-page .help-article-layout { flex-direction: column; }
  .apteco-help-page #toc { flex: none; width: auto; position: static; }
}

/* ---- Back to top ---- */
.apteco-help-page #back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--navy);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.apteco-help-page #back-to-top.visible { opacity: 1; pointer-events: auto; }
.apteco-help-page #back-to-top:hover { background: var(--violet); }
