/*
 * Gruff, in daylight.
 *
 * The house system already runs on two surfaces: the VPN portal on the light field, and
 * the till on black. A back office is read at a desk in an office, so it takes the light
 * one — the same hazard signage, the same heavy rules and hard offset shadows, the same
 * single amber accent, with none of the concessions the till makes to a dark bar.
 *
 * The rules of the system, unchanged:
 *   - Amber marks what acts. Nothing else is amber.
 *   - Red marks what stops.
 *   - Shadows are hard offsets, never blurred. A blur is the first thing to disappear on
 *     a bad monitor, and it takes the layout's structure with it.
 *   - Every number is monospaced. A column of takings has to align on the decimal or it
 *     cannot be read down.
 */

@font-face {
  font-family: 'ArchivoBlack';
  src: url('/static/fonts/ArchivoBlack-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Archivo';
  src: url('/static/fonts/Archivo-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'PlexMono';
  src: url('/static/fonts/IBMPlexMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'PlexMono';
  src: url('/static/fonts/IBMPlexMono-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

:root {
  --field: #f2efe6;
  --paper: #ffffff;
  --ink: #17150f;
  --ink-muted: #4a463c;
  --hair: #c9c2b0;
  --stone: #ddd8c8;
  --amber: #ffb000;
  --amber-deep: #d99500;
  --red: #9e1a0f;

  --rule: 3px solid var(--ink);
  --offset: 6px 6px 0 var(--ink);
  --display: 'ArchivoBlack', 'Arial Black', sans-serif;
  --sans: 'Archivo', 'Helvetica Neue', sans-serif;
  --mono: 'PlexMono', ui-monospace, 'SF Mono', monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--field);
  /* Paper grain. A flat fill reads as a screenshot of a design; a little tooth reads as a
     surface. Inline so it costs no request and cannot fail to load. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

/* ---- the hazard band -------------------------------------------------------
   The one piece of ornament in the system, and it is not ornament: it is what makes
   every surface recognisably the same product as the till. */
.hazard {
  height: 10px;
  background: repeating-linear-gradient(
    -45deg,
    var(--amber) 0 14px,
    var(--ink) 14px 28px
  );
}

/* ---- instrument labelling -------------------------------------------------- */
.label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.label--ruled {
  display: block;
  border-bottom: var(--rule);
  padding-bottom: 6px;
  margin-bottom: 14px;
  color: var(--ink);
}

/* ---- structure -------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  background: var(--ink);
  color: var(--field);
  border-right: var(--rule);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail__mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 22px 22px 4px;
  color: var(--field);
}

.rail__merchant {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  padding: 0 22px 22px;
  border-bottom: 3px solid #2e2a20;
}

.rail__nav { padding: 18px 0; flex: 1; }

.rail__link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 12px 22px;
  color: var(--stone);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-left: 6px solid transparent;
  transition: color 90ms linear, border-color 90ms linear, background-color 90ms linear;
}

.rail__link:hover { color: var(--field); background: #221f18; }

.rail__link[aria-current='page'] {
  color: var(--ink);
  background: var(--amber);
  border-left-color: var(--ink);
  font-weight: 600;
}

.rail__count { font-size: 12px; opacity: 0.75; }

.rail__foot {
  padding: 18px 22px;
  border-top: 3px solid #2e2a20;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #8d8676;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.rail__foot form { margin: 0; }

.rail__signout {
  background: none;
  border: 0;
  padding: 0;
  color: var(--amber);
  font: inherit;
  letter-spacing: 0.12em;
  cursor: pointer;
  text-transform: uppercase;
}
.rail__signout:hover { text-decoration: underline; }

.main { padding: 0 0 64px; min-width: 0; }

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 40px 18px;
  border-bottom: var(--rule);
  flex-wrap: wrap;
}

.masthead h1 {
  font-family: var(--display);
  font-size: clamp(28px, 3.4vw, 44px);
  letter-spacing: -0.01em;
  margin: 4px 0 0;
  text-transform: uppercase;
}

.masthead__when {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.section { padding: 34px 40px 0; }

/* ---- the headline figure ----------------------------------------------------
   Deliberately out of scale with everything else. A manager opens this screen to read one
   number, and the design should not make them hunt for it among five of equal weight. */
.takings {
  display: grid;
  grid-template-columns: minmax(320px, 1.4fr) minmax(280px, 1fr);
  gap: 28px;
  align-items: start;
}

.takings__figure {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(56px, 9vw, 116px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.takings__rule {
  height: 12px;
  background: var(--amber);
  border: var(--rule);
  border-bottom: 0;
  margin-bottom: -2px;
  max-width: 520px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 18px;
}

.slab {
  background: var(--paper);
  border: var(--rule);
  box-shadow: var(--offset);
  padding: 16px 18px;
}

.slab__value {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.slab__note {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* ---- the trading day -------------------------------------------------------- */
.hours {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 190px;
  border-bottom: var(--rule);
  padding-bottom: 0;
}

.hours__bar {
  flex: 1;
  min-width: 0;
  background: var(--amber);
  border: 2px solid var(--ink);
  border-bottom: 0;
  position: relative;
  transform-origin: bottom;
  animation: grow 420ms cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

.hours__bar--empty { background: var(--stone); }

.hours__bar:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -8px);
  background: var(--ink);
  color: var(--field);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 5px 8px;
  white-space: nowrap;
  z-index: 2;
}

.hours__axis {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}

.hours__axis span { flex: 1; text-align: center; min-width: 0; }

/* ---- tables ----------------------------------------------------------------- */
.ledger {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: var(--rule);
  box-shadow: var(--offset);
}

.ledger th {
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 12px 18px;
  border-bottom: var(--rule);
  white-space: nowrap;
}

.ledger td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.ledger tr:last-child td { border-bottom: 0; }
.ledger .num { text-align: right; }
.ledger .name { font-family: var(--sans); font-weight: 600; }

.ledger__empty {
  padding: 28px 18px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-muted);
}

/* ---- devices ---------------------------------------------------------------- */
.tills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.till__name {
  font-family: var(--display);
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 8px 0 2px;
}

.till__line {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 2px solid var(--ink);
}

.pill--live { background: var(--amber); }
.pill--waiting { background: var(--stone); }
.pill--behind { background: var(--red); color: var(--paper); border-color: var(--red); }

/* The code is read aloud across a room, so it is set like something to be read aloud. */
.code {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 0.28em;
  padding: 18px 20px;
  background: var(--ink);
  color: var(--amber);
  border: var(--rule);
  word-break: break-all;
}

/* ---- forms and actions ------------------------------------------------------ */
.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 14px 22px;
  border: var(--rule);
  background: var(--amber);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--offset);
  transition: transform 70ms linear, box-shadow 70ms linear;
}

.btn:hover { transform: translate(2px, 2px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--ink); }
.btn--quiet { background: var(--paper); }

.field { display: block; margin-bottom: 22px; }

.field__label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

/* Underlines rather than boxes. A box inside a slab inside a border is three nested
   rectangles saying the same thing; the rule under the text is enough. */
.field__input {
  width: 100%;
  font-family: var(--mono);
  font-size: 18px;
  padding: 8px 2px;
  border: 0;
  border-bottom: var(--rule);
  background: transparent;
  color: var(--ink);
}

.field__input:focus {
  outline: 0;
  border-bottom-color: var(--amber-deep);
  background: #fdf7e6;
}

.field__hint {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink-muted);
}

.notice {
  border: var(--rule);
  border-left-width: 10px;
  border-left-color: var(--red);
  background: var(--paper);
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: 22px;
}

.notice--good { border-left-color: var(--amber); }

/* ---- sign in ---------------------------------------------------------------- */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate__slab {
  width: min(440px, 100%);
  background: var(--paper);
  border: var(--rule);
  box-shadow: 10px 10px 0 var(--ink);
}

.gate__body { padding: 30px 34px 34px; }

.gate__mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--display);
  font-size: 34px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
}

.brand-icon { flex: none; }

.gate__sub {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 2px 0 28px;
}

/* ---- one orchestrated entrance ---------------------------------------------
   Staggered on load and nowhere else. Motion on a screen somebody reads forty times a day
   stops being delightful by the third time. */
.rise {
  animation: rise 420ms cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes grow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .rise, .hours__bar { animation: none; }
  .btn { transition: none; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: var(--rule); }
  .takings { grid-template-columns: 1fr; }
  .section, .masthead { padding-left: 20px; padding-right: 20px; }
}

/* ---- kitchen display --------------------------------------------------------
   The KDS is read at arm's length across a room, so a ticket is a slab whose item lines
   are large and whose note is set apart. The board is not a table: quantity, item and
   note sit on one line, because that is how a ticket is actually read. */
.kds {
  border-left: 4px solid var(--accent, #e4572e);
}

.kds__head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.kds__lines {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.kds__line {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 17px;
}

.kds__qty {
  font-family: var(--mono);
  font-weight: 700;
  min-width: 2ch;
  color: var(--ink-muted);
}

.kds__item {
  font-weight: 600;
}

.kds__note {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-muted);
  margin-left: auto;
}
