/* Built with Jev — the tally tape.
   Paper, ink, and one pink ribbon that prints totals and marks what clears the pass mark. */

:root {
  --paper: #fefefe;
  --desk: #dedede;
  --ink: #1e1e1e;
  --ink-2: #4b4b4b;
  --ink-3: #6b6b6b;
  --hair: #c4c4c4;
  --pink: #f386a1;
  --pink-wash: #fde7ee;
  --magenta: #d45bb6;

  --rule: 3px solid var(--ink);
  --rule-thin: 1px solid var(--ink);

  --display: "Host Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --tape-w: 340px;
  --pad: 24px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--ink) var(--desk);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  caret-color: var(--magenta);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--pink);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

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

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: var(--desk);
}
::-webkit-scrollbar-thumb {
  background: var(--ink);
  border: 3px solid var(--desk);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mono {
  font-family: var(--mono);
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: square;
  vertical-align: -3px;
}

/* ---------- demo stripe ---------- */

.demo {
  margin: 0;
  padding: 10px var(--pad);
  background: var(--desk);
  border-bottom: var(--rule);
  font-family: var(--mono);
  font-size: 13px;
  text-align: center;
}
.demo span {
  display: inline-block;
  padding: 2px 10px;
  background: var(--paper);
  border: 2px solid var(--ink);
}
.demo strong {
  text-transform: uppercase;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 var(--pad);
  height: 44px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
}
.topbar a {
  text-decoration: none;
}
.topbar a:hover {
  text-decoration: underline;
}
.topbar-home {
  font-weight: 700;
}
.topbar nav {
  display: flex;
  gap: 20px;
}
.topbar :focus-visible {
  outline-color: var(--pink);
}

/* ---------- frame: sheet on the left, the machine on the right ---------- */

.frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--tape-w);
  grid-template-areas:
    "mast machine"
    "sheet machine"
    "method method";
  border-bottom: var(--rule);
}

.mast {
  grid-area: mast;
  padding: 40px var(--pad) 28px;
  border-bottom: var(--rule);
}

h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(52px, 7.4vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  text-wrap: balance;
}

.lede {
  max-width: 58ch;
  margin: 18px 0 0;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink);
}
.lede em {
  font-style: normal;
  background: var(--ink);
  color: var(--paper);
  padding: 0 5px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- hand Jev a link: the machine's + key opens a slip beside it ---------- */

.hand-key {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 72px;
  padding: 0;
  border: 0;
  border-bottom: var(--rule);
  background: var(--pink);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 -6px 0 rgb(0 0 0 / 0.16);
  transition: box-shadow 120ms var(--ease), background-color 120ms var(--ease);
}
.hand-key:hover {
  background: #f597ae;
}
.hand-key:active,
.hand-key.is-open {
  box-shadow: inset 0 3px 0 rgb(0 0 0 / 0.22);
}
.hand-key:focus-visible {
  outline-offset: -6px;
  outline-color: var(--ink);
}
.hand-key-cap {
  display: grid;
  place-items: center;
  flex: none;
  width: 72px;
  border-right: var(--rule);
}
.hand-key-cap .icon-plus {
  width: 30px;
  height: 30px;
}
.hand-key-label {
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.icon-plus {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: square;
}

/* a printed slip: it hangs beside the machine, so the tape stays in view */
.hand-pop {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: var(--rule);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.16);
}
.hand-pop:popover-open {
  animation: slip-in 300ms var(--ease) both;
}
@keyframes slip-in {
  from {
    transform: translateX(28px);
    opacity: 0;
  }
}
.hand-pop::backdrop {
  background: transparent;
}
.hand {
  padding: 16px 18px 16px;
}
.hand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.hand-head label {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hand-x {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.hand-x:hover {
  background: var(--ink);
  color: var(--paper);
}
.hand-row {
  display: flex;
  border: var(--rule);
  background: var(--paper);
}
.hand input {
  flex: 1;
  min-width: 0;
  height: 64px;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
}
.hand input::placeholder {
  color: var(--ink-3);
}
.hand input:focus-visible {
  outline: none;
}
.hand-row:focus-within {
  outline: 3px solid var(--magenta);
  outline-offset: 2px;
}

.plus-key {
  flex: none;
  width: 72px;
  height: 64px;
  border: 0;
  border-left: var(--rule);
  background: var(--pink);
  color: var(--ink);
  cursor: pointer;
  box-shadow: inset 0 -6px 0 rgb(0 0 0 / 0.18);
  transition: box-shadow 120ms var(--ease), transform 120ms var(--ease);
}
.plus-key svg {
  width: 28px;
  height: 28px;
}
.plus-key:hover {
  background: #f597ae;
}
.plus-key:active,
.hand.is-busy .plus-key {
  box-shadow: inset 0 2px 0 rgb(0 0 0 / 0.25);
  transform: translateY(2px);
}
.plus-key:focus-visible {
  outline-offset: -6px;
  outline-color: var(--ink);
}
.hand.is-busy .plus-key {
  cursor: progress;
  background: repeating-linear-gradient(-45deg, var(--pink) 0 8px, #f7a3b8 8px 16px);
  background-size: 22.6px 22.6px;
  animation: feed 600ms linear infinite;
}
@keyframes feed {
  to {
    background-position: 22.6px 0;
  }
}

.hand-out {
  display: block;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
  min-height: 2lh;
}
.hand-out.is-error {
  color: var(--ink);
}
.hand-out.is-error::before {
  content: "ERR ";
  background: var(--ink);
  color: var(--paper);
  padding: 0 4px;
  margin-right: 6px;
  font-weight: 700;
}
.hand-out .verdict-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  color: var(--ink);
}
.hand-out .verdict-word {
  font-weight: 800;
  text-transform: uppercase;
  padding: 0 6px;
  border: 2px solid var(--ink);
}
.hand-out .verdict-word.is-pass {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- the machine: counters and tape ---------- */

.machine {
  grid-area: machine;
  border-left: var(--rule);
  background: var(--desk);
  min-width: 0;
}
.machine-stick {
  position: sticky;
  top: 0;
}

.counters {
  display: grid;
  border-bottom: var(--rule);
}
.counter {
  padding: 18px 20px 16px;
}
.counter p {
  margin: 0;
}
.counter-jev {
  background: var(--pink);
  border-bottom: var(--rule);
}
.counter-x {
  background: var(--ink);
  color: var(--paper);
}
.counter-label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.counter-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px !important;
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(28px, 2.6vw, 38px);
  line-height: 1;
  letter-spacing: -0.03em;
}
.counter-total .sym {
  font-size: 0.7em;
  font-weight: 700;
}
.counter-meta {
  margin-top: 10px !important;
  text-wrap: balance;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
}
.counter-x .counter-meta {
  color: #d6d6d6;
}
.ratio {
  margin: 0;
  padding: 10px 20px;
  border-top: var(--rule);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
}
.ratio strong {
  background: var(--ink);
  color: var(--paper);
  padding: 0 5px;
}

.digit-roll {
  display: inline-block;
  animation: roll 420ms var(--ease) both;
}
@keyframes roll {
  from {
    transform: translateY(-0.55em);
    opacity: 0;
    filter: blur(2px);
  }
}

/* the tape hangs off the machine and feeds downward */
.tape {
  padding: 0 22px 36px;
}
.tape-paper {
  list-style: none;
  margin: 0;
  padding: 14px 14px 26px;
  background: var(--paper);
  border: var(--rule-thin);
  border-top: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
  max-height: 62vh;
  overflow: hidden;
  -webkit-mask: linear-gradient(to bottom, #000 calc(100% - 36px), transparent), url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8"><path d="M0 0h12v2L6 8 0 2z"/></svg>') bottom / 12px 8px repeat-x;
  -webkit-mask-composite: source-over;
  box-shadow: 0 6px 14px rgb(0 0 0 / 0.08);
}
.tl {
  display: grid;
  grid-template-columns: 8.4ch 1.6ch minmax(0, 1fr);
  gap: 0 6px;
  padding: 3px 0;
  align-items: baseline;
}
.tl-amt {
  text-align: right;
  font-weight: 500;
}
.tl-sym {
  font-weight: 700;
}
.tl-what {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}
.tl-sub {
  margin: 2px -6px 8px;
  padding: 3px 6px;
  border-top: 1px dashed var(--ink);
}
.tl-sub .tl-what,
.tl-total .tl-what {
  color: var(--ink);
  text-transform: uppercase;
}
.tl-total {
  margin: 0 -6px 10px;
  padding: 6px;
  background: var(--pink);
  font-weight: 800;
}
.tl-total .tl-amt {
  font-weight: 800;
}
.tl-note .tl-what {
  color: var(--ink-3);
}
.tl.is-new {
  animation: print 520ms var(--ease) both;
  background: var(--pink-wash);
}
@keyframes print {
  from {
    clip-path: inset(0 100% 0 0);
  }
}
.tape-paper.is-feeding {
  animation: paperfeed 380ms steps(4) both;
}
@keyframes paperfeed {
  from {
    transform: translateY(-18px);
  }
}

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

.sheet {
  grid-area: sheet;
  min-width: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 14px var(--pad);
  border-bottom: var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 2;
}
.seg {
  display: flex;
  flex-wrap: wrap;
  border: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.seg > * {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  text-decoration: none;
  border-right: 2px solid var(--ink);
}
.seg > *:last-child {
  border-right: 0;
}
.seg a:hover {
  background: var(--desk);
}
.seg a[aria-current="true"] {
  background: var(--ink);
  color: var(--paper);
}
.seg .count {
  font-weight: 400;
  opacity: 0.75;
}
.seg-label {
  background: var(--desk);
}
.seg-wrap {
  border: 0;
  gap: 6px;
}

/* desktop: every control in view, ordered sort · window · pass mark / job · source */
.more {
  display: contents;
}
.more-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.more-label {
  display: none;
}
.seg-sort {
  order: 1;
}
.seg-window {
  order: 2;
}
.seg-cord {
  order: 3;
}
.seg-job {
  order: 4;
}
.seg-src {
  order: 5;
}
.seg-wrap > * {
  border: 2px solid var(--ink) !important;
}
.seg-cord a[aria-current="true"] {
  background: var(--pink);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink);
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.grid thead th {
  position: sticky;
  top: var(--toolbar-h, 64px);
  z-index: 1;
  padding: 8px 10px;
  background: var(--desk);
  border-bottom: var(--rule);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: nowrap;
}
.grid th + th,
.grid td + td {
  border-left: 1px solid var(--hair);
}
.grid td {
  padding: 10px;
  border-bottom: 1px solid var(--ink);
  vertical-align: middle;
}
.grid tbody tr {
  cursor: pointer;
}
.grid tbody tr:hover {
  background: #f1f1f1;
}

.c-n {
  width: 56px;
  white-space: nowrap;
  padding-left: 12px !important;
}
.c-n .n {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}
.stroke {
  width: 12px;
  height: 30px;
  vertical-align: middle;
  margin-right: 8px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: butt;
}
.stroke-borderline {
  stroke-width: 2;
}
.stroke-borderline path {
  stroke-width: 2;
}

.c-build {
  min-width: 260px;
}
.build-title {
  display: block;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  text-decoration: none;
  text-wrap: pretty;
}
.build-title:hover {
  text-decoration: underline;
}
.build-by {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}

.c-src,
.c-job,
.c-num,
.c-usd,
.c-sub {
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}
.c-src {
  font-weight: 700;
}
.c-num,
.c-usd {
  text-align: right;
}
.grid th.c-num,
.grid th.c-usd {
  text-align: right;
}
.c-usd {
  font-weight: 700;
}
.job-conf {
  display: block;
  color: var(--ink-3);
}
.c-go {
  width: 44px;
  text-align: center;
}
.c-go a {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink);
  background: var(--paper);
}
.c-go a:hover {
  background: var(--ink);
  color: var(--paper);
}

/* identical meters in every row: sweep a column and it reads as one instrument */
.c-p {
  width: 92px;
}
.meter {
  display: grid;
  gap: 4px;
  min-width: 64px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}
.meter-bar {
  position: relative;
  height: 8px;
  border: 1.5px solid var(--ink);
  background: linear-gradient(to right, var(--ink) calc(var(--p) * 100%), transparent 0);
}
.meter.is-over .meter-bar {
  background: linear-gradient(to right, var(--pink) calc(var(--p) * 100%), transparent 0);
}
.meter-score .meter-bar::after {
  display: none;
}
.meter-none {
  color: var(--ink-3);
}
.meter-bar::after {
  content: "";
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: calc(var(--mark) * 100%);
  width: 2px;
  background: var(--ink);
}

.sub {
  display: inline-block;
  min-width: 44px;
  padding: 2px 6px 6px;
  border: 2px solid var(--ink);
  font-weight: 800;
  text-align: center;
  background: linear-gradient(to right, var(--ink) calc(var(--s) * 100%), transparent 0) bottom / 100% 4px no-repeat;
}

/* borderline rows print lighter so passes carry the column */
.r-borderline .build-title,
.r-borderline .meter,
.r-borderline .c-usd {
  font-weight: 500;
}
.r-pinned td {
  border-bottom: 4px double var(--ink);
}

/* the headliner: the sheet's first row, billed at poster scale */
.r-head td {
  border-bottom: var(--rule);
  background: var(--paper);
}
.r-head:hover td {
  background: #f1f1f1;
}
.r-head .c-n {
  vertical-align: top;
  padding-top: 22px;
}
.r-head .c-n .stroke {
  display: none;
}
.r-head .c-n .n {
  display: block;
  font-family: var(--display);
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}
.r-head .head-cell {
  border-left: 8px solid var(--ink) !important;
}
.r-head.r-pinned .head-cell {
  border-left: 16px double var(--ink) !important;
}
.head-cell {
  padding: 22px 16px 24px !important;
}
.head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.head-title {
  display: block;
  font-size: clamp(30px, 3.4vw, 50px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
  text-decoration: none;
  text-wrap: balance;
}
.head-title:hover {
  text-decoration: underline;
  text-decoration-thickness: 4px;
}
.head-by {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
}
.head-body {
  margin: 12px 0 0;
  max-width: 62ch;
  font-size: 16px;
}
.head-receipt {
  display: flex;
  flex-wrap: wrap;
  margin: 18px 0 0;
  max-width: 660px;
  border-top: 2px solid var(--ink);
  border-left: 2px solid var(--ink);
}
.head-receipt > div {
  flex: 1 1 118px;
  padding: 8px 12px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}
.head-receipt > .wide {
  flex-basis: 250px;
}
.head-receipt dt {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.head-receipt dd {
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
}
.head-receipt .meter {
  font-size: 18px;
  min-width: 0;
}
.head.has-img {
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
}
.head-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: var(--rule);
  background: var(--desk);
  display: block;
}

/* rejects drop into the agate block at the foot */
.agate {
  border-top: var(--rule);
  background: var(--desk);
  padding: 16px var(--pad) 22px;
}
.agate-title {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
}
.agate-body {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  columns: 3 280px;
  column-gap: 28px;
  column-rule: 1px solid var(--ink-3);
}
.ag {
  display: flex;
  gap: 8px;
  break-inside: avoid;
  margin-bottom: 8px;
}
.ag .stroke {
  flex: none;
  width: 10px;
  height: 30px;
  margin: 0;
  stroke-width: 2.5;
}
.ag a {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.ag a:hover {
  text-decoration: underline;
}
.ag-meta {
  color: var(--ink-2);
}

.empty,
.notfound {
  padding: 56px var(--pad) 72px;
  font-size: 17px;
  max-width: 64ch;
}
.empty-big {
  margin: 0 0 10px;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

/* ---------- method ---------- */

.method {
  grid-area: method;
  border-top: var(--rule);
  padding: 48px var(--pad) 56px;
  background: var(--paper);
}
.method h2 {
  margin: 0 0 24px;
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}
.method-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 40px;
  align-items: start;
}
.method-prose p {
  margin: 0 0 16px;
  max-width: 62ch;
}
.listing {
  list-style: none;
  margin: 0;
  padding: 0;
  border: var(--rule);
  font-family: var(--mono);
  font-size: 13px;
}
.listing li {
  display: grid;
  grid-template-columns: 9ch 7ch minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ink);
}
.listing li:last-child {
  border-bottom: 0;
}
.listing-id {
  font-weight: 800;
}
.listing-type {
  color: var(--ink);
  background: var(--desk);
  padding: 0 4px;
  height: fit-content;
  text-align: center;
}
.listing-q {
  color: var(--ink-2);
}

/* ---------- colophon ---------- */

.colophon {
  padding: 22px var(--pad) 28px;
  background: var(--ink);
  color: #d6d6d6;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
}
.colophon p {
  margin: 0 0 6px;
  max-width: 100ch;
}
.colophon a {
  color: var(--paper);
}
.colophon :focus-visible {
  outline-color: var(--pink);
}

/* ---------- receipt page ---------- */

.receipt-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "subject receipt"
    "read receipt";
  min-height: calc(100vh - 44px);
  border-bottom: var(--rule);
}
.subject {
  grid-area: subject;
  padding: 40px var(--pad) 32px;
  border-bottom: var(--rule);
}
.subject-title {
  font-size: clamp(34px, 4.4vw, 64px);
  text-transform: none;
  line-height: 0.98;
  letter-spacing: -0.035em;
  max-width: 22ch;
}
.subject-src {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
}
.subject-img {
  display: block;
  width: 100%;
  max-width: 760px;
  margin-top: 28px;
  border: var(--rule);
  background: var(--desk);
}
.subject-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 0;
}

/* the read panel runs the slip's full length; long text scrolls inside it */
.read {
  grid-area: read;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  background: var(--desk);
}
.read-title {
  margin: 0;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.read-title span {
  margin-left: 8px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-2);
}
.read-frame {
  position: relative;
  flex: 1;
}
.read-body {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 6px var(--pad) 24px;
}
.read-body pre {
  margin: 0 0 8px;
  max-width: 100ch;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
}
.read-label {
  display: inline-block;
  margin: 14px 0 8px;
  padding: 1px 6px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: var(--rule);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: inset 0 -5px 0 rgb(255 255 255 / 0.18);
}
.btn:hover {
  background: #3a3a3a;
}
.btn:focus-visible {
  outline-color: var(--magenta);
}
.btn-ghost {
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 -5px 0 rgb(0 0 0 / 0.12);
}
.btn-ghost:hover {
  background: var(--desk);
}

.receipt {
  grid-area: receipt;
  border-left: var(--rule);
  background: var(--desk);
  padding: 0 28px 40px;
}
.receipt-paper {
  background: var(--paper);
  border: var(--rule-thin);
  border-top: 0;
  padding: 20px 20px 34px;
  font-family: var(--mono);
  font-size: 13px;
  -webkit-mask: linear-gradient(#000, #000) top / 100% calc(100% - 8px) no-repeat,
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8"><path d="M0 0h12v2L6 8 0 2z"/></svg>') bottom / 12px 8px repeat-x;
  box-shadow: 0 6px 14px rgb(0 0 0 / 0.08);
}
.rc-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--ink);
  font-size: 12px;
  color: var(--ink-2);
}
.rc-verdict {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  text-transform: uppercase;
}
.rc-pass,
.rc-borderline,
.rc-reject {
  display: inline-block;
  padding: 2px 10px;
  border: 4px solid var(--ink);
  transform: rotate(-2deg);
}
.rc-reject {
  text-decoration: line-through;
  text-decoration-thickness: 4px;
}
.rc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}
.rc-table th {
  text-align: left;
  font-weight: 500;
  padding: 6px 12px 6px 0;
  width: 44%;
  color: var(--ink-2);
}
.rc-table td {
  padding: 6px 0;
}
.rc-gate th,
.rc-gate td,
.rc-total th,
.rc-total td {
  border-top: 1px dashed var(--ink);
  font-weight: 800;
  color: var(--ink);
}
.rc-total td,
.rc-total th {
  background: var(--pink);
  padding-left: 6px;
}
.rc-h {
  margin: 18px 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dist {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.dist li {
  display: grid;
  grid-template-columns: 11ch minmax(0, 1fr) 5ch;
  gap: 10px;
  align-items: center;
  padding: 3px 0;
}
.dist-bar {
  height: 10px;
  border: 1.5px solid var(--ink);
  background: linear-gradient(to right, var(--ink) calc(var(--p) * 100%), transparent 0);
}
.dist li.is-pick .dist-bar {
  border-width: 2.5px;
}
.dist li.is-pick .dist-k {
  font-weight: 800;
}
.dist-p {
  text-align: right;
}
.dist-score li {
  grid-template-columns: 2ch minmax(0, 1fr) 5ch;
}
.dist-desc {
  grid-column: 2 / -1;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.receipt-back {
  margin: 20px 0 0;
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------- narrower screens ---------- */

@media (max-width: 1180px) {
  :root {
    --tape-w: 290px;
  }
  .c-num {
    display: none;
  }
  .head.has-img {
    grid-template-columns: minmax(0, 1fr);
  }
  .head-img {
    max-width: 520px;
  }
}

@media (max-width: 900px) {
  :root {
    --pad: 16px;
  }
  .frame {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "mast" "machine" "sheet" "method";
  }
  .machine {
    border-left: 0;
    border-bottom: var(--rule);
  }
  .counters {
    grid-template-columns: 1fr 1fr;
  }
  .counter-jev {
    border-bottom: 0;
    border-right: var(--rule);
  }
  .ratio {
    grid-column: 1 / -1;
  }
  .machine-stick {
    position: static;
  }
  .tape {
    padding: 0 16px 20px;
  }
  .tape-paper {
    max-height: 190px;
  }
  .toolbar {
    position: static;
  }
  .seg-job {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
    margin-right: calc(var(--pad) * -1);
    padding-right: var(--pad);
  }
  .seg-job > * {
    flex: none;
  }
  .more-label {
    order: 6;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--ink);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
  }
  .more-label::after {
    content: "+";
  }
  .more-now {
    flex: 1;
    font-weight: 400;
    text-transform: none;
    color: var(--ink-2);
  }
  .more-toggle:checked + .more-label {
    background: var(--ink);
    color: var(--paper);
  }
  .more-toggle:checked + .more-label .more-now {
    color: #d6d6d6;
  }
  .more-toggle:checked + .more-label::after {
    content: "−";
  }
  .more-toggle:focus-visible + .more-label {
    outline: 3px solid var(--magenta);
    outline-offset: 2px;
  }
  .more {
    order: 7;
    display: none;
    flex-wrap: wrap;
    gap: 10px 12px;
    width: 100%;
  }
  .more-toggle:checked ~ .more {
    display: flex;
  }
  .grid thead {
    display: none;
  }
  .grid,
  .grid tbody {
    display: block;
  }
  .grid tr {
    display: grid;
    grid-template-columns: 44px repeat(3, minmax(0, 1fr)) auto;
    grid-template-areas:
      "n build build build go"
      "n pjev cool love love"
      "n src job job usd";
    gap: 8px 12px;
    padding: 14px 16px 14px 8px;
    border-bottom: 1px solid var(--ink);
  }
  .grid td {
    padding: 0;
    border: 0 !important;
  }
  .grid td.c-n {
    grid-area: n;
    padding-left: 0 !important;
    width: auto;
  }
  .c-n .stroke {
    display: block;
    margin: 0 0 4px;
  }
  .c-build {
    grid-area: build;
    min-width: 0;
  }
  .c-go {
    grid-area: go;
    width: auto;
  }
  .grid .c-pjev {
    grid-area: pjev;
  }
  .grid .c-cool {
    grid-area: cool;
  }
  .grid .c-love {
    grid-area: love;
  }
  .grid .c-p {
    width: auto;
  }
  .grid .c-p::before,
  .grid .c-src::before,
  .grid .c-usd::before {
    display: block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--ink-2);
    margin-bottom: 2px;
  }
  .grid .c-pjev::before {
    content: "P·Jev";
  }
  .grid .c-cool::before {
    content: "Cool";
  }
  .grid .c-love::before {
    content: "<3";
  }
  .c-src {
    grid-area: src;
  }
  .c-job {
    grid-area: job;
  }
  .c-usd {
    grid-area: usd;
    text-align: left !important;
  }
  .grid .c-usd::before {
    content: "Cost $";
  }
  .job-conf {
    display: inline;
    margin-left: 6px;
  }
  .grid tr.r-head {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas: "n build";
  }
  .r-head .head-cell {
    grid-area: build;
    padding: 0 0 0 14px !important;
  }
  .r-head .c-n .n {
    font-size: 32px;
  }
  .head-receipt > div {
    flex-basis: 90px;
    padding: 6px 8px;
  }
  .head-receipt > .wide {
    flex-basis: 100%;
  }
  .method-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .receipt-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "subject" "receipt" "read";
  }
  .read-frame {
    flex: none;
  }
  .read-body {
    position: static;
  }
  .receipt {
    border-left: 0;
    border-top: var(--rule);
    padding: 0 16px 32px;
  }
}

@media (max-width: 560px) {
  .topbar nav a:not(:first-child) {
    display: none;
  }
  .counters {
    grid-template-columns: 1fr;
  }
  .counter-jev {
    border-right: 0;
    border-bottom: var(--rule);
  }
  .hand input {
    height: 56px;
    padding: 0 12px;
  }
  .plus-key {
    width: 60px;
    height: 56px;
  }
  .lede {
    font-size: 17px;
  }
  .listing li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .listing-type {
    width: fit-content;
  }
  .head-receipt .meter {
    font-size: 16px;
  }
}

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