/* 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 */

  /* Buttons. RED MEANS DESTRUCTIVE on a button (Kent, 2026-11-10), so the main-action
   * fill is the logo's aircraft blue, not the crimson it used to be. Not #377EB6
   * exactly: white label text on it is 4.35:1, under AA's 4.5 for a 16px label, so it
   * is darkened 5% to #3478AD (4.73:1), which reads as the same blue. Hover is a darker
   * shade of it (6.21:1). The same fill in both themes: against the dark page it still
   * clears 3:1 as a boundary. PROVISIONAL until Jill has seen it — she has not ruled on
   * button colours, and this replaces the crimson→blue swap the spec (§ 2.1) calls the
   * brand's one gesture. */
  --fc-btn-primary: #3478AD;
  --fc-btn-primary-hover: #2C6592;

  /* 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 */

  /* Headings. The LevelFlight indigo, kept when body ink stayed near-black
   * (Jill, 2026-08-12, § 8.5) — the perceptual link to the brand is carried by
   * the chrome colours and the display face, not by body copy. Provisional in
   * her own words: if it reads badly once assembled, that is a question for her,
   * not an adjustment to make here. */
  --fc-heading: #48506F;

  /* Neutrals */
  /* Was #111111. Jill, 2026-08-12 (§ 8.1): a deliberate step DOWN from maximum
   * contrast — at 18.9:1 a long block of regulation text shimmers, and 85% grey
   * removes that without costing a table read for an hour. Not a move toward the
   * brand indigo, which was the other option and was declined. */
  --fc-ink: #262626;
  --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;
  /* Section tint — the cool lavender-grey the site uses behind cards (§ 2.3).
   * Distinct from --fc-surface-2 by a hair and doing a different job: this is the
   * ground a table header sits on, where -2 is a control fill. */
  --fc-surface-3: #F5F6FA;

  /* 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;
  /* FOOTER BLOCK — Jill, 2026-08-12 (§ 8.3), chosen against this spec's own
   * recommendation on brand consistency. A solid coloured block, not a hairline rule.
   *
   * Light is the brand navy the section headers already use. Dark is HER value,
   * transcribed from the palette image rather than derived from the light one, which
   * is what § 9.3 requires — a derived substitute would be a different blue that
   * happened to pass a contrast check.
   *
   * Text is #E3E3E3 in both, which is the dark theme's ink: on the block it is the
   * SAME relationship in either theme, so the footer reads identically rather than
   * flipping polarity with the rest of the page. */
  --fc-footer-bg: #255A81;
  --fc-footer-fg: #E3E3E3;
  /* Links and the AI disclaimer need to separate from body text INSIDE the block, and
   * --fc-link and --fc-warn are both tuned for a white page and illegible here. White
   * for links (the strongest available separation without introducing a hue that is
   * not the brand's), and the disclaimer in the warm tint the amber resolves to on a
   * dark ground. */
  --fc-footer-link: #FFFFFF;
  --fc-footer-warn: #FFD9A0;
  /* The A- A A+ and theme buttons sit ON the block, so their boundary is bound by
   * SC 1.4.11 at 3:1 against IT, not against the page. --fc-control-line is tuned for
   * a white page and manages 1.80:1 on the light block and 2.77:1 on the dark one —
   * caught by the gate, not by eye. The button FILL clears it easily in light mode
   * (6.79:1) and fails in dark (1.25:1, a dark chip on a dark navy), so the border is
   * what has to carry it in both. */
  --fc-footer-control-line: #E3E3E3;
  --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;
  /* TWO stacks, not one with per-page overrides (Jill, 2026-08-12, § 8.2). The
   * split is by CONTENT TYPE rather than by element: Poppins for headings, nav,
   * buttons and the uppercase micro-labels; the system stack for table data and
   * quoted regulation text — so a citation string inside a heading is still data
   * and still sets in the system face. `14 CFR §135.267(b)(3)` in a narrow column
   * is exactly where a wide geometric face hurts.
   *
   * Poppins is vendored as of 2026-08-15 — see the @font-face block below. The
   * system stack stays behind it as the fallback, which is what font-display:swap
   * paints while the woff2 loads and what a blocked or missing file falls back to
   * permanently. */
  --fc-font-display: "Poppins", 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;
  /* ONE height for every control — buttons, filter inputs, selects. A row that
   * mixes them lines up because they share this token, not because three separate
   * rules happen to agree on a number. rem, so the A− / A / A+ control scales it. */
  --fc-control-h: 2.5rem;
  --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;
  /* Secondary text. Re-derived neutral with the ground (§ 6.4): the old #A9B6C4
   * was a blue-grey chosen against #10151A and reads as tinted on a true black. */
  --fc-slate: #B4B4B4;

  /* Headings in dark. The light theme's #48506F is 2.4:1 on this ground and
   * unusable; this is the same indigo lightened until it clears AA on the
   * neutral, keeping the hue relationship rather than the value. */
  --fc-heading: #A9AECB;

  /* THE GROUND IS A TRUE NEUTRAL (Jill, 2026-08-12, § 8.4). #E3E3E3 on #0D0D0D
   * mirrors #262626 on white — the symmetry is the point, and the gate asserts
   * it. Not #181E30: that is the light end of a decorative gradient behind ONE
   * block of content and a dark blue rather than a ground, which § 2.3 records
   * as a sampling error in the spec rather than a preference.
   *
   * THIS IS A HUE CHANGE, NOT A LEGIBILITY ONE, and must not be reported as an
   * improvement: the old pair was about 15.5:1 and this is 15.1:1.
   *
   * The knock-on is the work. Every surface and line below was hand-derived to
   * sit on a blue-black #10151A; left alone they read as blue-grey cards
   * floating on a neutral. They are re-derived as neutrals here — and they step
   * UP from the ground rather than down, because a near-black ground has no room
   * below it. */
  --fc-ink: #E3E3E3;
  --fc-muted: #B0B0B0;
  --fc-line: #303030;         /* decorative rules and dividers — not a control boundary */
  /* 3.6:1 on --fc-surface, 3.1:1 on --fc-surface-2 — the boundary role, unchanged
   * in intent, re-derived neutral. */
  --fc-control-line: #757575;
  --fc-surface: #0D0D0D;
  --fc-surface-alt: #191919;
  --fc-surface-2: #222222;
  /* Steps UP from the ground, like the two above — a near-black has no room
   * below it, so the elevation ordering is inverted from the light theme's. */
  --fc-surface-3: #1E1E1E;

  --fc-warn: #E0A64A;
  /* Light tint in dark mode, paired with dark badge text below. */
  --fc-guidance: #D9A66B;
  --fc-badge-fg: #111111;
  /* Jill's own dark values, transcribed. #15354D is what she drew; the text stays
   * #E3E3E3, which is this theme's ink, so the footer is the one element that does not
   * change relationship between themes. */
  --fc-footer-bg: #15354D;
  --fc-footer-fg: #E3E3E3;
  --fc-footer-link: #FFFFFF;
  --fc-footer-warn: #FFD9A0;
  --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;

  /* Buttons stay brown-orange here. In this palette DANGER is blue, so a blue main
   * action would read as destructive — the opposite of the rule the blue serves. */
  --fc-btn-primary: #8A3D00;
  --fc-btn-primary-hover: #6B2F00;
}

: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;
}

/* Poppins — self-hosted ------------------------------------------------------
   NEVER fonts.googleapis.com. This product serves everything from embed.FS as a
   single binary, government users are in scope, and a third-party request on every
   page load is a privacy and availability dependency it does not otherwise have.

   FOUR WEIGHTS, LATIN ONLY, 32KB the lot. The site loads nine weights across the
   full range; nothing here uses anything lighter than 400, so the subset is what
   § 3 says is actually used — 400 body, 500 emphasis, 600 nav and sub-heads, 700
   headings — and the latin unicode range Google already subsets these files to.

   font-display: swap, so text is readable in the system face from the first paint
   rather than invisible while 32KB arrives. The reflow that costs is the trade the
   alternative (invisible text) loses badly.

   Licence: SIL Open Font License 1.1, shipped beside the files as fonts/OFL.txt and
   read rather than assumed — the dependency tree is deliberately free of GPL, LGPL
   and AGPL and that is a shipping requirement, not a preference. */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/poppins-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/poppins-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/poppins-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/poppins-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
