/* Alfred Trauma — design tokens. The one place a colour, a size or a space is
 * defined; every stylesheet in the application reads these through var(--...)
 * and none redeclares them (#40).
 *
 * Reconciled from two files that had each grown a palette of their own:
 *
 * - the Flask application's static/css/styles.css, whose :root block held the
 *   five brand colours and which three of this project's board stylesheets
 *   had each copied (one of them redefining --orange-web-transparent to a
 *   different alpha under the same name);
 * - the Feedback-Bot's static/tokens.css, which took the same five colours,
 *   added the ramps, aliases and scales a data surface needs, and recorded
 *   three values where it departed from the upstream design system as
 *   "proposals to push back upstream, not private forks".
 *
 * The five brand colours were already identical in both. Feedback's analysis is
 * the starting point for everything else, and each of its three departures is
 * decided below, marked DECIDED, rather than carried forward as a fork.
 *
 * Linked first by templates/base.html, before any page's own stylesheet. It
 * declares custom properties and nothing else — no selector here styles an
 * element — so linking it into a page changes nothing about how that page
 * looks until a rule reads a token.
 *
 * Feedback's @font-face rules are not here. The self-hosted PT Sans binaries
 * arrived with the Feedback client (#54), with their OFL licence beside them,
 * and the client's own sheet declares them: this file states no rule, and
 * declaring them here would load the binaries on every page that links it. The
 * family name is in --font-body. */

:root {
  /* ---- Base palette ----------------------------------------------------- */
  /* The organisation's own names, identical in both source files, so a colour
   * here can be traced to the roster and tools sites without a translation
   * table. --orange-web-transparent is the canonical 0.5 alpha; the daily
   * roster's lighter row wash is now its own literal rather than this name
   * quietly meaning something else on one page. */
  --licorice: #220901;
  --blood-red: #621708;
  --penn-red: #941b0c;
  --rust: #bc3908;
  --orange-web: #f6aa1c;
  --orange-web-transparent: rgba(246, 170, 28, 0.5);

  /* Warm neutral ramp. --neutral-400 is a rule-and-border colour: it is not
   * legible as text at any size. */
  --neutral-0: #ffffff;
  --neutral-100: #ede7e3;
  --neutral-200: #dcd3cc;
  --neutral-400: #a8998e;
  --neutral-600: #6f5f54;
  --neutral-900: #2b201a;

  /* Warm tints: the surface washes behind a quoted message, a warning and a
   * table header. */
  --wash-warm: #fbf5ec;
  --wash-line: #f4ede3;
  --wash-critical: #fdf3f1;
  --wash-critical-border: #f0d2cb;
  --wash-warning: #fffaf1;
  --wash-warning-border: #f0dcb4;
  --wash-warning-text: #8a5a00;
  --wash-ok: #eef3e9;
  --wash-ok-border: #cfe0c2;
  --wash-neutral: #f0e6da;
  /* The boards' error notice: deeper than --wash-critical, which sits behind
   * a quoted message rather than announcing that a roster failed to load. */
  --wash-error: #fbeae7;

  /* ---- Semantic aliases ------------------------------------------------- */
  /* DECIDED (departure 1, page background warmth) — warm, not the upstream
   * system's cool #f4f4f4. Every page in this application that paints a
   * ground at all already paints a warm one, and a cool grey under a
   * red/orange palette reads as a mistake. The value is #f5f2ef, the ground
   * the daily roster and the ED wall board already carry, rather than
   * Feedback's #f2ece4: the retrofit that introduced this file may not
   * repaint a board, and the two warm values differ by a shade nobody would
   * pick between. Feedback's dashboard and administration grounds (#f2ece4,
   * and the #fbf7f2 its own file had already dropped) converge here when
   * those surfaces are ported — one ground in the product, not three. */
  --color-bg-page: #f5f2ef;
  --color-bg-surface: var(--neutral-0);
  --color-bg-surface-warm: var(--wash-warm);
  --color-bg-brand: var(--orange-web);
  --color-bg-brand-strong: var(--blood-red);

  --color-text-primary: var(--licorice);
  --color-text-secondary: #3a2d24;
  /* The faintest colour permitted on text anywhere, charts included. */
  --color-text-muted: var(--neutral-600);
  --color-text-inverse: var(--neutral-0);
  --color-text-brand: var(--penn-red);

  /* DECIDED (departure 2, border colour) — accepted. #dcd3cc is the upstream
   * system's own --neutral-200, so taking it is a return to the system rather
   * than a fork of it; the faint #ece1d3 it replaced read as ~1.15:1 against
   * white, which is not an edge. It is the default for a control, a card or a
   * table. The wall boards' grid rules are not borders in that sense — they
   * are part of each board's own geometry, tuned for reading across a room,
   * and stay in that board's sheet. */
  --color-border-default: var(--neutral-200);
  --color-border-soft: var(--wash-line);
  --color-border-focus: var(--penn-red);

  /* Status. Every one of these also carries its word in the interface —
   * colour never carries meaning on its own. */
  --color-status-critical: var(--penn-red);
  --color-status-warning: var(--orange-web);
  --color-status-ok: #4b7f52;
  --color-status-ok-deep: #2f6b45;
  --color-status-info: var(--rust);
  /* Outlined until armed, filled only at the moment a typed confirmation
   * matches. The roster sites delete nothing; Feedback purges records. */
  --color-status-destructive: var(--penn-red);

  /* Rail: Feedback's sidebar, the one dark surface with a navigation list on
   * it. Text reversed out of it needs its own ramp. The gradient is brand
   * chrome and is the only gradient permitted anywhere. */
  --rail-gradient: linear-gradient(180deg, #3a1102 0%, var(--licorice) 60%);
  --rail-text: #f5efe6;
  --rail-text-muted: #c9bcae;
  --rail-text-nav: #e8ddce;
  --rail-text-faint: #b7a99b;
  --rail-border: rgba(246, 170, 28, 0.22);
  --rail-border-soft: rgba(246, 170, 28, 0.14);
  --rail-hover: rgba(246, 170, 28, 0.14);
  --rail-active: rgba(246, 170, 28, 0.20);

  /* The Feedback client's ground behind an initials mark, and behind a
   * photograph until it loads. Both of its sheets draw one (#54). */
  --avatar-ground: rgba(246, 170, 28, 0.28);
  /* Its scrollbar thumb: the licorice at a fifth, a rule rather than a fill. */
  --scrollbar-thumb: rgba(34, 9, 1, 0.2);

  /* ---- Type ------------------------------------------------------------- */
  /* The family every page in the application already asks for. Feedback's
   * Arial fallback is not carried: it was the face shown while self-hosted
   * PT Sans loaded under font-display: swap, and nothing here self-hosts it
   * (see the head of this file). The retrofitted pages keep the stack they
   * have always rendered with. */
  --font-body: 'PT Sans', sans-serif;

  /* DECIDED (departure 3, the dense desk-read scale) — accepted as the
   * application's one text scale, replacing the upstream em scale that runs
   * to 4.5em. Seven sizes. Expressed in rem rather than Feedback's px: at the
   * browser's default 16px root each is exactly Feedback's value (34, 26, 17,
   * 15, 15, 13 and 12px), and a reader who has raised their default text
   * size still gets it, which a px scale silently ignores. --t-label-size is
   * the floor, SVG text included.
   *
   * The wall boards do not read this scale. Their header and grid sizes are
   * set for a screen read across a resuscitation bay, belong to one board
   * each, and are kept in that board's sheet: this file holds what pages
   * share, and a retrofit that resized a wall board would be a redesign. */
  --t-display-size: 2.125rem;  --t-display-lh: 1.15;
  --t-title-size: 1.625rem;    --t-title-lh: 1.2;
  --t-section-size: 1.0625rem; --t-section-lh: 1.3;
  --t-body-size: 0.9375rem;    --t-body-lh: 1.5;
  --t-ui-size: 0.9375rem;      --t-ui-lh: 1.2;
  --t-meta-size: 0.8125rem;    --t-meta-lh: 1.4;
  --t-label-size: 0.75rem;     --t-label-lh: 1.3;
  --t-label-tracking: 0.06em;

  --weight-regular: 400;
  --weight-bold: 700;

  /* ---- Space ------------------------------------------------------------ */
  /* DECIDED (departure 3, continued) — the 4px grid is accepted, replacing
   * the upstream 5/10/15/20/40, which cannot express a table cell, a field gap
   * and a section gap without collisions. Where a board's existing spacing
   * already falls on the grid its shared furniture reads these; the rest of a
   * board's spacing is its own geometry, under the same reasoning as its
   * type sizes above. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  /* ---- Radius ----------------------------------------------------------- */
  /* --radius-sm is the boards' button radius as well as Feedback's. */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-pill: 999px;

  /* ---- Elevation -------------------------------------------------------- */
  /* Two levels. Content is flat with a border; only things that float above
   * the page get a shadow. */
  --shadow-overlay: 0 16px 48px rgba(34, 9, 1, 0.24);
  --shadow-focus: 0 0 8px var(--orange-web-transparent);

  /* ---- Controls --------------------------------------------------------- */
  --control-height: 40px;
  --control-padding-x: var(--space-4);

  /* ---- Board furniture -------------------------------------------------- */
  /* What roster/board.html gives every board — the band its navbar sits in,
   * the strip of links between the boards and the footer — is one component
   * on three pages, so its measurements are declared once here rather than
   * in each board's sheet. They are the values the boards were built with,
   * off the 4px grid because a retrofit may not move a board: the strip's
   * label is em so it follows each board's own body size, and the ED board
   * still tightens the strip vertically in its own sheet. */
  --board-chrome-padding: 10px;
  --board-strip-padding: 8px 10px;
  --board-link-padding: 9px 6px;
  --board-link-max-width: 180px;
  --board-link-size: 0.95em;

  /* ---- Motion ----------------------------------------------------------- */
  --duration-fast: 0.3s;
  --ease-standard: ease;
}

/* Touch. Below the tablet breakpoint every control grows to the 44px thumb
 * target; nothing else about the scale changes. */
@media (max-width: 920px) {
  :root { --control-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --duration-fast: 0.01s; }
}
