/*
 * ROI Magnet CRM Help: layout and components. Uses only the names in tokens.css.
 * Load order on every page: tokens.css, then help.css.
 */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--s4)); }
body { margin: 0; font: var(--fs-body)/var(--lh-body) var(--font); color: var(--ink); background: var(--paper); }
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s4); top: -60px; z-index: 50; padding: var(--s2) var(--s4); background: var(--paper);
        border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: var(--fs-ui); }
.skip:focus { top: var(--s2); }

/* ---------- Top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; min-height: var(--header-h);
       padding: 10px var(--s6); background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 700; font-size: 13px;
        display: grid; place-items: center; flex: none; }
.brand b { font-size: 15px; }
.brand span { color: var(--muted); font-size: 15px; }
.menu-btn { display: none; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
            background: var(--paper); color: var(--ink); cursor: pointer; place-items: center; }
.menu-btn svg { display: block; }

/* ---------- Search ---------- */
.search { position: relative; margin-left: auto; width: 300px; }
.search input { width: 100%; padding: var(--s2) var(--s3) var(--s2) 34px; font: var(--fs-ui) var(--font); color: var(--ink);
                background: var(--soft); border: 1px solid var(--line); border-radius: var(--s2); }
.search input::placeholder { color: var(--faint); }
.search input:focus { background: var(--paper); border-color: var(--brand); outline: 2px solid var(--brand-soft); outline-offset: 0; }
.search .glass { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .hint { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 600 12px var(--font); color: var(--faint);
                border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; background: var(--paper); pointer-events: none; }
.search input:focus ~ .hint, .search input:not(:placeholder-shown) ~ .hint { display: none; }
.results { position: absolute; right: 0; top: calc(100% + 6px); width: max(100%, 360px); max-height: 70vh; overflow: auto; margin: 0;
           padding: var(--s1); list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
           box-shadow: var(--shadow-pop); z-index: 30; }
.results[hidden] { display: none; }
.results li { padding: var(--s2) var(--s3); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-ui); line-height: 1.4; }
.results li small { display: block; color: var(--muted); font-size: var(--fs-sm); }
.results li[aria-selected="true"], .results li:hover { background: var(--brand-soft); }
.results li.empty { cursor: default; color: var(--muted); background: none; }

/* ---------- Three-column layout ---------- */
.wrap { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--toc-w); max-width: var(--site-max); margin: 0 auto; }
.chapters { position: sticky; top: var(--header-h); align-self: start; height: calc(100vh - var(--header-h)); overflow-y: auto;
            padding: 26px var(--s5) var(--s7); border-right: 1px solid var(--line); font-size: var(--fs-ui); }
.chapters .home-link { display: block; padding: 5px 10px; margin-bottom: var(--s2); color: var(--muted); text-decoration: none; border-radius: var(--radius-sm); }
.chapters .nav-h { margin: 18px 0 6px; padding: 0 10px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: var(--tracking-caps);
                   text-transform: uppercase; color: var(--faint); }
.chapters ul { list-style: none; margin: 0; padding: 0; }
.chapters ul a { display: block; padding: 5px 10px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; line-height: 1.45; }
.chapters a:hover { background: var(--soft); color: var(--ink); }
.chapters a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.chapters .nav-note { color: var(--muted); padding: 0 10px; }
.nav-backdrop { display: none; }

main { padding: 34px var(--s8) 80px; max-width: var(--content-max); min-width: 0; }
main:focus { outline: none; }

/* ---------- Page head ---------- */
.crumb { font-size: var(--fs-sm); color: var(--muted); min-height: 1.5em; }
.crumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumb li + li::before { content: "›"; margin-right: 6px; color: var(--faint); }
.crumb a { color: var(--muted); }
.titlerow { display: flex; align-items: flex-start; gap: var(--s4); }
h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); margin: var(--s2) 0 6px; flex: 1; letter-spacing: -.01em; }
.copy { margin-top: var(--s3); display: inline-flex; align-items: center; gap: 7px; padding: 6px var(--s3); font: 500 var(--fs-sm) var(--font);
        color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--s2); cursor: pointer; white-space: nowrap; }
.copy:hover { background: var(--soft); }
.copy.done { color: var(--tip); border-color: var(--tip-line); }
.lead { color: var(--muted); font-size: var(--fs-lead); margin: 0 0 6px; }
.who { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0 var(--s2); padding: 0; }
.pill { font-size: 12.5px; padding: 2px 10px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); color: var(--muted); }
h2 { font-size: var(--fs-h2); line-height: 1.3; margin: var(--s7) 0 var(--s3); }
h3 { font-size: var(--fs-h3); line-height: 1.35; margin: var(--s6) 0 var(--s2); }
p { margin: 0 0 var(--s3); }

/* ---------- Pictures ---------- */
/* Label above each picture: "Where:" or "Then:" in bold. */
.label { font-size: var(--fs-sm); color: var(--muted); margin: 14px 0 6px; }
.label b { color: var(--ink); }
figure.shot { margin: 18px 0 6px; }
.shot .stage { background: var(--stage); border-radius: var(--radius-lg); padding: var(--shot-pad); display: flex; justify-content: center; }
.shot figcaption, .caption { font-size: var(--fs-sm); color: var(--faint); text-align: center; margin: var(--s2) 0; }

/* "Where": the whole screen, dimmed, with a spotlight on the area to use. */
.where { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); line-height: 0; }
.where img { display: block; width: 100%; }
.spot { position: absolute; border-radius: var(--spot-radius);
        box-shadow: 0 0 0 var(--ring-width) var(--brand-ring), 0 0 0 9999px var(--spot-dim); }

/* "Then": a zoomed crop with thin outlines. Width is set on .frame to the crop's real pixel width. */
.frame { position: relative; max-width: 100%; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); line-height: 0; }
.frame img { display: block; width: 100%; }
.ring { position: absolute; border-radius: var(--ring-radius); box-shadow: 0 0 0 var(--ring-width) var(--brand-ring); }

/* Numbered marker, shared by both. Its left/top is its centre. */
.n { position: absolute; z-index: 2; width: var(--marker-size); height: var(--marker-size);
     margin: calc(var(--marker-size) / -2) 0 0 calc(var(--marker-size) / -2); border-radius: 50%;
     background: var(--brand); color: #fff; font: var(--marker-font); text-align: center; box-shadow: var(--marker-edge); }

/* ---------- Steps ---------- */
ol.steps { counter-reset: step; list-style: none; padding: 0; margin: var(--s5) 0; }
ol.steps > li { counter-increment: step; position: relative; padding: 2px 0 14px 40px; }
ol.steps > li::before { content: counter(step); position: absolute; left: 0; top: 3px; width: 24px; height: 24px; border-radius: 50%;
                        background: var(--brand); color: #fff; font: 600 12.5px/24px var(--font); text-align: center; }
main ul { padding-left: 1.3em; }
main li { margin-bottom: 4px; }
kbd { font: 600 13px var(--font); background: var(--soft); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; }

/* ---------- Tip and Watch out ---------- */
.call { border-radius: var(--radius); padding: var(--s3) var(--s4); margin: var(--s4) 0; font-size: 15px; border-left: 3px solid; }
.call > strong:first-child { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.call p:last-child { margin-bottom: 0; }
.tip { background: var(--tip-soft); border-color: var(--tip); }
.tip > strong:first-child { color: var(--tip); }
.warn { background: var(--warn-soft); border-color: var(--warn); }
.warn > strong:first-child { color: var(--warn); }

/* ---------- Field tables ---------- */
.table-scroll { overflow-x: auto; margin: 10px 0; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--soft); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* ---------- Previous / Next ---------- */
.pager { display: flex; justify-content: space-between; gap: var(--s4); margin-top: 44px; padding-top: var(--s5); border-top: 1px solid var(--line); }
.pager:empty { display: none; }
.pager a { text-decoration: none; color: var(--brand); font-weight: 600; max-width: 48%; }
.pager a.next { margin-left: auto; text-align: right; }
.pager small { display: block; color: var(--faint); font-weight: 400; }

/* ---------- On this page ---------- */
.toc { position: sticky; top: var(--header-h); align-self: start; padding: 34px 18px; font-size: var(--fs-sm); }
.toc[hidden] { display: none; }
.toc .toc-h { margin: 0 0 var(--s2); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--faint); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; color: var(--muted); text-decoration: none; padding: 3px 0 3px 10px; border-left: 2px solid transparent; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--brand); border-left-color: var(--brand); }

/* ---------- Home page ---------- */
.home-main { max-width: 1120px; margin: 0 auto; padding: 56px var(--s6) 80px; }
.hero { max-width: 680px; margin-bottom: 40px; }
.hero h1 { font-size: 38px; margin: 0 0 var(--s3); }
.hero .lead { font-size: 18px; margin-bottom: var(--s5); }
.hero .search { margin: 0; width: 100%; max-width: 560px; }
.hero .search input { padding-top: 12px; padding-bottom: 12px; font-size: var(--fs-body); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s4); }
.card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s5); background: var(--paper); scroll-margin-top: calc(var(--header-h) + var(--s4)); }
.card:target { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.card .num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--brand-soft);
             color: var(--brand); font: 700 13px var(--font); margin-bottom: var(--s3); }
.card h3 { font-size: 18px; margin: 0 0 6px; }
.card p { color: var(--muted); font-size: 15px; margin-bottom: var(--s3); }
.card ul { list-style: none; margin: 0; padding: 0; font-size: var(--fs-ui); }
.card li { margin: 0; padding: 3px 0; }
.card .soon { color: var(--faint); font-size: var(--fs-sm); }

/* ---------- Narrow screens ---------- */
@media (max-width: 1100px) {
  .wrap { grid-template-columns: 220px minmax(0, 1fr); }
  .toc { display: none; }
  main { padding: var(--s6) var(--s6) 60px; }
}
@media (max-width: 720px) {
  :root { --shot-pad: 12px; --fs-h1: 27px; }
  .top { flex-wrap: wrap; padding: var(--s2) var(--s4); gap: 10px; }
  .menu-btn { display: grid; }
  .search { order: 3; width: 100%; margin-left: 0; }
  .search .hint { display: none; }
  .results { width: 100%; }
  .wrap { grid-template-columns: minmax(0, 1fr); }
  main { padding: var(--s5) var(--s4) 48px; }
  .titlerow { flex-direction: column; gap: 0; }
  .copy { margin: var(--s1) 0 var(--s2); }
  /* The chapter menu becomes a panel that slides in from the left. */
  .chapters { position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; height: auto; width: min(310px, 86vw); padding-top: var(--s5);
              background: var(--paper); border-right: 1px solid var(--line); box-shadow: var(--shadow-pop);
              transform: translateX(-102%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  body.nav-open .chapters { transform: none; visibility: visible; transition: transform .2s ease; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 12, 20, .35); }
  body.nav-open { overflow: hidden; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
  .home-main { padding: 32px var(--s4) 60px; }
  .hero h1 { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .top, .chapters, .toc, .copy, .pager, .skip { display: none !important; }
  .wrap { display: block; }
  main { padding: 0; max-width: none; }
  .shot .stage { padding: 8px; }
}
