/* Hitchpost design tokens.
 *
 * One token set for every surface: the gate tablet, the operations dashboard,
 * the live board, the console and the public pages. The defaults are neutral
 * (slate and amber), so a business that sets no colours still gets a calm,
 * professional product, not somebody else's brand.
 *
 * A tenant's brand plugs in through /tenant/theme.css, which the server
 * generates from the tenant file and every page loads after this one. It sets
 * --brand, --accent and the tinted neutrals. Nothing else needs to change.
 *
 * Two densities, one product:
 *   body.touch  the gate tablet: 56px targets, 64px for anything used every rental
 *   body.desk   the dashboard and the console: 40px targets
 *
 * Status colours (go, stop, warn, info) never follow the brand. A red "stop"
 * means the same thing in every tenant. Colour never carries meaning alone.
 *
 * Chrome 80 runs the tablets: no color-mix() without a fallback, no :is().
 */

:root {
  color-scheme: light;

  /* ---- brand: replaced per tenant by /tenant/theme.css ---- */
  --brand: #16233b;
  --brand-strong: #0c1628;
  --brand-ink: #ffffff;
  --brand-rgb: 22, 35, 59;
  --accent: #ffb627;
  --accent-ink: #1d1400;
  --accent-rgb: 255, 182, 39;
  --accent-tint: rgba(var(--accent-rgb), .2);
  /* Kept for code written before the rename. Use --accent. */
  --lime: var(--accent);
  --lime-ink: var(--accent-ink);

  /* ---- surfaces ---- */
  --bg: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f5f6f9;
  --sunk: #e4e7ed;
  --line: #d4d9e1;
  --line-strong: #a3acb9;
  --scrim: rgba(8, 12, 18, .58);
  --chrome: var(--brand);

  /* ---- text: ink-2 and ink-3 pass AA on surface and bg ---- */
  --ink: #0b0f14;
  --ink-2: #333c48;
  --ink-3: #56606e;

  /* ---- the one thing to press ---- */
  --primary: var(--brand);
  --primary-ink: #ffffff;
  --primary-press: var(--brand-strong);

  /* ---- states: a colour, a tint for backgrounds, an ink that passes on it ---- */
  --go: #0a7a3a;
  --go-tint: #e3f4e8;
  --go-ink: #07502a;
  --stop: #b3261e;
  --stop-tint: #fdeceb;
  --stop-ink: #7c1712;
  --warn: #8a5a00;
  --warn-tint: #fff3d1;
  --warn-ink: #5e3d00;
  --info: #1d5fae;
  --info-tint: #e6effb;
  --on-solid: #ffffff;        /* text on a solid go or stop fill */
  --on-warn: #1d1300;         /* text on a solid warn fill */

  --focus: #f5b400;

  /* ---- type ---- */
  --font: Roboto, "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --mono: "Roboto Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --t-xs: 13px;
  --t-sm: 15px;
  --t-md: 17px;
  --t-lg: 20px;
  --t-xl: 26px;
  --t-2xl: 34px;
  --t-3xl: 48px;

  /* ---- spacing: a 4px grid ---- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --gap: var(--s-4);
  --pad: var(--s-5);

  /* ---- shape ---- */
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --r-ctl: var(--r);          /* buttons and fields */
  --r-card: var(--r-lg);

  /* ---- depth: neutral shadows, so they suit any brand ---- */
  --e1: 0 1px 2px rgba(12, 16, 22, .08), 0 1px 1px rgba(12, 16, 22, .04);
  --e2: 0 2px 6px rgba(12, 16, 22, .08), 0 8px 24px rgba(12, 16, 22, .08);
  --e3: 0 12px 40px rgba(12, 16, 22, .22);
  --e-primary: 0 6px 18px rgba(var(--brand-rgb), .22);

  /* ---- motion ---- */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --fast: 120ms;
  --med: 220ms;

  /* ---- density: the tablet's, unless the page says desk ---- */
  --touch: 56px;
  --touch-lg: 64px;
  --field-font: var(--t-lg);
  --field-pad: 12px 16px;
  --ctl-border: 2px;
  --btn-font: var(--t-md);
  --btn-pad: 0 22px;

  /* ---- chrome heights, to keep content clear of the fixed bars ---- */
  --topbar-h: 68px;
  --tabbar-h: 72px;
  --actionbar-h: 88px;
}

/* Night. Set by data-theme, which the gate sets from the clock unless a
   person has pinned a theme. The accent becomes the primary, so the one thing
   to press is still the brightest thing on a dark screen. */
:root[data-theme="night"] {
  color-scheme: dark;

  --bg: #0a0e14;
  --surface: #121821;
  --surface-2: #171e29;
  --sunk: #0e131a;
  --line: #252e3b;
  --line-strong: #3c4757;
  --scrim: rgba(0, 0, 0, .66);
  --chrome: var(--sunk);

  --ink: #eef1f5;
  --ink-2: #b9c1cc;
  --ink-3: #8e98a6;

  --primary: var(--accent);
  --primary-ink: var(--accent-ink);
  --primary-press: var(--accent);

  --go: #4ade80;
  --go-tint: #0f2e1d;
  --go-ink: #9df0b9;
  --stop: #ff6b5e;
  --stop-tint: #3a1512;
  --stop-ink: #ffc2bc;
  --warn: #fbbf24;
  --warn-tint: #33260a;
  --warn-ink: #fde3a0;
  --info: #7cb4ff;
  --info-tint: #10233d;
  --on-solid: #12060a;

  --e1: 0 1px 2px rgba(0, 0, 0, .4);
  --e2: 0 2px 8px rgba(0, 0, 0, .45);
  --e3: 0 16px 48px rgba(0, 0, 0, .6);
  --e-primary: 0 6px 22px rgba(var(--accent-rgb), .18);
}

/* ---- densities ---- */

body.touch {
  --touch: 56px;
  --touch-lg: 64px;
}

body.desk {
  --touch: 40px;
  --touch-lg: 48px;
  --r-ctl: 9px;
  --r-card: 14px;
  --field-font: var(--t-md);
  --field-pad: 8px 12px;
  --ctl-border: 1px;
  --btn-font: var(--t-sm);
  --btn-pad: 0 16px;
}

/* A desk page opened on a phone still gets a thumb-sized target. */
@media (pointer: coarse) {
  body.desk { --touch: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --fast: 0ms; --med: 0ms; }
}
