/*
 * M-0242: the one owner of every colour, type size, radius, shadow and motion value in Meridian.
 * Brand Book v0.2, Cobalt Signal. Each colour holds its light and dark value; the page's color-scheme picks one.
 * Screens, part recipes and Vaadin's own properties read these names and never hold a literal colour.
 * infra/keycloak/themes/meridian/login/resources/css/tokens.css is an exact copy, because the sign-in service can't
 * read this file; ThemeContrastSpec fails if the two differ.
 * A client's own design system, when one arrives, replaces this file.
 */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url("fonts/dm-sans-latin-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url("fonts/dm-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations"); }

/* html[theme] outranks Lumo's own [theme~='dark'] fallbacks, so these names hold in an explicit dark page as well. */
html, html[theme~="dark"] {
  color-scheme: light dark;
  /* Surfaces and ink. Contrast is computed for every pair, in both modes, by ThemeContrastSpec. */
  --m-surface-2: light-dark(#f4f7fc, #0a1324);
  --m-surface: light-dark(#ffffff, #0f1a30);
  --m-ink: light-dark(#0e1b33, #eaf0fb);
  --m-ink-2: light-dark(#33415c, #c6d1e6);
  --m-muted: light-dark(#5a6780, #a0aec7);
  --m-ink-3: var(--m-muted);
  --m-divider: light-dark(#d8dfec, #2a3a5c);
  --m-card-border: var(--m-divider);
  --m-control-border: light-dark(#7c8aa6, #6c7c9c);
  --m-border: var(--m-control-border);
  --m-fill: light-dark(#eef1f6, #1e2a42);

  /* Cobalt: main actions, links, selection. */
  --m-primary: light-dark(#2450c8, #2f5fe0);
  --m-primary-hover: light-dark(#1c3fa3, #2752cc);
  --m-primary-text: light-dark(#1f46b4, #9dbbff);
  --m-primary-soft: light-dark(#e9effc, #1a2b52);
  --m-on-primary: #ffffff;
  --m-focus: light-dark(#2450c8, #5ce1e6);

  /* Meaning colours, always with words or an icon. Amber: a person must decide. Red: denied, failed or wrong.
     Green: finished successfully. Grey: external or neutral. */
  --m-amber: light-dark(#b07a18, #f2cb7a);
  --m-amber-soft: light-dark(#fbf5e8, #3a2c0f);
  --m-amber-ink: light-dark(#7d5400, #f2cb7a);
  --m-red: light-dark(#b0473f, #f4a9a2);
  --m-red-soft: light-dark(#fbecea, #3e1a18);
  --m-red-ink: light-dark(#8c342e, #f4a9a2);
  --m-on-red: light-dark(#ffffff, #3e1a18);
  --m-green: light-dark(#17663f, #8fdda8);
  --m-green-soft: light-dark(#e7f5ec, #12341f);
  --m-green-ink: light-dark(#17663f, #8fdda8);
  --m-grey-soft: light-dark(#eef1f6, #1e2a42);
  --m-grey-ink: light-dark(#3d4a63, #cbd5e6);

  /* The side menu is navy in both modes, darker on a dark page. Signal cyan appears only on the dark menu, the logo and the
     dark-mode focus ring: it reads at 1.6:1 on white. */
  --m-nav-bg: light-dark(#0b1f4b, #080f1c);
  --m-nav-ink: #ffffff;
  --m-nav-muted: #c8d5ef;
  --m-nav-signal: #5ce1e6;
  --m-nav-active: rgb(92 225 230 / .16);
  --m-nav-hover: rgb(255 255 255 / .08);
  --m-nav-rule: rgb(255 255 255 / .14);
  --m-logo-tile: #2450c8;

  /* Chart colours approved on Analytics; validated apart in both modes. Series never use meaning colours. */
  --m-chart-1: light-dark(#2a78d6, #3987e5);
  --m-chart-2: light-dark(#d95f02, #d95926);
  --m-chart-3: light-dark(#0f9fb0, #16a7b8);
  --m-chart-4: light-dark(#7c5cd6, #9176e5);
  --m-chart-5: light-dark(#d6478e, #d55181);

  /* Type: DM Sans for reading, JetBrains Mono only for ids, codes and hashes. Scale 12 / 14 / 16 / 20 / 24 / 32. */
  --m-font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --m-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --m-small: .75rem;
  --m-body: .875rem;
  --m-lead: 1rem;
  --m-card-title: 1.25rem;
  --m-heading: 1.5rem;
  --m-title: 2rem;
  --m-line: 1.5;
  --m-weight-regular: 400;
  --m-weight-medium: 500;
  --m-weight-bold: 700;

  /* 4-point grid. */
  --m-space-1: 4px;
  --m-space-2: 8px;
  --m-space-3: 12px;
  --m-space-4: 16px;
  --m-space-5: 20px;
  --m-space-6: 24px;
  --m-space-8: 32px;
  --m-space-12: 48px;
  --m-compact-control-height: 2rem;
  --m-control-height: 2.25rem;

  /* Corners: 6 chips, 8 buttons and fields, 12 cards, 16 dialogs. Round only for dots, avatars and bars. */
  --m-radius-chip: 6px;
  --m-radius: 8px;
  --m-panel-radius: 12px;
  --m-dialog-radius: 16px;
  --m-round: 9999px;

  /* Depth: cards sit flat on a hairline; shadow only for what floats. In dark mode depth comes from lighter surfaces. */
  --m-card-shadow: none;
  --m-raised-shadow: 0 4px 12px light-dark(rgb(14 27 51 / .10), rgb(0 0 0 / .40));
  --m-overlay-shadow: 0 16px 40px light-dark(rgb(14 27 51 / .20), rgb(0 0 0 / .55));

  /* Motion shows what changed; none under reduced motion (see the rule below). */
  --m-motion-fast: 120ms;
  --m-motion: 200ms;

  /* Vaadin's own properties, mapped once, so Flow and React components follow the tokens. */
  --lumo-font-family: var(--m-font);
  --lumo-primary-color: var(--m-primary);
  --lumo-primary-text-color: var(--m-primary-text);
  --lumo-primary-color-50pct: color-mix(in srgb, var(--m-primary) 50%, transparent);
  --lumo-primary-color-10pct: var(--m-primary-soft);
  --lumo-primary-contrast-color: var(--m-on-primary);
  --lumo-header-text-color: var(--m-ink);
  --lumo-body-text-color: var(--m-ink-2);
  --lumo-secondary-text-color: var(--m-muted);
  --lumo-tertiary-text-color: var(--m-muted);
  --lumo-base-color: var(--m-surface);
  --lumo-shade-5pct: var(--m-surface-2);
  --lumo-contrast-10pct: var(--m-fill);
  --lumo-error-color: var(--m-red);
  --lumo-error-color-10pct: var(--m-red-soft);
  --lumo-error-text-color: var(--m-red-ink);
  --lumo-error-contrast-color: var(--m-on-red);
  --lumo-success-color: var(--m-green);
  --lumo-success-color-10pct: var(--m-green-soft);
  --lumo-success-text-color: var(--m-green-ink);
  --lumo-font-size-s: var(--m-small);
  --lumo-font-size-m: var(--m-body);
  --lumo-font-size-l: var(--m-lead);
  --lumo-font-size-xl: var(--m-card-title);
  --lumo-font-size-xxl: var(--m-heading);
  --lumo-font-size-xxxl: var(--m-title);
  --lumo-line-height-m: var(--m-line);
  --lumo-border-radius-s: var(--m-radius-chip);
  --lumo-border-radius-m: var(--m-radius);
  --lumo-border-radius-l: var(--m-panel-radius);
  --lumo-space-xs: var(--m-space-1);
  --lumo-space-s: var(--m-space-2);
  --lumo-space-m: var(--m-space-4);
  --lumo-space-l: var(--m-space-6);
  --lumo-space-xl: var(--m-space-8);
  --lumo-box-shadow-xs: var(--m-card-shadow);
  --lumo-box-shadow-s: var(--m-raised-shadow);
  --lumo-box-shadow-m: var(--m-overlay-shadow);
  --vaadin-input-field-border-width: 1px;
  --vaadin-input-field-border-color: var(--m-control-border);
  --vaadin-input-field-background: var(--m-surface);
  --vaadin-input-field-height: var(--m-control-height);
  --vaadin-focus-ring-color: var(--m-focus);
}

@media (prefers-reduced-motion: reduce) {
  html, html[theme~="dark"] { --m-motion-fast: 0ms; --m-motion: 0ms; }
}

html, body { background: var(--m-surface-2); color: var(--m-ink-2); font-family: var(--m-font); line-height: var(--m-line); -webkit-font-smoothing: antialiased; }
:focus-visible { outline-color: var(--m-focus); }
