/* Ledgerman guides: long-form articles. Same tokens and header as the Trust Centre
   (ledgerman/trust/index.html); kept in one file because every guide shares it. */
:root {
  --paper: #fcfbfd;
  --surface: #f4eff6;
  --ink: #1e1522;
  --muted: #65586b;
  --rule: #e3dbe7;
  --brand: #b3007f;
  --brand-fill: #cc0099;
  --amber: #ff9900;
  --amber-ink: #8a4b00;
  --on-brand: #ffffff;
  --ok: #1f7a4d;
  --bad: #b3261e;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --figures: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.45rem, 1.2rem + 1vw, 1.8rem);
  --step-3: clamp(2rem, 1.5rem + 2.2vw, 2.8rem);
  --measure: 68ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141017; --surface: #1e1822; --ink: #f2ecf4; --muted: #ab9fb1; --rule: #31283a;
    --brand: #ff6ad5; --brand-fill: #cc0099; --amber: #ffad33; --amber-ink: #ffc266; --on-brand: #ffffff;
    --ok: #6fd3a0; --bad: #ff8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141017; --surface: #1e1822; --ink: #f2ecf4; --muted: #ab9fb1; --rule: #31283a;
  --brand: #ff6ad5; --brand-fill: #cc0099; --amber: #ffad33; --amber-ink: #ffc266; --on-brand: #ffffff;
  --ok: #6fd3a0; --bad: #ff8a80;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: var(--step-0)/1.65 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-underline-offset: 0.18em; }
a:focus-visible, .btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); font-stretch: 118%; line-height: 1.14; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--step-3); font-weight: 800; }
h2 { font-size: var(--step-2); font-weight: 800; }
h3 { font-size: var(--step-1); font-weight: 700; font-stretch: 112%; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
.tag { font-family: var(--figures); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.fine { font-size: var(--step--1); color: var(--muted); }
code { font-family: var(--figures); font-size: 0.86em; background: var(--surface); padding: 0.1em 0.35em; border-radius: 4px; }
.num { font-family: var(--figures); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrap { max-width: 72rem; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
@media (min-width: 640px) { .wrap { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); } }

/* Header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper); }
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 800; font-stretch: 118%; font-size: 1.15rem; }
.brand img { width: 32px; height: 32px; display: block; }
.nav { display: flex; gap: 20px; margin-left: auto; font-size: var(--step--1); }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); }
@media (max-width: 760px) { .nav { display: none; } .site-header .btn { margin-left: auto; } }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; font: 600 var(--step--1)/1.2 var(--body); border-radius: 6px; text-decoration: none; border: 1.5px solid var(--brand-fill); }
.btn-primary { background: var(--brand-fill); color: var(--on-brand); }
.btn-primary:hover { background: #a8007e; border-color: #a8007e; }
.btn-ghost { color: var(--brand); background: transparent; }

/* Article */
.crumbs { font-size: var(--step--1); color: var(--muted); }
.crumbs a { color: var(--muted); }
.article-head { padding-block: clamp(36px, 6vw, 64px) 28px; display: grid; gap: 16px; max-width: 52rem; }
.article-head .lead { font-size: var(--step-1); line-height: 1.5; max-width: var(--measure); }
.layout { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); padding-block: 8px 72px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }
.toc { position: sticky; top: 84px; display: grid; gap: 8px; font-size: var(--step--1); }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.prose { display: grid; gap: 48px; min-width: 0; }
.prose section { display: grid; gap: 16px; min-width: 0; }
.prose section > p, .prose section > ul, .prose section > ol { max-width: var(--measure); }
.prose h3 { margin-top: 8px; }

.summary { border-left: 4px solid var(--brand-fill); background: var(--surface); padding: 16px 20px; border-radius: 0 8px 8px 0; display: grid; gap: 8px; max-width: var(--measure); }
.summary strong { font-family: var(--display); font-stretch: 112%; }

/* Definition cards: the three layers */
.layers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .layers { grid-template-columns: minmax(0, 1fr); } }
.layer { border: 1px solid var(--rule); border-top: 4px solid var(--c, var(--brand-fill)); border-radius: 8px; padding: 14px 16px; display: grid; gap: 6px; align-content: start; font-size: var(--step--1); }
.layer strong { font-family: var(--display); font-stretch: 112%; font-size: 1.05rem; }
.layer .q { color: var(--muted); }
.layer.budget { --c: var(--muted); }
.layer.committed { --c: var(--amber); }
.layer.actuals { --c: var(--brand-fill); }

/* Stacked bar: budget vs committed vs actuals for one project-year */
.bars { display: grid; gap: 10px; max-width: 46rem; }
.bar-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) 7.5rem; gap: 12px; align-items: center; font-size: var(--step--1); }
@media (max-width: 560px) { .bar-row { grid-template-columns: 5.5rem minmax(0, 1fr); } .bar-row .num { grid-column: 2; } }
.track { height: 22px; background: var(--surface); border-radius: 4px; position: relative; overflow: hidden; }
.fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.fill.budget { background: var(--muted); opacity: 0.55; }
.fill.committed { background: var(--amber); }
.fill.actuals { background: var(--brand-fill); }
.fill.over { background: repeating-linear-gradient(135deg, var(--bad) 0 6px, transparent 6px 10px); }

/* Tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; }
table.data { border-collapse: collapse; width: 100%; min-width: 520px; font-size: var(--step--1); }
.data caption { text-align: left; padding: 10px 14px; font-weight: 600; border-bottom: 1px solid var(--rule); }
.data th, .data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.data td.r, .data th.r { text-align: right; }
.data thead th { background: var(--surface); font-weight: 600; }
.data tbody tr:last-child th, .data tbody tr:last-child td { border-bottom: 0; }
.data tbody th { font-weight: 600; }
.data tr.total th, .data tr.total td { border-top: 2px solid var(--ink); font-weight: 600; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }

.formula { font-family: var(--figures); font-size: 0.92rem; background: var(--surface); border-radius: 6px; padding: 12px 14px; overflow-x: auto; max-width: var(--measure); white-space: pre; }

.callout { border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); padding: 18px 20px; display: grid; gap: 10px; max-width: var(--measure); }
.warn { border-color: var(--amber); }

/* End of article: the product */
.cta { border-top: 2px solid var(--ink); padding-top: 28px; display: grid; gap: 14px; max-width: var(--measure); }
.cta .actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Guide list */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 16px; padding-block: 8px 72px; }
.card { border: 1px solid var(--rule); border-radius: 10px; padding: 20px; display: grid; gap: 10px; align-content: start; text-decoration: none; color: var(--ink); background: var(--paper); }
.card:hover { border-color: var(--brand-fill); }
.card h2 { font-size: var(--step-1); }
.card .more { color: var(--brand); font-weight: 600; font-size: var(--step--1); }

.related { display: grid; gap: 8px; max-width: var(--measure); }

footer { border-top: 1px solid var(--rule); font-size: var(--step--1); color: var(--muted); }
footer .wrap { padding-block: 28px; display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
footer a { color: var(--muted); }
