/*
  Maximus on the web. Every page in invite-site/ links this file and declares no
  colours or font stacks of its own (lib/__tests__/webBrand.test.ts checks).

  Sources: docs/DESIGN_TOKENS.md, assets/brand/README.md, lib/theme.ts.
  Two typefaces: Unbounded (display) and Manrope (reading). Each page loads both
  from Google Fonts: weights Unbounded 600/700/800, Manrope 400/500/600/700/800.
*/

:root {
  /* Palette: the only raw colours on the web side */
  --night: #0D0D12;
  --paper: #F5F4F1;
  --ink: #222222;
  --black: #000000;
  --white: #FFFFFF;
  --red: #EF4444;          /* brand red: main buttons, live states */
  --red-ink: #B91C1C;      /* small red text on light surfaces */
  --red-bright: #F87171;   /* small red text on dark surfaces */
  --green-ink: #15803D;
  --zinc-100: #F4F4F5;
  --zinc-200: #E4E4E7;
  --zinc-300: #D4D4D8;
  --zinc-400: #A1A1AA;
  --zinc-600: #52525B;
  --zinc-800: #27272A;
  --zinc-900: #18181B;

  /* Type: 75% of the nominal size for headlines, because Unbounded runs wide */
  --font-display: Unbounded, Manrope, system-ui, sans-serif;
  --font-body: Manrope, system-ui, sans-serif;

  /* Radius: 8 / 12 / 16 / 24 / full */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 999px;

  /* Semantic colours: paper by day */
  --bg: var(--paper);
  --surface: var(--white);
  --line: var(--zinc-300);
  --text: var(--night);
  --muted: var(--zinc-600);
  --accent-text: var(--red-ink);
  --counter: var(--zinc-200);
  --shadow: rgb(13 13 18 / .22);
  --wm-light: block;
  --wm-dark: none;

  /* A printed ticket stays paper in both themes */
  --ticket: var(--paper);
  --ticket-ink: var(--night);
  --ticket-faded: var(--zinc-600);
  --ticket-rule: var(--zinc-300);

  color-scheme: light;
}

/* Night */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--night);
    --surface: var(--zinc-900);
    --line: var(--zinc-800);
    --text: var(--paper);
    --muted: var(--zinc-400);
    --accent-text: var(--red-bright);
    --counter: var(--night);
    --shadow: rgb(0 0 0 / .45);
    --wm-light: none;
    --wm-dark: block;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: var(--night);
  --surface: var(--zinc-900);
  --line: var(--zinc-800);
  --text: var(--paper);
  --muted: var(--zinc-400);
  --accent-text: var(--red-bright);
  --counter: var(--night);
  --shadow: rgb(0 0 0 / .45);
  --wm-light: none;
  --wm-dark: block;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* Wordmark: both files are in the page, the theme shows one */
.wordmark { height: 26px; width: auto; }
.wordmark.on-light { display: var(--wm-light); }
.wordmark.on-dark { display: var(--wm-dark); }

/* Type roles */
.headline {
  margin: 0;
  font: 800 clamp(1.75rem, 9vw, 2.25rem)/1.05 var(--font-display);
  letter-spacing: -.035em;
  text-wrap: balance;
}
.title {
  margin: 0;
  font: 700 clamp(1.25rem, 6vw, 1.5rem)/1.1 var(--font-display);
  letter-spacing: -.03em;
  text-wrap: balance;
}
.label {
  font: 600 .6375rem/1.3 var(--font-display);   /* 85% of 12px, never under 10px Unbounded */
  letter-spacing: .08em;
  text-transform: uppercase;
}
.number { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.lead { color: var(--muted); font-size: 1.0625rem; margin: 0; text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tabular { font-variant-numeric: tabular-nums; }

/* Buttons: primary is brand red with a black label; secondary is an outline */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 56px; padding: 0 20px;
  border: 1px solid transparent; border-radius: var(--r-lg);
  font: 800 1rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  touch-action: manipulation;
  transition: transform .15s ease-out, background-color .15s ease-out;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--red); color: var(--black); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line); }
@media (hover: hover) {
  .btn-secondary:hover { border-color: var(--muted); }
}

/* Docket cells: six boxes, 3 + 3, like the code on a printed slip */
.cells { position: relative; display: grid; grid-template-columns: repeat(3, 1fr) 14px repeat(3, 1fr); gap: 8px; }
.cell {
  aspect-ratio: 3 / 4; max-width: 100%;
  display: grid; place-items: center;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  font: 700 clamp(1.375rem, 7.5vw, 2rem) var(--font-display); font-variant-numeric: tabular-nums; color: var(--text);
}
.cell.cur { border-color: var(--text); box-shadow: inset 0 -3px 0 var(--red); }
.gap { align-self: center; height: 2px; background: var(--line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
