/* bdg look for code.bdg.io (Systemadministration repo: hosts/gitlab/theme/).
 * Loaded through gitlab_rails['custom_html_header_tags'], served by nginx from /etc/gitlab/bdg-theme/.
 * Mostly GitLab UI design tokens (--gl-*), plus the classes .ui-gray (theme) and .gl-nav-item
 * (GitLab UI), which can change between releases. Check after every GitLab upgrade
 * (README, "After an upgrade").
 *
 * Colours from bdg Design 3.0 (bdg-presentation-deck skill): orange #F55910 as accent,
 * blue #3236FF for links on light surfaces. Primary buttons are near-black in GitLab 19.5 already.
 * Orange is never used for text on white (contrast 3.1:1, below AA for text); for focus rings and
 * indicators 3:1 is enough.
 */

@font-face {
  font-family: 'Instrument Sans Cond';
  src: url("instrument-sans-cond.ttf") format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* html:root outranks GitLab's own :root / :root.gl-dark rules regardless of load order. */
html:root {
  --bdg-orange: #F55910;
  --bdg-blue: #3236FF;

  --gl-focus-ring-outer-color: var(--bdg-orange);
  --gl-tab-selected-indicator-color-default: var(--bdg-orange);
  --gl-text-color-link: var(--bdg-blue);
}

/* Dark mode: #3236FF on near-black is 2.6:1, so links keep GitLab's light blue. */
html:root.gl-dark {
  --gl-text-color-link: var(--gl-color-blue-200);
}

/* Headlines in the bdg condensed face; body text and code stay GitLab Sans / GitLab Mono. */
h1, h2,
.gl-heading-display, .gl-heading-1, .gl-heading-2 {
  font-family: 'Instrument Sans Cond', var(--gl-font-family-regular);
  letter-spacing: 0;
}

/* The uploaded bdg logo is black on transparent: turn it white on dark surfaces. */
html.gl-dark img[src*="/system/appearance/logo/"],
html.gl-dark img[src*="/system/appearance/header_logo/"] {
  filter: invert(1);
}

::selection {
  background: rgba(245, 89, 16, 0.25);
}

/* ---- Gray theme = bdg theme: bdg greys and orange primary buttons. ----
 * Scoped to .ui-gray so users on other colour themes keep GitLab's look.
 * html:root.ui-gray outranks GitLab's :root.ui-gray and :root.gl-dark palette rules. */
html:root.ui-gray {
  /* bdg ink scale (Design 3.0) on GitLab's neutral steps; in-between steps interpolated. */
  --gl-color-neutral-0: #FFFFFF;
  --gl-color-neutral-10: #FAFAFA;
  --gl-color-neutral-50: #F4F4F5;
  --gl-color-neutral-100: #E4E4E7;
  --gl-color-neutral-200: #D5D5D7;
  --gl-color-neutral-300: #A2A2A9;
  --gl-color-neutral-400: #898990;
  --gl-color-neutral-500: #727279;
  --gl-color-neutral-600: #616167;
  --gl-color-neutral-700: #53535A;
  --gl-color-neutral-800: #404045;
  --gl-color-neutral-900: #27272A;
  --gl-color-neutral-950: #161618;
  --gl-color-neutral-1000: #09090B;

  /* Primary buttons orange with black text (6.4:1; white text would be 3.1:1). */
  --gl-button-confirm-primary-background-color-default: var(--bdg-orange);
  --gl-button-confirm-primary-background-color-hover: color-mix(in srgb, var(--bdg-orange) 88%, black);
  --gl-button-confirm-primary-background-color-active: color-mix(in srgb, var(--bdg-orange) 78%, black);
  --gl-button-confirm-primary-foreground-color-default: var(--gl-color-neutral-1000);
  --gl-button-confirm-primary-foreground-color-hover: var(--gl-color-neutral-1000);
  --gl-button-confirm-primary-foreground-color-active: var(--gl-color-neutral-1000);
}

/* Orange bar at the selected navigation item (GitLab draws it in currentColor). */
.ui-gray .gl-nav-item.selected::before {
  background-color: var(--bdg-orange);
}
