/*
 * Till page layout. Colours come only from the tokens in till.css; this file
 * adds no colour value of its own. Every text colour sits on a ground that
 * FACE SCHEMA §4 measures: ink and state tokens on --paper, ink on --lift,
 * ribbon ink on --dusk.
 */

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

html {
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.45 ui-serif, Georgia, Cambria, 'Times New Roman', serif;
}

body {
  margin: 0;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

h1,
h2 {
  line-height: 1.15;
  margin: 1.25rem 0 0.25rem;
}

a {
  color: var(--ink);
  text-underline-offset: 0.15em;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.cluster-ribbon {
  margin: 0 -1rem;
  padding: 0.4rem 1rem;
  background: var(--dusk);
  color: var(--till-replay);
  font: 600 0.85rem/1.3 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-align: center;
}

.demo-label {
  display: inline-block;
  margin: 0.25rem 0;
  padding: 0.1rem 0.5rem;
  border: 2px solid var(--ink);
  font: 700 0.9rem/1.4 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.03em;
}

.shop-note,
.till-about {
  margin: 0.25rem 0 1rem;
}

.till-items {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}

.till-items li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--lift);
  border-bottom: 1px solid var(--ink);
}

.price,
.till-total,
[data-amount],
[data-countdown] {
  font-variant-numeric: tabular-nums;
}

.qty {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.qty output {
  min-width: 2ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

button {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  border-style: dashed;
}

.till-pay {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  font-weight: 700;
}

.till-cap,
[data-problem] {
  color: var(--till-problem);
  font-weight: 600;
}

.till-panel {
  margin: 1.25rem 0;
  padding: 1rem 0;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.till-panel h2:focus {
  outline: none;
}

.till-pay-ways {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.till-qr {
  display: block;
  width: min(80vw, 18rem);
  height: auto;
  image-rendering: pixelated;
}

.deeplink {
  display: inline-block;
  padding: 0.6rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-weight: 700;
  min-height: 44px;
}

/* Deep link first on a phone, QR first on a wider screen (FACE V1 §8). */
@media (max-width: 40rem) {
  .deeplink {
    order: -1;
  }
}

[data-amount] {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0.5rem 0 0;
}

.mono {
  font: 0.8rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.till-state {
  font-weight: 700;
  font-size: 1.15rem;
}

.is-waiting {
  color: var(--till-open);
}

.is-detected,
.is-soon {
  color: var(--till-detected);
}

.is-paid {
  color: var(--till-paid);
}

.is-problem {
  color: var(--till-problem);
}

.is-expired {
  color: var(--till-expired);
}

.till-rpc label {
  display: block;
  font-weight: 600;
}

.till-rpc input {
  font: inherit;
  width: 100%;
  min-height: 44px;
  margin: 0.25rem 0 0.5rem;
  padding: 0.25rem 0.5rem;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
}

[hidden] {
  display: none !important;
}

/* The devnet ribbon shows on devnet builds only (FACE SCHEMA §5). */
[data-till-cluster]:not([data-till-cluster="devnet"]) .cluster-ribbon {
  display: none;
}

.till-cad,
.till-via {
  margin: 0.25rem 0;
}

.till-via {
  color: var(--till-paid);
  font-weight: 600;
}

/* Verify page */
.verify .facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 0.75rem;
  background: var(--lift);
  padding: 0.75rem;
}

.verify .facts dt {
  font-weight: 700;
}

.verify .facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.verify-paste textarea {
  font: 0.85rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  width: 100%;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
}

.recheck input {
  font: inherit;
  width: 100%;
  min-height: 44px;
  margin: 0.25rem 0 0.5rem;
  padding: 0.25rem 0.5rem;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
}

.checks {
  list-style: none;
  padding: 0;
}

.checks li {
  margin: 0.35rem 0;
}

.check-ok {
  color: var(--till-paid);
  font-weight: 600;
}

.check-bad {
  color: var(--till-problem);
  font-weight: 600;
}

.hash {
  font-weight: 700;
}

.verify-footer {
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ink);
  font-weight: 600;
}

/* Board */
.board {
  max-width: 64rem;
}

.replay-ribbon {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0 -1rem;
  padding: 0.5rem 1rem;
  background: var(--dusk);
  color: var(--till-replay);
  font: 800 1.1rem/1.2 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.2em;
  text-align: center;
}

.replay-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  background: var(--dusk);
  color: var(--till-replay);
  font: 700 0.75rem/1.6 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.1em;
}

.board-rate {
  font-variant-numeric: tabular-nums;
}

.alarms p {
  margin: 0.5rem 0;
  padding: 0.6rem 0.75rem;
  background: var(--lift);
  border: 2px solid var(--till-problem);
  color: var(--till-problem);
  font-weight: 700;
}

.alarms button {
  margin-left: 0.75rem;
}

.board-login input,
.sale-open input {
  font: inherit;
  min-height: 44px;
  padding: 0.25rem 0.5rem;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
}

.new-sale .sale-item {
  margin: 0.25rem 0.5rem 0.25rem 0;
  padding: 0.4rem 0.8rem;
}

.board-list {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}

.board-list li {
  display: grid;
  grid-template-columns: 6ch 1fr auto;
  gap: 0.25rem 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--lift);
  border-bottom: 1px solid var(--ink);
  font-variant-numeric: tabular-nums;
}

.board-list .row-sub {
  grid-column: 2 / 4;
  font-size: 0.9rem;
}

.badge {
  font: 700 0.85rem/1.4 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.04em;
}

/* Present mode: read from two metres (UIUXQOL §2.5). */
.present {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: auto;
  background: var(--paper);
  padding: 1rem;
  text-align: center;
}

.present-qr {
  display: block;
  width: min(70vw, 70vh);
  height: auto;
  margin: 0 auto;
  image-rendering: pixelated;
}

.present-amount {
  margin: 0.5rem 0 0;
  font-size: 96px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--till-amount-present);
  font-variant-numeric: tabular-nums;
}

.present-cad {
  margin: 0.25rem 0;
  font-size: 32px;
}

.present-short {
  margin: 0.25rem 0;
  font: 700 48px/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.present-state {
  font-size: 1.6rem;
  font-weight: 800;
}
