/* ==========================================================================
   DIRECTION: THE TILL ROLL  (assigned)
   World: a two-colour thermal till receipt, torn off the roll and handed to
   you. One monospaced face carries everything — hierarchy comes from scale,
   case, alignment and ruled lines, never from a second typeface. Raised by
   named donations, noted at each rule below.
   ========================================================================== */

:root {
  /* Thermal paper is off-white, never pure white, and it yellows at the edges. */
  --till-paper: #fbfaf7;
  --till-paper-edge: #efece2;
  --till-ink: #1b1a18;
  /* Measured against the paper (#fbfaf7): 4.7:1 minimum at the lightest use.
     The first pass used #8b8578, which the capture tool read as 3.51:1 across
     twenty-one small-text nodes — a real AA failure, not a cosmetic one. */
  --till-grey: #6e6a60;
  --till-faint: #ded9cd;
  /* Two-colour thermal heads print black and one red. Red means money going. */
  --till-red: #d42b21;
  --till-band: #23211f;
  --till-counter: #26231f;

  --till-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  /* The one line on the receipt that is not mono. Nastaliq is a hanging script:
     it needs the face itself and far more leading than latin, or the descenders
     collide with the line below. */
  --till-urdu: "Noto Nastaliq Urdu", "Segoe UI", serif;
  --till-measure: 34rem;
}

*, *::before, *::after { box-sizing: border-box; }

body.till {
  margin: 0;
  padding: 2rem 0 6rem;
  background-color: var(--till-counter);
  background-image:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(255, 255, 255, .07), transparent 70%),
    linear-gradient(180deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0) 30rem);
  color: var(--till-ink);
  font-family: var(--till-mono);
  font-size: .9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ------------------------------------------------------------ the paper --- */

.receipt {
  position: relative;
  max-width: var(--till-measure);
  margin: 0 auto;
  padding: 1.5rem 1.375rem 3rem;
  background:
    linear-gradient(180deg, var(--till-paper-edge), var(--till-paper) 2.5rem, var(--till-paper) calc(100% - 2.5rem), var(--till-paper-edge)),
    var(--till-paper);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 2px 0 rgba(0, 0, 0, .3);
  /* Torn top and bottom edges: the roll is cut, not trimmed. */
  -webkit-mask-image:
    radial-gradient(circle at 6px 0, transparent 5.5px, #000 6px) top left / 12px 8px repeat-x,
    radial-gradient(circle at 6px 8px, transparent 5.5px, #000 6px) bottom left / 12px 8px repeat-x,
    linear-gradient(#000, #000) center / 100% calc(100% - 16px) no-repeat;
  mask-image:
    radial-gradient(circle at 6px 0, transparent 5.5px, #000 6px) top left / 12px 8px repeat-x,
    radial-gradient(circle at 6px 8px, transparent 5.5px, #000 6px) bottom left / 12px 8px repeat-x,
    linear-gradient(#000, #000) center / 100% calc(100% - 16px) no-repeat;
  -webkit-mask-composite: source-over;
}

@media (min-width: 560px) {
  .receipt { padding: 2rem 2.25rem 3.5rem; }
}

/* Faint print misregistration, the way a two-head thermal printer lands. */
.r-hot { text-shadow: .5px 0 rgba(212, 43, 33, .28); }

/* --------------------------------------------------------------- blocks --- */

.r-block {
  padding: 1.25rem 0;
  border-top: 1px dashed var(--till-faint);
}

.r-block:first-of-type { border-top: 0; padding-top: 0; }

.r-head {
  margin: 0 0 .375rem;
  text-align: center;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.r-sub {
  margin: 0 0 1.25rem;
  text-align: center;
  font-size: .6875rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--till-grey);
}

.r-rule {
  height: 0;
  margin: 1rem 0;
  border-top: 1px dashed var(--till-faint);
}

h2.r-title {
  margin: 0 0 .75rem;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.r-lede { margin: 0 0 1rem; }

/* The hook line: the problem restated as the owner says it. Printed heavier than
   the description under it, and sitting closer to it than to the figure above. */
.r-lede--hook {
  margin-bottom: .5rem;
  font-weight: 700;
}

/* The brand line: printed centred like the rest of the head, in the script the
   name actually comes from. right-to-left and isolated, so it never reorders
   the latin sentence it sits above. */
.r-urdu {
  margin: 0 0 .5rem;
  text-align: center;
  direction: rtl;
  unicode-bidi: isolate;
  font-family: var(--till-urdu);
  font-size: 1.5rem;
  line-height: 2.1;
}

/* Rows of text with dot leaders, the way a printed till itemises. */
.r-row {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: .3125rem 0;
  font-size: .875rem;
}

.r-row .lbl { flex: 0 1 auto; }

.r-row .lead {
  flex: 1 1 auto;
  min-width: 1.5rem;
  border-bottom: 2px dotted var(--till-faint);
  transform: translateY(-.25em);
}

.r-row .amt {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.r-row .amt--out { color: var(--till-red); }

.r-row li { list-style: none; }

/* ------------------------------------------------------------ the figure -- */

/* Donated by the variable-font-specimen challenger: one numeral set enormous,
   so scale alone carries the page's loudest moment. */
.r-big {
  margin: .5rem 0 .25rem;
  font-size: clamp(2.75rem, 16vw, 4.5rem);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.02em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  text-shadow: 1.5px 0 rgba(212, 43, 33, .3);
}

.r-big--kept { text-shadow: 1.5px 0 rgba(0, 0, 0, .12); }

.r-caption {
  margin: 0 0 1rem;
  text-align: center;
  font-size: .6875rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--till-grey);
}

/* Caption set flush left, for the ones that introduce a list or a price block
   instead of labelling a figure above them. Replaces an inline style that had
   been copied twice. */
.r-caption--start { text-align: left; }

/* Inverse band: the one printed block that inverts, so the result cannot be
   mistaken for one more line. */
.r-band {
  margin: 1.25rem -1.375rem;
  padding: 1.25rem 1.375rem;
  background: var(--till-band);
  color: var(--till-paper);
  text-align: center;
}

@media (min-width: 560px) {
  .r-band { margin: 1.5rem -2.25rem; padding: 1.5rem 2.25rem; }
}

.r-band .r-caption { color: #b9b3a6; }

.r-band .r-big { margin: 0; text-shadow: 1.5px 0 rgba(212, 43, 33, .5); }

.r-band .r-fine { margin: .5rem 0 0; font-size: .75rem; color: #b9b3a6; }

/* ------------------------------------------------------------ the void ---- */

/* Donated by the phosphor-terminal challenger: the afterimage. When a figure
   changes, the old one stays printed above the new one, voided — so the page
   remembers what it used to claim and you can watch it move. */
.r-void {
  display: none;
  margin: 0 auto .75rem;
  padding: .4375rem .625rem;
  max-width: 22rem;
  text-align: center;
  font-size: .6875rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--till-grey);
  border: 1px dashed var(--till-faint);
}

.r-void.is-show { display: block; }

.r-void s { text-decoration-thickness: 2px; }

.r-void b { font-weight: 700; }

/* ---------------------------------------------------------------- stamps -- */

.r-stamp {
  display: inline-block;
  padding: .1875rem .4375rem;
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--till-grey);
  border: 2px solid currentColor;
  transform: rotate(-1.4deg);
}

.r-stamp--red { color: var(--till-red); }

.r-stamp--ink { color: var(--till-ink); }

/* ------------------------------------------------------------- the keys --- */

.r-input {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem 0;
  border-bottom: 1px dotted var(--till-faint);
}

.r-input-text { flex: 1 1 auto; font-size: .8125rem; letter-spacing: .04em; }

.r-input-value {
  flex: 0 0 auto;
  min-width: 4.5rem;
  text-align: right;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.key {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  font-family: var(--till-mono);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1;
  color: var(--till-ink);
  background: var(--till-paper);
  border: 2px solid var(--till-ink);
  box-shadow: 0 3px 0 var(--till-ink);
  cursor: pointer;
}

.key:active { transform: translateY(3px); box-shadow: none; }

.key:focus-visible { outline: 3px solid var(--till-red); outline-offset: 2px; }

/* A printed scale bar rather than a browser slider. */
.r-scale {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 1.375rem;
  margin: .25rem 0 .375rem;
  background: transparent;
  cursor: pointer;
  border: 0;
}

.r-scale::-webkit-slider-runnable-track {
  height: .375rem;
  border-bottom: 2px solid var(--till-ink);
  background-image: repeating-linear-gradient(90deg, var(--till-ink) 0 1px, transparent 1px 10%);
  background-repeat: no-repeat;
  background-size: 100% .3125rem;
}

.r-scale::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: .5rem;
  height: 1.375rem;
  margin-top: -.5rem;
  background: var(--till-ink);
  border: 0;
}

.r-scale::-moz-range-track { height: .375rem; border-bottom: 2px solid var(--till-ink); }

.r-scale::-moz-range-thumb {
  width: .5rem;
  height: 1.375rem;
  border: 0;
  border-radius: 0;
  background: var(--till-ink);
}

.r-scale:focus-visible { outline: 3px solid var(--till-red); outline-offset: 4px; }

.r-ends {
  display: flex;
  justify-content: space-between;
  font-size: .625rem;
  letter-spacing: .1em;
  color: var(--till-grey);
}

/* ------------------------------------------------------------- the list --- */

.r-list { margin: 0; padding: 0; list-style: none; }

.r-list li {
  position: relative;
  padding: .375rem 0 .375rem 1.25rem;
  font-size: .875rem;
  border-bottom: 1px dotted var(--till-faint);
}

.r-list li::before {
  content: "";
  position: absolute;
  left: .25rem;
  top: .8125rem;
  width: .5rem;
  height: .5rem;
  border: 2px solid var(--till-ink);
}

.r-list li:last-child { border-bottom: 0; }

/* A caption opening the next group sits right after a list — give it the air
   its own bottom margin cannot provide. */
.r-list + .r-caption { margin-top: 1rem; }

/* ------------------------------------------------------- the two columns -- */

.r-fit { display: grid; gap: 1.25rem; }

@media (min-width: 560px) {
  .r-fit { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

.r-fit h3 {
  margin: 0 0 .5rem;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.r-fit ul { margin: 0; padding: 0; list-style: none; }

.r-fit li {
  position: relative;
  padding: .375rem 0 .375rem 1.125rem;
  font-size: .875rem;
  border-bottom: 1px dotted var(--till-faint);
}

.r-fit li::before {
  content: "+";
  position: absolute;
  left: 0;
  font-weight: 700;
}

.r-fit--no li::before { content: "\00d7"; color: var(--till-grey); }

/* ------------------------------------------------------------ operator ---- */

.r-op { display: grid; gap: 1rem; align-items: start; }

@media (min-width: 560px) {
  .r-op { grid-template-columns: 9rem 1fr; }
}

.r-op-photo {
  display: grid;
  place-content: center;
  gap: .375rem;
  width: 100%;
  max-width: 9rem;
  aspect-ratio: 4 / 5;
  padding: .625rem;
  text-align: center;
  font-size: .625rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--till-grey);
  border: 1px dashed var(--till-faint);
}

.r-op-photo--filled {
  padding: 0;
  border-style: solid;
  border-color: var(--till-faint);
}

.r-op-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The same portrait pasted flat on the paper in the header — centred like the
   brand head above it, since it is a direct child of a block. */
.r-block > .r-op-photo {
  margin-inline: auto;
}

/* ---------------------------------------------------------- the screens --- */

/* Three real screens of the build, pasted flat on the paper: a hairline rule
   around each and a printed caption under it. Two across on the phone, three
   on the desktop — any smaller and the menu stops being readable, any bigger
   and the receipt turns into a gallery. */
.r-shots { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }

@media (min-width: 560px) {
  .r-shots { grid-template-columns: repeat(3, 1fr); gap: .875rem; }
}

.r-shots figure { margin: 0; }

.r-shots img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--till-faint);
}

.r-shots figcaption {
  margin-top: .375rem;
  text-align: center;
  font-size: .625rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--till-grey);
}

/* --------------------------------------------------------------- footer --- */

.r-tear {
  margin: 2rem -1.375rem 1.25rem;
  padding-top: .75rem;
  text-align: center;
  font-size: .625rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--till-grey);
  border-top: 2px dashed var(--till-faint);
}

@media (min-width: 560px) {
  .r-tear { margin-left: -2.25rem; margin-right: -2.25rem; }
}

.r-end { text-align: center; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; }

.r-foot { margin: 1rem 0 0; font-size: .8125rem; }

.r-link {
  color: var(--till-ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------- action --- */

.r-cta {
  display: block;
  width: 100%;
  padding: .9375rem 1.25rem;
  text-align: center;
  font-family: var(--till-mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--till-paper);
  background: var(--till-band);
  border: 2px solid var(--till-band);
  box-shadow: 0 3px 0 var(--till-red);
}

.r-cta:hover { background: var(--till-red); border-color: var(--till-red); }

.r-cta:focus-visible { outline: 3px solid var(--till-red); outline-offset: 3px; }

.r-cta:active { transform: translateY(3px); box-shadow: none; }

.r-alt {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  justify-content: center;
  margin: .75rem 0 0;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--till-grey);
}

@media (prefers-reduced-motion: no-preference) {
  [data-reveal] {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 380ms ease, transform 380ms cubic-bezier(.22, .61, .36, 1);
  }

  [data-reveal].is-in { opacity: 1; transform: none; }
}