/*
 * SPDX-License-Identifier: Apache-2.0
 * SPDX-FileCopyrightText: 2026 ndaal Gesellschaft für Sicherheit in der Informationstechnik mbH & Co KG, Cologne
 * SPDX-FileCopyrightText: Author: Pierre Gronau <Pierre.Gronau@ndaal.eu>
 */

/* csaf-crud token layer.
 *
 * Loaded AFTER ndaal-tokens.css (skills/ndaal-design v1.1.0, vendored
 * unchanged). The brand colours, surfaces, text, borders, focus ring and
 * light status chips all come from that file; this layer only adds what the
 * skill does not define. Every colour pair carries its measured contrast
 * ratio (skills/ndaal-design/assets/check-contrast.py). No component rule may
 * use a raw colour: add a token here and measure it first.
 *
 * Recorded divergence from the skill (documentation/Developer_Guide.md):
 * the mono face is Roboto Mono (project rule), not JetBrains Mono.
 */

:root {
  /* Typography: Roboto Mono instead of JetBrains Mono. */
  --ndaal-font-mono: 'Roboto Mono', 'SF Mono', menlo, consolas, monospace;

  /* The logo is burgundy on transparent: a white plate keeps it readable on
   * the dark theme and is invisible on the white light header. */
  --csaf-logo-plate: #FFFFFF;

  /* Danger hover (light); the skill defines no dark value. */
  --csaf-danger-hover: #991B1B; /* white text 8.31:1 */

  /* Table and menu row hover. */
  --csaf-row-hover: #F1F5F9;

  /* TLP 2.0 (https://www.first.org/tlp/), black text on each. */
  --csaf-tlp-red-bg: #FF2B2B; /* black text 5.63:1 */
  --csaf-tlp-amber-bg: #FFC000; /* black text 12.79:1 */
  --csaf-tlp-green-bg: #33FF00; /* black text 15.44:1 */
  --csaf-tlp-clear-bg: #FFFFFF; /* black text 21.00:1 */
  --csaf-tlp-fg: #000000;
}

/* An explicit light choice also pins the browser's own widgets to light. */
:root[data-theme='light'] {
  color-scheme: light;
}

/* Dark theme, OS preference.
 * Same values as the explicit [data-theme='dark'] block below. Duplicated on
 * purpose: a custom property cannot be shared across two selectors that are
 * gated differently (media query versus attribute).
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    /* Danger hover and row hover (dark). */
    --csaf-danger-hover: #FECACA; /* dark text 12.94:1 */
    --csaf-row-hover: #1B2740;

    /* Status chips (dark): the skill defines light values only. */
    --ndaal-status-ok-bg: #0F2E1F;
    --ndaal-status-ok-fg: #34D399; /* 7.63:1 */
    --ndaal-status-info-bg: #0C2D45;
    --ndaal-status-info-fg: #7DD3FC; /* 8.53:1 */
    --ndaal-status-warn-bg: #3B2606;
    --ndaal-status-warn-fg: #FBBF24; /* 8.58:1 */
    --ndaal-status-med-bg: #3A2F06;
    --ndaal-status-med-fg: #FCD34D; /* 9.16:1 */
    --ndaal-status-crit-bg: #3A1418;
    --ndaal-status-crit-fg: #FCA5A5; /* 8.56:1 */
    --ndaal-status-neutral-bg: #1B2740;
    --ndaal-status-neutral-fg: #CBD5E1; /* 10.03:1 */
  }
}

/* Dark theme, explicit choice (cookie). */
:root[data-theme='dark'] {
  color-scheme: dark;

  /* Danger hover and row hover (dark). */
  --csaf-danger-hover: #FECACA;
  --csaf-row-hover: #1B2740;

  /* Status chips (dark). */
  --ndaal-status-ok-bg: #0F2E1F;
  --ndaal-status-ok-fg: #34D399;
  --ndaal-status-info-bg: #0C2D45;
  --ndaal-status-info-fg: #7DD3FC;
  --ndaal-status-warn-bg: #3B2606;
  --ndaal-status-warn-fg: #FBBF24;
  --ndaal-status-med-bg: #3A2F06;
  --ndaal-status-med-fg: #FCD34D;
  --ndaal-status-crit-bg: #3A1418;
  --ndaal-status-crit-fg: #FCA5A5;
  --ndaal-status-neutral-bg: #1B2740;
  --ndaal-status-neutral-fg: #CBD5E1;
}

/* Increased-contrast preference: dividers become control-strength. */
@media (prefers-contrast: more) {
  :root {
    --ndaal-border-decorative: var(--ndaal-border-interactive);
  }
}
