/* help.agilenotes.ai — documentation theme. Matches the app's indigo accent. */
:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --ink: #1e2230;
  --ink-soft: #51596b;
  --ink-faint: #8a91a3;
  --line: #e6e8ef;
  --line-soft: #eef0f6;
  --indigo: #6366f1;
  --indigo-dark: #4f46e5;
  --indigo-soft: #eef0ff;
  --code-bg: #f1f3f9;
  --radius: 12px;
  --maxw: 820px;
  --sidebar-w: 280px;
  --topbar-h: 56px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--indigo); color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ── Top bar (dark, matches the app) ─────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-logo {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px;
  background: var(--indigo); color: #fff; font-weight: 700; font-size: 12.5px;
  display: flex; align-items: center; justify-content: center; letter-spacing: 0.02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; }
.brand-mark { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-tag { color: #94a3b8; font-size: 11px; white-space: nowrap; }
/* "Help" centered without affecting header height */
.topbar-help {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: #fff; font-weight: 700; font-size: 22px; letter-spacing: -0.01em;
  pointer-events: none;
}
.topbar-cta {
  flex: 0 0 auto; text-decoration: none; font-weight: 600; font-size: 14px; color: #fff;
  background: var(--indigo); padding: 9px 16px; border-radius: 8px;
}
.topbar-cta:hover { background: var(--indigo-dark); }
.nav-toggle {
  display: none; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px; width: 38px; height: 38px; font-size: 18px; cursor: pointer; color: #fff;
}

/* ── Layout ──────────────────────────────────────────────── */
.layout { display: flex; align-items: flex-start; max-width: 1280px; margin: 0 auto; }
.sidebar {
  position: sticky; top: var(--topbar-h);
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 26px 18px 40px;
  border-right: 1px solid var(--line);
}
.toc { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.toc li { margin: 1px 0; }
.toc a {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink-soft);
  padding: 8px 12px; border-radius: 8px; font-size: 14.5px; font-weight: 500;
}
.toc a:hover { background: var(--line-soft); color: var(--ink); }
.toc li.active a { background: var(--indigo-soft); color: var(--indigo-dark); font-weight: 600; }
.toc-num {
  flex: 0 0 22px; text-align: center; font-size: 12px; font-weight: 600;
  color: var(--ink-faint); background: var(--line-soft); border-radius: 6px; padding: 2px 0;
}
.toc li.active .toc-num { background: #fff; color: var(--indigo); }
.sidebar-note { margin: 22px 6px 0; font-size: 12.5px; color: var(--ink-faint); line-height: 1.5; }

/* ── Content ─────────────────────────────────────────────── */
.content { flex: 1 1 auto; min-width: 0; padding: 34px clamp(20px, 5vw, 56px) 64px; }
.doc { max-width: var(--maxw); }
.doc h1 {
  font-size: clamp(28px, 4vw, 36px); line-height: 1.15; letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.doc .lede { font-size: 18px; color: var(--ink-soft); margin: 0 0 28px; }
.doc h2 {
  font-size: 22px; letter-spacing: -0.01em; margin: 40px 0 12px;
  padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.doc h3 { font-size: 17px; margin: 26px 0 8px; }
.doc p { margin: 12px 0; }
.doc a { color: var(--indigo-dark); text-decoration: none; border-bottom: 1px solid rgba(99,102,241,0.3); }
.doc a:hover { border-bottom-color: var(--indigo); }
.doc ul, .doc ol { margin: 12px 0; padding-left: 22px; }
.doc li { margin: 5px 0; }
.doc strong { color: var(--ink); font-weight: 700; }
.doc code { font-family: var(--mono); font-size: 0.88em; background: var(--code-bg); padding: 1.5px 6px; border-radius: 6px; }
.doc hr { border: none; border-top: 1px solid var(--line); margin: 32px 0; }

.doc blockquote {
  margin: 18px 0; padding: 12px 16px; border-left: 3px solid var(--indigo);
  background: var(--indigo-soft); border-radius: 0 8px 8px 0; color: var(--ink-soft);
}
.doc blockquote p { margin: 4px 0; }

/* Callout via blockquote starting with "Tip:" handled in markdown as **Tip:** */

/* ── Tables (incl. in-app help-table markup) ─────────────── */
.doc table, .help-table {
  width: 100%; border-collapse: collapse; margin: 16px 0;
  font-size: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.doc th, .doc td, .help-table th, .help-table td {
  text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top;
}
.doc thead th, .help-table thead th {
  background: #fafbfe; font-weight: 600; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-faint);
}
.doc tr:last-child td, .help-table tr:last-child td { border-bottom: none; }

/* kbd + status codes + severity dots (mirror in-app help markup) */
.kbd, .status-code {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  background: #fff; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 7px; color: var(--ink);
}
.status-code { background: var(--code-bg); border-bottom-width: 1px; }
.severity-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.severity-dot.high { background: #ef4444; }
.severity-dot.medium { background: #fb923c; }
.severity-dot.low { background: #22c55e; }

/* ── Screenshots ─────────────────────────────────────────── */
.shot { margin: 22px 0; }
.shot-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.shot img {
  display: block; width: 100%; height: auto; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 28px rgba(30,34,48,0.08);
}
.shot figcaption { margin-top: 8px; font-size: 13px; color: var(--ink-faint); text-align: center; }
.shot-pending .shot-ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  aspect-ratio: 16 / 9; border: 1px dashed var(--line); border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, #fafbfe, #fafbfe 12px, #f3f5fb 12px, #f3f5fb 24px);
  color: var(--ink-faint);
}
.shot-ph-label { font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; font-size: 12px; }
.shot-ph code { background: #fff; border: 1px solid var(--line); }
.shot-ph-hint { font-size: 12px; }

/* ── Prev / next ─────────────────────────────────────────── */
.prevnext { display: flex; justify-content: space-between; gap: 16px; margin: 48px 0 0; max-width: var(--maxw); }
.pn {
  flex: 1 1 0; display: flex; flex-direction: column; gap: 3px;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; background: var(--surface); border-bottom: 1px solid var(--line);
}
.pn:hover { border-color: var(--indigo); }
.pn.next { text-align: right; align-items: flex-end; }
.pn span { font-size: 12px; color: var(--ink-faint); }
.pn strong { color: var(--indigo-dark); font-size: 15px; }

.doc-footer { max-width: var(--maxw); margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.doc-footer p { font-size: 12.5px; color: var(--ink-faint); margin: 0; }

/* ── Lightbox ────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 80; display: flex;
  align-items: flex-start; justify-content: center;
  background: rgba(15,18,28,0.85); padding: 5vh 4vw; overflow: auto;
}
.lightbox[hidden] { display: none; }
/* Width-constrained, natural height — long screenshots render full-size and the
   overlay scrolls (rather than shrinking to fit the viewport height). */
.lightbox img {
  display: block; width: auto; max-width: min(1100px, 94vw); height: auto;
  border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: fixed; top: 18px; right: 22px; width: 42px; height: 42px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.18); color: #fff; font-size: 24px; cursor: pointer;
  z-index: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,0.22); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; z-index: 25;
    transform: translateX(-100%); transition: transform 0.2s ease;
    background: var(--surface); width: min(86vw, var(--sidebar-w));
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .content { padding: 26px 20px 56px; }
}
@media (max-width: 620px) {
  .brand-tag { display: none; }
  .topbar-help { font-size: 18px; }
  .topbar-cta { padding: 8px 12px; font-size: 13px; }
}
@media (max-width: 480px) {
  .topbar-help { display: none; }
}
