/* Verisight Help Center — static stylesheet. Tokens follow the portal's
   brand scale (apps/portal/src/assets/main.css) and the brand guide. */

:root {
  --brand-50: #eff3ff;
  --brand-100: #dfe7ff;
  --brand-500: #6271f2;
  --brand-600: #4f55e5;
  --brand-700: #4244ca;
  --grad: linear-gradient(135deg, #497fff, #7367f0);

  --bg: #f7f8fc;
  --surface: #ffffff;
  --subtle: #f1f3f9;
  --line: #e3e6ef;
  --fg: #2b2c40;
  --muted: #5d6178;
  --faint: #8a8ea3;
  --link: var(--brand-600);
  --code-bg: #f1f3f9;
  --shadow: 0 1px 2px rgba(31, 35, 64, .05), 0 4px 16px rgba(31, 35, 64, .05);

  --note: #497fff;
  --tip: #28c76f;
  --warn: #ff9f43;
  --danger: #ea5455;

  --radius: 12px;
  --top: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12172a;
    --surface: #1a2036;
    --subtle: #222944;
    --line: #2e3654;
    --fg: #e6e8f2;
    --muted: #a9aec4;
    --faint: #7b819b;
    --link: #a3b5fd;
    --code-bg: #232a45;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #12172a;
  --surface: #1a2036;
  --subtle: #222944;
  --line: #2e3654;
  --fg: #e6e8f2;
  --muted: #a9aec4;
  --faint: #7b819b;
  --link: #a3b5fd;
  --code-bg: #232a45;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--top) + 16px); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 Inter, "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
svg { flex-shrink: 0; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--top);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand .mark { width: 30px; height: 30px; }
.brand em { font-style: normal; font-weight: 500; color: var(--muted); }

.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search > svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 40px;
  padding: 0 40px 0 38px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--subtle); color: var(--fg);
  font: inherit; font-size: 15px;
}
.search input:focus { outline: none; border-color: var(--brand-500); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 20%, transparent); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 12px/1 ui-monospace, monospace; color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; }
.search input:focus ~ kbd { display: none; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px;
}
.search-results a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--fg); text-decoration: none; }
.search-results a small { display: block; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.search-results a span { display: block; color: var(--muted); font-size: 14px; line-height: 1.45; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--subtle); }
.search-results mark { background: color-mix(in srgb, var(--brand-500) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-results .empty { padding: 14px 12px; color: var(--muted); font-size: 14px; }

.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid transparent; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--subtle); color: var(--fg); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu-btn { display: none; }

.portal-link, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 16px; border-radius: 10px;
  background: var(--grad); color: #fff; font-weight: 600; font-size: 14px;
  text-decoration: none; white-space: nowrap;
}
.support-link { display: inline-flex; align-items: center; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.support-link:hover { background: var(--subtle); color: var(--fg); }
.portal-link:hover, .btn:hover { filter: brightness(1.06); text-decoration: none; }

/* ---------- layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: 280px minmax(0, 1fr); width: 100%; max-width: 1440px; margin: 0 auto; }

.sidebar {
  position: sticky; top: var(--top);
  height: calc(100vh - var(--top));
  overflow-y: auto;
  padding: 20px 12px 40px 20px;
  border-right: 1px solid var(--line);
  font-size: 14.5px;
}
.nav-group { margin-bottom: 4px; }
.nav-group summary { list-style: none; cursor: pointer; padding: 6px 8px; border-radius: 8px; display: flex; align-items: center; gap: 6px; font-weight: 600; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::before { content: ""; width: 6px; height: 6px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; }
.nav-group[open] summary::before { transform: rotate(45deg); }
.nav-group summary a { color: var(--fg); text-decoration: none; }
.nav-group summary:hover { background: var(--subtle); }
.nav-group ul { list-style: none; margin: 2px 0 10px; padding: 0 0 0 18px; border-left: 1px solid var(--line); margin-left: 12px; }
.nav-group li a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; line-height: 1.4; }
.nav-group li a:hover { color: var(--fg); background: var(--subtle); }
.nav-group li a[aria-current="page"] { color: var(--brand-600); background: var(--brand-50); font-weight: 600; }
:root[data-theme="dark"] .nav-group li a[aria-current="page"] { color: #c6d3ff; background: color-mix(in srgb, var(--brand-500) 18%, transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-group li a[aria-current="page"] { color: #c6d3ff; background: color-mix(in srgb, var(--brand-500) 18%, transparent); }
}

.nav-support { margin: 16px 0 0; padding: 16px 8px 0; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.nav-support a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--link); font-weight: 600; text-decoration: none; }
.nav-support a:hover { background: var(--subtle); }

.content { min-width: 0; padding: 36px 40px 64px; }

/* ---------- article ---------- */
.article-wrap { display: grid; grid-template-columns: minmax(0, 760px) 220px; gap: 48px; }
.article { min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--faint); margin-bottom: 10px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--link); }

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.015em; margin: 0; }
h1 { font-size: clamp(28px, 4vw, 36px); font-weight: 700; }
.lede { font-size: 18px; color: var(--muted); margin: 10px 0 28px; }
.article h2 { font-size: 23px; margin: 44px 0 12px; padding-top: 8px; }
.article h3 { font-size: 18px; margin: 30px 0 8px; }
.article p, .article ul, .article ol { margin: 0 0 16px; }
.article li { margin: 4px 0; }
.article li > ul, .article li > ol { margin: 4px 0; }
.article strong { font-weight: 650; }
.article img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }

code {
  font: 0.88em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg); border-radius: 5px; padding: 2px 5px;
  overflow-wrap: anywhere;
}
pre { position: relative; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 0 0 18px; }
pre code { background: none; padding: 0; font-size: 13.5px; overflow-wrap: normal; white-space: pre; }
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  font: 600 12px/1 inherit; padding: 6px 9px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }

.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--subtle); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

kbd { font: 12.5px ui-monospace, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface); }

/* admonitions: !!! note / tip / warning / danger */
.admonition { border: 1px solid var(--line); border-left: 4px solid var(--note); border-radius: 10px; background: var(--surface); padding: 12px 16px; margin: 0 0 20px; }
.admonition > :last-child { margin-bottom: 0; }
.admonition-title { font-weight: 650; margin: 0 0 4px !important; }
.admonition.tip { border-left-color: var(--tip); }
.admonition.warning { border-left-color: var(--warn); }
.admonition.danger { border-left-color: var(--danger); }
.admonition.note .admonition-title { color: var(--note); }
.admonition.tip .admonition-title { color: var(--tip); }
.admonition.warning .admonition-title { color: var(--warn); }
.admonition.danger .admonition-title { color: var(--danger); }

.toc { position: sticky; top: calc(var(--top) + 36px); align-self: start; font-size: 13.5px; max-height: calc(100vh - var(--top) - 72px); overflow-y: auto; }
.toc > p { font-weight: 600; text-transform: uppercase; letter-spacing: .05em; font-size: 12px; color: var(--faint); margin: 0 0 10px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul ul { padding-left: 12px; }
.toc a { display: block; padding: 4px 0 4px 12px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--fg); }
.toc a.active { color: var(--brand-600); border-left-color: var(--brand-500); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); text-decoration: none; font-weight: 600; }
.pager a:hover { border-color: var(--brand-500); }
.pager small { display: block; font-weight: 500; color: var(--faint); font-size: 13px; }
.pager .next { text-align: right; }

/* ---------- section index ---------- */
.section-page { max-width: 860px; }
.article-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.article-list a { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); text-decoration: none; box-shadow: var(--shadow); }
.article-list a:hover { border-color: var(--brand-500); }
.article-list strong { display: block; font-size: 16.5px; }
.article-list span { display: block; color: var(--muted); font-size: 14.5px; margin-top: 2px; }

/* ---------- home ---------- */
.home { max-width: 1100px; margin: 0 auto; }
.hero {
  position: relative; overflow: hidden;
  padding: 48px 40px; border-radius: 20px; margin-bottom: 32px;
  background: radial-gradient(1200px 300px at 0% 0%, color-mix(in srgb, #497fff 18%, transparent), transparent 60%),
              radial-gradient(800px 300px at 100% 100%, color-mix(in srgb, #7367f0 20%, transparent), transparent 60%),
              var(--surface);
  border: 1px solid var(--line);
}
.eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero h1 { font-size: clamp(30px, 5vw, 44px); }
.hero .lede { max-width: 620px; }
.hero-search {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 560px; height: 52px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--faint); font: inherit; font-size: 16px; cursor: text; box-shadow: var(--shadow);
}
.hero-search svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.popular { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 18px; font-size: 14px; color: var(--faint); }
.popular ul { display: contents; list-style: none; }
.popular a { color: var(--muted); }

.section-grid { list-style: none; padding: 0; margin: 0 0 32px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.section-grid a { display: flex; flex-direction: column; height: 100%; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg); text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.section-grid a:hover { border-color: var(--brand-500); transform: translateY(-1px); }
.section-grid strong { font-size: 17px; }
.section-grid span { color: var(--muted); font-size: 14.5px; margin: 4px 0 12px; flex: 1; }
.section-grid small { color: var(--faint); font-size: 13px; }

.help-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 28px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.help-cta h2 { font-size: 20px; }
.help-cta p { margin: 4px 0 0; color: var(--muted); max-width: 640px; }

.footer { border-top: 1px solid var(--line); padding: 20px; text-align: center; font-size: 13.5px; color: var(--faint); }
.footer p { margin: 0; }
.footer a { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .article-wrap { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 900px) {
  .menu-btn { display: grid; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: var(--top); left: 0; bottom: 0; z-index: 30;
    width: min(320px, 86vw); height: auto;
    background: var(--surface); box-shadow: var(--shadow);
    transform: translateX(-102%); transition: transform .2s;
  }
  body.nav-open .sidebar { transform: none; }
  .content { padding: 24px 16px 48px; }
  .portal-link, .support-link { display: none; }
  .brand em { display: none; }
  .hero { padding: 32px 20px; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 8px 0 4px; gap: 6px; }
  .brand span { display: none; }
  .search kbd { display: none; }
  .search input { padding-right: 12px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
}

@media print {
  .topbar, .sidebar, .toc, .pager, .footer, .copy-btn { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  body { background: #fff; color: #000; }
}
