/* Global tokens and base styles. Component styles live next to each component. */

/* Plus Jakarta Sans 2.7.1, self-hosted (see README.md in this folder). One variable file covers every weight
   the UI uses, so there is one request. swap: text is readable in the fallback font until it arrives. */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/assets/jakarta.ttf") format("truetype-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* The palette is a soft blue-grey page with white cards. Every text colour below is checked against the surface it
   is used on for 4.5:1 (3:1 for the borders that mark an input), in both themes. Each tone (ok, warning, critical,
   informational, working) has four values: the text, a soft fill, a hairline, and a stripe. The stripe is
   decoration only; the words always say the same thing. */
:root {
  color-scheme: light dark;
  --color-bg: #fbfcff;
  --color-surface: #ffffff;
  --color-surface-sunken: #f6f9fe;
  --color-tint: #edf5ff;
  --color-text: #152642;
  --color-text-soft: #3d526f;
  --color-heading: #0b2144;
  --color-muted: #586c89;
  --color-border: #e5ecf5;
  --color-border-soft: #eef2f7;
  --color-border-strong: #8396b0;
  --color-border-button: #cddbee;
  --color-divider: #d5e0ed;
  --color-dot: #b8c5d8;
  --color-accent: #2269ec;
  --color-accent-hover: #1b57c6;
  --color-accent-contrast: #ffffff;
  --color-button-text: #274a7a;
  --color-button-hover: #f3f8ff;
  --color-critical: #a4303f;
  --color-critical-bg: #fdf0f1;
  --color-critical-line: #f3cdd1;
  --color-critical-stripe: #d64557;
  --color-warning: #8f4d09;
  --color-warning-bg: #fff7eb;
  --color-warning-line: #f6dec0;
  --color-warning-stripe: #edac4a;
  --color-ok: #12704c;
  --color-ok-bg: #ebf8f1;
  --color-ok-line: #d7eee2;
  --color-ok-stripe: #2a9c72;
  --color-informational: #4f6482;
  --color-informational-bg: #f5f8fc;
  --color-informational-line: #dce5f0;
  --color-informational-stripe: #8396b0;
  --color-working: #1c58c9;
  --color-working-bg: #edf5ff;
  --color-working-line: #cfe0fb;
  --color-file: #d64545;
  /* The evidence highlight: two sides of one difference, told apart by label and dash pattern, never by colour. */
  --color-highlight-a: #c2410c;
  --color-highlight-b: #1f5fbf;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 16px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --shadow: 0 3px 14px rgba(34, 65, 108, 0.035);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  /* The type scale: the sizes the screens use, so a size is picked from this list and not invented per component. */
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.1875rem;
  --text-xl: 1.4375rem;
  --text-2xl: 1.95rem;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-loose: 1.65;
  --focus-ring: 2px solid var(--color-accent);
  --content-width: 960px;
  --check-width: 1220px;
  --wide-width: 1400px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0d1320;
    --color-surface: #141c2b;
    --color-surface-sunken: #1a2436;
    --color-tint: #1b2a47;
    --color-text: #e2e8f2;
    --color-text-soft: #c0cde0;
    --color-heading: #f3f6fb;
    --color-muted: #9db0ca;
    --color-border: #26324a;
    --color-border-soft: #1f2a3f;
    --color-border-strong: #6b7f9c;
    --color-border-button: #34445f;
    --color-divider: #34445f;
    --color-dot: #4a5b78;
    --color-accent: #7aa7ff;
    --color-accent-hover: #9bbcff;
    --color-accent-contrast: #0d1117;
    --color-button-text: #c9d8f2;
    --color-button-hover: #1b2a47;
    --color-critical: #ff9fa0;
    --color-critical-bg: #3a1a22;
    --color-critical-line: #5b2a35;
    --color-critical-stripe: #ff7b86;
    --color-warning: #f0c060;
    --color-warning-bg: #33270f;
    --color-warning-line: #574217;
    --color-warning-stripe: #e0a13a;
    --color-ok: #5fd0a0;
    --color-ok-bg: #112e24;
    --color-ok-line: #1d4a38;
    --color-ok-stripe: #3fb48a;
    --color-informational: #aebfd6;
    --color-informational-bg: #1a2436;
    --color-informational-line: #2c3a52;
    --color-informational-stripe: #6b7f9c;
    --color-working: #7aa7ff;
    --color-working-bg: #1b2a47;
    --color-working-line: #2d4a7d;
    --color-file: #ff8f8f;
    --color-highlight-a: #ff9a62;
    --color-highlight-b: #7aa7ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font: 0.9375rem/1.5 var(--font-sans);
  /* No font-variation-settings for wght here: it is inherited and would pin every weight to one value, so a heading
     or a button could never be bolder than body text. The @font-face range (200 800) lets font-weight pick the weight. */
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
  color: var(--color-heading);
  line-height: 1.25;
  font-weight: 740;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.75rem;
  letter-spacing: -0.035em;
  margin-block: 0 var(--space-4);
}

h2 {
  font-size: 1.1875rem;
  margin-block: var(--space-6) var(--space-3);
}

h3 {
  font-size: 1rem;
  margin-block: var(--space-4) var(--space-2);
}

p {
  margin-block: 0 var(--space-3);
}

/* A link inside a sentence stays underlined: colour alone is too close to the text colour to tell it apart. */
a {
  color: var(--color-accent);
  font-weight: 600;
  text-underline-offset: 3px;
}

/* Links that stand alone (navigation, a table cell, the end of a card) are plain until pointed at. */
.app-header a,
td a,
.link-plain {
  text-decoration: none;
}

.app-header a:hover,
td a:hover,
.link-plain:hover {
  text-decoration: underline;
}

/* One focus ring for everything a keyboard can reach. No rule in the UI removes it; a component that needs it
   somewhere else (a hidden file input, whose label is what the reader sees) moves it with :has(:focus-visible). */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- forms and buttons */

label {
  display: block;
  font-weight: 600;
  margin-block-end: var(--space-1);
}

input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  inline-size: 100%;
  max-inline-size: 28rem;
}

textarea {
  min-block-size: 4.5rem;
  resize: vertical;
}

input[type="file"] {
  padding: var(--space-2);
  background: var(--color-surface-sunken);
}

/* A checkbox or a radio button keeps its own size: the full width above is for fields of text (P1D-11: the bulk "Select every finding" box was
   stretched across a 375 px window). */
input[type="checkbox"],
input[type="radio"] {
  inline-size: auto;
  padding: 0;
}

button {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-button-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-button);
  border-radius: var(--radius-sm);
  padding: 9px var(--space-4);
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--color-button-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.primary {
  color: var(--color-accent-contrast);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

/* Its own background on hover: button:hover:not(:disabled) is the more specific selector, so without this a
   primary button would take the plain hover background and keep its white text — a label on pale blue it cannot be
   read against. */
button.primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin: 0;
}

legend {
  font-weight: 600;
  padding-inline: var(--space-2);
}

/* ---------------------------------------------------------------- tables */

table {
  border-collapse: collapse;
  inline-size: 100%;
  font-size: 0.875rem;
}

th,
td {
  text-align: start;
  padding: var(--space-3) var(--space-4);
  border-block-end: 1px solid var(--color-border-soft);
  vertical-align: top;
}

th {
  font-weight: 700;
  white-space: nowrap;
}

/* A column heading is a small label on a pale band; a row heading in the body stays ordinary text. */
thead th {
  background: var(--color-surface-sunken);
  color: var(--color-muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  border-block-end-color: var(--color-border);
}

tbody tr:last-child > td,
tbody tr:last-child > th {
  border-block-end: 0;
}

caption {
  text-align: start;
  color: var(--color-muted);
  padding-block-end: var(--space-2);
}

/* A number reads as a number: tabular figures, and the unit never wraps away from it. */
.numeric {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.muted {
  color: var(--color-muted);
}

.raw {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* Visible only to a screen reader; still focusable, unlike display: none. */
.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
