/* Glassbox tokens. Ledger-paper green, ink, and brass. */
:root {
  --paper: #eef2ec;
  --paper-2: #e2e9e1;
  --ink: #16302a;
  --ink-soft: #46605a;
  --rule: #a9bdb0;
  --brass: #b08a3e;
  --brass-ink: #7a5d22;
  --pine: #1f5e57;
  --error: #9b2c2c;

  --serif: "Spectral", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;

  /* modular scale, ratio 1.25 from 17px */
  --t-sm: 0.85rem;
  --t-base: 1.0625rem;
  --t-md: 1.33rem;
  --t-lg: 1.66rem;
  --t-xl: 2.6rem;
  --t-xxl: clamp(2.6rem, 6vw, 4.4rem);

  --gutter: clamp(16px, 4vw, 48px);
  --measure: 62ch;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.12;
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--t-xxl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-md); font-weight: 600; }

p { margin: 0 0 1em; max-width: var(--measure); }

a { color: var(--pine); text-underline-offset: 3px; }
a:hover { color: var(--ink); }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

.num { font-variant-numeric: tabular-nums lining-nums; }

.button {
  display: inline-block;
  font: 500 var(--t-base) var(--sans);
  padding: 0.7em 1.25em;
  border-radius: 3px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--pine); border-color: var(--pine); color: var(--paper); }
.button.quiet { background: transparent; color: var(--ink); }
.button.quiet:hover { background: var(--paper-2); color: var(--ink); }
.button[disabled] { opacity: 0.5; cursor: wait; }

label { display: block; font-weight: 500; margin-bottom: 0.35em; }
input, textarea, select {
  width: 100%;
  font: var(--t-base) var(--sans);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.6em 0.75em;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: var(--brass); }
.hint { color: var(--ink-soft); font-size: var(--t-sm); margin-top: 0.4em; }
.error { color: var(--error); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- shell ---------- */
.site-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-top: 1.25rem; padding-bottom: 1.25rem;
  flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 0.5rem;
  font: 600 var(--t-md) var(--serif); color: var(--ink); text-decoration: none;
}
.site-head nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.site-head nav a { color: var(--ink-soft); text-decoration: none; }
.site-head nav a:hover, .site-head nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--brass); }

.site-foot { border-top: 1px solid var(--rule); margin-top: 5rem; padding-top: 1.5rem; padding-bottom: 3rem; color: var(--ink-soft); font-size: var(--t-sm); }

.lede { font-size: var(--t-md); line-height: 1.5; color: var(--ink-soft); }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.75rem; }

/* ---------- home ---------- */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 3rem; align-items: center;
  padding-top: 3rem; padding-bottom: 4rem;
}
.sides {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4rem;
  border-top: 1px solid var(--rule); padding-top: 3rem;
}
.sides > div > a { font-weight: 500; }
.steps { padding-left: 1.2rem; margin: 0 0 1.25rem; }
.steps li { margin-bottom: 0.5rem; padding-left: 0.25rem; }
.facts { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.facts li { padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }

/* ---------- balance scale ---------- */
.scale { margin: 0; background: var(--paper-2); border-radius: 6px; padding: 1.5rem; }
.scale svg { width: 100%; height: auto; display: block; overflow: visible; }
.scale .post { fill: var(--ink); }
.scale .base { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.scale .beam { stroke: var(--brass); stroke-width: 6; stroke-linecap: round; }
.scale .pivot { fill: var(--brass); stroke: var(--ink); stroke-width: 2; }
.scale .chain { stroke: var(--brass-ink); stroke-width: 1.25; }
.scale .pan { fill: var(--brass); stroke: var(--brass-ink); stroke-width: 1.5; }
.scale .pan-label { font: 500 13px var(--sans); fill: var(--ink-soft); text-anchor: middle; }
.scale .pan-value { font: 600 19px var(--serif); fill: var(--ink); text-anchor: middle; }
.scale-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.scale-controls label { font-size: var(--t-sm); }
.scale input[type="range"] { padding: 0; border: 0; background: none; accent-color: var(--pine); }
.scale figcaption { margin-top: 1rem; font-size: var(--t-sm); }
.scale figcaption .hint { display: block; }

/* ---------- inner pages ---------- */
.page { padding-top: 3rem; }
.page > .lede { margin-bottom: 2.5rem; }
.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; align-items: start; }
.split form .button { margin-top: 1rem; }
.note { border-left: 3px solid var(--brass); padding-left: 1.25rem; }
.readout { margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: 2rem; }
.readout table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; }
.readout th, .readout td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
.readout th { font-weight: 500; color: var(--ink-soft); font-size: var(--t-sm); }
.readout td:last-child, .readout th:last-child { text-align: right; padding-right: 0; }
.readout dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 0 0 1rem; }
.readout dt { color: var(--ink-soft); font-size: var(--t-sm); }
.readout dd { margin: 0; font: 600 var(--t-lg) var(--serif); }

@media (max-width: 820px) {
  .hero, .sides, .split { grid-template-columns: 1fr; gap: 2rem; }
  .readout dl { grid-template-columns: 1fr 1fr; }
  .scale-controls { grid-template-columns: 1fr; }
}

/* ---------- admin ---------- */
.signin { max-width: 360px; }
.signin .button { margin-top: 1rem; }
.admin-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.biz-list { list-style: none; padding: 0; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.biz h3 { margin-top: 2.5rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 2rem 0 0; }
.stats dt { color: var(--ink-soft); font-size: var(--t-sm); }
.stats dd { margin: 0; font: 600 var(--t-lg) var(--serif); }
.biz table { width: 100%; border-collapse: collapse; }
.biz th, .biz td { text-align: right; padding: 0.45rem 0 0.45rem 0.75rem; border-bottom: 1px solid var(--rule); }
.biz th:first-child, .biz td:first-child { text-align: left; padding-left: 0; }
.biz th { font-weight: 500; color: var(--ink-soft); font-size: var(--t-sm); }
.biz td.neg { color: var(--error); }
.flow-chart { width: 100%; height: auto; display: block; }
.flow-chart .bar-in { fill: var(--pine); }
.flow-chart .bar-out { fill: var(--brass); }
.flow-chart .axis { stroke: var(--rule); }
.flow-chart .tick { font: 11px var(--sans); fill: var(--ink-soft); text-anchor: middle; }
.legend { font-size: var(--t-sm); color: var(--ink-soft); display: flex; align-items: center; gap: 0.4rem; }
.legend .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.legend .key.in { background: var(--pine); }
.legend .key.out { background: var(--brass); margin-left: 1rem; }
@media (max-width: 820px) { .stats { grid-template-columns: 1fr 1fr; } }
