/* Copyright (c) 2026 by Fly Compliant, LLC
 *
 * Design tokens. A rebrand is this one file.
 *
 * Values sampled from flycompliant.com (2026-08-01) and then contrast-
 * corrected: accessibility outranks brand fidelity. Every token in the
 * text-role set clears WCAG 2.2 AA against its own surface, asserted by
 * `make check-contrast` — not by a comment.
 *
 * Dark mode is a second set of deliberate colours, not a filter. Inverting a
 * crimson-and-blue mark gives cyan and orange.
 */

:root {
  color-scheme: light;

  /* Brand — sampled from the wordmark */
  --fc-red: #B00323;         /* logo crimson: primary action, active nav */
  --fc-red-deep: #7E1226;    /* hover / pressed on --fc-red */
  --fc-red-solid: #C41435;   /* solid fills needing white text */
  --fc-blue-plane: #377EB6;  /* the aircraft blue — decorative, not text */

  /* Sampled from flycompliant.com stylesheets, corrected where needed */
  --fc-navy: #255A81;        /* section headers, secondary buttons */
  --fc-link: #066AAB;
  --fc-link-hover: #00679F;  /* was #0080BB at 4.37 — hover must not reduce legibility */
  --fc-slate: #545979;       /* secondary text, metadata */

  /* Neutrals */
  --fc-ink: #111111;
  --fc-muted: #475569;
  --fc-line: #D1D5DB;         /* decorative rules and dividers — not a control boundary */
  /* Control boundaries: inputs, buttons, checkboxes, focus targets.
   * WCAG 2.2 SC 1.4.11 requires 3:1 against the adjacent surface. --fc-line is 1.47:1 on
   * white, which is fine for a divider between paragraphs and not fine for the edge of a
   * text field a low-vision user has to find. 4.62:1 on white, 4.28:1 on --fc-surface-2. */
  --fc-control-line: #767E8C;
  --fc-surface: #FFFFFF;
  --fc-surface-alt: #F0F5FA; /* answer panel, cards */
  --fc-surface-2: #F4F6F9;

  /* Semantic — deliberately not the brand red, so "error" and "primary
   * action" cannot be confused. */
  --fc-warn: #8F5600;        /* was #B26A00 at 4.24 — this carries the AI disclaimer */
  /* Guidance badge. Distinct from --fc-navy so a reader can tell an Advisory
   * Circular from a regulation at a glance — the badge is the only thing on the
   * card that states a source's force. 7.45:1 against white. */
  --fc-guidance: #7A4A17;
  /* Badge text. A separate token because badge backgrounds are mid-tone brand
   * colours in light mode and LIGHT tints in dark mode, so white text is
   * correct in one theme and unreadable in the other — all three original
   * badges sat at 2.06-2.26:1 in dark mode. */
  --fc-badge-fg: #FFFFFF;
  --fc-danger: #A61B1B;
  --fc-ok: #1B7F4B;
  --fc-tint-red: #FFE4EA;

  /* Type and metrics. Sizing is rem throughout so the A− / A / A+ control
   * scales the whole interface rather than a subset of it. */
  --fc-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fc-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fc-radius: 0.375rem;
  --fc-radius-lg: 0.875rem;   /* cards and panels — a tighter radius on a large card
                               * reads as a 2012 dialog box */
  --fc-space: 1rem;
  /* Elevation. Two steps only. A shadow is the one place this palette is allowed to
   * be approximate: it is decorative, sits under no text, and so is outside the
   * contrast gate's remit. */
  --fc-shadow: 0 0.0625rem 0.125rem rgba(17, 17, 17, 0.06), 0 0.25rem 0.75rem rgba(17, 17, 17, 0.05);
  --fc-shadow-lg: 0 0.125rem 0.25rem rgba(17, 17, 17, 0.06), 0 1rem 2rem rgba(17, 17, 17, 0.09);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --fc-red: #E8536B;
  --fc-red-deep: #F0808C;
  --fc-red-solid: #B00323;
  --fc-blue-plane: #6BA8DC;

  --fc-navy: #7FB2DA;
  --fc-link: #6FB6E8;
  --fc-link-hover: #9CCFF5;
  --fc-slate: #A9B6C4;

  --fc-ink: #E8EDF2;
  --fc-muted: #A9B6C4;
  --fc-line: #2E3945;         /* decorative rules and dividers — not a control boundary */
  /* 3.62:1 on --fc-surface, 3.04:1 on --fc-surface-2. */
  --fc-control-line: #6D7885;
  --fc-surface: #10151A;
  --fc-surface-alt: #171E26;
  --fc-surface-2: #1D2630;

  --fc-warn: #E0A64A;
  /* Light tint in dark mode, paired with dark badge text below. 8.9:1. */
  --fc-guidance: #D9A66B;
  --fc-badge-fg: #111111;
  --fc-danger: #F0808C;
  --fc-ok: #5CC98D;
  --fc-tint-red: #3A1620;

  /* A black shadow on a #10151A surface does nothing. Depth in dark mode comes from a
   * faint light rim plus a deeper black spread. */
  --fc-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0.25rem 0.75rem rgba(0, 0, 0, 0.5);
  --fc-shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 1rem 2rem rgba(0, 0, 0, 0.6);
}

/* Colour-vision-safe palette ---------------------------------------------
 *
 * Opt-in from the footer, stamped as [data-palette="cb"] on :root.
 *
 * WHAT THIS IS AND IS NOT. There is no ADA colour palette: the ADA does not specify
 * colours. The binding criteria are WCAG 2.2 **1.4.1 Use of Color** — information must
 * never be conveyed by colour ALONE — and 1.4.3 / 1.4.11 for contrast. 1.4.1 is satisfied
 * by the markup rather than by any palette: every badge, severity, verdict and tier in this
 * app carries its own text label, so a reader who sees no colour difference at all loses
 * nothing. This palette is an aid on top of that, not the thing that makes us compliant.
 *
 * WHY THESE COLOURS. The default semantic set is red / amber / green, which is the one pair
 * of distinctions the common deficiencies collapse: deuteranopia and protanopia together
 * are ~8% of men, and both make red and green converge. Blue and orange stay separable
 * under deuteranopia, protanopia AND tritanopia, so the semantic tokens are remapped onto a
 * blue-orange axis and separated by LIGHTNESS as well as hue — lightness survives every
 * deficiency, including full achromatopsia.
 *
 * Every value here is contrast-checked by `make check-contrast` against both themes, the
 * same as the default palette. An unverified accessibility palette would be worse than
 * none, because it would be trusted.
 */
:root[data-palette="cb"] {
  /* Semantic. "Bad" is dark blue, "caution" is mid brown-orange, "good" is deep teal —
   * three clearly different lightnesses, not three hues at the same lightness. */
  --fc-danger: #1A4F8A;
  --fc-warn: #8A5A00;
  --fc-ok: #005F73;
  --fc-guidance: #6B4A9B;
  --fc-tint-red: #DCE6F2;

  /* The brand red is an action colour, not a status one, so it stays recognisable but
   * shifts off the red-green axis enough to separate from --fc-ok. */
  --fc-red: #8A3D00;
  --fc-red-deep: #6B2F00;
  --fc-red-solid: #8A3D00;
}

:root[data-palette="cb"][data-theme="dark"],
:root[data-theme="dark"][data-palette="cb"] {
  --fc-danger: #8CB8E8;
  --fc-warn: #E0A64A;
  --fc-ok: #5CC8D6;
  --fc-guidance: #C0A6E8;
  --fc-tint-red: #16283D;

  --fc-red: #E89A5C;
  --fc-red-deep: #F0B183;
  --fc-red-solid: #8A3D00;
}
