/* =============================================================
   MeioFlow — manual.css
   User Manual page. Extends formatting_guide.css (shared layout,
   TOC/side-nav, .fg-section heading/paragraph rules, .fg-rules)
   with the element types the Formatting Guide
   doesn't use: h3 subheadings, prose lists, screenshots, and the
   reading aids below (UI chips, note rows, callouts, quality
   badges, pipeline flow).

   Component class names are generic (no "manual-" prefix) so the
   Methods & References page can reuse them. Colours come only
   from base.css tokens.
   ============================================================= */

/* -------------------------------------------------------------
   TEXT
   ------------------------------------------------------------- */
.fg-section h3 {
  margin: 18px 0 0;
  font-size: 16px;
  font-weight: 600;
}

.fg-section h2 + h3 {
  margin-top: 0;
}

.fg-section ul,
.fg-section ol {
  margin: 0;
  padding-left: 22px;
  font-size: var(--text-md);
  line-height: 1.6;
}

.fg-section li + li {
  margin-top: 4px;
}

.fg-section pre {
  margin: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm-mid);
  line-height: 1.6;
  color: var(--color-text-primary);
}

/* Name of something on screen (button, tab, field, stage).
   Usage: <strong class="ui">Apply</strong> */
.fg-section strong.ui {
  display: inline-block;
  padding: 0 7px;
  font-size: 0.93em;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-btn);
  box-shadow: 0 1px 0 var(--color-border);
}

/* Button-styled names: same colours as the buttons they stand for.
   Usage: <strong class="ui ui--primary">Upload dataset</strong> */
.fg-section strong.ui--primary {
  color: #fff;
  background: var(--color-brand);
  border-color: var(--color-brand);
  box-shadow: none;
}

.fg-section strong.ui--danger {
  color: #fff;
  background: var(--color-danger);
  border-color: var(--color-danger);
  box-shadow: none;
}

.fg-section strong.ui--warning {
  color: var(--color-warning-text);
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  box-shadow: none;
}

/* Short run-in label at the start of a paragraph.
   Usage: <strong class="lead">Summary at the top</strong> */
.fg-section strong.lead {
  margin-right: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-brand);
}

sup.footnote-marker {
  color: var(--color-brand);
  font-weight: 600;
  font-size: var(--text-xs);
  line-height: 0;
  margin-left: 2px;
}

.manual-note {
  color: var(--color-text-muted);
}

/* -------------------------------------------------------------
   NOTE ROW: label in the left column, explanation on the right.
   Usage:
   <div class="note-row">
     <div class="note-row__tag">Dash</div>
     <div class="note-row__body"><p>...</p></div>
   </div>
   ------------------------------------------------------------- */
.note-row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 4px 18px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.note-row__tag {
  padding-top: 3px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-brand);
}

.note-row__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* -------------------------------------------------------------
   CALLOUTS: builds on .banner (base.css). The amber variant is
   .banner--warning; this adds a teal "note" variant.
   Usage: <div class="banner banner--note">
            <div class="banner__icon">i</div>
            <div class="banner__text">...</div></div>
   ------------------------------------------------------------- */
.fg-section .banner {
  margin-bottom: 0;
}

.fg-section .banner__text {
  font-size: var(--text-md);
  line-height: 1.6;
}

.fg-section .banner__text p + p {
  margin-top: 8px;
}

.fg-section .banner__icon {
  margin-top: 3px;
}

.banner--note {
  background: var(--color-brand-bg-light);
  border-color: var(--color-brand-border);
  border-left-color: var(--color-brand);
}

.banner--note .banner__icon {
  background: var(--color-brand);
  color: #fff;
}

.banner--note .banner__text {
  color: var(--color-text-primary);
}

/* -------------------------------------------------------------
   QUALITY BADGES: same tokens as the MI / ITD cells in the app.
   Usage: <span class="q-badge q-badge--bad">Bad</span>
   ------------------------------------------------------------- */
.q-badge {
  display: inline-block;
  padding: 0 8px;
  font-size: 0.9em;
  font-weight: 600;
  line-height: 1.5;
  border-radius: var(--radius-md);
}

.q-badge--bad      { background: var(--color-q-red-bg);    color: var(--color-q-red-fg); }
.q-badge--poor     { background: var(--color-q-orange-bg); color: var(--color-q-orange-fg); }
.q-badge--moderate { background: var(--color-q-yellow-bg); color: var(--color-q-yellow-fg); }
.q-badge--good     { background: var(--color-q-green-bg);  color: var(--color-q-green-fg); }
.q-badge--high     { background: var(--color-q-blue-bg);   color: var(--color-q-blue-fg); }

/* -------------------------------------------------------------
   PIPELINE FLOW: boxes joined by arrows. Numbers match the
   stepper in the app (Upload 1, Audit 2, Results 3).
   ------------------------------------------------------------- */
.fg-section .pipeline {
  display: flex;
  gap: 30px;
  list-style: none;
  margin: 4px 0 6px;
  padding: 0;
}

.fg-section .pipeline > li {
  margin-top: 0;
}

.pipeline__step {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-brand) var(--tint, 0%), var(--color-surface));
  border-color: color-mix(in srgb, var(--color-brand) calc(var(--tint, 0%) + 12%), var(--color-border));
}

.pipeline__step:nth-child(2) { --tint: 5%; }
.pipeline__step:nth-child(3) { --tint: 10%; }
.pipeline__step:nth-child(4) { --tint: 15%; }
.pipeline__step:nth-child(5) { --tint: 20%; }

.pipeline__step + .pipeline__step::before {
  content: "→";
  position: absolute;
  left: -24px;
  top: 50%;
  width: 18px;
  transform: translateY(-50%);
  text-align: center;
  font-size: 16px;
  color: var(--color-text-faint);
}

.pipeline__num {
  width: var(--stepper-size);
  height: var(--stepper-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-brand);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.pipeline__title {
  font-size: var(--text-base+);
  font-weight: 600;
  line-height: 1.3;
}

.pipeline__note {
  font-size: var(--text-sm-mid);
  line-height: 1.4;
  color: var(--color-text-primary);
}

.fg-section .pipeline__sub {
  display: flex;
  flex-direction: column;
  gap: 3px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-sm-mid);
  line-height: 1.45;
  color: var(--color-text-primary);
}

.fg-section .pipeline__sub li + li {
  margin-top: 0;
}

/* -------------------------------------------------------------
   TABLES (reference tables built on .data-table)
   ------------------------------------------------------------- */
.fg-section .data-table th {
  text-align: left;
}

.fg-section .data-table td:first-child {
  font-weight: 500;
}

/* Rows are not clickable on this page. */
.fg-section .data-table tbody tr:hover {
  cursor: default;
}

/* -------------------------------------------------------------
   NUMBERED RULES (.fg-rules from formatting_guide.css), used
   without the label row.
   ------------------------------------------------------------- */
.fg-rules .fg-rule:first-child {
  border-top: 0;
}

/* -------------------------------------------------------------
   FIGURES
   ------------------------------------------------------------- */
/* Screenshot placeholders — reuses .fg-figure / figcaption; only the
   empty media box itself (normally an <img>) needs new rules. */
.manual-figure__media {
  min-height: 120px;
  border: 1px dashed var(--color-brand-border);
  background: var(--color-surface-subtle);
}

.manual-figure__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* Real screenshots — fill the full width of the figure frame instead of
   .fg-figure__media's default centered/height-capped diagram treatment,
   with height scaling to keep the screenshot's own proportions. */
.manual-screenshot .fg-figure__media {
  padding: 0;
}

/* Teal border (lighter than --color-brand) so screenshots read as
   distinct from the surrounding page, overriding .fg-figure's plain
   1px grey border — thicker too, so it isn't lost next to it. */
.manual-screenshot {
  border-width: 2px;
  border-color: var(--color-brand-border);
}

.manual-screenshot .fg-figure__media img {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  display: block;
}

/* Narrower variant — the frame itself shrinks and is centred, so the
   screenshot fills it with no empty side bands. */
.manual-screenshot--narrow {
  max-width: 62%;
  margin-inline: auto;
}

/* -------------------------------------------------------------
   NARROW SCREENS
   ------------------------------------------------------------- */
@media (max-width: 760px) {
  .note-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .manual-screenshot--narrow {
    max-width: 100%;
  }

  .fg-section .pipeline {
    flex-direction: column;
    gap: 28px;
  }

  .pipeline__step + .pipeline__step::before {
    content: "↓";
    left: 50%;
    top: -24px;
    transform: translateX(-50%);
  }
}
