/* Receipt, the sheet: the invoice with a payment method and a Paid stamp. Print-first; Letter by default, A4 under html.a4 (the
   @page rule is swapped by the runtime). Colors only through --t-* so a theme
   is a set of variables. Static font instances, one file per weight and
   style (DESIGN.md section 6). Grown from spikes/render/invoice.html. */

@font-face { font-family: "Newsreader"; src: url("/assets/fonts/newsreader-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: block; }
@font-face { font-family: "Newsreader"; src: url("/assets/fonts/newsreader-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: block; }
@font-face { font-family: "Inter Tight"; src: url("/assets/fonts/intertight-400.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Inter Tight"; src: url("/assets/fonts/intertight-500.woff2") format("woff2"); font-weight: 500; font-display: block; }

@page { size: Letter; margin: 0; }

:root { --t-paper: #ffffff; --t-ink: #1a1a1a; --t-accent: #1f4e79; --t-muted: #5b6b7a; }
html, body { margin: 0; padding: 0; background: #fff; }
[hidden] { display: none !important; }

.sheet {
  width: 8.5in; height: 11in; padding: 0.5in 0.55in; box-sizing: border-box; position: relative; overflow: hidden;
  background: var(--t-paper); color: var(--t-ink);
  font: 400 10.5pt/1.45 "Inter Tight", system-ui, sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
html.a4 .sheet { width: 210mm; height: 297mm; }
.num { font-variant-numeric: tabular-nums; }

/* Header: the business at the left, the word and the dates at the right. */
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.3in; border-bottom: 2pt solid var(--t-accent); padding-bottom: 0.18in; }
.biz { display: flex; gap: 0.16in; align-items: flex-start; min-width: 0; }
.logo { height: 0.55in; width: auto; max-width: 1.6in; flex: none; }
.mark { width: 0.5in; height: 0.5in; flex: none; border: 1pt solid var(--t-accent); border-radius: 50%; display: grid; place-items: center; color: var(--t-accent); font: 500 15pt/1 "Newsreader", Georgia, serif; }
.biz-text { min-width: 0; }
.biz h1 { font: 500 21pt/1.05 "Newsreader", Georgia, serif; margin: 0 0 4pt; color: var(--t-ink); white-space: nowrap; max-width: 4.2in; overflow: hidden; height: 1.05em; }
.biz p { margin: 0; color: var(--t-muted); font-size: 9.5pt; white-space: nowrap; max-width: 4.2in; overflow: hidden; height: 1.45em; }
.inv { text-align: right; flex: none; }
.inv .word { font: 400 30pt/1 "Newsreader", Georgia, serif; color: var(--t-accent); letter-spacing: -0.01em; }
.inv table { margin-left: auto; margin-top: 6pt; border-collapse: collapse; font-size: 9.5pt; }
.inv td { padding: 1pt 0 1pt 12pt; text-align: right; white-space: nowrap; }
.inv td:first-child { color: var(--t-muted); }
.inv td.v { max-width: 1.6in; overflow: hidden; }

/* Bill to and payment. */
.billto { margin-top: 0.22in; display: grid; grid-template-columns: 1fr 1fr; gap: 0.3in; }
.label { font-size: 8pt; letter-spacing: 0.12em; text-transform: uppercase; color: var(--t-muted); margin-bottom: 3pt; font-weight: 500; }
.client { font: 500 13pt/1.2 "Newsreader", Georgia, serif; white-space: nowrap; overflow: hidden; max-width: 3.4in; height: 1.2em; }
.client-address { white-space: nowrap; overflow: hidden; max-width: 3.4in; height: 1.45em; }
.payment { max-height: 4.35em; overflow: hidden; }

/* The stamp. */
.stampbox { display: flex; justify-content: flex-end; align-items: flex-start; }
.stamp { display: inline-block; font: 500 16pt/1 "Inter Tight", system-ui, sans-serif; letter-spacing: 0.28em; text-transform: uppercase; color: var(--t-accent); border: 2pt solid var(--t-accent); padding: 6pt 10pt 6pt 14pt; transform: rotate(-6deg); }

/* The table. */
table.items { width: 100%; border-collapse: collapse; margin-top: 0.28in; }
.items th { text-align: left; font-size: 8pt; letter-spacing: 0.12em; text-transform: uppercase; color: var(--t-muted); border-bottom: 1pt solid var(--t-accent); padding: 0 0 5pt; font-weight: 500; }
.items td { padding: 5pt 0; border-bottom: 0.5pt solid color-mix(in srgb, var(--t-muted) 35%, transparent); vertical-align: top; }
.items th.n, .items td.n { text-align: right; font-variant-numeric: tabular-nums; width: 0.9in; padding-left: 0.1in; }
.items td.desc { white-space: nowrap; overflow: hidden; max-width: 4.2in; height: 1.45em; box-sizing: content-box; }

/* Totals, in the corner where the eye lands. The amount column is wider than
   it needs to be so a long total never wraps. */
.totals { margin: 0.18in 0 0 auto; width: 2.9in; border-collapse: collapse; }
.totals td { padding: 3pt 0; font-variant-numeric: tabular-nums; }
.totals td:last-child { text-align: right; white-space: nowrap; }
.totals tr.total td { border-top: 1.5pt solid var(--t-accent); padding-top: 6pt; font: 500 15pt/1.2 "Newsreader", Georgia, serif; color: var(--t-accent); }

/* Note. */
.notes { margin-top: 0.3in; max-width: 4.6in; font-size: 9.5pt; }
.notes p { margin: 0; max-height: 4.35em; overflow: hidden; }

/* The foot: the free version's credit line and one-inch mark, and the number. */
.foot { position: absolute; left: 0.55in; right: 0.55in; bottom: 0.45in; font-size: 7.5pt; color: var(--t-muted); display: flex; justify-content: space-between; align-items: flex-end; }
.ruler { width: 1in; border-top: 0.5pt solid var(--t-muted); font-size: 6.5pt; color: var(--t-muted); text-align: center; line-height: 1.6; }
