/* Fonts: self-hosted, OFL. See fonts/LICENCES.md */
@font-face { font-family: "Thermal"; src: url("fonts/ShareTechMono-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Ticket"; src: url("fonts/Archivo-VF.ttf") format("truetype"); font-weight: 100 900; font-stretch: 62% 125%; }

:root {
  /* Surface: self-healing cutting mat */
  --mat: #2b5c4c;
  --mat-line: rgba(214, 236, 226, 0.13);
  --mat-line-major: rgba(214, 236, 226, 0.26);
  --mat-print: #d8e8e0;
  /* Paper and print */
  --paper: #f7f7f3;
  --ink: #26262b;
  --ink-soft: #55555d;
  /* Shelf ticket */
  --card: #ffffff;
  --card-ink: #16161a;
  --card-soft: #5c5c64;
  --shadow-flat: drop-shadow(0 1px 1px rgba(8, 24, 18, 0.35)) drop-shadow(0 10px 18px rgba(8, 24, 18, 0.28));
}

* { box-sizing: border-box; margin: 0; padding: 0; }



/* ---------- Stage + mat ---------- */
.stage { position: relative; overflow: hidden; background-color: var(--mat); }
.mat-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--mat-line-major) 0 2px, transparent 2px),
    linear-gradient(to bottom, var(--mat-line-major) 0 2px, transparent 2px),
    linear-gradient(to right, var(--mat-line) 0 1px, transparent 1px),
    linear-gradient(to bottom, var(--mat-line) 0 1px, transparent 1px);
  background-size: 180px 180px, 180px 180px, 36px 36px, 36px 36px;
  background-position: -1px -1px;
}
.mat-diag { position: absolute; height: 1px; background: var(--mat-line-major); transform-origin: 0 0; }
.mat-ruler { position: absolute; font-family: "Ticket", sans-serif; font-weight: 500; font-size: 14px; color: var(--mat-print); opacity: 0.55; letter-spacing: 0.02em; }

/* ---------- Receipt ---------- */
.receipt-shadow { position: absolute; filter: var(--shadow-flat); }
.receipt {
  --fs: 24px;
  font-family: "Thermal", monospace;
  font-size: var(--fs);
  line-height: 1.12;
  color: var(--ink);
  background: var(--paper);
  padding: 1.5em 1.5em 1.6em;
  width: calc(32ch + 3em);
  text-transform: uppercase;
  font-variant-ligatures: none;
  position: relative;
}
/* thermal head streaks: two faint vertical lighter columns, like a weak heating dot */
.receipt .print {
  -webkit-mask-image: linear-gradient(to right, #000 0 37%, rgba(0,0,0,.78) 37% 37.6%, #000 37.6% 71%, rgba(0,0,0,.85) 71% 71.4%, #000 71.4%);
          mask-image: linear-gradient(to right, #000 0 37%, rgba(0,0,0,.78) 37% 37.6%, #000 37.6% 71%, rgba(0,0,0,.85) 71% 71.4%, #000 71.4%);
}
/* paper curl from the roll: faint shade at the long edges */
.receipt::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right, rgba(30,30,20,.06), rgba(30,30,20,0) 7%, rgba(30,30,20,0) 93%, rgba(30,30,20,.07));
}
.row { display: flex; white-space: nowrap; }
.row .lbl { flex: none; }
.row .lead { flex: 1 1 auto; overflow: hidden; margin: 0 1ch; color: var(--ink-soft); min-width: 1ch; }
.row .lead::before { content: "................................................................................"; }
.row .amt { flex: none; text-align: right; }
.row .mk { flex: none; width: 1ch; text-align: right; }
.row.indent .lbl { padding-left: 2ch; }
.row.soft { color: var(--ink-soft); }
.c { text-align: center; }
.soft { color: var(--ink-soft); }
.sep { white-space: nowrap; overflow: hidden; color: var(--ink-soft); line-height: 0.8; margin: 0.22em 0; }
.sep::before { content: "--------------------------------------------------------------------"; }
.sep.eq::before { content: "===================================================================="; }
.gap { height: 0.45em; }
.bold { -webkit-text-stroke: 0.045em currentColor; }

/* ESC/POS style double-size and double-height print */
.dbl { display: block; height: 2.44em; line-height: 1.22; }
.dbl > .in { display: block; transform: scaleY(2); transform-origin: 50% 0; }
.dsz { font-size: 2em; line-height: 1.12; letter-spacing: 0; }
.shop { margin-bottom: 0.3em; overflow-wrap: anywhere; }
.shop .in { overflow-wrap: anywhere; white-space: normal; }

/* TOTAL: label in double size, the amount on its own line in triple size (ESC/POS GS ! 0x22) */
.total { margin: 0.15em 0 0.05em; white-space: nowrap; }
.total .t-lbl { line-height: 1.05; }
.total .t-amt { font-size: 3em; line-height: 0.98; text-align: right; padding-right: 0.333ch; letter-spacing: -0.02em; -webkit-text-stroke: 0.035em currentColor; }
/* units keep their real case on the uppercase receipt: kB, MB, GB, s, g */
.u { text-transform: none; }
.clip { white-space: nowrap; overflow: hidden; text-overflow: clip; }
.wrap { white-space: normal; overflow-wrap: anywhere; }
.barcode { display: block; margin: 0.45em auto 0.15em; }
.tail { margin-top: 0.1em; }
.gap-t { margin-top: 0.35em; }

/* torn edges: clip-path is generated per receipt in receipt.js */

/* ---------- Shelf ticket (landscape only) ---------- */
.ticket-shadow { position: absolute; filter: var(--shadow-flat); }
.ticket {
  background: var(--card); color: var(--card-ink);
  font-family: "Ticket", sans-serif;
  width: 520px; padding: 24px 0 0;
  position: relative;
}
.t-name { font-weight: 800; font-stretch: 80%; font-size: 52px; line-height: 1; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; padding: 0 28px; }
.t-sub { font-weight: 500; font-size: 19px; color: var(--card-soft); padding: 8px 28px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* price: whole number big, the decimals as superscript "cents" at 45%, unit and "per page view" under them */
.t-price { --ps: 176px; display: flex; align-items: flex-start; gap: 0.04em; padding: 4px 28px 0 22px; font-size: var(--ps); }
.t-price .num { font-weight: 850; font-stretch: 72%; line-height: 0.86; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.t-price .side { display: flex; flex-direction: column; align-items: flex-start; padding-top: 0.035em; }
.t-price .cents { font-weight: 850; font-stretch: 72%; font-size: 0.45em; line-height: 0.82; letter-spacing: -0.02em; }
.t-price .unit { font-weight: 800; font-stretch: 80%; font-size: 0.26em; line-height: 1; padding-top: 0.22em; }
.t-price .per { white-space: nowrap; font-weight: 500; font-stretch: 100%; font-size: 17px; line-height: 1.15; color: var(--card-soft); padding-top: 4px; }
.t-facts { display: flex; gap: 30px; padding: 10px 28px 0; font-weight: 700; font-stretch: 85%; font-size: 34px; line-height: 1.05; }
.t-facts small { font-weight: 500; font-stretch: 100%; font-size: 19px; color: var(--card-soft); }
.t-facts .tu, .t-unit .tu { font-weight: 700; }
.t-when { padding: 8px 28px 0; font-size: 15px; font-weight: 500; color: var(--card-soft); }
/* foot: barcode bottom left, store line, boxed unit price in the bottom right corner */
.t-foot { display: flex; align-items: stretch; margin-top: 12px; border-top: 2px solid var(--card-ink); }
.t-code { display: flex; flex-direction: column; justify-content: flex-end; padding: 10px 0 8px 22px; flex: none; }
.t-code .bc { display: block; }
.t-code .bc svg { display: block; margin: 0; }
.t-code .sr { font-family: "Thermal", monospace; font-size: 13px; line-height: 1; letter-spacing: 0.02em; white-space: nowrap; color: var(--card-ink); padding: 4px 0 0; text-align: center; }
.t-store { flex: 1 1 auto; min-width: 0; align-self: flex-end; text-align: right; white-space: nowrap; padding: 0 12px 10px; font-size: 13px; line-height: 1.35; font-weight: 500; color: var(--card-soft); }
.t-store b { font-weight: 700; color: var(--card-ink); }
.t-unit { flex: none; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 8px 16px 10px 12px; border-left: 2px solid var(--card-ink); }
.t-unit small { font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--card-soft); }
.t-unit b { font-weight: 800; font-stretch: 80%; font-size: 24px; white-space: nowrap; line-height: 1.1; color: var(--card-ink); }
