:root {
  --paper: #f1f5f3;
  --surface: #ffffff;
  --ink: #16233a;
  --ink-2: #4b5a6e;
  --rule: #cfdbd5;
  --rule-soft: #e2eae6;
  --teal: #0b6b57;
  --teal-soft: #dcefe9;
  --amber: #8f5300;
  --hatch: #f3dfb4;
  --neg: #b42318;
  --focus: #2459c9;
  --sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  --serif: 'Literata', Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1922;
    --surface: #14212d;
    --ink: #e5edef;
    --ink-2: #9fb0bd;
    --rule: #2b3d4a;
    --rule-soft: #1f2f3b;
    --teal: #5cc9ab;
    --teal-soft: #173a35;
    --amber: #eab55a;
    --hatch: #3b3018;
    --neg: #ff8a7a;
    --focus: #8fb1ff;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.55 var(--sans); }
a { color: var(--teal); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* header / footer */
.site-head { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.head-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand svg { color: var(--teal); }
.site-head nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-head nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-weight: 500; font-size: 0.95rem; }
.site-head nav a:hover { color: var(--ink); background: var(--rule-soft); }
.site-head nav a[aria-current='page'] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--teal); border-radius: 0; }
.site-foot { border-top: 1px solid var(--rule); margin-top: 96px; padding: 32px 0 48px; color: var(--ink-2); font-size: 0.92rem; }
.foot-inner { display: grid; gap: 8px; max-width: 760px; }
.foot-inner p { margin: 0; }
.foot-inner strong { color: var(--ink); }

/* buttons */
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 8px; background: var(--ink); color: var(--paper); font-weight: 600; text-decoration: none; border: 1px solid var(--ink); }
.btn:hover { background: var(--teal); border-color: var(--teal); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--ink); background: var(--surface); }

/* value states: the visual language of the site */
.val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); white-space: nowrap; }
.val.neg { color: var(--neg); }
.val.partial { border-bottom: 2px dashed var(--amber); }
.unknown {
  display: inline-block; font-weight: 600; font-size: 0.9em; color: var(--amber); padding: 1px 10px; border-radius: 4px; white-space: nowrap;
  background: repeating-linear-gradient(135deg, var(--hatch) 0 5px, transparent 5px 10px);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 35%, transparent);
}
.unknown.big { font-size: 1.5rem; padding: 2px 14px; }

/* home */
.hero { padding: 56px 0 72px; border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; gap: 48px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.1fr 0.9fr; gap: 64px; } .hero { padding: 88px 0 96px; } }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4.6rem); line-height: 0.98; letter-spacing: -0.035em; font-weight: 600; margin: 0 0 24px; max-width: 12ch; }
.hero .lede { font: 400 1.2rem/1.6 var(--serif); color: var(--ink-2); max-width: 36em; margin: 0 0 32px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 0; }

.demo {
  margin: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 20px 20px 16px;
  box-shadow: 0 1px 0 var(--rule), 0 18px 40px -28px color-mix(in srgb, var(--ink) 45%, transparent);
}
.demo figcaption { font-size: 0.95rem; color: var(--ink-2); margin-bottom: 12px; }
.demo figcaption strong { color: var(--ink); display: block; }
.demo-rows { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.demo-row {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 4px; min-height: 52px;
  background: none; border: 0; border-bottom: 1px solid var(--rule); color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.demo-row:hover { background: var(--rule-soft); }
.demo-row .lbl { display: flex; flex-direction: column; font-weight: 500; }
.demo-row small { color: var(--ink-2); font-size: 0.82rem; font-weight: 400; }
.demo-row[aria-pressed='true'] .lbl { color: var(--ink-2); }
.demo-out { border-top: 2px solid var(--ink); margin-top: -1px; padding-top: 8px; }
.demo-line { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 4px; }
.demo-line.total { font-size: 1.1rem; }
.demo-line.per { font-size: 1.35rem; font-weight: 600; border-top: 1px solid var(--rule); padding-top: 10px; margin-top: 4px; }
.demo-line.per .val { color: var(--teal); }
.demo-note { font-size: 0.8rem; color: var(--ink-2); margin: 10px 4px 0; }

.principles { padding-top: 72px; }
.principles h2, .guides h2 { font-size: 1.6rem; letter-spacing: -0.02em; font-weight: 600; margin: 0 0 28px; }
.principle-grid { display: grid; gap: 32px; }
@media (min-width: 800px) { .principle-grid { grid-template-columns: repeat(3, 1fr); } }
.principle-grid h3 { font-size: 1.1rem; margin: 0 0 8px; padding-top: 14px; border-top: 2px solid var(--teal); }
.principle-grid p { margin: 0; font: 400 1rem/1.65 var(--serif); color: var(--ink-2); }
.guides { padding-top: 80px; }
.guide-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.guide a { display: grid; gap: 4px 48px; padding: 24px 0; border-bottom: 1px solid var(--rule); color: inherit; text-decoration: none; }
@media (min-width: 800px) { .guide a { grid-template-columns: 1.1fr 1fr; } .guide-tool { grid-column: 2; } }
.guide h3 { margin: 0; font-size: 1.3rem; line-height: 1.25; letter-spacing: -0.015em; font-weight: 600; grid-row: span 2; }
.guide a:hover h3 { color: var(--teal); text-decoration: underline; text-underline-offset: 0.18em; }
.guide p { margin: 0; color: var(--ink-2); font-family: var(--serif); }
.guide .guide-tool { font-family: var(--sans); font-size: 0.9rem; color: var(--teal); font-weight: 500; }

/* article */
.article-head { padding-top: 48px; padding-bottom: 40px; }
.article-head h1 { font-size: clamp(2rem, 4.4vw, 3.3rem); line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; margin: 0 0 20px; max-width: 22ch; }
.article-head .lede { font: 400 1.22rem/1.65 var(--serif); max-width: 40em; margin: 0 0 20px; }
.jump { margin: 0; font-weight: 600; }
.article-grid { display: grid; gap: 32px; border-top: 1px solid var(--rule); padding-top: 40px; }
@media (min-width: 1000px) { .article-grid { grid-template-columns: 210px minmax(0, 1fr); gap: 56px; } }
.toc { font-size: 0.92rem; }
.toc nav { position: sticky; top: 84px; }
.toc-title { font-weight: 600; margin: 0 0 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc a { display: block; padding: 5px 0 5px 14px; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--ink); border-left: 2px solid var(--teal); margin-left: -1px; padding-left: 13px; }
@media (max-width: 999px) { .toc { border: 1px solid var(--rule); border-radius: 8px; padding: 12px 16px; background: var(--surface); } .toc nav { position: static; } }

.prose { min-width: 0; }
.prose > :is(p, ul, ol, h2, h3, h4, pre, .table-wrap, .sources) { max-width: 70ch; }
.prose > p, .prose > :is(ul, ol) > li { font: 400 1.075rem/1.75 var(--serif); }
.prose > :is(ul, ol) > li { margin-bottom: 6px; }
.prose h2 { font-size: 1.7rem; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; margin: 64px 0 16px; }
.prose h3 { font-size: 1.25rem; letter-spacing: -0.01em; font-weight: 600; margin: 40px 0 12px; }
.prose > h2:first-child { margin-top: 0; }
.prose strong { font-weight: 600; }
a.ext::after { content: ''; display: inline-block; width: 0.55em; height: 0.55em; margin-left: 0.2em; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: translateY(-0.35em); opacity: 0.7; }
.formula { background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--teal); border-radius: 6px; padding: 16px 18px; overflow-x: auto; font: 500 0.92rem/1.7 var(--sans); }
.formula code { font: inherit; white-space: pre; }
.table-wrap { overflow-x: auto; margin: 24px 0; border-top: 2px solid var(--ink); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; }
td { color: var(--ink-2); }
td:first-child { color: var(--ink); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 0; }
tbody tr:last-child td { border-bottom: 2px solid var(--ink); }
.sources { margin-top: 72px; border-top: 1px solid var(--rule); padding-top: 8px; }
.sources h2 { font-size: 1.2rem; margin: 16px 0 12px; }
.sources ul { list-style: none; padding: 0; margin: 0; }
.sources li { font: 400 0.95rem/1.5 var(--sans); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
.sources .host { color: var(--ink-2); font-size: 0.85rem; }
.related { margin-top: 72px; }
.related h2 { font-size: 1.2rem; margin: 0 0 12px; }
.related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
@media (min-width: 720px) { .related ul { grid-template-columns: 1fr 1fr; } }
.related a { display: block; padding: 18px 20px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: inherit; text-decoration: none; height: 100%; }
.related a:hover { border-color: var(--teal); }
.rel-title { display: block; font-weight: 600; margin-bottom: 4px; }
.rel-blurb { color: var(--ink-2); font-size: 0.95rem; }


/* calculator */
.tool { margin: 56px 0; background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid var(--ink); border-radius: 4px 4px 10px 10px; padding: 24px 16px; }
@media (min-width: 720px) { .tool { padding: 28px 28px 32px; } }
.tool-intro { max-width: 70ch; }
.tool-intro h3 { margin: 0 0 8px; font-size: 1.5rem; letter-spacing: -0.02em; }
.tool-intro p { font: 400 0.98rem/1.65 var(--serif); color: var(--ink-2); margin: 0 0 10px; }
.tool.is-live .tool-intro p + p { display: none; }
.noscript { color: var(--amber); font-weight: 600; }
.calc-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin: 18px 0 8px; padding: 12px 0; border-block: 1px solid var(--rule); }
.calc-status { margin: 0; font-size: 0.92rem; color: var(--ink-2); }
.calc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
button { font: inherit; }
.ghost, .add, .remove { cursor: pointer; border-radius: 6px; min-height: 40px; padding: 0 14px; font-weight: 600; font-size: 0.92rem; }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.ghost:hover { border-color: var(--ink); }
.ghost[data-act='preset'] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.ghost[data-act='preset']:hover { background: var(--teal); border-color: var(--teal); }
.preset-label { margin: 0 0 8px; font-size: 0.88rem; color: var(--amber); font-weight: 500; }
.add { background: transparent; color: var(--teal); border: 1px dashed color-mix(in srgb, var(--teal) 60%, transparent); margin-top: 10px; }
.add:hover { background: var(--teal-soft); }
.remove { background: transparent; color: var(--ink-2); border: 1px solid transparent; font-weight: 500; }
.remove:hover { color: var(--neg); border-color: var(--rule); }

.calc-body { display: grid; gap: 24px; margin-top: 16px; }
@media (min-width: 1100px) { .calc-body { grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; } .calc-results { order: 2; } }
.calc-results .results-inner { position: sticky; top: 84px; background: var(--paper); border-radius: 8px; padding: 20px; border: 1px solid var(--rule); }
.tool:has([data-tool-mount='training-software-tco']) .calc-body { grid-template-columns: 1fr; }
.tool:has([data-tool-mount='training-software-tco']) .calc-results { order: 0; }
.tool:has([data-tool-mount='training-software-tco']) .results-inner { position: static; padding: 0 0 0 14px; border: 0; border-left: 3px solid var(--teal); border-radius: 0; background: none; }

.group { border: 0; margin: 0 0 28px; padding: 0; min-width: 0; }
.group legend { font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: 4px; }
.group-note { margin: 0 0 12px; color: var(--ink-2); font-size: 0.92rem; }
.empty { margin: 8px 0; padding: 14px; color: var(--ink-2); font-size: 0.92rem; border: 1px dashed var(--rule); border-radius: 6px; }
.grid, .row-fields { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.field-wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.field input[type='text'], .field input[type='number'], .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface);
  color: var(--ink); font: 400 0.95rem/1.4 var(--sans); font-variant-numeric: tabular-nums;
}
.field textarea { resize: vertical; min-height: 42px; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: color-mix(in srgb, var(--ink) 35%, var(--rule)); }
.field input::placeholder { color: var(--amber); opacity: 0.75; font-style: italic; }
.field [aria-invalid='true'] { border-color: var(--neg); box-shadow: 0 0 0 1px var(--neg); }
.numbox { position: relative; display: block; }
.numbox i { position: absolute; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--ink-2); pointer-events: none; font-size: 0.92rem; }
.numbox.has-pre i:first-child { left: 10px; }
.numbox.has-pre input { padding-left: 22px; }
.numbox.has-suf i:last-child { right: 10px; }
.numbox.has-suf input { padding-right: 26px; }
.hint { display: none; font-size: 0.8rem; color: var(--ink-2); line-height: 1.4; }
.field:focus-within .hint { display: block; }
.field-error { font-size: 0.82rem; color: var(--neg); font-weight: 500; }
.field-error:empty { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 0.95rem; font-weight: 500; padding: 6px 0; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--teal); flex: none; }

.ledger-row { display: grid; gap: 12px; padding: 16px 0; border-top: 1px solid var(--rule); }
.ledger-row:last-of-type { border-bottom: 1px solid var(--rule); }
@media (min-width: 720px) { .ledger-row { grid-template-columns: minmax(0, 1fr) 130px; } .ledger-row .remove { grid-column: 2; justify-self: end; align-self: start; } .row-total { grid-row: 1; grid-column: 2; } }
.row-total { text-align: right; padding-top: 24px; font-size: 1.05rem; }

.headline { display: flex; flex-direction: column; gap: 4px; padding-bottom: 14px; margin-bottom: 8px; border-bottom: 2px solid var(--ink); }
.headline-label { font-size: 0.88rem; font-weight: 600; color: var(--ink-2); }
.headline .val { font-size: 2.1rem; letter-spacing: -0.02em; color: var(--teal); line-height: 1.15; }
.headline .val.neg { color: var(--neg); }
.headline-sub { font-size: 0.82rem; color: var(--ink-2); }
.figures { margin: 0; display: grid; }
.figures > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
.figures dt { font-size: 0.9rem; color: var(--ink-2); }
.figures dd { margin: 0; text-align: right; }
.figures .rule { border-top: 1px solid var(--ink); }
.figures .total dt { color: var(--ink); font-weight: 600; }
.figures .total .val { font-size: 1.1rem; }
.figures.capacity { border-left: 3px solid var(--amber); padding-left: 10px; }
h4.sub { margin: 18px 0 4px; font-size: 0.95rem; }
.fine { font-size: 0.82rem; color: var(--ink-2); margin: 12px 0 0; line-height: 1.5; }
.results-errors:not(:empty) { margin-top: 14px; padding: 12px; border-radius: 6px; border: 1px solid var(--neg); color: var(--neg); font-size: 0.88rem; }
.results-errors ul { margin: 6px 0 0; padding-left: 18px; }
.err-head { margin: 0; font-weight: 600; }
.missing { margin-top: 14px; font-size: 0.88rem; }
.missing summary { cursor: pointer; font-weight: 600; color: var(--amber); }
.missing ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); }
.missing li { margin-bottom: 3px; }
.all-set { margin: 14px 0 0; font-size: 0.88rem; color: var(--teal); font-weight: 600; }

.scenarios { display: grid; gap: 20px; }
@media (min-width: 900px) { .scenarios { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); } }
.scenario { border: 1px solid var(--rule); border-radius: 8px; padding: 16px; background: var(--paper); min-width: 0; }
.scenario-head { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.scenario-head .field { flex: 1; }
.scenario-head input { font-weight: 700 !important; font-size: 1.05rem !important; }
.scenario h4 { margin: 20px 0 8px; font-size: 0.95rem; padding-top: 12px; border-top: 1px solid var(--rule); }
.price-note { background: var(--surface); border-radius: 6px; padding: 10px 12px; font-size: 0.86rem; color: var(--ink-2); border: 1px solid var(--rule-soft); }
.price-note p { margin: 0 0 4px; }
.price-note strong { color: var(--ink); }
.price-note ul { margin: 4px 0 0; padding-left: 18px; }
.scenario-results { margin-top: 20px; padding: 14px; background: var(--surface); border-radius: 6px; border-top: 2px solid var(--ink); }
.eligible { margin: 10px 0 0; font-size: 0.86rem; color: var(--amber); font-weight: 600; }
.eligible.yes { color: var(--teal); }
.row-fields { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.row-fields .field-wide:first-child { grid-column: 1 / -1; }
.missing summary, .missing li, .fine, .eligible, .price-note { line-height: 1.45; }
.notfound { padding-top: 72px; max-width: 760px; }
.notfound h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; margin: 40px 0 12px; }
.nf-lede { font: 400 1.15rem/1.6 var(--serif); color: var(--ink-2); margin: 0 0 24px; }
.nf-ledger { max-width: 420px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.nf-line { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 2px; }
.nf-line + .nf-line { border-top: 1px solid var(--rule); color: var(--ink-2); }
.nf-links { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 12px; }
.nf-links a { display: block; padding: 16px 18px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: inherit; text-decoration: none; }
.nf-links a:hover { border-color: var(--teal); }
