/* The user manual: its contents sidebar, and the prose that comes out of the Markdown files.
 *
 * Why this is hand-written CSS and not Tailwind utilities, unlike every other page here: the chapter
 * body is HTML produced at RUNTIME by a Markdown renderer. Tailwind compiles at build time by scanning
 * the source for class names, and it does not read Content/Manual/*.md — so a `class="text-[15px]"` in
 * rendered output would name a utility that was never generated, and the chapter would render unstyled.
 * Element selectors under .manual-body have no such dependency.
 *
 * Everything below resolves to the same design tokens as the rest of the app (base.css / dark.css), so
 * the manual re-skins with the theme instead of being a light-only island.
 */

/* ============================================================================================
   CONTENTS SIDEBAR
   ============================================================================================ */

.manual-nav-link {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0.4rem;
  border-radius: 0.375rem;
  font-size: 13px;
  line-height: 1.45;
  color: rgb(var(--c-muted));
  transition: color 0.12s, background-color 0.12s;
}

.manual-nav-link:hover {
  color: rgb(var(--c-ink));
  background: rgb(var(--c-track) / 0.6);
}

.manual-nav-link.is-current {
  color: rgb(var(--c-ink));
  background: rgb(var(--c-track));
  font-weight: 500;
}

/* The number is a fixed-width column so the titles line up whatever the digit count — and it is the
   one place a reader can say "chapter 14" out loud to a colleague. */
.manual-nav-number {
  flex-shrink: 0;
  width: 1.35rem;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: end;
  opacity: 0.55;
}

/* A part whose every chapter was filtered out hides its heading too: a section title floating over no
   rows reads as a broken filter rather than an empty result. */
.manual-nav-part[hidden] { display: none !important; }
.manual-nav-item[hidden] { display: none !important; }

/* On a phone the contents open as a panel under the header rather than a sidebar beside the text. */
@media (max-width: 1023px) {
  .manual-nav {
    border-bottom: 1px solid rgb(var(--c-line) / 0.6);
  }
}

/* ============================================================================================
   CHAPTER PROSE
   ============================================================================================ */

.manual-body {
  font-size: 15px;
  line-height: 1.75;
  color: rgb(var(--c-inksoft));
  max-width: 46rem;
}

.manual-body > * + * { margin-top: 1.15rem; }

.manual-body h2 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  color: rgb(var(--c-ink));
  margin-top: 2.5rem;
  padding-top: 0.25rem;
  scroll-margin-top: 4.5rem;   /* the sticky header must not cover the heading a link jumps to */
}

.manual-body h3 {
  font-size: 16px;
  font-weight: 600;
  color: rgb(var(--c-ink));
  margin-top: 1.9rem;
  scroll-margin-top: 4.5rem;
}

.manual-body strong { color: rgb(var(--c-ink)); font-weight: 600; }

.manual-body a {
  color: rgb(var(--c-ink));
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgb(var(--c-bar));
}

.manual-body a:hover { text-decoration-color: rgb(var(--c-ink)); }

.manual-body ul, .manual-body ol { padding-inline-start: 1.35rem; }
.manual-body ul { list-style: disc; }
.manual-body ol { list-style: decimal; }
.manual-body li { margin-top: 0.4rem; }
.manual-body li::marker { color: rgb(var(--c-bar)); }

/* A numbered list in this manual is almost always a sequence of steps somebody is following with one
   hand on the mouse, so the numerals get weight the surrounding prose does not. */
.manual-body ol > li::marker {
  color: rgb(var(--c-muted));
  font-weight: 600;
}

/* Inline code is a literal — a button's exact label, a file name, a setting. It must be visibly not
   prose, because "press Save" and "press `Save`" are different promises. */
.manual-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
  background: rgb(var(--c-track));
  color: rgb(var(--c-ink));
}

.manual-body pre {
  background: rgb(var(--c-track) / 0.7);
  border: 1px solid rgb(var(--c-line));
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}

.manual-body pre code { background: none; padding: 0; }

/* Tables carry the "this field means that" content in most chapters. They scroll inside their own box
   rather than widening the page — a chapter that scrolls sideways on a laptop is a chapter nobody
   finishes reading. */
.manual-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  display: block;
  overflow-x: auto;
}

.manual-body thead th {
  text-align: start;
  font-weight: 600;
  color: rgb(var(--c-ink));
  border-bottom: 1px solid rgb(var(--c-bar));
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}

.manual-body tbody td {
  border-bottom: 1px solid rgb(var(--c-line));
  padding: 0.5rem 0.75rem;
  vertical-align: top;
}

.manual-body tbody tr:last-child td { border-bottom: 0; }

/* A blockquote in a chapter is a caution — "this cannot be undone", "only an owner sees this". The bar
   is on the inline-start edge so it mirrors correctly in Arabic without a second rule. */
.manual-body blockquote {
  border-inline-start: 3px solid rgb(var(--c-bar));
  padding: 0.15rem 0 0.15rem 0;
  padding-inline-start: 1rem;
  color: rgb(var(--c-muted));
}

.manual-body blockquote > * + * { margin-top: 0.6rem; }

/* Screenshots. Bordered because a screenshot of a mostly-white application on a white page has no edge
   of its own, and the reader cannot tell where the product stops and the manual starts. */
.manual-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid rgb(var(--c-line));
  border-radius: 0.5rem;
  margin-top: 1.25rem;
}

.manual-body hr {
  border: 0;
  border-top: 1px solid rgb(var(--c-line));
  margin-top: 2.25rem;
}

/* ============================================================================================
   DARK THEME
   ============================================================================================ */

/* Only the surfaces that were spelled as literal white need a rule; everything else already reads a
   token and re-tints on its own. */
.dark .manual-nav input[type="search"] {
  background: rgb(var(--c-surface));
  color: rgb(var(--c-ink));
}

/* A screenshot is a picture of a light-themed application. On a dark page a hard white rectangle
   glares, so the border warms and the image is very slightly dimmed — enough to sit in the page,
   not enough to misrepresent what the screen looks like. */
.dark .manual-body img {
  border-color: rgb(var(--c-bar) / 0.3);
  filter: brightness(0.94);
}
