/* BACKPAY: a payroll office on cream paper. Flat ink rules, no shadows, no gradients. */
@font-face { font-family: 'Fraunces'; src: url('/assets/fonts/fraunces-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/assets/fonts/fraunces-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/assets/fonts/fraunces-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/assets/fonts/fraunces-latin-900-normal.woff2') format('woff2'); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/assets/fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --cream: #ede6d6;
  --paper: #f4efe3;
  --ink: #141414;
  --green: #1e6b45;
  --red: #c2412d;
  --rule: rgba(20, 20, 20, .14);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --side: clamp(16px, 2vw, 28px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: var(--serif); font-size: 17px; line-height: 1.5;
  /* faint ledger lines, like the cover */
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
  background-attachment: local;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--cream); padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

/* ---------- header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: clamp(14px, 2.4vw, 40px);
  min-height: 96px; padding: 12px var(--side);
  background: var(--cream); border-bottom: 2px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; flex: none; }
.brand-seal { width: 64px; height: 64px; }
.brand-word { font-weight: 900; font-size: clamp(30px, 3.2vw, 46px); letter-spacing: -.035em; line-height: 1; font-variation-settings: 'opsz' 144; transform: scaleX(.92); transform-origin: left; }
.nav { display: flex; gap: clamp(14px, 2vw, 34px); font-family: var(--mono); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.nav a { text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.on { border-bottom-color: var(--ink); }
.hdr-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ca {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  background: transparent; border: 1.5px solid var(--ink); border-radius: 4px; cursor: pointer;
  font-family: var(--mono); font-size: 12px;
}
.ca-k { font-weight: 600; letter-spacing: .1em; }
.ca-v { opacity: .75; max-width: 13ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-i { width: 14px; height: 14px; }
.ca[disabled] { cursor: default; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 4px; cursor: pointer; white-space: nowrap;
  font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-decoration: none;
  border: 1.5px solid var(--ink); background: transparent; transition: background-color .15s, color .15s;
}
.btn-line:hover { background: var(--ink); color: var(--cream); }
.btn-green { background: var(--green); border-color: var(--green); color: var(--cream); }
.btn-green:hover { background: var(--ink); border-color: var(--ink); }
.btn-ink { background: var(--ink); color: var(--cream); }
.btn-ink:hover { background: var(--green); border-color: var(--green); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn-big { height: 54px; min-width: 260px; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; }
.ico { width: 40px; height: 40px; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 4px; }
.ico svg { width: 18px; height: 18px; }
.ico:hover { background: var(--ink); color: var(--cream); }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: clamp(24px, 4vw, 64px);
  align-items: center; padding: clamp(36px, 6vw, 88px) var(--side) clamp(40px, 6vw, 80px);
}
.h1 {
  margin: 0; font-weight: 900; font-size: clamp(54px, 7.3vw, 124px); line-height: .9; letter-spacing: -.04em; white-space: nowrap;
  font-variation-settings: 'opsz' 144;
}
.dot { color: var(--red); }
.sub { font-family: var(--mono); font-size: clamp(14px, 1.15vw, 17px); line-height: 1.6; margin: 28px 0 0; max-width: 40ch; }
.line-wrap { display: block; overflow: hidden; padding-bottom: .14em; margin-bottom: -.14em; }
.line-wrap > span { display: inline-block; }

.cheque { position: relative; display: flex; border: 1px solid var(--ink); background: var(--paper); padding: 10px 10px 10px 0; }
.holes {
  flex: none; width: 34px;
  background-image: radial-gradient(circle at 50% 50%, var(--cream) 0 5px, var(--ink) 5px 6px, transparent 6.5px);
  background-size: 34px 30px; background-position: center 6px; background-repeat: repeat-y;
}
.cheque-card { position: relative; flex: 1; border: 2px solid var(--ink); padding: clamp(18px, 2.2vw, 30px); min-width: 0; overflow: hidden; }
.cheque-top { display: flex; align-items: center; gap: 16px; margin-bottom: clamp(22px, 3vw, 38px); }
.cheque-seal { width: 56px; height: 56px; flex: none; }
.guilloche {
  flex: 1; height: 34px; border-top: 1.5px solid var(--green); border-bottom: 1.5px solid var(--green);
  background: url('/assets/img/guilloche.svg') repeat-x center / auto 28px;
}
.cheque-no { font-size: 12px; letter-spacing: .08em; opacity: .7; flex: none; }
.cheque-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px 28px; align-items: end; }
.lbl { display: block; font-size: 12px; letter-spacing: .16em; margin-bottom: 10px; }
.wallet {
  width: 100%; font-size: clamp(15px, 1.35vw, 20px); padding: 8px 0 10px; background: transparent;
  border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; color: var(--ink);
}
.wallet::placeholder { color: rgba(20, 20, 20, .45); }
.wallet:focus { outline: none; border-bottom-color: var(--green); }
.typed:empty { display: none; }
.typed { min-height: 1.5em; font-size: 12px; margin-top: 8px; letter-spacing: .04em; color: var(--green); overflow-wrap: anywhere; }
.amount { text-align: right; }
.amount-box { border: 2px solid var(--ink); padding: 12px 18px; font-size: clamp(22px, 2.4vw, 34px); font-weight: 600; white-space: nowrap; background: var(--cream); }
.sol-sign { color: var(--green); }
.unit { font-size: .6em; letter-spacing: .08em; }
.usd { display: block; font-size: 12px; margin-top: 8px; opacity: .75; }
.split { margin-top: 22px; border-top: 1px dashed var(--ink); padding-top: 14px; font-size: 13px; }
.split > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.split b { font-weight: 600; white-space: nowrap; }
.split-fee { color: var(--red); }
.split-net { border-top: 1.5px solid var(--ink); margin-top: 6px; padding-top: 8px !important; font-size: 15px; }
.split-note { margin: 8px 0 0; font-size: 12px; opacity: .75; }
.cheque-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: clamp(22px, 3vw, 34px); }
.hint { margin: 0; font-size: 12px; opacity: .8; max-width: 46ch; min-height: 58px; }
.hint.err { color: var(--red); opacity: 1; }
.hint.ok { color: var(--green); opacity: 1; }

.stamp {
  position: absolute; right: clamp(14px, 3vw, 40px); bottom: clamp(14px, 2vw, 24px);
  padding: 6px; border: 3px solid var(--red); color: var(--red); transform: rotate(-8deg) scale(1.6);
  opacity: 0; pointer-events: none; mix-blend-mode: multiply;
}
.stamp span {
  display: block; border: 1.5px solid var(--red); padding: 6px 18px;
  font-family: var(--serif); font-weight: 900; font-size: clamp(26px, 2.6vw, 38px); letter-spacing: .08em; line-height: 1;
}
.stamp.paid { border-color: var(--green); color: var(--green); }
.stamp.paid span { border-color: var(--green); }
.stamp.on { opacity: .9; transform: rotate(-8deg) scale(1); }

/* ---------- perforation ---------- */
.tear { position: relative; height: 28px; margin: 0; }
.tear::before { content: ''; position: absolute; left: 22px; right: 22px; top: 13px; border-top: 2px dashed var(--ink); }
.tear::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 0 50%, var(--ink) 0 14px, transparent 14.5px), radial-gradient(circle at 100% 50%, var(--ink) 0 14px, transparent 14.5px);
}

/* ---------- sections ---------- */
.h2 { margin: 0; font-weight: 900; font-size: clamp(42px, 5.4vw, 84px); line-height: .95; letter-spacing: -.04em; font-variation-settings: 'opsz' 144; }
.how, .reg, .docs { padding: clamp(36px, 5vw, 72px) var(--side); }
.stubs { list-style: none; margin: clamp(26px, 3.5vw, 48px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 28px); }
.stub { display: flex; border: 1px solid var(--ink); background: var(--paper); padding: 8px 8px 8px 0; }
.stub .holes { width: 26px; background-size: 26px 26px; }
.stub-in { flex: 1; border: 2px solid var(--ink); padding: 18px 22px 24px; }
.stub .guilloche { height: 26px; background-size: auto 20px; }
.stub-n { display: block; font-size: clamp(54px, 5.2vw, 82px); font-weight: 600; line-height: 1; margin: 18px 0 14px; letter-spacing: -.04em; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.stub h3 { margin: 0 0 8px; font-weight: 900; font-size: clamp(26px, 2.4vw, 36px); letter-spacing: -.02em; }
.stub p { margin: 0; font-size: 13.5px; line-height: 1.6; }

.reg-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: clamp(22px, 3vw, 40px); }
.totals { margin: 0; display: grid; gap: 6px; text-align: right; font-size: 14px; letter-spacing: .08em; }
.totals div { display: flex; justify-content: flex-end; gap: 18px; }
.totals dt { opacity: .75; }
.totals dd { margin: 0; font-weight: 600; min-width: 12ch; }
.ledger { border: 1px solid var(--ink); padding: 8px; background: var(--paper); }
.ledger-in { border: 2px solid var(--ink); overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 14px; min-width: 620px; }
.tbl th { text-align: left; font-weight: 600; font-size: 12px; letter-spacing: .14em; padding: 12px 16px; border-bottom: 2px solid var(--ink); border-right: 1px solid var(--ink); }
.tbl td { padding: 0 16px; height: 46px; border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); white-space: nowrap; }
.tbl th:last-child, .tbl td:last-child { border-right: 0; }
.tbl td.num { font-weight: 600; }
.tbl a { color: var(--green); }
.tbl tr.empty td { height: 150px; text-align: center; font-family: var(--serif); font-style: italic; font-size: clamp(20px, 2vw, 28px); border-right: 0; white-space: normal; }
.tbl tr.empty.err td { color: var(--red); }
.tbl tr.fresh td { background: rgba(30, 107, 69, .1); }

.docs-grid { margin-top: clamp(24px, 3vw, 40px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 2px solid var(--ink); border-left: 1px solid var(--ink); }
.doc { padding: 24px clamp(18px, 2vw, 30px) 28px; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.doc h3 { margin: 0 0 10px; font-weight: 900; font-size: 26px; letter-spacing: -.02em; }
.doc p { margin: 0; font-size: 16px; line-height: 1.6; max-width: 62ch; }
.doc code { font-family: var(--mono); font-size: .82em; background: rgba(20, 20, 20, .07); padding: 1px 5px; }
.doc .small { margin-top: 14px; font-size: 14px; font-style: italic; }
.progs { margin: 0; display: grid; gap: 10px; font-size: 13px; }
.progs div { display: grid; grid-template-columns: 9ch minmax(0, 1fr); gap: 12px; }
.progs dt { opacity: .7; }
.progs dd { margin: 0; overflow-wrap: anywhere; }

.ftr { display: flex; align-items: center; gap: 24px; margin: clamp(20px, 3vw, 40px) var(--side) 0; padding: 22px 0 28px; border-top: 2px solid var(--ink); }
.ftr p { margin: 0; font-size: 13px; flex: 1; }
.ftr-rule { align-self: stretch; width: 1.5px; background: var(--ink); }
.ftr-word { font-weight: 900; font-size: 30px; letter-spacing: -.035em; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: var(--ink); color: var(--cream); padding: 10px 16px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; border-radius: 4px; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* fountain-pen nib that follows the pointer over buttons */
.nib { position: fixed; left: 0; top: 0; width: 26px; height: 26px; pointer-events: none; z-index: 60; opacity: 0; transform: translate(-100px, -100px); transition: opacity .15s; }
.nib.on { opacity: 1; }
@media (hover: hover) and (pointer: fine) { body.nib-ready .mag, body.nib-ready .ca, body.nib-ready .ico, body.nib-ready .nav a { cursor: none; } }

/* intro: hide the split pieces until the script animates them in */
.js .h1 .line-wrap > span, .js .h2 .line-wrap > span { transform: translateY(105%); }
.js .reveal { opacity: 0; transform: translateY(24px); }
.ready .h1 .line-wrap > span { transform: none; }

@media (max-width: 1100px) {
  .nav { display: none; }
  .hero { grid-template-columns: 1fr; }
  .h1 br { display: none; }
  .h1 { font-size: clamp(56px, 11vw, 110px); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .hdr { min-height: 72px; gap: 10px; }
  .brand-seal { width: 44px; height: 44px; }
  .brand-word { font-size: 28px; }
  .hdr { flex-wrap: wrap; }
  .hdr-tools { gap: 6px; }
  .hdr-tools .ico { display: none; }
  .ca { height: 38px; padding: 0 8px; }
  .ca-v { max-width: 7ch; }
  .ca-i { display: none; }
  .btn { height: 38px; padding: 0 12px; font-size: 12px; }
  .h1 br { display: inline; }
  .h1 { font-size: clamp(52px, 16vw, 88px); }
  .cheque { padding: 6px 6px 6px 0; }
  .holes { width: 22px; background-size: 22px 24px; background-image: radial-gradient(circle at 50% 50%, var(--cream) 0 4px, var(--ink) 4px 5px, transparent 5.5px); }
  .cheque-body { grid-template-columns: 1fr; }
  .amount { text-align: left; }
  .amount-box { display: inline-block; }
  .btn-big { width: 100%; min-width: 0; }
  .cheque-no { display: none; }
  .stubs, .docs-grid { grid-template-columns: 1fr; }
  .reg-head { align-items: flex-start; }
  .totals { text-align: left; }
  .totals div { justify-content: flex-start; }
  .ftr { flex-wrap: wrap; }
  .ftr-rule { display: none; }
  .stamp span { font-size: 26px; }
  .stamp { bottom: auto; top: 16px; right: 14px; }
  .hint { min-height: 0; }
  .tbl { min-width: 0; font-size: 12px; }
  .tbl th, .tbl td { padding-left: 8px; padding-right: 8px; }
  .tbl th:nth-child(3), .tbl td:nth-child(3) { display: none; }
  .tbl tr.empty td { display: table-cell; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .js .reveal, .js .h1 .line-wrap > span, .js .h2 .line-wrap > span { opacity: 1; transform: none; }
}
