:root {
  color-scheme: light dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--reader-page, Canvas);
  color: var(--reader-ink, CanvasText);
  font: var(--reader-text)/1.6 Georgia, 'Iowan Old Style', 'Times New Roman', serif;
}
main {
  max-width: var(--reader-measure);
  margin: 0 auto;
  padding: var(--reader-top) var(--reader-side) var(--reader-bottom);
}
h1,
h2,
h3,
h4,
nav,
footer,
.muted {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}
h1 {
  font-size: var(--reader-h1);
  line-height: 1.2;
  margin: 0 0 var(--space-3);
}
h2 {
  font-size: var(--reader-h2);
  margin: var(--rhythm-9) 0 var(--rhythm-2);
  padding-top: var(--rhythm-3);
  border-top: var(--border-1) solid var(--reader-line);
}
h3 {
  font-size: var(--reader-h3);
  margin: var(--rhythm-7) 0 var(--rhythm-2);
}
h4 {
  font-size: var(--reader-h4);
  margin: var(--rhythm-6) 0 var(--rhythm-1);
}
p,
ul,
ol {
  margin: 0 0 var(--rhythm-4);
}
li {
  margin: var(--rhythm-1) 0;
}
a {
  color: var(--reader-link);
  overflow-wrap: anywhere;
}
.muted {
  color: var(--reader-muted);
  font-size: var(--reader-small);
}
.error {
  color: var(--reader-bad);
}
header {
  margin-bottom: var(--rhythm-8);
}
nav.contents {
  border: var(--border-1) solid var(--reader-line);
  border-radius: var(--radius-3);
  padding: var(--space-6) var(--space-9);
  margin: 0 0 var(--rhythm-8);
  font-size: var(--reader-small);
}
nav.contents ol {
  margin: 0;
  padding-left: var(--rhythm-6);
}
/* A site's header: its name and its main pages on one line; what does not fit scrolls sideways, never wraps. */
nav.site-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-9);
  margin: calc(-1 * var(--rhythm-5)) 0 var(--rhythm-9);
  padding-bottom: var(--space-6);
  border-bottom: var(--border-1) solid var(--reader-line);
  font-size: var(--reader-small);
  white-space: nowrap;
}
nav.site-head a {
  text-decoration: none;
  color: var(--reader-muted);
}
nav.site-head a:hover,
nav.site-head a[aria-current] {
  color: var(--reader-ink);
}
nav.site-head .site-name {
  flex: none;
  font-weight: 600;
  color: var(--reader-ink);
}
.site-pages {
  display: flex;
  gap: var(--space-8);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
footer {
  margin-top: var(--rhythm-10);
  padding-top: var(--rhythm-5);
  border-top: var(--border-1) solid var(--reader-line);
}
button.print {
  font: inherit;
  padding: var(--space-4) var(--space-7);
  border: var(--border-1) solid var(--reader-line);
  border-radius: var(--radius-2);
  background: transparent;
  color: var(--reader-ink);
  cursor: pointer;
}
@media print {
  /* On paper, the theme's print colours: set on the body, so they win over the page's own. */
  body {
    --reader-ink: var(--reader-print-ink);
    --reader-muted: var(--reader-print-muted);
    --reader-link: var(--reader-print-ink);
    --reader-page: var(--reader-print-page);
    font-size: 11pt;
  }
  main {
    max-width: none;
    padding: 0;
  }
  footer,
  nav.contents {
    display: none;
  }
  h2 {
    break-after: avoid;
  }
  section {
    break-inside: auto;
  }
}
/* Text between two sections is the document's own, not the end of the section above it. */
section + div.text {
  margin-top: var(--rhythm-9);
  padding-top: var(--rhythm-4);
  border-top: var(--border-1) solid var(--reader-line);
}
/* A section's figure: as wide as the text, on its own light card so a drawing made on white reads in the dark too. */
figure {
  margin: var(--rhythm-2) 0 var(--rhythm-6);
}
figure img {
  display: block;
  width: 100%;
  height: auto;
  border: var(--border-1) solid var(--reader-line);
  border-radius: var(--radius-3);
  background: var(--reader-figure);
}
/* An invoice: its number, dates and what is due as a heading block; the rest reads as the bill, in a plain face. */
body.invoice main {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: var(--text-6);
}
.invoice-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-11);
  padding-bottom: var(--space-10);
  margin-bottom: var(--rhythm-7);
  border-bottom: var(--border-3) solid var(--reader-ink);
}
.invoice-head h1 {
  font-size: var(--reader-title);
  letter-spacing: var(--track-1);
}
.invoice-facts {
  display: grid;
  grid-template-columns: auto auto;
  gap: var(--space-3) var(--space-10);
  margin: var(--space-4) 0 0;
  text-align: right;
}
.invoice-facts dt {
  color: var(--reader-muted);
}
.invoice-facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.invoice-total {
  font-size: var(--reader-h2);
  font-weight: 700;
}
.stamp {
  position: absolute;
  left: 46%;
  top: var(--space-5);
  padding: var(--space-3) var(--space-8);
  border: var(--border-4) solid var(--reader-paid);
  border-radius: var(--radius-2);
  color: var(--reader-paid);
  font-weight: 800;
  letter-spacing: var(--track-3);
  text-transform: uppercase;
  transform: rotate(-8deg);
}
.stamp.void {
  border-color: var(--reader-void);
  color: var(--reader-void);
}
body.invoice ul {
  padding-left: var(--rhythm-6);
}
body.invoice li {
  font-variant-numeric: tabular-nums;
}
/* Tables: ruled rows, numbers that line up, a head in the plain face. */
table.text-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--rhythm-2) 0 var(--rhythm-6);
  font-variant-numeric: tabular-nums;
}
table.text-table th {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: var(--reader-tiny);
  font-weight: 600;
  letter-spacing: var(--track-2);
  text-transform: uppercase;
  color: var(--reader-muted);
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--border-2) solid var(--reader-ink);
}
table.text-table td {
  padding: var(--space-5) var(--space-5);
  border-bottom: var(--border-1) solid var(--reader-line);
  vertical-align: top;
}
table.text-table tr:last-child td {
  border-bottom: 0;
}
/* On an invoice, the totals sit to the right under the work, and its last row is what is due. */
body.invoice h3 + table.text-table:not(:has(thead)) {
  width: auto;
  min-width: 46%;
  margin-left: auto;
}
body.invoice table.text-table:not(:has(thead)) tr:last-child td {
  border-top: var(--border-2) solid var(--reader-ink);
  font-size: var(--reader-total);
}
body.invoice table.text-table:first-of-type td {
  border-bottom: 0;
  padding: var(--space-2) var(--space-5);
}
@media print {
  table.text-table th {
    color: var(--reader-print-ink);
  }
  table.text-table tr {
    break-inside: avoid;
  }
}

.align-left {
  text-align: left;
}
.align-right {
  text-align: right;
}
.align-center {
  text-align: center;
}
