/*
 * SESAM design tokens.
 *
 * Brand variables and Bootstrap variable overrides only. Loaded first so that
 * Bootstrap and all later SESAM stylesheets see the correct values.
 *
 * All custom properties added by SESAM use the `--sesam-*` prefix. Bootstrap
 * customization happens by re-binding the appropriate `--bs-*` variable.
 *
 * RGB-triplet tokens
 * ------------------
 * When a token has to be consumed with an alpha channel, also expose its
 * value as an `--…-rgb` triplet (three comma-separated integers) and use
 * `rgba(var(--…-rgb), <alpha>)`. The triplet must be re-bound inside the
 * `[data-bs-theme="dark"]` block alongside its base token so the alpha
 * variant stays in sync with the theme.
 */

:root {
  /* ***************************************************
   * BRAND COLORS
   * *************************************************** */

  --sesam-blue: #235b8c;
  --sesam-blue-rgb: 35, 91, 140;
  --sesam-light-blue: #e2effe;
  --sesam-dark-blue: #13324e;

  /* Hovered links: a shade darker than --sesam-blue (lighter in the dark theme, where the blue itself is dark) */
  --sesam-link-hover-color: var(--sesam-dark-blue);
  --sesam-green: #858c1e;
  --sesam-green-rgb: 133, 140, 30;
  --sesam-green-hover: #a7af39;
  --sesam-red: #e74a3b;
  --sesam-red-rgb: 231, 74, 59;

  /* Stronger red used for destructive copy ("Delete account", warning
     labels) where --sesam-red is not bold enough against light backgrounds. */
  --sesam-red-strong: #c51104;
  --sesam-yellow: #dbab0a;
  --sesam-yellow-rgb: 219, 171, 10;

  /* Text in the green and yellow of a state ("Done", "Finished with errors") on light backgrounds, where the brand
     green and yellow are too light to read */
  --sesam-green-strong: #6b7118;
  --sesam-yellow-strong: #8a6a00;

  /* Secondary marketing/feature blues used by the landing pages. */
  --sesam-marketing-blue: #10598f;
  --sesam-marketing-blue-bright: #368dd9;

  /* Muted teal used by .text-primary and the analytics border-start. */
  --sesam-teal-muted: #567f83;

  /* Premium-plan accent (dashboard upgrade banner). */
  --sesam-premium: #5a2ca0;

  /* Lane-to-lane connections in the Editor: the amber of the connection arrows on the map, for their list rows. */
  --sesam-connection: #e8892f;
  --sesam-connection-rgb: 232, 137, 47;

  /* Accent colors for `.sesam-border-start-*` highlight strips. */
  --sesam-accent-purple: #8d74a5;
  --sesam-accent-green: #568360;

  /* Categorical palette of charts, in this fixed order (issue #523: the vehicle classes of the Analyzer chart
     Vehicles in the Network). Validated for colour vision deficiencies with the dataviz validator on adjacent pairs:
     use the slots in a row from 1, without gaps, so neighbours in a stack are always adjacent slots. Slots 3, 4 and 5
     are below 3:1 on white: show the names next to the colours (legend, toggles). Dark values below. */

  /* SESAM blue (--sesam-blue #235B8C) a touch more saturated: plain SESAM blue reads gray next to the other slots
     (chroma below the floor of the palette validator); this one passes every check */
  --sesam-chart-1: #2763a0;  /* SESAM blue */
  --sesam-chart-2: #eb6834;  /* orange */
  --sesam-chart-3: #1baf7a;  /* aqua */
  --sesam-chart-4: #eda100;  /* yellow */
  --sesam-chart-5: #e87ba4;  /* magenta */
  --sesam-chart-6: #008300;  /* green */
  --sesam-chart-7: #6250d6;  /* violet */
  --sesam-chart-8: #e34948;  /* red */

  /* The vehicle classes in the Analyzer chart Simulation Entities (#514, #523): one colour family per group, the
     classes of a group differ in lightness. Motorised private transport in SESAM blue, public transport in petrol
     green, active mobility in ochre; unknown classes gray. Icons and names carry the identity next to the colour. */
  --sesam-load-miv-1: #2763a0;  /* passenger cars, taxis */
  --sesam-load-miv-2: #5b8fcb;  /* delivery vans */
  --sesam-load-miv-3: #1b3e66;  /* trucks, trailers */
  --sesam-load-miv-4: #8da8cb;  /* motorcycles, mopeds, emergency and authority vehicles */
  --sesam-load-pt-1: #1f8a6e;  /* buses, coaches */
  --sesam-load-pt-2: #4db393;  /* trams */
  --sesam-load-pt-3: #0f5c49;  /* urban rail, subway */
  --sesam-load-pt-4: #86c9b1;  /* rail, ships */
  --sesam-load-active-1: #c0904a;  /* bicycles, scooters */
  --sesam-load-active-2: #8f5a2e;  /* pedestrians, wheelchairs */
  --sesam-load-other: #8a919e;

  /* Type scale for application surfaces (dashboard, builder start, ...): use these instead of ad-hoc rem values. */
  --sesam-text-title: 1.5rem;     /* page title */
  --sesam-text-section: 1.0625rem;  /* section heading above a group of cards */
  --sesam-text-item: .9375rem;  /* card / list item title */
  --sesam-text-body: .875rem;   /* running text, descriptions, buttons */
  --sesam-text-meta: .8125rem;  /* secondary info, timestamps, captions */

  /* ***************************************************
   * NEUTRAL GRAY SCALE
   * Single source for the muted grays that recur across separators,
   * placeholders, borders, and body text. Re-mapped in dark mode further
   * down so consumers do not need to special-case the theme.
   * *************************************************** */

  --sesam-gray-300: #dddfeb;  /* hr-thin, soft separators */
  --sesam-gray-400: #d1d3e2;  /* placeholders, light borders */
  --sesam-gray-500: #b7b9cc;  /* disabled */
  --sesam-gray-600: #858796;  /* body text */
  --sesam-gray-600-rgb: 133, 135, 150;
  --sesam-gray-700: #6e707e;  /* form focus color */

  /* Muted gray used by marketing copy and the "soft" link variant. */
  --sesam-muted-soft: #707070;

  /* ***************************************************
   * SEMANTIC COLORS
   * Re-themed via [data-bs-theme="dark"] below. Use these instead of the
   * raw brand colors when the value should flip in dark mode.
   * *************************************************** */

  --sesam-heading-color: #13324e;

  /* Values in tables and figure lists: a step lighter than the headings (about 78 % of the heading colour on the card) */
  --sesam-value-color: #475f75;

  /* ***************************************************
   * SHADOWS
   * *************************************************** */

  --sesam-shadow-soft: 0 .15rem 1.75rem 0 rgb(58 59 69 / .15);
  --sesam-shadow-strong: 0 1rem 3rem rgb(0 0 0 / .175);

  /* ***************************************************
   * SURFACE / CHROME
   * *************************************************** */

  --sesam-card-bg: #fff;
  --sesam-card-border: #e3e6f0;
  --sesam-card-header-bg: #f8f9fc;
  --sesam-modal-bg: #fff;
  --sesam-top-navbar-bg: #fff;
  --sesam-dropdown-bg: #fff;

  /* Dropdown item color tracks the heading color so it flips with the
     theme without needing its own dark-mode override. */
  --sesam-dropdown-item: var(--sesam-heading-color);
  --sesam-terminal-bg: #202529;
  --sesam-terminal-fg: #d0d7de;
  --sesam-content-bg: #fefefe;
  --sesam-table-striped-bg: #f9f9f9;

  /* Muted lavender-gray surface used for muted modal headers and hover
     backgrounds in marketing dropdowns. */
  --sesam-surface-muted: #eaecf4;
  --sesam-surface-muted-rgb: 234, 236, 244;

  /* ***************************************************
   * DESTRUCTIVE / DANGER
   * Used by the red pills and markers of failed or destructive states.
   * *************************************************** */

  --sesam-danger-bg: #fadbd8;
  --sesam-danger-border: #f8ccc8;

  /* ***************************************************
   * FOCUS RING
   * SB-Admin lavender glow used by `.form-control:focus` and friends.
   * Exposed as RGB triplet for `rgba(…, <alpha>)` consumers.
   * *************************************************** */

  --sesam-focus-ring-rgb: 78, 115, 223;

  /* ***************************************************
   * APP SHELL GEOMETRY
   * *************************************************** */

  --sesam-sidebar-width: 67px;
  --sesam-navbar-height: 50px;

  /* ***************************************************
   * BOOTSTRAP OVERRIDES
   * Re-bind Bootstrap's own --bs-* tokens instead of overriding rules
   * with !important.
   * *************************************************** */

  --bs-primary: var(--sesam-blue);

  /* Map Bootstrap's "success" theme color to the SESAM olive so utility
     classes like .bg-success / .text-success / .btn-success / striped
     progress bars match the brand. The -rgb form is the one .bg-success
     actually reads (background-color: RGBA(var(--bs-success-rgb), ...)). */
  --bs-success: var(--sesam-green);
  --bs-success-rgb: 133, 140, 30;

  /* SESAM uses a muted mid-gray as the base body text color so every
     Bootstrap component that inherits from --bs-body-color picks up the
     SESAM look (cards, list-groups, ...). */
  --bs-body-color: var(--sesam-gray-600);

  /* `.text-muted` and other Bootstrap components consume --bs-secondary-color
     (which defaults to rgba(emphasis, .75) -- a dark slate). Re-bind it to the
     same muted SESAM gray as the body color so muted text on cards / list
     groups stays consistent with the rest of the UI. */
  --bs-secondary-color: var(--sesam-gray-600);
  --bs-secondary-color-rgb: var(--sesam-gray-600-rgb);

  /* Striped table rows share the SESAM table-striped surface. */
  --bs-table-striped-bg: var(--sesam-table-striped-bg);
}

[data-bs-theme="dark"] {
  /* Note: `--sesam-dark-blue` is intentionally not flipped — the marketing
     footer keeps the deep navy in both themes. */
  --sesam-content-bg: #212529;
  --sesam-heading-color: #fff;
  --sesam-value-color: #cecfd0;
  --sesam-card-bg: #212529;
  --sesam-card-border: #30363d;
  --sesam-card-header-bg: #161b22;
  --sesam-modal-bg: #212529;
  --sesam-top-navbar-bg: #35363a;
  --sesam-dropdown-bg: #212529;
  --sesam-dropdown-item: #dee2e6;
  --sesam-blue: #294a71;
  --sesam-blue-rgb: 41, 74, 113;
  --sesam-link-hover-color: #8ab4e8;
  --sesam-table-striped-bg: #35363a;
  --sesam-terminal-bg: #000;
  --sesam-surface-muted: #161b22;
  --sesam-surface-muted-rgb: 22, 27, 34;
  --sesam-green-strong: #c2c95a;
  --sesam-yellow-strong: #f0c83c;

  /* Dark-mode gray scale: invert the brightness so separators, borders and
     placeholders remain visible against the dark canvas. */
  --sesam-gray-300: #30363d;
  --sesam-gray-400: #495057;
  --sesam-gray-500: #6c757d;
  --sesam-gray-600: #adb5bd;
  --sesam-gray-600-rgb: 173, 181, 189;
  --sesam-gray-700: #dee2e6;

  /* The chart palette stepped for the dark surface (validated against #212529) */
  --sesam-chart-1: #3987e5;
  --sesam-chart-2: #d95926;
  --sesam-chart-3: #199e70;
  --sesam-chart-4: #c98500;
  --sesam-chart-5: #d55181;
  --sesam-chart-6: #0ca30c;
  --sesam-chart-7: #9085e9;
  --sesam-chart-8: #e66767;

  /* The vehicle class families of the Analyzer chart, lighter for the dark surface */
  --sesam-load-miv-1: #5b8fd0;
  --sesam-load-miv-2: #8db3e3;
  --sesam-load-miv-3: #3b6597;
  --sesam-load-miv-4: #a9bfdb;
  --sesam-load-pt-1: #3db08f;
  --sesam-load-pt-2: #72ccad;
  --sesam-load-pt-3: #2a8068;
  --sesam-load-pt-4: #a6dcc8;
  --sesam-load-active-1: #d9ae6e;
  --sesam-load-active-2: #b98252;
  --sesam-load-other: #9aa1ad;
}
