:root {
  color-scheme: light;
  --wall: #d9d3c6;
  --paper: #f7f3e8;
  --ink: #20221f;
  --faded-ink: #65665f;
  --signal: #ec4c2f;
  --blue-ink: #265e70;
  --paper-width: 39rem;
}

* { box-sizing: border-box; }

html { background: var(--wall); }

body {
  position: relative;
  margin: 0;
  min-width: 18rem;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, rgb(255 255 255 / 28%) 0 1px, transparent 2px),
    linear-gradient(90deg, rgb(70 61 45 / 4%) 1px, transparent 1px),
    var(--wall);
  background-size: 19px 23px, 47px 100%;
  font-family: "Courier New", Courier, monospace;
  line-height: 1.5;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  padding: 0.65rem 0.8rem;
  color: #fff;
  background: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.next-display {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 3;
  width: min(20.5rem, calc(100% - 2rem));
  margin: 0;
  padding: 0.7rem;
  border: 2px solid #171815;
  border-radius: 0.55rem;
  background: #30332f;
  box-shadow:
    inset 0 0 0 2px #4b4e48,
    0 0.8rem 1.6rem rgb(37 31 23 / 22%);
  transform: rotate(-0.35deg);
}

.next-display::before,
.next-display::after {
  position: absolute;
  content: "";
  background: #252723;
}

.next-display::before {
  top: -0.4rem;
  right: 0.85rem;
  width: 2rem;
  height: 0.45rem;
  border-radius: 0.25rem;
}

.next-display::after {
  top: -1.5rem;
  right: 1.65rem;
  width: 0.45rem;
  height: 1.5rem;
}

.next-display__screen {
  min-height: 5.8rem;
  padding: 0.7rem 1rem;
  overflow: hidden;
  color: #b6ff70;
  border: 2px inset #151b13;
  border-radius: 0.18rem;
  background:
    repeating-linear-gradient(0deg, rgb(182 255 112 / 3%) 0 2px, transparent 2px 4px),
    #10170f;
  box-shadow: inset 0 0 1.25rem rgb(0 0 0 / 78%);
  text-shadow: 0 0 0.4rem rgb(182 255 112 / 48%);
}

.next-display p { margin: 0; }

.next-display__label {
  color: #7caf55;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.next-display__project {
  margin-top: 0.45rem !important;
  color: #e0ffc1;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.next-display__message {
  margin-top: 0.35rem !important;
  font-size: clamp(1rem, 4vw, 1.35rem);
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
}

.next-display[data-mode="processing"] .next-display__message {
  animation: display-processing 1.5s steps(2, end) infinite;
}

.printer {
  position: relative;
  z-index: 2;
  width: min(45rem, calc(100% - 1.5rem));
  height: 5.4rem;
  margin: 8.75rem auto -1.15rem;
  border: 2px solid #242622;
  border-radius: 0.55rem 0.55rem 0.2rem 0.2rem;
  background: #3b3d38;
  box-shadow: 0 1rem 2rem rgb(37 31 23 / 25%);
}

.printer__label {
  position: absolute;
  top: 1rem;
  left: 50%;
  padding: 0.2rem 0.45rem;
  color: #c9c5b8;
  border: 1px solid #73756c;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  transform: translateX(-50%);
}

.printer__light {
  position: absolute;
  top: 1.2rem;
  right: 1.4rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #9bdb6c;
  box-shadow: 0 0 0.55rem #9bdb6c;
}

.printer__slot {
  position: absolute;
  right: 4%;
  bottom: 0.65rem;
  left: 4%;
  height: 0.72rem;
  border: 2px solid #171815;
  border-radius: 50%;
  background: #11120f;
}

.receipt {
  position: relative;
  z-index: 1;
  width: min(var(--paper-width), calc(100% - 2rem));
  min-height: 100vh;
  margin: 0 auto;
  padding: 4.6rem clamp(1.2rem, 5vw, 3.25rem) 2.6rem;
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, transparent 0 4px, rgb(36 38 34 / 1.5%) 5px),
    linear-gradient(90deg, rgb(73 65 49 / 4%), transparent 8%, transparent 92%, rgb(73 65 49 / 5%)),
    var(--paper);
  box-shadow: 0 1.3rem 2.8rem rgb(54 46 34 / 24%);
}

.receipt.is-printing {
  animation: feed-paper var(--feed-duration, 5s) linear both;
}

.printer.is-printing {
  animation: printer-rattle 120ms steps(2, end) infinite;
}

.printer.is-printing .printer__light {
  animation: printer-light 480ms steps(2, end) infinite;
}

.receipt::before,
.receipt::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  content: "";
  background: rgb(52 54 49 / 8%);
}

.receipt::before { left: 0.55rem; }
.receipt::after { right: 0.55rem; }

.masthead { text-align: center; }

h1 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(3.3rem, 13vw, 6.2rem);
  font-weight: 900;
  line-height: 0.78;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

h1 span {
  display: block;
  color: var(--paper);
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3px 3px 0 var(--signal);
}

.tagline {
  max-width: 30rem;
  margin: 1.7rem auto;
  font-size: clamp(0.88rem, 2.5vw, 1.05rem);
  font-weight: 700;
}

.receipt-meta {
  display: flex;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-block: 2px solid var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
}

.intro { padding: 2.3rem 0 2rem; }

.intro h2,
.section-rule h2 {
  margin: 0 0 0.7rem;
  font: 900 0.76rem/1 "Courier New", monospace;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.intro p { margin: 0; font-size: 0.96rem; }

.section-rule {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-bottom: 0.6rem;
  border-bottom: 3px double var(--ink);
}

.section-rule h2 { margin: 0; }
.section-rule span { color: var(--faded-ink); font-size: 0.62rem; }

.dispatch {
  position: relative;
  padding: 2rem 0 2.25rem;
  border-bottom: 1px dashed #88877e;
  animation: ink-in 420ms calc(350ms + var(--print-order) * 90ms) ease-out both;
}

.dispatch__top {
  display: flex;
  min-height: 3rem;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.dispatch time {
  color: var(--blue-ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.project-mark {
  display: grid;
  width: 3.4rem;
  height: 2.6rem;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  color: var(--stamp-ink, var(--signal));
  border: 2px solid currentColor;
  font-family: Arial, sans-serif;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  transform: rotate(4deg);
  opacity: 0.88;
}

.project-mark img { max-width: 82%; max-height: 82%; object-fit: contain; }

.dispatch__project {
  margin: 0 0 0.55rem;
  color: var(--faded-ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.example-label {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.3rem;
  color: var(--paper);
  background: var(--signal);
  letter-spacing: 0.04em;
}

.dispatch h3 {
  max-width: 29rem;
  margin: 0;
  font: 900 clamp(1.25rem, 4vw, 1.7rem)/1.12 Arial, Helvetica, sans-serif;
  letter-spacing: -0.025em;
}

.dispatch__body { margin: 0.8rem 0 0; font-size: 0.9rem; }

.dispatch__link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--blue-ink);
  font-size: 0.78rem;
  font-weight: 700;
  text-underline-offset: 0.2em;
}

.dispatch__link::after { content: "  ↗"; }
.dispatch__link[aria-disabled="true"] { cursor: not-allowed; opacity: 0.7; }

.dispatch__number {
  position: absolute;
  right: 0;
  bottom: 0.25rem;
  color: rgb(32 34 31 / 30%);
  font-size: 0.58rem;
}

.receipt-footer { padding: 3.3rem 0 1.2rem; text-align: center; }
.receipt-footer p { font-weight: 700; }
.end-mark { color: var(--signal); letter-spacing: 0.8em; }

.receipt-footer a {
  display: inline-block;
  margin: 0.9rem 0 2.2rem;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  text-underline-offset: 0.25em;
}

.receipt-footer small { display: block; color: var(--faded-ink); font-size: 0.58rem; letter-spacing: 0.13em; }

.paper-end {
  position: relative;
  z-index: 2;
  width: min(var(--paper-width), calc(100% - 2rem));
  height: 1rem;
  margin: 0 auto 5rem;
  background: linear-gradient(135deg, var(--paper) 0.45rem, transparent 0) 0 0/0.9rem 100% repeat-x;
  filter: drop-shadow(0 0.7rem 0.5rem rgb(54 46 34 / 16%));
}

.paper-end.is-printing {
  animation: follow-paper var(--feed-duration, 25s) linear both;
}

.noscript-note { padding: 2rem 0; font-size: 0.85rem; }

a:focus-visible { outline: 3px solid var(--signal); outline-offset: 4px; }

@keyframes feed-paper {
  from { clip-path: inset(0 0 96%); transform: translateY(-1.5rem); }
  to { clip-path: inset(0); transform: translateY(0); }
}

@keyframes follow-paper {
  from { transform: translateY(var(--paper-start, 0)); }
  to { transform: translateY(0); }
}

@keyframes printer-rattle {
  from { transform: translateX(-1px); }
  to { transform: translateX(1px); }
}

@keyframes printer-light {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes display-processing {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.58; }
}

@keyframes ink-in {
  from { opacity: 0; filter: blur(1px); transform: translateY(-0.3rem); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@media (max-width: 34rem) {
  .next-display {
    top: 0.75rem;
    right: 0.55rem;
    width: min(14rem, calc(100% - 1rem));
  }
  .next-display__screen { min-height: 5.2rem; padding-inline: 0.75rem; }
  .printer { height: 4.5rem; margin-top: 7.5rem; }
  .printer__label { display: none; }
  .receipt { width: calc(100% - 1rem); padding-inline: 1.35rem; }
  .paper-end { width: calc(100% - 1rem); }
  .receipt-meta { font-size: 0.58rem; }
  .section-rule { align-items: start; flex-direction: column; gap: 0.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body { background: #fff; }
  .printer, .paper-end, .skip-link { display: none; }
  .receipt { width: 100%; margin: 0; box-shadow: none; }
}
