/* ---------------------------------------------------------------------------
   Tovi — the whole design system, in one file.

   Hand-authored rather than generated, and that is deliberate. There is no
   stylesheet to compile, so a deploy is a file copy with no npm install in
   front of it. The design is also
   unusually literal — 6px espresso shelves under buttons, dotted receipt
   rules, punched ticket edges — and those read better as named components than
   as forty arbitrary-value utilities per element.

   Everything below comes from "Tovi · Brand Foundations · V1": cream canvas,
   red for one decision per screen, enormous display numerals, chrome only on
   controls, mint and mustard under 5% of any screen.
   --------------------------------------------------------------------------- */

/* ------------------------------------------------------------------ tokens */
:root {
  /* Palette */
  --red:        #C0272D;   /* CTAs, signage, brand */
  --red-deep:   #8E1B20;   /* the shelf under a pressed button */
  --cream:      #F5ECDC;   /* app canvas */
  --cream-menu: #FBF6EA;   /* cards, receipts */
  --cream-lit:  #F6EFE0;   /* type on red or espresso */
  --espresso:   #241C17;   /* type, keylines, boards */
  --espresso-2: #3A2E26;   /* the lighter board edge */

  /* Ink, warm to cool */
  --ink:        #241C17;
  --ink-2:      #3F3329;
  --ink-3:      #55483E;
  --ink-4:      #6B5B4E;
  --ink-5:      #8E8577;
  --on-dark:    #BCB0A4;
  --on-dark-2:  #9C9086;

  /* Keylines */
  --rule:       #D6CCB6;
  --rule-2:     #C9BEA6;
  --rule-3:     #E2D8C2;

  /* Rare accents — mustard is the only non-red highlight, mint is for states */
  --mustard:    #E8C25A;
  --mint:       #8FBFAE;

  --chrome: linear-gradient(160deg, #FFFFFF, #D8D5CF 45%, #F2F0EC 60%, #B9B6B0);

  /* Type */
  --display: 'Alfa Slab One', Georgia, 'Times New Roman', serif;
  --ui: Archivo, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ticket: 'Courier Prime', 'Courier New', monospace;

  /* Rhythm. The desktop comp is 1440 wide with 80px gutters; the phone comp is
     390 with 22–28. Everything between interpolates. */
  --gutter: 22px;
  --measure: 1280px;
}

@media (min-width: 700px)  { :root { --gutter: 44px; } }
@media (min-width: 1000px) { :root { --gutter: 80px; } }

/* -------------------------------------------------------------------- base */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; line-height: 1.1; }
p { margin: 0; }
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-deep); }
img { max-width: 100%; }

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

/* Anything that is only there for a screen reader. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--espresso); color: var(--cream-lit); padding: 12px 18px;
  font-family: var(--ticket); font-size: 12px; letter-spacing: 0.12em;
}
.skip-link:focus { left: 0; color: var(--cream-lit); }

/* --------------------------------------------------------------- lettering */
.display { font-family: var(--display); }
.ticket {
  font-family: var(--ticket);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.ticket--lit { color: var(--on-dark); }
.ticket--red { color: var(--red); }

.lede { font-size: 16px; line-height: 1.55; color: var(--ink-2); }
@media (min-width: 1000px) { .lede { font-size: 19px; } }

.money { font-family: var(--display); color: var(--red); line-height: 1; }

/* ------------------------------------------------------------- checker band */
/* The 16px band is the only checkerboard the brand rules allow. */
.checks {
  height: 12px;
  background: repeating-conic-gradient(var(--espresso) 0% 25%, var(--cream) 0% 50%) 0 0 / 12px 12px;
}
@media (min-width: 700px) { .checks { height: 16px; background-size: 16px 16px; } }
.checks--red {
  background: repeating-conic-gradient(var(--espresso) 0% 25%, var(--red) 0% 50%) 0 0 / 16px 16px;
  height: 8px;
}

/* ------------------------------------------------------------------ wordmark */
/* Direction A from the foundations: the roadside badge. Italic slab in a pill
   with the starburst diamond. */
.mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 9px;
  background: var(--red);
  border: 2px solid var(--espresso);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--espresso);
}
.mark__word {
  font-family: var(--display);
  font-style: italic;
  font-size: 18px;
  letter-spacing: 0.1em;
  color: var(--cream-lit);
}
.mark__star {
  width: 6px; height: 6px; display: block;
  background: var(--cream-lit);
  transform: rotate(45deg);
}
@media (min-width: 700px) {
  .mark { padding: 8px 16px 10px; box-shadow: 3px 3px 0 var(--espresso); }
  .mark__word { font-size: 22px; }
  .mark__star { width: 7px; height: 7px; }
}
.mark--xl { padding: 12px 26px 14px; border-width: 3px; box-shadow: 5px 5px 0 var(--espresso); }
.mark--xl .mark__word { font-size: 30px; }
.mark--xl .mark__star { width: 10px; height: 10px; }
@media (min-width: 700px) {
  .mark--xl .mark__word { font-size: 38px; }
  .mark--xl .mark__star { width: 11px; height: 11px; }
}

/* ------------------------------------------------------------------ buttons */
/* Primary CTAs sit on a 6px espresso shelf and depress on press. No pills. */
.btn {
  display: inline-block;
  padding: 18px 30px;
  background: var(--red);
  color: var(--cream-lit);
  border: 2px solid var(--espresso);
  border-radius: 11px;
  box-shadow: 0 4px 0 var(--red-deep), 0 6px 0 var(--espresso);
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.btn:hover { color: var(--cream-lit); }
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--red-deep), 0 3px 0 var(--espresso);
}
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: progress;
}
.btn--block { display: block; width: 100%; }
.btn--lg { padding: 20px 34px; font-size: 16px; }
@media (min-width: 1000px) {
  .btn--lg {
    padding: 24px 42px; font-size: 19px; border-radius: 12px;
    box-shadow: 0 5px 0 var(--red-deep), 0 8px 0 var(--espresso);
  }
  .btn--lg:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--red-deep), 0 4px 0 var(--espresso); }
}
.btn--sm { padding: 13px 22px; font-size: 13px; border-radius: 8px; box-shadow: 0 3px 0 var(--red-deep), 0 5px 0 var(--espresso); }

/* The quiet control: a keyline box, no shelf. Never competes with the red. */
.btn-plain {
  display: inline-block;
  padding: 15px 20px;
  background: none;
  border: 1px solid var(--espresso);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  cursor: pointer;
}
.btn-plain:hover { background: #EFE4CE; color: var(--ink); }

.btn-back {
  align-self: flex-start;
  background: none; border: none; padding: 0;
  font-family: var(--ticket); font-size: 12px; letter-spacing: 0.14em;
  color: var(--ink-4); cursor: pointer;
}

/* -------------------------------------------------------------------- cards */
.card {
  background: var(--cream-menu);
  border: 1px solid var(--espresso);
  box-shadow: 3px 3px 0 rgba(36, 28, 23, 0.3);
  padding: 18px 20px 20px;
}
.card--quiet { border-color: var(--rule); box-shadow: none; }
.board {
  background: var(--espresso);
  color: var(--cream-lit);
  padding: 26px 24px 30px;
}
.board .ticket { color: var(--on-dark); }

/* ------------------------------------------------------------------ receipt */
/* Used for verified history only — never for a projection or an estimate. */
.receipt {
  background: var(--cream-menu);
  border: 1px solid var(--rule-2);
  box-shadow: 0 16px 30px -20px rgba(36, 28, 23, 0.5);
}
.receipt__head {
  padding: 20px 22px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  border-bottom: 2px solid var(--espresso);
}
.receipt__brand {
  font-family: var(--display); font-size: 20px; letter-spacing: 0.16em; color: var(--red);
}
.receipt__body { padding: 12px 22px 2px; }
.receipt__row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 11px 0;
  border-bottom: 1px dotted var(--rule-2);
  font-family: var(--ticket);
}
.receipt__row span:nth-child(3) { flex: 1; }
.receipt__label { font-size: 14px; letter-spacing: 0.05em; }
.receipt__meta { font-size: 11px; color: var(--ink-3); }
.receipt__amount { font-size: 15px; font-weight: 700; }
.receipt__tear { margin: 10px 22px 0; border-top: 2px dashed var(--rule-2); }
.receipt__total {
  padding: 14px 22px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.receipt__total .money { font-size: 46px; }
/* The punched edge. A radial gradient, repeated — no image to load. */
.receipt__edge {
  height: 12px;
  background: radial-gradient(circle at 6px 12px, var(--cream) 0 6px, var(--cream-menu) 6.5px) repeat-x;
  background-size: 12px 12px;
}
@media (min-width: 1000px) {
  .receipt__head { padding: 26px 30px 20px; }
  .receipt__brand { font-size: 24px; }
  .receipt__body { padding: 18px 30px 4px; }
  .receipt__row { padding: 14px 0; gap: 10px; }
  .receipt__label { font-size: 15px; }
  .receipt__meta { font-size: 12px; }
  .receipt__amount { font-size: 16px; }
  .receipt__tear { margin: 12px 30px 0; }
  .receipt__total { padding: 16px 30px 26px; }
  .receipt__total .money { font-size: 62px; }
}

/* -------------------------------------------------------------- menu board */
/* The red-headed panel: a lit board over a list. Used for anything still being
   worked out — scans, discoveries, things not yet verified. */
.panel {
  background: var(--cream);
  border: 2px solid var(--espresso-2);
  /* Explicit, because the panel's usual home is the espresso section, which
     sets a cream text colour — and cream type on a cream panel is invisible. */
  color: var(--ink);
}
.panel__head {
  background: var(--red);
  padding: 11px 16px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.panel__title {
  font-family: var(--display); font-size: 12px; letter-spacing: 0.12em; color: var(--cream-lit);
}
.panel__count {
  font-family: var(--ticket); font-size: 11px; letter-spacing: 0.1em; color: var(--cream-lit);
}
.panel__body { padding: 4px 16px 2px; }
.panel__foot { padding: 14px 16px 18px; }
@media (min-width: 1000px) {
  .panel { border-width: 3px; }
  .panel__head { padding: 14px 24px; }
  .panel__title { font-size: 15px; letter-spacing: 0.14em; }
  .panel__body { padding: 8px 24px 4px; }
  .panel__foot { padding: 20px 24px 24px; }
}

/* --------------------------------------------------------------- list rows */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0;
  border-bottom: 1px dotted var(--rule-2);
  transition: opacity 0.4s ease;
}
.row:last-child { border-bottom: none; }
.row__main { flex: 1; min-width: 0; }
.row__label { font-family: var(--display); font-size: 14px; letter-spacing: 0.05em; }
.row__meta { font-family: var(--ticket); font-size: 11px; color: var(--ink-3); }
.row__amount { font-family: var(--ticket); font-size: 14px; font-weight: 700; }
.row--dim { opacity: 0.22; }
@media (min-width: 1000px) {
  .row { gap: 16px; padding: 17px 0; }
  .row__label { font-size: 18px; letter-spacing: 0.06em; }
  .row__meta { font-size: 12px; padding-top: 3px; }
  .row__amount { font-size: 16px; }
}

/* Category mark: a letterform in a keyline box. Stands in for the
   mid-century pictogram set until it is drawn. */
.mark-box {
  width: 32px; height: 32px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--espresso);
  border-radius: 4px;
  font-family: var(--display);
  font-size: 13px;
  color: var(--ink);
}
.mark-box--lg { width: 38px; height: 38px; border-width: 2px; border-radius: 5px; font-size: 15px; }
.mark-box--chrome { background: var(--chrome); border: 1px solid #9C978F; border-radius: 6px; color: var(--espresso-2); }
.mark-box--red { background: var(--red); border-color: var(--espresso); color: var(--cream-lit); }

/* ------------------------------------------------------------------- chips */
.chip {
  display: inline-block;
  font-family: var(--ticket);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 5px 9px;
  border: 1px solid var(--espresso);
  color: var(--ink);
  white-space: nowrap;
}
.chip--red { background: var(--red); border-color: var(--red); color: var(--cream-lit); }
.chip--outline-red { border-color: var(--red); color: var(--red); }
.chip--quiet { border-color: var(--rule); color: var(--ink-4); }

/* --------------------------------------------------------------- section rule */
.rule-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.rule-head__label { font-family: var(--display); font-size: 13px; letter-spacing: 0.14em; }
.rule-head__line { flex: 1; height: 1px; background: var(--rule-2); }

/* ------------------------------------------------------------------ layout */
.wrap { max-width: var(--measure); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.section { padding-top: 34px; padding-bottom: 34px; }
@media (min-width: 1000px) { .section { padding-top: 84px; padding-bottom: 84px; } }
.section--menu { background: var(--cream-menu); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.section--board { background: var(--espresso); color: var(--cream-lit); }
.section--board h2 { color: var(--cream-lit); }
.stack { display: flex; flex-direction: column; }
.stack--sm { gap: 10px; }
.stack--md { gap: 20px; }
.stack--lg { gap: 30px; }

/* --------------------------------------------------------------- animation */
@keyframes toviUp    { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toviIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes toviPrint { from { opacity: 0; transform: translateY(-30px) scaleY(0.9); } to { opacity: 1; transform: translateY(0) scaleY(1); } }
@keyframes toviBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.anim-print { animation: toviPrint 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.anim-in    { animation: toviIn 0.3s ease both; }
.anim-up    { animation: toviUp 0.5s ease both; }
.blink      { animation: toviBlink 1.1s steps(1, end) infinite; }

/* Somebody who has asked their machine to stop moving things means it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------------------------------------ notices */
.notice {
  border: 1px solid var(--espresso);
  background: var(--cream-menu);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.5;
}
.notice--bad { border-color: var(--red); border-left-width: 5px; }
.notice--demo {
  background: var(--mustard);
  border: none;
  padding: 9px var(--gutter);
  font-family: var(--ticket);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--espresso);
  text-align: center;
}
[hidden] { display: none !important; }

/* ------------------------------------------------------------- utilities */
/* A deliberately small set, and the reason it exists at all: the
   Content-Security-Policy in _headers does not allow 'unsafe-inline' for
   styles, so a style="" attribute in the HTML is dropped on the deployed site
   while working perfectly on a local file server. Every one-off in the markup
   is a class here instead. (Styles set from JavaScript through element.style
   are CSSOM writes, which CSP does not touch.) */
.u-right  { text-align: right; }
.u-center { text-align: center; }
.u-tiny   { font-size: 11px; }
.u-note   { font-size: 13px; color: var(--ink-4); }
.u-hint   { font-size: 12px; color: var(--ink-3); }
.prose-sm { font-size: 15px; line-height: 1.55; color: var(--ink-3); }
.prose-md { font-size: 16px; line-height: 1.6; color: var(--ink-3); }
.prose-lg { font-size: 17px; line-height: 1.6; color: var(--ink-3); max-width: 40ch; }
.prose-dark { font-size: 16px; line-height: 1.6; color: var(--on-dark); max-width: 42ch; }
.measure-30 { max-width: 30ch; }
