/* FxMath Elliott Wave Pro — documentation stylesheet
   Self-contained: no web fonts, no CDN. Works from file:// and from the app. */

:root {
  --bg: #ffffff;
  --bg-alt: #f6f8fb;
  --panel: #ffffff;
  --border: #e2e7ef;
  --text: #1b2330;
  --muted: #5f6b7d;
  --accent: #b8860b;
  --accent-soft: #fdf6e3;
  --green: #12876f;
  --red: #c0392b;
  --code-bg: #f2f4f8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #0e1117;
  --bg-alt: #121722;
  --panel: #151a23;
  --border: #232c3a;
  --text: #dbe2ec;
  --muted: #8b97a8;
  --accent: #f5c542;
  --accent-soft: #1e1a0d;
  --green: #2bb39a;
  --red: #ef6b66;
  --code-bg: #10151d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  padding: 20px 16px 40px;
}

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand b { font-size: 14px; letter-spacing: .02em; display: block; }
.brand span { font-size: 11px; color: var(--muted); }

.search-box { margin: 16px 0 10px; position: relative; }
.search-box input {
  width: 100%; padding: 8px 10px 8px 30px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 13px;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-box::before {
  content: "⌕"; position: absolute; left: 10px; top: 6px; color: var(--muted); font-size: 16px;
}

.toc { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 1px 0; }
.toc a {
  display: block; padding: 6px 9px; border-radius: 7px;
  color: var(--muted); text-decoration: none; font-size: 13px;
  border-left: 2px solid transparent;
}
.toc a:hover { background: var(--panel); color: var(--text); }
.toc a.active { color: var(--text); background: var(--panel); border-left-color: var(--accent); font-weight: 600; }
.toc .num { display: inline-block; width: 20px; color: var(--muted); font-family: var(--mono); font-size: 11px; }

.sidebar-foot { margin-top: 18px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.sidebar-foot a { color: var(--muted); }

/* ---------- main ---------- */
main { padding: 40px 48px 120px; max-width: 980px; }

.hero { padding-bottom: 26px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.hero h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; max-width: 70ch; }

.toolbar { display: flex; gap: 8px; margin: 14px 0 0; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: 8px; padding: 7px 12px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

section.chapter { padding-top: 34px; }
section.chapter h2 {
  font-size: 24px; margin: 0 0 6px; letter-spacing: -.01em;
  scroll-margin-top: 20px;
}
section.chapter h2 .n {
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  margin-right: 10px; vertical-align: 2px;
}
section.chapter > p.lead { color: var(--muted); margin: 0 0 18px; max-width: 72ch; }

h3 { font-size: 16px; margin: 26px 0 8px; }
h4 { font-size: 13.5px; margin: 18px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

p { margin: 10px 0; }
a { color: var(--accent); }
ul, ol { margin: 10px 0 10px 20px; padding: 0; }
li { margin: 4px 0; }
strong { font-weight: 650; }
code {
  font-family: var(--mono); font-size: .88em;
  background: var(--code-bg); padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border);
}
pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.55; position: relative;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  border-radius: 6px; padding: 2px 7px; font-size: 10px; cursor: pointer; opacity: 0;
  transition: opacity .15s;
}
pre:hover .copy-btn { opacity: 1; }

table {
  width: 100%; border-collapse: collapse; margin: 14px 0;
  font-size: 13.5px;
}
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
tbody tr:hover { background: var(--bg-alt); }
td code { white-space: nowrap; }

figure { margin: 18px 0; }
figure img {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); display: block;
}
figcaption { font-size: 12px; color: var(--muted); margin-top: 8px; text-align: center; }

.callout {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 16px 0; font-size: 14px;
}
.callout.warn { border-left-color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); }
.callout.tip { border-left-color: var(--green); background: color-mix(in srgb, var(--green) 8%, transparent); }
.callout b { display: block; margin-bottom: 2px; }

.kbd {
  display: inline-block; min-width: 20px; text-align: center;
  font-family: var(--mono); font-size: 11px;
  padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--border); border-bottom-width: 2px;
  background: var(--panel); color: var(--text);
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card-mini {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  background: var(--panel);
}
.card-mini h4 { margin-top: 0; }

/* search results */
.results { display: none; margin-top: 10px; }
.results.on { display: block; }
.results a { display: block; font-size: 12px; padding: 5px 8px; border-radius: 6px; color: var(--text); text-decoration: none; }
.results a:hover { background: var(--panel); }
.results a span { color: var(--muted); display: block; font-size: 11px; }
mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

.top-btn {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  cursor: pointer; display: none; box-shadow: var(--shadow); font-size: 16px;
}
.top-btn.on { display: block; }

footer.doc-foot {
  margin-top: 60px; padding-top: 18px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 12px;
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  main { padding: 24px 18px 80px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------- print ---------- */
@media print {
  .sidebar, .toolbar, .top-btn, .copy-btn { display: none !important; }
  .layout { display: block; }
  main { max-width: none; padding: 0; }
  section.chapter { page-break-inside: avoid; }
  figure img { box-shadow: none; }
  body { font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
}

.no-deco { text-decoration: none; }
