/* PRE receipt printer. Dark plastic machine, thermal paper that feeds out of the slot.
   Only transform, opacity and clip-path are animated. */
.pre-rp {
  --rp-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --rp-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --rp-radius: calc(var(--radius, 12px) * 2);
  --rp-inset: 0.75rem;
  --rp-inner-radius: calc(var(--rp-radius) - var(--rp-inset));
  --rp-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --rp-accent: var(--accent, #9fd8ff);
  --rp-paper: #eeece6;
  --rp-ink: #111214;
  --rp-noise: url("data:image/svg+xml,%3Csvg width='180' height='180' viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 24rem;
  margin-inline: auto;
  font-family: var(--font-main, 'Manrope', sans-serif);
  color: #f3f5f8;
}

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

/* Machine body */
.pre-rp__machine {
  position: relative;
  isolation: isolate;
  width: 100%;
  overflow: hidden;
  border-radius: var(--rp-radius);
  border: 1px solid #25282d;
  background: linear-gradient(168deg, #212328 0%, #141518 48%, #0c0d0f 100%);
  padding: var(--rp-inset) var(--rp-inset) 2rem;
  box-shadow:
    0 20px 36px -20px rgba(0, 0, 0, 0.9),
    0 6px 14px -8px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6);
}
.pre-rp__machine::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background-image: var(--rp-noise);
  background-size: 180px 180px;
  background-repeat: repeat;
  opacity: 0.22;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.pre-rp__slot {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  bottom: var(--rp-inset);
  z-index: 40;
  height: 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid #000;
  background: #000;
  box-shadow: inset 0 2px 3px #000, 0 1px 0 rgba(255, 255, 255, 0.07);
}

.pre-rp__header {
  position: relative;
  z-index: 10;
  display: flex;
  height: 2.75rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.3rem 0.35rem 0;
}
.pre-rp__mark {
  font-family: 'Syncopate', var(--font-heading, sans-serif);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  line-height: 1;
  color: #fff;
  padding-top: 0.2rem;
}
.pre-rp__tag {
  font-family: var(--rp-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  color: var(--rp-accent);
  border: 1px solid color-mix(in srgb, var(--rp-accent) 40%, transparent);
  background: color-mix(in srgb, var(--rp-accent) 8%, transparent);
}

/* Screen */
.pre-rp__screen {
  position: relative;
  z-index: 10;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--rp-inner-radius);
  border: 1px solid #000;
  background:
    radial-gradient(120% 90% at 20% 0%, color-mix(in srgb, var(--rp-accent) 9%, transparent), transparent 60%),
    #050607;
  padding: 1rem;
  color: #eef1f5;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 255, 0.06);
}
.pre-rp__screen::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 20;
  border-radius: inherit;
  box-shadow: inset 0 0 24px 4px rgba(0, 0, 0, 0.52);
  pointer-events: none;
}
.pre-rp__screen-inner { position: relative; z-index: 10; display: grid; gap: 1rem; }
.pre-rp__summary { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.pre-rp__summary-left { min-width: 0; }
.pre-rp__screen-order, .pre-rp__screen-id { margin: 0; line-height: 1.35; }
.pre-rp__screen-order { font-size: 0.875rem; font-weight: 600; }
.pre-rp__screen-id {
  font-family: var(--rp-mono);
  font-size: 0.75rem;
  color: rgba(238, 241, 245, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pre-rp__screen-total { font-size: 0.95rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

.pre-rp__status { display: flex; min-width: 0; align-items: center; gap: 0.5rem; }
.pre-rp__indicator { position: relative; display: grid; place-items: center; width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.pre-rp__ind {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  transition: opacity 160ms var(--rp-ease-out), transform 160ms var(--rp-ease-out);
}
.pre-rp__ind--working { color: rgba(238, 241, 245, 0.62); opacity: 1; transform: scale(1); }
.pre-rp__ind--complete { color: var(--rp-accent); opacity: 0; transform: scale(0.94); }
.pre-rp[data-stage='complete'] .pre-rp__ind--working { opacity: 0; transform: scale(0.96); }
.pre-rp[data-stage='complete'] .pre-rp__ind--complete { opacity: 1; transform: scale(1); }
.pre-rp__spin { animation: pre-rp-spin 1s linear infinite; }
.pre-rp[data-stage='complete'] .pre-rp__spin { animation-play-state: paused; }

.pre-rp__live { display: grid; min-width: 0; flex: 1; align-items: center; }
.pre-rp__status-text {
  grid-area: 1 / 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.1;
  color: rgba(238, 241, 245, 0.66);
}
.pre-rp[data-stage='complete'] .pre-rp__status-text { color: #eef1f5; }

/* Output and paper */
.pre-rp__output {
  position: relative;
  z-index: 50;
  margin-top: -1rem;
  width: calc(80% + 3rem);
  max-width: 100%;
  overflow: hidden;
  padding: 0 1.5rem 1.25rem;
}
.pre-rp__slot-shadow {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  top: -0.25rem;
  z-index: 20;
  height: 0.5rem;
  background: rgba(0, 0, 0, 0.75);
  filter: blur(6px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms var(--rp-ease-out);
}
.pre-rp:not([data-stage='processing']) .pre-rp__slot-shadow { opacity: 1; }

.pre-rp__feed {
  position: relative;
  isolation: isolate;
  opacity: 0;
  transform: translateY(calc(-100% + 2px));
  transition: opacity 160ms var(--rp-ease-out), transform 1.75s var(--rp-ease-in-out);
}
.pre-rp__feed::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  top: 0.75rem;
  bottom: 1rem;
  z-index: 0;
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.pre-rp__feed::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  z-index: 0;
  height: 0.75rem;
  transform: translateY(0.375rem);
  border-radius: 999px;
  background: color-mix(in srgb, var(--rp-accent) 12%, transparent);
  filter: blur(16px);
  pointer-events: none;
}
.pre-rp[data-stage='printing'] .pre-rp__feed {
  opacity: 1;
  transform: translateY(0%);
  transition: opacity 160ms var(--rp-ease-out);
  animation: pre-rp-feed 1.75s linear both;
}
.pre-rp[data-stage='complete'] .pre-rp__feed { opacity: 1; transform: translateY(0%); }

.pre-rp__paper {
  position: relative;
  z-index: 10;
  min-height: 20rem;
  margin: 0;
  padding: 1.75rem 1.5rem 2rem;
  background-color: var(--rp-paper);
  background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.06), transparent 1.5rem), var(--rp-noise);
  background-size: 100% 100%, 180px 180px;
  background-blend-mode: normal, soft-light;
  font-family: var(--rp-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--rp-ink);
}
.pre-rp__brand {
  margin: 0 0 1rem;
  text-align: center;
  font-family: 'Syncopate', var(--font-heading, sans-serif);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  line-height: 1;
}
.pre-rp__meta, .pre-rp__sums { margin: 0; display: grid; gap: 0.2rem; }
.pre-rp__row { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.pre-rp__key, .pre-rp__value { margin: 0; }
.pre-rp__key { color: rgba(17, 18, 20, 0.62); }
.pre-rp__value { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pre-rp__row--total { margin-top: 0.45rem; font-size: 0.9rem; font-weight: 700; text-transform: uppercase; }
.pre-rp__row--total .pre-rp__key { color: var(--rp-ink); }
.pre-rp__currency { margin-left: 0.5em; font-size: 0.65rem; font-weight: 400; letter-spacing: 0.08em; color: rgba(17, 18, 20, 0.55); }

.pre-rp__rule { margin: 0.85rem 0; border: 0; border-top: 1px dashed rgba(17, 18, 20, 0.35); height: 0; }
.pre-rp__rule--double { border-top-style: double; border-top-width: 3px; }

.pre-rp__lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.pre-rp__line { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.pre-rp__line-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.45rem; min-width: 0; }
.pre-rp__name { font-weight: 600; }
.pre-rp__chip {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  padding: 0.18rem 0.4rem;
  border-radius: 3px;
  color: var(--rp-paper);
  background: var(--rp-ink);
}
.pre-rp__line-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }

.pre-rp__note {
  margin: 0;
  text-align: center;
  font-variant-caps: all-small-caps;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  color: rgba(17, 18, 20, 0.7);
}

@keyframes pre-rp-spin { to { transform: rotate(360deg); } }

/* Stepped feed: one printed line at a time, the times match the source exactly. */
@keyframes pre-rp-feed {
  0% { transform: translateY(calc(-100% + 2px)); }
  7.5% { transform: translateY(-91%); }
  10.5% { transform: translateY(-91%); }
  18% { transform: translateY(-81%); }
  21% { transform: translateY(-81%); }
  28.5% { transform: translateY(-70%); }
  31.5% { transform: translateY(-70%); }
  39% { transform: translateY(-58%); }
  42% { transform: translateY(-58%); }
  49.5% { transform: translateY(-45%); }
  52.5% { transform: translateY(-45%); }
  60% { transform: translateY(-32%); }
  63% { transform: translateY(-32%); }
  70.5% { transform: translateY(-20%); }
  73.5% { transform: translateY(-20%); }
  81% { transform: translateY(-10%); }
  84% { transform: translateY(-10%); }
  91.5% { transform: translateY(-3%); }
  94.5% { transform: translateY(-3%); }
  100% { transform: translateY(0%); }
}

@media (prefers-reduced-motion: reduce) {
  .pre-rp__feed,
  .pre-rp[data-stage='printing'] .pre-rp__feed {
    transform: none;
    animation: none;
    transition: opacity 160ms var(--rp-ease-out);
  }
  .pre-rp__spin { animation: none; }
  .pre-rp__ind { transform: none !important; transition: opacity 160ms var(--rp-ease-out); }
}
