/* Forest Metrix User Manual — shared stylesheet for every chapter.
   Layout: a sticky chapter contents rail beside one reading column; screenshots
   sit in phone frames to the right of the text they illustrate and stack under
   it on narrow screens. */
:root {
  --ink: #1f2a36;        /* the app's slate header */
  --paper: #f4f5f1;      /* cool, faintly green page */
  --panel: #ffffff;
  --forest: #4b6b55;     /* the app's primary green */
  --bark: #86643a;       /* the wordmark's rings */
  --muted: #5d6a64;
  --line: #d8ddd4;
  --tint: #e8ede5;
  --pro: #2f6f8f;
  --max: #86643a;
  --warn-bg: #fbf3e4;
  --warn-ink: #6b4a14;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e4e8e2; --paper: #12181d; --panel: #1a2228; --forest: #8db398;
    --bark: #c9a467; --muted: #a3ada8; --line: #2c363d; --tint: #1f2a2f;
    --pro: #7fb6d1; --max: #c9a467; --warn-bg: #2a2416; --warn-ink: #e7cf9c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e4e8e2; --paper: #12181d; --panel: #1a2228; --forest: #8db398;
  --bark: #c9a467; --muted: #a3ada8; --line: #2c363d; --tint: #1f2a2f;
  --pro: #7fb6d1; --max: #c9a467; --warn-bg: #2a2416; --warn-ink: #e7cf9c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.6 var(--body);
  padding-inline: 16px;
}
a { color: var(--forest); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }

/* ── Masthead ───────────────────────────────────────────── */
.masthead {
  max-width: 1180px; margin: 0 auto; padding-block: 28px 18px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--display); font-stretch: 125%; font-weight: 700;
  letter-spacing: .32em; text-transform: uppercase; font-size: 15px; color: var(--ink);
  text-decoration: none;
}
.wordmark span { color: var(--bark); }
.masthead .edition { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ── Page grid ──────────────────────────────────────────── */
.page { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; padding-block: 32px 80px; }
@media (max-width: 900px) { .page { grid-template-columns: minmax(0, 1fr); gap: 20px; } }

.toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 20px); align-self: start; font-size: 15px; }
@media (max-width: 900px) { .toc { position: static; border-bottom: 1px solid var(--line); padding-bottom: 16px; } }
.toc h2 { font-family: var(--display); font-stretch: 112%; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.toc a { color: var(--ink); text-decoration: none; display: grid; grid-template-columns: 2.4em 1fr; }
.toc a:hover { color: var(--forest); }
.toc .n { font-family: var(--mono); font-size: 13px; color: var(--bark); padding-top: 2px; }

/* ── Chapter heading ────────────────────────────────────── */
.chapter-head { display: grid; gap: 6px; margin-bottom: 30px; }
.chapter-head .eyebrow { font-family: var(--mono); font-size: 13px; color: var(--bark); letter-spacing: .06em; }
.chapter-head h1 {
  font-family: var(--display); font-stretch: 118%; font-weight: 800; letter-spacing: -.01em;
  font-size: clamp(32px, 5vw, 50px); line-height: 1.05; margin: 0; text-wrap: balance;
}
.chapter-head .lede { font-size: 19px; color: var(--muted); max-width: 62ch; margin: 6px 0 0; }

main section { padding-top: 26px; margin-top: 26px; border-top: 1px solid var(--line); }
main section:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
h2.sec {
  font-family: var(--display); font-stretch: 110%; font-weight: 700; font-size: 26px; line-height: 1.2;
  margin: 0 0 12px; text-wrap: balance; display: flex; gap: .5em; align-items: baseline;
}
h2.sec .n { font-family: var(--mono); font-weight: 500; font-size: 16px; color: var(--bark); }
h3 { font-family: var(--display); font-stretch: 105%; font-size: 19px; margin: 26px 0 8px; }
p, li { max-width: 66ch; }
ol.steps { padding-left: 1.3em; display: grid; gap: 8px; }
ol.steps li::marker { font-family: var(--mono); color: var(--bark); }

/* UI words the reader will see on screen. */
.ui {
  font-family: var(--display); font-stretch: 100%; font-weight: 600; font-size: .86em;
  padding: .08em .45em; border-radius: 5px; background: var(--tint); border: 1px solid var(--line);
  white-space: nowrap;
}
.term { font-weight: 600; }

/* Version badges. */
.ver { font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  border-radius: 4px; padding: 2px 6px; vertical-align: 2px; border: 1px solid currentColor; }
.ver.pro { color: var(--pro); }
.ver.max { color: var(--max); }

/* ── Text + screenshot rows ─────────────────────────────── */
.with-shot { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 32px; align-items: start; }
.with-shot.two { grid-template-columns: minmax(0, 1fr) 250px 250px; }
@media (max-width: 1080px) { .with-shot.two { grid-template-columns: minmax(0, 1fr) 250px; } .with-shot.two figure:last-child { grid-column: 2; } }
@media (max-width: 700px) { .with-shot, .with-shot.two { grid-template-columns: minmax(0, 1fr); } .with-shot.two figure:last-child { grid-column: auto; } }
.with-shot > div { min-width: 0; }

figure.phone { margin: 0; display: grid; gap: 8px; justify-items: center; }
figure.phone img {
  width: 100%; max-width: 250px; height: auto; display: block;
  border-radius: 26px; border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line), 0 10px 24px -14px rgba(20, 30, 40, .45);
  background: var(--panel);
}
figcaption { font-size: 14px; color: var(--muted); max-width: 250px; line-height: 1.4; }
figcaption b { font-family: var(--mono); font-weight: 500; color: var(--bark); margin-right: .35em; }

/* A strip of sequential screens (wizard steps). */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 200px; gap: 20px; overflow-x: auto; padding: 6px 2px 14px; scroll-snap-type: x proximity; }
.strip figure { scroll-snap-align: start; }
.strip figure.phone img { max-width: 200px; border-radius: 22px; }
.strip figcaption { max-width: 200px; }

/* ── Tables and callouts ────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 14px 0; }
table { border-collapse: collapse; min-width: 520px; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
th { font-family: var(--display); font-stretch: 105%; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
td:first-child { font-weight: 600; white-space: nowrap; }

.note { border-left: 3px solid var(--forest); background: var(--tint); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 16px 0; max-width: 66ch; }
.note.warn { border-color: var(--bark); background: var(--warn-bg); color: var(--warn-ink); }
.note p { margin: 0; }
.note p + p { margin-top: 6px; }
.note .label { font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; display: block; margin-bottom: 3px; }

/* Review-only panel; removed before publishing. */
.draft { border: 1px dashed var(--bark); border-radius: 10px; padding: 14px 18px; margin-bottom: 34px; background: var(--panel); max-width: 72ch; }
.draft h2 { font-family: var(--display); font-size: 14px; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 6px; color: var(--bark); }
.draft ul { margin: 0; padding-left: 1.2em; }

.chapter-nav { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-family: var(--display); }

/* Desktop screenshots (account website, Office pages) in a browser frame. */
figure.browser { margin: 18px 0; display: grid; gap: 8px; max-width: 760px; }
figure.browser .frame { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); box-shadow: 0 10px 24px -16px rgba(20, 30, 40, .45); }
figure.browser .bar { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-bottom: 1px solid var(--line); background: var(--tint); font-family: var(--mono); font-size: 12px; color: var(--muted); }
figure.browser .bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; }
figure.browser .bar span { margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
figure.browser img { display: block; width: 100%; height: auto; }
figure.browser figcaption { max-width: none; }
figure.browser.dialog { max-width: 400px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 760px) { .pair { grid-template-columns: minmax(0, 1fr); } }
.pending { border: 1px dashed var(--line); border-radius: 26px; aspect-ratio: 9 / 19.5; max-width: 250px; width: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 14px; padding: 16px; background: var(--panel); }

/* Contents page. */
main.contents { max-width: 860px; margin: 0 auto; padding-block: 36px 80px; }
ol.chapters { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
ol.chapters li > a, ol.chapters li.todo { display: grid; grid-template-columns: 3em minmax(0, 1fr); gap: 8px; padding: 14px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); }
ol.chapters li > a:hover { background: var(--tint); }
ol.chapters .cn { font-family: var(--display); font-stretch: 118%; font-weight: 800; font-size: 26px; color: var(--bark); line-height: 1; }
ol.chapters strong { display: block; font-family: var(--display); font-stretch: 108%; font-size: 19px; }
ol.chapters em { display: block; font-style: normal; color: var(--muted); font-size: 15px; max-width: 64ch; }
ol.chapters li.todo { opacity: .55; }

/* Findings page. */
main.findings ul { padding-left: 1.2em; display: grid; gap: 8px; }
main.findings li { max-width: 72ch; }
main.findings code { font-family: var(--mono); font-size: .85em; }
.findings-link { margin-top: 28px; font-family: var(--display); }
.pdf-save { font: inherit; color: var(--forest); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.pdf-save:disabled { opacity: .6; cursor: progress; }
.pdf-status { font-family: var(--body, inherit); font-size: 14px; color: var(--muted); margin-left: 8px; }
a.xref { color: inherit; text-decoration: underline; text-decoration-color: var(--forest); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
a.xref:hover { color: var(--forest); }
