/* The Process Turbine library (docs/MARKETING-PLAN.md §4): inline in every standalone document, and
   site/assets/library.css on the website. Colours are the app's: slate #2b3643, teal #1caf9a, the logo's lime. */
:root {
  --l-bg: #f6f8fa;
  --l-paper: #ffffff;
  --l-text: #1f2a36;
  --l-muted: #4d5b69;
  --l-line: #d5dde4;
  --l-band: #eef3f6;
  --l-slate: #2b3643;
  --l-teal: #13897a;
  --l-teal-strong: #0f6f63;
  --l-lime: #c6d22a;
  --l-node: #ffffff;
  --l-node-line: #9fb0bf;
  --l-code: #eef2f5;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --l-bg: #141b23; --l-paper: #1c2530; --l-text: #e6ebf0; --l-muted: #a9b6c3; --l-line: #2f3b48;
    --l-band: #18212b; --l-teal: #1caf9a; --l-teal-strong: #39c6b0; --l-node: #1f2a36; --l-node-line: #4a5a6b;
    --l-code: #232e3a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --l-bg: #141b23; --l-paper: #1c2530; --l-text: #e6ebf0; --l-muted: #a9b6c3; --l-line: #2f3b48;
  --l-band: #18212b; --l-teal: #1caf9a; --l-teal-strong: #39c6b0; --l-node: #1f2a36; --l-node-line: #4a5a6b;
  --l-code: #232e3a; color-scheme: dark;
}

/* ── A standalone document's own page ── */
body.standalone {
  margin: 0;
  background: var(--l-bg);
  color: var(--l-text);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.standalone .doc-head,
body.standalone .toc,
body.standalone .doc,
body.standalone .doc-foot { max-width: 820px; margin-left: auto; margin-right: auto; padding-left: 16px; padding-right: 16px; }
body.standalone .doc-head {
  display: flex; gap: 16px; align-items: flex-start;
  padding-top: 32px; padding-bottom: 20px; border-bottom: 4px solid var(--l-lime);
}
.doc-logo { flex: 0 0 auto; margin-top: 4px; }
.doc-brand { margin: 0; color: var(--l-teal-strong); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .8rem; }
.doc-head h1 { margin: .15em 0 .3em; font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; letter-spacing: -0.01em; }
.doc-lede { margin: 0; color: var(--l-muted); font-size: 1.1rem; }
.doc-download { margin: 14px 0 0; }
.doc-foot { color: var(--l-muted); font-size: .9rem; border-top: 1px solid var(--l-line); margin-top: 40px; padding-top: 16px; padding-bottom: 32px; }
.doc-foot a { color: var(--l-teal-strong); }

/* ── Contents ── */
.toc { margin-top: 20px; }
.toc h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--l-muted); margin: 0 0 6px; }
.toc ol { margin: 0; padding-left: 1.3em; columns: 2 16em; column-gap: 2em; }
.toc li { margin: 2px 0; break-inside: avoid; }
.toc a { color: var(--l-teal-strong); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ── The document ── */
.doc { padding-top: 8px; }
.doc h2 { font-size: 1.5rem; margin: 2em 0 .5em; padding-top: .3em; border-top: 1px solid var(--l-line); }
.doc h3 { font-size: 1.15rem; margin: 1.5em 0 .4em; }
.doc p, .doc li { max-width: 70ch; }
.doc a { color: var(--l-teal-strong); }
.doc img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--l-line); }
.doc figure { margin: 1.5em 0; }
.doc dl { margin: 1em 0; }
.doc dt { font-weight: 650; margin-top: .9em; }
.doc dd { margin: .2em 0 0; color: var(--l-muted); }
.doc img.phone { display: block; width: min(280px, 80%); margin: 0 auto; }
.doc img.dialog { display: block; width: min(460px, 100%); margin: 0 auto; }
.doc figure:has(img.phone) figcaption, .doc figure:has(img.dialog) figcaption { text-align: center; }
.doc figcaption { color: var(--l-muted); font-size: .9rem; margin-top: 6px; }
.doc blockquote { margin: 1.2em 0; padding: .6em 1em; border-left: 4px solid var(--l-teal); background: var(--l-band); border-radius: 0 8px 8px 0; }
.doc blockquote p { margin: .3em 0; }
.doc code { background: var(--l-code); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.doc hr { border: 0; border-top: 1px solid var(--l-line); margin: 2em 0; }

/* Wide tables scroll in their own box, never the page. */
.doc table { display: block; overflow-x: auto; border-collapse: collapse; margin: 1.2em 0; max-width: 100%; }
.doc th, .doc td { border: 1px solid var(--l-line); padding: 8px 12px; text-align: left; vertical-align: top; }
.doc th { background: var(--l-band); }

/* A row of cards: "<div class="cards">" with "<div>" children in the Markdown. */
.doc .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 1.2em 0; }
.doc .cards > div { background: var(--l-paper); border: 1px solid var(--l-line); border-radius: 12px; padding: 14px 16px; }
.doc .cards > div p { margin: .3em 0 0; color: var(--l-muted); }
.doc .cards > div p.tags { margin-top: .6em; line-height: 1.4; }
.doc .tags span { display: inline-block; margin: 4px 4px 0 0; padding: 1px 9px; border: 1px solid var(--l-line);
  border-radius: 999px; font-size: .74em; color: var(--l-muted); }
.doc .tags span.key { border-color: var(--l-teal); color: var(--l-teal-strong); }

/* Diagrams: inline SVG, coloured from the tokens so they read in light and dark. */
.doc .diagram { overflow-x: auto; margin: 1.5em 0; }
/* A wide diagram keeps a readable size on a phone and scrolls sideways in its own box. */
.doc .diagram svg { display: block; width: 100%; min-width: 620px; height: auto; margin: 0 auto; }
.dia-node { fill: var(--l-node); stroke: var(--l-node-line); stroke-width: 2; }
.dia-node.accent { stroke: var(--l-teal); stroke-width: 3; }
.dia-node.soft { fill: var(--l-band); }
.dia-edge { stroke: var(--l-teal); stroke-width: 2.5; fill: none; }
.dia-text { fill: var(--l-text); font: 600 14px system-ui, -apple-system, "Segoe UI", sans-serif; text-anchor: middle; }
.dia-small { fill: var(--l-muted); font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; text-anchor: middle; }
.dia-arrow { fill: var(--l-teal); }

/* A label for fictional examples (MARKETING-PLAN §4: every case study and example says so). */
.doc .fictional { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .03em; color: var(--l-slate);
  background: var(--l-lime); border-radius: 999px; padding: 2px 10px; }

/* ── On the website (site.css gives the page; these the document) ── */
.library-page { padding-top: 28px; padding-bottom: 40px; }
.library-page .doc-head.site { border-bottom: 4px solid var(--l-lime); padding-bottom: 18px; }
.crumbs { margin: 0 0 8px; font-size: .9rem; }
.crumbs a { color: var(--l-teal-strong); }
.doc-list { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 12px; }
.doc-list li { background: var(--l-paper); border: 1px solid var(--l-line); border-radius: 12px; padding: 14px 18px; display: grid; gap: 4px; }
.doc-list a { color: var(--l-text); text-decoration: none; font-size: 1.1rem; }
.doc-list a:hover b { color: var(--l-teal-strong); }
.doc-list span { color: var(--l-muted); }
.doc-list .for { font-size: .85rem; }

@media (max-width: 640px) {
  body.standalone .doc-head { flex-direction: column; gap: 8px; }
  .toc ol { columns: 1; }
}

/* ── Print: "Save as PDF" makes the PDF version ── */
@media print {
  :root { --l-bg: #fff; --l-paper: #fff; --l-text: #000; --l-muted: #333; --l-band: #f2f4f6; color-scheme: light; }
  body.standalone { font-size: 11pt; }
  .doc h2 { break-before: auto; break-after: avoid; }
  .doc h2.sheet ~ h2.sheet { break-before: page; }   /* feature sheets (D9): one printed page each */
  .doc figure, .doc .diagram, .doc table, .doc .cards > div { break-inside: avoid; }
  .doc a { color: #000; }
  .doc-download, .top, .crumbs { display: none; }
}
