/**
 * Design tokens: defined once here, used by the theme and by the es_decision_api stylesheets.
 *
 * Loaded after the compiled Bootstrap (css/style.css). Each token is also mapped onto Bootstrap 5.3's own
 * CSS variables (--bs-*), so Bootstrap components pick it up without one-off overrides. The same values are
 * mirrored in scss/_variables_bootstrap.scss for the next Sass build.
 */
:root {
  /* Colour: one accent for primary actions and key status; neutrals for everything else. */
  --es-accent: #fc6723;          /* primary actions and the "act now" status */
  --es-accent-hover: #ff8a52;
  --es-accent-ink: #022a38;      /* text on the accent: 5.1:1 (white on this orange is only 2.9:1) */
  --es-ink: #12303a;             /* body text, 13:1 on white */
  --es-ink-strong: #033547;      /* headings, focus outline */
  --es-muted: #4d636b;           /* secondary text, 6.1:1 on white */
  --es-line: #dfe5e7;            /* dividers and panel borders (decorative) */
  --es-control: #7a8d94;         /* form-control borders, 3.4:1 on white (WCAG 1.4.11) */
  --es-surface: #ffffff;
  --es-surface-2: #f6f8f9;       /* table heads, quiet panels */
  --es-focus: #033547;
  /* Status only (never decoration). */
  --es-ok: #1d6b45;   --es-ok-bg: #e7f3ec;
  --es-warn: #8a4b00; --es-warn-bg: #fdf3e3;
  --es-bad: #a12b1f;  --es-bad-bg: #fbecea;
  --es-info: #1f4f82; --es-info-bg: #e9f0f8;

  /* Type: one family, five sizes. */
  --es-font: Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif; /* loaded by css/style.css; matches emergentskills.com */
  --es-fs-xs: .8125rem;   /* 13px */
  --es-fs-sm: .9375rem;   /* 15px */
  --es-fs-md: 1.0625rem;  /* 17px, body */
  --es-fs-lg: 1.3125rem;  /* 21px */
  --es-fs-xl: 1.75rem;    /* 28px, page titles */

  /* Spacing: 4px base. */
  --es-s1: .25rem; --es-s2: .5rem; --es-s3: .75rem; --es-s4: 1rem; --es-s5: 1.5rem; --es-s6: 2rem;

  /* Shape. */
  --es-radius: .375rem;     /* controls */
  --es-radius-lg: .5rem;    /* panels */

  /* Bootstrap's own variables, set from the tokens. */
  --bs-body-font-family: var(--es-font);
  --bs-body-color: var(--es-ink);
  --bs-body-color-rgb: 18, 48, 58;
  --bs-secondary-color: var(--es-muted);
  --bs-emphasis-color: var(--es-ink-strong);
  --bs-heading-color: var(--es-ink-strong);
  --bs-border-color: var(--es-line);
  --bs-border-radius: var(--es-radius);
  --bs-border-radius-sm: .25rem;
  --bs-border-radius-lg: var(--es-radius-lg);
  --bs-link-color: #0a6470;      /* 6.4:1 on white */
  --bs-link-color-rgb: 10, 100, 112;
  --bs-link-hover-color: var(--es-ink-strong);
  --bs-link-hover-color-rgb: 3, 53, 71;
  --bs-focus-ring-color: var(--es-focus);
  --bs-focus-ring-width: 2px;
  --bs-focus-ring-opacity: 1;
  --bs-success: var(--es-ok);
  --bs-warning: var(--es-warn);
  --bs-danger: var(--es-bad);
}

/* Focus: a solid 2px outline everywhere (WCAG 2.4.7 / 2.4.13), replacing Bootstrap's faint glow. */
:focus-visible { outline: 2px solid var(--es-focus); outline-offset: 2px; }
.btn:focus-visible, .button:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus { outline: 2px solid var(--es-focus); outline-offset: 2px; box-shadow: none; }
/* On the navy footer and the navy title band of marketing pages, the outline is white. */
.es-footer :focus-visible, .es-page-header:not(.es-page-header--app) :focus-visible { outline-color: #fff; }

/* Form controls: visible borders (3:1). */
.form-control, .form-select { border-color: var(--es-control); border-radius: var(--es-radius); }
.form-control:focus, .form-select:focus { border-color: var(--es-focus); }
.form-check-input { border: 1px solid var(--es-control); }
.form-check-input:checked { background-color: var(--es-ink-strong); border-color: var(--es-ink-strong); }
.form-control::placeholder { color: var(--es-muted); opacity: 1; }

/* Buttons: one accent for the primary action; neutral outline for secondary; text links for minor actions.
   Drupal and the base theme mark primary buttons in several ways; all of them map to the one accent. */
.btn-primary, .btn-accent, .button--primary.btn, a.button.button--primary, button.button--primary, input.button--primary,
.webform-submission-es-decision-review-form .webform-button--submit {
  --bs-btn-color: var(--es-accent-ink);
  --bs-btn-bg: var(--es-accent);
  --bs-btn-border-color: var(--es-accent);
  --bs-btn-hover-color: var(--es-accent-ink);
  --bs-btn-hover-bg: var(--es-accent-hover);
  --bs-btn-hover-border-color: var(--es-accent-hover);
  --bs-btn-active-color: var(--es-accent-ink);
  --bs-btn-active-bg: var(--es-accent-hover);
  --bs-btn-active-border-color: var(--es-accent-hover);
  --bs-btn-disabled-color: var(--es-accent-ink);
  --bs-btn-disabled-bg: var(--es-accent);
  --bs-btn-disabled-border-color: var(--es-accent);
  font-weight: 700;
}
.btn-secondary, .btn-outline-secondary, .btn-outline-primary, a.button:not(.button--primary), input.button:not(.button--primary) {
  --bs-btn-color: var(--es-ink-strong);
  --bs-btn-bg: var(--es-surface);
  --bs-btn-border-color: var(--es-control);
  --bs-btn-hover-color: var(--es-ink-strong);
  --bs-btn-hover-bg: var(--es-surface-2);
  --bs-btn-hover-border-color: var(--es-ink-strong);
  --bs-btn-active-color: var(--es-ink-strong);
  --bs-btn-active-bg: var(--es-line);
  --bs-btn-active-border-color: var(--es-ink-strong);
  --bs-btn-disabled-color: var(--es-muted);
  --bs-btn-disabled-bg: var(--es-surface);
  --bs-btn-disabled-border-color: var(--es-line);
}
.btn { --bs-btn-font-weight: 600; --bs-btn-border-radius: var(--es-radius); --bs-btn-padding-y: .5rem; --bs-btn-padding-x: 1rem; --bs-btn-font-size: var(--es-fs-sm); }
.btn-lg { --bs-btn-padding-y: .625rem; --bs-btn-padding-x: 1.25rem; --bs-btn-font-size: var(--es-fs-md); }
.btn-sm { --bs-btn-padding-y: .25rem; --bs-btn-padding-x: .625rem; --bs-btn-font-size: var(--es-fs-xs); }
.btn-link, input.button.btn-link, a.button.btn-link {
  --bs-btn-color: var(--bs-link-color); --bs-btn-hover-color: var(--bs-link-hover-color); --bs-btn-active-color: var(--bs-link-hover-color);
  --bs-btn-bg: transparent; --bs-btn-hover-bg: transparent; --bs-btn-active-bg: transparent;
  --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent;
  --bs-btn-padding-x: 0; font-weight: 600; text-decoration: underline;
}

/* Tables: dense and quiet. */
.table { --bs-table-color: var(--es-ink); --bs-table-border-color: var(--es-line); --bs-table-striped-bg: var(--es-surface-2); font-size: var(--es-fs-sm); }
.table > thead th, table > thead th { background: var(--es-surface-2); color: var(--es-ink-strong); font-size: var(--es-fs-xs); font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.table > :not(caption) > * > * { padding: .5rem .75rem; }
