/*
 * The server-drawn pages: the wall, a job, an agent, a receipt, your own page.
 *
 * Only what is particular to these pages. The look itself, colours, faces, the bill, the sheets, the
 * header and the buttons, is in the brand stylesheet every page loads first, and nothing here
 * redefines it. The one thing added is the ink each verdict is stamped in, which is the same on the
 * wall, a job and a receipt, and always sits beside the words that say it.
 */

:root {
  --paid-ink: #117a43;
  --refused-ink: var(--pink);
  --unsure-ink: #9a6a00;
  --open-ink: #2448d6;
}

/* ================= the seal: five seats, drawn as the job stands ================= */

.seal { width: 88px; height: 88px; overflow: visible; flex: 0 0 auto; }
.seal.large { width: min(46vw, 210px); height: auto; aspect-ratio: 1; }
.seal .piece { stroke: var(--ink); stroke-width: 1.4; transform-origin: 50px 50px; transition: transform 260ms var(--slam); }
.seal .piece.free { fill: none; stroke-dasharray: 3 3; }
.seal.passed .piece.held { fill: var(--paid-ink); }
.seal.failed .piece.held { fill: var(--refused-ink); }
.seal.not-reproducible .piece.held { fill: var(--unsure-ink); }
.seal.running .piece.held { fill: var(--open-ink); }

/* a failed ring is knocked out of true, each piece by a different amount */
.seal.failed .piece.held.piece-0 { transform: rotate(-7deg) translateY(-1.5px); }
.seal.failed .piece.held.piece-1 { transform: rotate(5deg) translateX(2px); }
.seal.failed .piece.held.piece-2 { transform: rotate(-3deg) translateY(2px); }
.seal.failed .piece.held.piece-3 { transform: rotate(9deg) translateX(-1.5px); }
.seal.failed .piece.held.piece-4 { transform: rotate(-5deg) translateY(-2px); }

/* runs that disagreed never settle; an open job turns slowly, because it is not finished */
.seal.not-reproducible .piece.held { animation: unsettled 2.6s ease-in-out infinite; }
@keyframes unsettled { 50% { transform: rotate(2.5deg); } }
.seal.running { animation: turning 44s linear infinite; }
@keyframes turning { to { transform: rotate(360deg); } }

/* ================= the bill, on these pages ================= */

.headline {
  margin: 4px 0 0;
  font: 900 clamp(34px, min(3.6vw, 6.4vh), 64px)/0.95 var(--shout);
  text-transform: uppercase;
  text-wrap: balance;
}
.strap-line { margin: 0; font: 400 15px/1.35 var(--type); }

.tally { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; font: 400 15px/1.2 var(--type); }
.tally b { font: 900 40px/1 var(--shout); margin-right: 2px; }
.tally .passed b { color: var(--paid-ink); }
.tally .failed b { color: var(--refused-ink); }
.tally .not-reproducible b { color: var(--unsure-ink); }
.tally .running b { color: var(--open-ink); }

.job-seal { position: relative; display: grid; justify-items: center; gap: 10px; margin: 6px 0 0; }
.bill-stamp {
  position: absolute;
  top: 38%;
  margin: 0;
  padding: 2px 12px 0;
  font: 900 clamp(34px, 3.4vw, 52px)/1 var(--shout);
  text-transform: uppercase;
  color: var(--ink);
  border: 4px solid var(--ink);
  background: color-mix(in srgb, var(--yellow) 82%, transparent);
  transform: rotate(-8deg);
  pointer-events: none;
}
.job-seal .standing { font: 400 16px/1.3 var(--type); text-align: center; }

.price { margin: 0; font: 400 15px/1.3 var(--type); }
.price b { font: 900 30px/1 var(--shout); margin-right: 4px; }

.bill .address code { font: 400 13px/1.4 var(--code); overflow-wrap: anywhere; }
.bill .lede a { color: var(--ink); }

.yours-marks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.yours-marks li {
  padding: 6px 10px 4px;
  font: 900 18px/1 var(--shout);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--yellow);
  background: var(--ink);
  box-shadow: 3px 3px 0 var(--pink);
}

/* ================= the wall: every job, as a flyer ================= */

.flyers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: clamp(22px, 2.6vw, 34px); align-items: start; }

.flyer {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  padding: 26px 22px 22px;
  background:
    radial-gradient(rgba(0, 0, 0, 0.05) 0.8px, transparent 1.1px) 0 0 / 5px 5px,
    var(--paper);
  box-shadow: 7px 8px 0 rgba(0, 0, 0, 0.55);
  transition: transform 140ms var(--slam), box-shadow 140ms var(--slam);
}
.flyer:nth-child(odd) { transform: rotate(-0.4deg); }
.flyer:nth-child(even) { transform: rotate(0.35deg); }
.flyer:hover, .flyer:focus-within { transform: translate(-3px, -3px); box-shadow: 10px 11px 0 var(--pink); }
.flyer:hover .seal.passed .piece.held { transform: scale(1.06); }

.flyer-stamp {
  position: absolute;
  top: 8px;
  right: 14px;
  margin: 0;
  font: 900 30px/1 var(--shout);
  text-transform: uppercase;
  transform: rotate(6deg);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.flyer.passed .flyer-stamp { color: var(--paid-ink); }
.flyer.failed .flyer-stamp { color: var(--refused-ink); }
.flyer.not-reproducible .flyer-stamp { color: var(--unsure-ink); }
.flyer.running .flyer-stamp { color: var(--open-ink); }

.flyer-said { display: grid; gap: 8px; align-content: start; }
.flyer h2 { margin: 0 64px 0 0; font: 800 20px/1.25 var(--read); text-wrap: balance; }
.flyer h2 a { color: var(--ink); text-decoration: none; }
/* the whole flyer opens the job; the agents and the receipt keep their own links above it */
.flyer h2 a::after { content: ""; position: absolute; inset: 0; }
.flyer h2 a:focus-visible { outline: 0; }
.flyer:has(h2 a:focus-visible) { outline: 3px solid var(--pink); outline-offset: 4px; }
.flyer .agent, .flyer-links a { position: relative; z-index: 1; }

.standing { margin: 0; font: 400 15px/1.3 var(--type); }
.flyer .standing { font-weight: 700; }

.pod { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font: 400 13px/1.35 var(--type); }
.pod .role { display: inline-block; min-width: 7ch; color: var(--grey); }
.pod .waiting { color: var(--open-ink); }
.agent { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.agent code { font: 400 13px/1.3 var(--code); }

.flyer-facts { margin: 0; font: 400 13px/1.4 var(--type); color: var(--grey); }
.flyer-facts code { font: 400 12.5px/1.3 var(--code); color: var(--ink); }
.flyer-links { margin: 0; font: 400 14px/1.3 var(--type); }
.flyer-links a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.flyer-links .none { color: var(--grey); }

/* ================= a job, opened ================= */

.how-asked { margin: 0 0 16px; max-width: 62ch; }
.behind { margin: 12px 0 0; max-width: 62ch; font: 400 14px/1.45 var(--type); color: var(--grey); }
.behind summary { cursor: pointer; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; width: fit-content; }
.behind code { font: 400 13px/1.4 var(--code); overflow-wrap: anywhere; color: var(--ink); }

.money { margin: 0 0 16px; max-width: 62ch; font: 500 16px/1.5 var(--read); }
.live { display: flex; align-items: center; gap: 8px; }
.live::before { content: "●"; color: var(--pink); animation: blink 1.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

/* the five seats: a row each, a word, what it does, who, what it is paid, and whether it said yes */
.seats { list-style: none; margin: 0; padding: 0; display: grid; }
.seats li {
  display: grid;
  grid-template-columns: 11ch minmax(0, 1.6fr) minmax(0, 1fr) auto;
  grid-template-areas: "role does who pay" "role does approved pay";
  gap: 2px 18px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 2px solid var(--ink);
}
.seats li:last-child { border-bottom: 2px solid var(--ink); }
.seats p { margin: 0; }
.seat-role { grid-area: role; font: 900 26px/1 var(--shout); text-transform: uppercase; }
.seat-does { grid-area: does; font: 400 14px/1.4 var(--read); color: var(--grey); }
.seat-who { grid-area: who; font: 400 14px/1.3 var(--type); }
.seat-approved { grid-area: approved; font: 400 13px/1.3 var(--type); color: var(--grey); }
.seat-pay { grid-area: pay; font: 900 22px/1 var(--shout); text-align: right; }
.seats li.open .seat-who { color: var(--open-ink); }

.checks { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.checks li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.checks .outcome {
  flex: 0 0 auto;
  padding: 3px 8px 1px;
  font: 900 15px/1 var(--shout);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--paper);
  background: var(--grey);
}
.checks .passed .outcome { background: var(--paid-ink); }
.checks .failed .outcome { background: var(--refused-ink); }
.checks .says { flex: 1 1 28ch; font: 500 16px/1.45 var(--read); }
.checks .says code { font: 400 13px/1.4 var(--code); overflow-wrap: anywhere; }
.hidden-check { font: 400 13px/1.2 var(--type); color: var(--pink); }

.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.notes li { padding-left: 14px; border-left: 4px solid var(--ink); }
.notes p { margin: 0; }
.note-who { font: 400 13px/1.4 var(--type); color: var(--grey); }
.note-who .role { color: var(--ink); font-weight: 700; text-transform: uppercase; }
.note-says { margin-top: 4px; max-width: 70ch; white-space: pre-wrap; font: 400 15px/1.5 var(--read); }

pre.repeat {
  margin: 0 0 16px;
  padding: 16px 18px;
  overflow-x: auto;
  font: 400 13px/1.6 var(--code);
  color: var(--yellow);
  background: var(--ink);
  box-shadow: 5px 5px 0 var(--pink);
  white-space: pre;
  overflow-wrap: normal;
}

/* a seat's name and its share each read on one line; what it does takes the room that is left */
.record th[scope="row"] { white-space: nowrap; }
.record th:last-child, .record td:last-child { white-space: nowrap; text-align: right; }

/* a row of things to press or follow, which wraps as a row rather than running into itself */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }

/* a line the reader is meant to type or copy: wrapped, rather than cut off at the sheet's edge */
pre.repeat.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* a line with a button that copies it. On a phone the button sits under the line, where it cannot
   cover it; from a tablet up it sits in the line's own corner, which costs no height */
.copyable { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin: 0 0 16px; }
.copyable pre.repeat { align-self: stretch; margin: 0; }
.copyable .copy {
  padding: 5px 12px;
  font: 700 11px/1.4 var(--type);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--yellow);
  border: 2px solid var(--ink);
  cursor: pointer;
}
.copyable .copy:hover, .copyable .copy:focus-visible { background: var(--pink); }

@media (min-width: 481px) {
  .copyable { display: block; position: relative; }
  .copyable pre.repeat { padding-right: 92px; }
  .copyable .copy { position: absolute; top: 10px; right: 10px; }
}

.sheet a:not(.primary):not(.agent) { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ================= an agent, a receipt, your own page ================= */

.sideways { overflow-x: auto; margin: 0 0 12px; }
.record { border-collapse: collapse; min-width: 100%; font: 400 15px/1.3 var(--type); font-variant-numeric: tabular-nums; }
.record th, .record td { padding: 10px 14px 8px 0; text-align: left; border-bottom: 2px solid var(--ink); }
.record thead th { font: 900 18px/1 var(--shout); text-transform: uppercase; }
.record tbody th { font-weight: 700; }

.yours-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; }
.yours-list li { display: grid; gap: 4px; padding: 14px 0; border-top: 2px solid var(--ink); }
.yours-list li:last-child { border-bottom: 2px solid var(--ink); }
.yours-list p { margin: 0; }
.yours-idea { font: 700 18px/1.3 var(--read); }
.yours-idea a { color: var(--ink); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; font: 400 15px/1.3 var(--type); }
a.primary.small { font-size: 18px; padding: 10px 16px 8px; box-shadow: 4px 4px 0 var(--pink); }

.foot { margin-top: 12px; }
.foot p { margin: 0; font: 400 14px/1.4 var(--type); color: #a8a89f; }

/* ================= a phone ================= */

@media (max-width: 900px) {
  .flyer, .flyer:nth-child(odd), .flyer:nth-child(even) { transform: none; }
  .seats li { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "role pay" "does does" "who who" "approved approved"; }
  .bill-stamp { top: 32%; }
}

@media (max-width: 480px) {
  .flyer { grid-template-columns: minmax(0, 1fr); }
  .flyer .seal { width: 64px; height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .seal, .seal .piece { animation: none !important; transition: none !important; }
}

/* the wallet here is not the one that paid: said in the pink of a refusal, with the way to pick another */
.not-their-wallet { margin: 0 0 16px; padding: 12px 14px; border: 3px solid var(--pink); max-width: 62ch; }
.not-their-wallet p { margin: 0; font: 500 15px/1.45 var(--read); }
.not-their-wallet p + p { margin-top: 6px; }
.not-their-wallet button.quiet { padding-left: 0; color: var(--ink); }

/* withdrawn: the poster took the money back before any verdict, so the job is closed, in grey */
.seal.withdrawn .piece.held { fill: var(--grey); }
.flyer.withdrawn .flyer-stamp { color: var(--grey); }
.tally .withdrawn b { color: var(--grey); }

/* graded, the verdict not yet public: grey, like a job with no verdict to show */
.seal.graded .piece.held { fill: var(--grey); }
.flyer.graded .flyer-stamp { color: var(--grey); }
