/* Paid In Anything ($PICK).
   One object: a payroll advice printed in electric blue on paper white, lying on a black desk.
   Three inks and nothing else. Every rule, box and leader on this page is print, not decoration;
   the objects (the emblem, the stamps, the tractor-feed edge) are pictures. */

:root {
  --ink: #1a17ff;          /* the ribbon */
  --ink-weak: #6f6dff;     /* the same ribbon, worn */
  --paper: #ffffff;
  --desk: #000000;
  --display: "Workbench", "DotGothic16", monospace;
  --body: "DotGothic16", ui-monospace, monospace;
  --mono: "Martian Mono", ui-monospace, "Courier New", monospace;
  --sheet-max: 1120px;
  --perf: 34px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.45;
  padding: clamp(0px, 2.5vw, 44px) clamp(0px, 2vw, 40px) clamp(24px, 6vw, 72px);
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 20;
  background: var(--paper); color: var(--ink); padding: 12px 16px; font-family: var(--mono);
}
.skip:focus { left: 8px; top: 8px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

:focus-visible { outline: 4px solid var(--ink); outline-offset: 2px; }

/* ------------------------------------------------------------------ the sheet */

.sheet {
  position: relative;
  max-width: var(--sheet-max);
  margin: 0 auto;
  background: var(--paper);
  padding: 0 var(--perf);
  min-height: 60vh;
}

/* the tractor-feed edge, a real picture of punched paper, tiled down both sides */
.perf {
  position: absolute; top: 0; bottom: 0; width: var(--perf);
  background-image: url("art/perf.png");
  background-repeat: repeat-y;
  background-size: var(--perf) auto;
  pointer-events: none;
}
.perf-l { left: 0; }
.perf-r { right: 0; transform: scaleX(-1); }

/* ------------------------------------------------------------ employer band */

.band {
  border-bottom: 6px double var(--ink);
  padding: clamp(18px, 3vw, 34px) clamp(12px, 2.2vw, 30px) 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 clamp(14px, 2.5vw, 26px);
  align-items: start;
}

.emblem {
  grid-row: 1 / span 2;
  width: clamp(64px, 11vw, 116px); height: auto;
  image-rendering: pixelated;
  align-self: center;
}

.employer { min-width: 0; }

.wordmark {
  font-family: var(--display);
  font-size: clamp(30px, 7.2vw, 74px);
  line-height: 0.95;
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.01em;
  overflow-wrap: break-word;
}

.sub {
  font-family: var(--mono);
  font-size: clamp(11px, 1.5vw, 14px);
  letter-spacing: 0.12em;
  margin: 8px 0 0;
  color: var(--ink);
}
.sub b { font-weight: 700; }

/* the account line: the contract, whole, selectable, wrapping on a phone */
.account {
  grid-column: 1 / -1;
  margin-top: clamp(14px, 2.4vw, 24px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  border-top: 2px solid var(--ink);
  padding-top: 12px;
}
.acct-label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; }
.acct-no {
  font-family: var(--mono); font-size: clamp(12px, 1.7vw, 16px);
  word-break: break-all; user-select: all; flex: 1 1 260px; min-width: 0;
}
.acct-no[data-empty="true"] { font-family: var(--body); color: var(--ink-weak); user-select: auto; }
.said { font-family: var(--mono); font-size: 12px; min-width: 6ch; }

/* a printed box that behaves like a button */
.stampbtn {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em;
  min-height: 48px; padding: 0 18px;
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 0; cursor: pointer;
}
.stampbtn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.stampbtn:active:not(:disabled) { transform: translate(2px, 2px); }
.stampbtn:disabled { border-style: dashed; color: var(--ink-weak); cursor: not-allowed; }

/* the venues, at the end of the band where a payslip prints where the money comes from */
.venues {
  grid-column: 1 / -1;
  margin-top: 14px;
  display: flex; flex-wrap: wrap; gap: 10px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 52px; padding: 0 18px;
  border: 3px solid var(--ink); background: var(--paper); color: var(--ink);
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.08em; text-decoration: none;
}
.btn img { image-rendering: auto; display: block; }
.btn-mark { width: 60px; padding: 0; }
.btn:hover:not(.is-off) { background: var(--ink); color: var(--paper); }
.btn:hover:not(.is-off) img { filter: invert(1) brightness(2); }
.btn:active:not(.is-off) { transform: translate(2px, 2px); }
.btn.is-off { border-style: dashed; color: var(--ink-weak); cursor: not-allowed; opacity: 0.65; }
.btn.is-off img { opacity: 0.5; }

/* the stubs: the four printed boxes that reprint the body of the same sheet */
.stubs {
  grid-column: 1 / -1;
  margin-top: clamp(16px, 2.6vw, 26px);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: 3px solid var(--ink); border-bottom: 0;
}
.stub {
  min-height: 54px; padding: 0 6px;
  font-family: var(--mono); font-size: clamp(11px, 1.6vw, 14px); letter-spacing: 0.1em;
  background: var(--paper); color: var(--ink);
  border: 0; border-right: 3px solid var(--ink); border-radius: 0; cursor: pointer;
}
.stub:last-child { border-right: 0; }
.stub.is-on { background: var(--ink); color: var(--paper); }
.stub:hover:not(.is-on) { background: #e6e6ff; }

/* ------------------------------------------------------------------- body */

.body { padding: clamp(20px, 3.4vw, 40px) clamp(12px, 2.2vw, 30px) clamp(28px, 4vw, 56px); }

.tab { display: none; }
.tab.is-on { display: block; }

.print { font-family: var(--mono); font-size: clamp(13px, 1.8vw, 16px); }

.row {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 14px;
}
.row .k { letter-spacing: 0.1em; white-space: nowrap; }
.row .dots {
  flex: 1 1 auto; min-width: 16px;
  border-bottom: 2px dotted var(--ink); transform: translateY(-4px);
}
.row .v { text-align: right; word-break: break-word; }
.row .v em { font-style: normal; color: var(--ink-weak); }
.row.rule { border-top: 2px solid var(--ink); padding-top: 14px; margin-top: 22px; }
.row.big { font-size: clamp(17px, 3vw, 28px); margin-top: 22px; }
.row.big .k { letter-spacing: 0.06em; }

/* the line being printed */
.printing { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.acts { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(20px, 3vw, 32px); }
.act {
  min-height: 56px; padding: 0 22px;
  font-family: var(--mono); font-size: clamp(13px, 1.7vw, 15px); letter-spacing: 0.08em;
  background: var(--ink); color: var(--paper); border: 3px solid var(--ink); border-radius: 0; cursor: pointer;
}
.act:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.act:active:not(:disabled) { transform: translate(2px, 2px); }
.act:disabled { background: var(--paper); color: var(--ink-weak); border-style: dashed; cursor: not-allowed; }

.note {
  font-family: var(--body); font-size: clamp(16px, 1.9vw, 18px);
  margin: 20px 0 0; max-width: 62ch; color: var(--ink);
}
.note code, .mono { font-family: var(--mono); font-size: 0.9em; }

.h {
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.18em;
  margin: 0 0 14px; padding-bottom: 8px; border-bottom: 3px solid var(--ink);
}

.last { margin-top: clamp(26px, 4vw, 44px); }

/* a claimed week wears the stamp */
.stamped { position: relative; }
.stamped::after {
  content: ""; position: absolute; right: 0; top: -18px;
  width: 168px; height: 168px; pointer-events: none;
  background: url("art/stamp-paid.png") center/contain no-repeat;
  opacity: 0.9;
}
.stamped.is-pending::after { background-image: url("art/stamp-pending.png"); }

.how .p { max-width: 66ch; font-family: var(--body); font-size: clamp(15px, 1.9vw, 17px); margin: 0 0 18px; }
.how .p b { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0.06em; }

/* the printed histogram of what everyone chose: dot-matrix bars, made of type */
.bar { font-family: var(--mono); letter-spacing: -0.06em; color: var(--ink); }

/* ----------------------------------------------------------------- picker */

dialog {
  width: min(680px, 94vw); height: min(86vh, 760px);
  padding: 0; border: 5px solid var(--ink); background: var(--paper); color: var(--ink);
  overflow: hidden;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(0, 0, 0, 0.82); }
.picker-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: var(--paper); border-bottom: 3px solid var(--ink);
}
.picker-head .h { margin: 0; border: 0; padding: 0; }
.search { display: block; padding: 12px 16px 0; flex: 0 0 auto; }
.search input {
  width: 100%; min-height: 52px; padding: 0 14px;
  font-family: var(--mono); font-size: 16px;
  border: 3px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink);
}
#picker .note { padding: 0 16px; margin: 12px 0; flex: 0 0 auto; font-size: 15px; }
.list { list-style: none; margin: 0; padding: 0 16px 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.list li { border-bottom: 2px dotted var(--ink); }
.pickbtn {
  width: 100%; min-height: 56px; display: grid;
  grid-template-columns: 6ch 1fr auto; align-items: center; gap: 12px; text-align: left;
  background: var(--paper); color: var(--ink); border: 0; border-radius: 0; cursor: pointer;
  font-family: var(--mono); font-size: 14px; padding: 8px 6px;
}
.pickbtn:hover { background: var(--ink); color: var(--paper); }
.pickbtn .nm { font-family: var(--body); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pickbtn .dp { font-size: 12px; white-space: nowrap; }
.pickbtn[aria-current="true"] { background: #e6e6ff; }
.pickbtn[aria-current="true"]::after { content: " ✓"; }

/* ------------------------------------------------------------------ phone */

@media (max-width: 720px) {
  :root { --perf: 22px; }
  body { padding: 0 0 32px; font-size: 16px; }
  .band { grid-template-columns: 1fr; }
  .emblem { grid-row: auto; width: 72px; }
  .stubs { grid-template-columns: repeat(2, 1fr); border-bottom: 3px solid var(--ink); }
  .stub:nth-child(2) { border-right: 0; }
  .stub:nth-child(1), .stub:nth-child(2) { border-bottom: 3px solid var(--ink); }
  .row { flex-wrap: wrap; }
  .row .dots { min-width: 8px; }
  .row .v { flex: 1 0 100%; text-align: left; }
  .stamped::after { width: 108px; height: 108px; top: -10px; }
  .btn-primary { flex: 1 1 100%; }
}

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