/* ==============================================
 * Analyt MTC — Color Theme
 * Single source of truth for all template colors.
 * Light mode: :root
 * Dark mode: :root[data-wh-theme="dark"]
 * ============================================== */

:root {
  /* --- Core --- */
  --wh-primary-bg: #fff;
  --wh-primary-color: #000;
  --wh-secondary-bg: #fff;
  --wh-secondary-color: #333333;
  --wh-strong-color: #333333;
  --wh-soft-color: #ccc;
  --wh-subtle-color: #f2f2f2;

  /* --- Header & Menu --- */
  --wh-header-bg: white;
  --wh-top-menu-bg: #e6e6e6;
  --wh-close-toc-icon-border: #343a40;
  --wh-close-toc-button-shadow: rgba(0, 0, 0, .16);

  /* --- Links --- */
  --wh-link-color: #006eb5;
  --wh-related-links-color: #006eb5;

  /* --- Labels & Code --- */
  --wh-label-color: #696969;
  --wh-pre-bg: #eee;
  --wh-code-color: #800000;
  --wh-boolean-color: #008000;
  --wh-state-color: #ff0000;
  --wh-syntaxdiagram-color: #800000;
  --wh-markup-color: #639;
  --wh-filepath-color: #c7254e;

  /* --- Tiles --- */
  --wh-tile-bg: #e5f0f8;
  --wh-tile-link-color: #006eb5;
  --wh-main-page-shortdesc-color: #333333;
  --wh-main-page-toc-bg: #e5f0f8;
  --wh-main-page-toc-border: #c0c0c0;

  /* --- Breadcrumb --- */
  --wh-breadcrumb-color: #006eb5;
  --wh-breadcrumb-bg: #e5f0f8;

  /* --- TOC --- */
  --wh-publication-toc-color: #000;
  --wh-publication-toc-bg: #e5f0f8;
  --wh-publication-toc-border-color: #e0e0e0;
  --wh-publication-toc-active-color: #006eb5;

  /* --- Tooltip --- */
  --wh-tooltip-color: #5185cb;

  /* --- Footer --- */
  --wh-footer-bg: #e5f0f8;
  --wh-footer-link-color: #006eb5;

  /* --- Borders & UI --- */
  --wh-outline-color: #ccc;
  --wh-fig-border: #c0c0c0;
  --wh-toggle-border: #006eb5;
  --wh-go2top-bg: #444;
  --wh-go2top-border: #999;

  /* --- Search --- */
  --wh-search-color: #006eb5;
  --wh-search-input-bg: #e5f0f8;
  --wh-search-bg: #e5f0f8;
  --wh-search-breadcrumb-color: #ccc;
  --wh-search-loader-base-bg: #eaecec;
  --wh-search-loader-glow-bg: #f3f3f3;
  --wh-search-facets-bg: #e3ebf3;
  --wh-search-facets-disabled-color: #b7b6b6;
  --wh-search-facets-border: #ebebeb;
  --wh-search-results-facets-bg: #f5f5f5;
  --wh-search-results-facets-color: #212c37;
  --wh-searchresult-color: #346ec5;
  --wh-searchresult-relativepath-color: #006621;
  --wh-search-pagination-bg: var(--wh-primary-bg);
  --wh-search-pagination-active-bg: #346ec5;
  --wh-search-pagination-disabled-bg: #e9ecef;
  --wh-search-pagination-disabled-color: rgba(33, 37, 41, 0.75);
  --wh-highlight-bg: #ffff88;
  --wh-scroll-bg: #d6d6d6;

  /* --- Hazard notes (Oxygen standard) --- */
  --wh-caution-bg: #ffd100;
  --wh-danger-bg: #c8102e;
  --wh-warning-bg: #ff8200;
  --wh-hazardstatement-bg: #0072ce;
  --wh-indexterm-bg: #fdf;

  /* --- Change Tracking --- */
  --wh-oxy-delete-color: #ff0000;
  --wh-oxy-insert-color: #0000ff;
  --wh-oxy-change-done-color: #808080;
  --wh-oxy-range-color: #800000;
  --wh-oxy-comment-border: #ffa500;
  --wh-oxy-change-bg: #ffff00;
  --wh-oxy-attributes-footnote-bg: #00ffff;
  --wh-oxy-comment-footnote-bg: #ffffaa;
  --wh-oxy-delete-footnote-bg: #ffaaaa;
  --wh-oxy-insert-footnote-bg: #ddddff;

  /* --- Syntax Highlight --- */
  --wh-hl-json_key-color: #7263b9;
  --wh-hl-keyword-color: #7f0055;
  --wh-hl-string-color: #2a00ff;
  --wh-hl-comment-color: #006400;
  --wh-hl-directive-color: #8b26c9;
  --wh-hl-tag-color: #000096;
  --wh-hl-attribute-color: #ff7935;
  --wh-hl-value-color: #993300;
  --wh-hl-html-color: #000080;
  --wh-hl-xsl-color: #0066ff;
  --wh-hl-annotation-color: #808080;
  --wh-hl-tag-doctype-comment-color: #3f5fbf;
  --wh-hl-tag-doctype-color: #0000ff;

  /* --- Brand Custom (no --wh-* equivalent) --- */
  --brand-accent-bg: #e5f0f8;
  --brand-title-color: #333333;
  --brand-label-color: #696969;
  --brand-footer-text: #333333;
  --brand-menu-text: #333333;
  --brand-menu-hover-bg: #d9d9d9;
  --brand-menu-submenu-separator: #fff;
  --brand-mobile-menu-bg: #b3b3b3;
  --brand-metadata-bg: #f9f9f9;
  --brand-metadata-border: #0073e6;
  --brand-metadata-value: #333;
  --brand-front-page-subtitle: gray;
  --brand-step-bullet-bg: #000;
  --brand-step-bullet-color: #fff;
  --brand-step-sidebar: #e5f0f8;
  --brand-table-header-bg: #e5f0f8;
  --brand-linklist-header-bg: #e5f0f8;
  --brand-linklist-header-color: #000000;
  --brand-relinfo-bg: #e5f0f8;
  --brand-index-letters-bg: #e5f0f8;
  --brand-topic-toc-bg: #e5f0f8;
  --brand-topic-toc-color: #000;
  --brand-topic-toc-active-color: #006eb5;

  /* --- Note Colors --- */
  --brand-note-bg: rgba(0, 110, 181, 0.1);
  --brand-note-border: rgba(0, 110, 181, 1);
  --brand-note-caution-bg: rgba(255, 202, 45, 0.1);
  --brand-note-caution-border: #606060;
  --brand-note-warning-bg: rgba(255, 202, 45, 0.1);
  --brand-note-warning-border: #FFCA2D;
  --brand-note-restriction-bg: rgba(255, 226, 225, 0.32);
  --brand-note-restriction-border: #FF342D;

  /* --- Drift Table — gradient base colors (RGB for rgba() in calc) --- */
  --brand-drift-fail-rgb: 211, 47, 47;         /* red for out-of-spec */
  --brand-drift-sig-rgb: 0, 110, 181;          /* blue for in-spec significance */
  --brand-drift-fail-color: #d32f2f;
  --brand-drift-sig-color: #005a96;
}

@media screen {
  :root[data-wh-theme="dark"] {
    color-scheme: dark;

    /* --- Core --- */
    --wh-primary-bg: #212529;
    --wh-primary-color: #e3e3e3;
    --wh-secondary-bg: #1a1d20;
    --wh-secondary-color: #e3e3e3;
    --wh-strong-color: #e0e0e0;
    --wh-subtle-color: #3a3b3c;

    /* --- Header & Menu --- */
    --wh-header-bg: #1a1d20;
    --wh-top-menu-bg: #2b3035;
    --wh-close-toc-icon-border: var(--wh-primary-color);
    --wh-close-toc-button-shadow: rgba(255, 255, 255, .16);

    /* --- Links --- */
    --wh-link-color: #5ba3d9;
    --wh-related-links-color: #5ba3d9;

    /* --- Labels & Code --- */
    --wh-label-color: #bbb;
    --wh-pre-bg: #444;
    --wh-code-color: #ffa500;
    --wh-boolean-color: #66ff66;
    --wh-state-color: #ff6666;
    --wh-syntaxdiagram-color: #ff4d4d;
    --wh-markup-color: #d1b3ff;
    --wh-filepath-color: #ff6b88;

    /* --- Tiles --- */
    --wh-tile-bg: #1e2d3d;
    --wh-tile-link-color: #5ba3d9;
    --wh-main-page-shortdesc-color: #d5d5d5;
    --wh-main-page-toc-bg: #1e2d3d;

    /* --- Breadcrumb --- */
    --wh-breadcrumb-color: #5ba3d9;
    --wh-breadcrumb-bg: #1e2d3d;

    /* --- TOC --- */
    --wh-publication-toc-color: #b8bec4;
    --wh-publication-toc-bg: #1e2d3d;
    --wh-publication-toc-border-color: #343a40;
    --wh-publication-toc-active-color: #5ba3d9;

    /* --- Footer --- */
    --wh-footer-bg: #1e2d3d;
    --wh-footer-link-color: #5ba3d9;

    /* --- Borders & UI --- */
    --wh-outline-color: #555;
    --wh-toggle-border: #5ba3d9;

    /* --- Search --- */
    --wh-search-color: #006eb5;
    --wh-search-input-bg: #1e2d3d;
    --wh-search-bg: #1e2d3d;
    --wh-search-breadcrumb-color: #555;
    --wh-search-loader-base-bg: #3a3f44;
    --wh-search-loader-glow-bg: #4b525a;
    --wh-search-facets-bg: #2d333b;
    --wh-search-facets-disabled-color: var(--wh-label-color);
    --wh-search-facets-border: #444;
    --wh-search-results-facets-bg: #2c2f35;
    --wh-search-results-facets-color: #d8dee9;
    --wh-searchresult-color: #7c9cf0;
    --wh-searchresult-relativepath-color: #32d26a;
    --wh-search-pagination-active-bg: #5279d9;
    --wh-search-pagination-disabled-bg: #495057;
    --wh-search-pagination-disabled-color: rgba(248, 249, 250, .75);
    --wh-highlight-bg: #777700;
    --wh-scroll-bg: #444;

    /* --- Hazard notes --- */
    --wh-caution-bg: #7f6000;
    --wh-danger-bg: #62002b;
    --wh-warning-bg: #993500;
    --wh-hazardstatement-bg: #0025cb;

    /* --- Change Tracking --- */
    --wh-oxy-delete-color: #ff6b6b;
    --wh-oxy-insert-color: #66aaff;
    --wh-oxy-change-done-color: #ccc;
    --wh-oxy-range-color: #ff4d4d;
    --wh-oxy-comment-border: #995f00;
    --wh-oxy-change-bg: #666600;
    --wh-oxy-attributes-footnote-bg: #006666;
    --wh-oxy-comment-footnote-bg: #363600;
    --wh-oxy-delete-footnote-bg: #994d4d;
    --wh-oxy-insert-footnote-bg: #666699;

    /* --- Syntax Highlight --- */
    --wh-hl-json_key-color: #b5adda;
    --wh-hl-keyword-color: #ff89d8;
    --wh-hl-string-color: #b7a8ff;
    --wh-hl-comment-color: #00cf00;
    --wh-hl-directive-color: #d0a0ed;
    --wh-hl-tag-color: #aaaaff;
    --wh-hl-attribute-color: #ff9763;
    --wh-hl-value-color: #ff9661;
    --wh-hl-html-color: #a9a9ff;
    --wh-hl-xsl-color: #80b2ff;
    --wh-hl-annotation-color: #b0b0b0;
    --wh-hl-tag-doctype-comment-color: #a2b2e0;
    --wh-hl-tag-doctype-color: #a8a8ff;

    /* --- Brand Custom --- */
    --brand-accent-bg: #1e2d3d;
    --brand-title-color: #e0e0e0;
    --brand-label-color: #bbbbbb;
    --brand-footer-text: #e0e0e0;
    --brand-menu-text: #e0e0e0;
    --brand-menu-hover-bg: #3a3f44;
    --brand-menu-submenu-separator: #444;
    --brand-mobile-menu-bg: #495057;
    --brand-metadata-bg: #2b3035;
    --brand-metadata-border: #4a8cc7;
    --brand-metadata-value: #d5d5d5;
    --brand-front-page-subtitle: #aaa;
    --brand-step-bullet-bg: #e3e3e3;
    --brand-step-bullet-color: #212529;
    --brand-step-sidebar: #1e2d3d;
    --brand-table-header-bg: #1e2d3d;
    --brand-linklist-header-bg: #1e2d3d;
    --brand-linklist-header-color: #e3e3e3;
    --brand-relinfo-bg: #1e2d3d;
    --brand-index-letters-bg: #1e2d3d;
    --brand-topic-toc-bg: #1e2d3d;
    --brand-topic-toc-color: #b8bec4;
    --brand-topic-toc-active-color: #5ba3d9;

    /* --- Note Colors --- */
    --brand-note-bg: rgba(91, 163, 217, 0.15);
    --brand-note-border: rgba(91, 163, 217, 0.7);
    --brand-note-caution-bg: rgba(255, 202, 45, 0.15);
    --brand-note-caution-border: #888;
    --brand-note-warning-bg: rgba(255, 202, 45, 0.15);
    --brand-note-warning-border: #b8922a;
    --brand-note-restriction-bg: rgba(255, 100, 100, 0.15);
    --brand-note-restriction-border: #cc5555;

    --brand-drift-fail-rgb: 255, 107, 107;
    --brand-drift-sig-rgb: 91, 163, 217;
    --brand-drift-fail-color: #ff6b6b;
    --brand-drift-sig-color: #7cb8e0;
  }

  /* Bootstrap dropdown overrides — must target .dropdown-menu directly
     because Bootstrap defines --bs-dropdown-* on that element, not :root */
  :root[data-wh-theme="dark"] .dropdown-menu {
    --bs-dropdown-bg: #2b3035;
    --bs-dropdown-color: #e3e3e3;
    --bs-dropdown-link-color: #e3e3e3;
    --bs-dropdown-link-hover-bg: #3a3f44;
    --bs-dropdown-link-hover-color: #fff;
    --bs-dropdown-link-active-bg: #3a3f44;
    --bs-dropdown-link-active-color: #fff;
  }

  /* Dark mode search input */
  :root[data-wh-theme="dark"] .wh_search_textfield {
    background-color: var(--wh-primary-bg);
    color: var(--wh-primary-color);
  }
  :root[data-wh-theme="dark"] .wh_search_button {
    background-color: var(--wh-tile-bg);
    color: #fff;
  }

  /* Dark mode logo swap */
  :root[data-wh-theme="dark"] a.wh_logo {
    background-image: url('resources/logo-dark.svg');
    background-repeat: no-repeat;
    background-size: contain;
  }
  :root[data-wh-theme="dark"] .wh_logo img {
    visibility: hidden;
  }

  /* --- Dark mode: tile icons --- */
  :root[data-wh-theme="dark"] .wh_tile_image img {
    filter: brightness(0) invert(1);
  }

  /* --- Dark mode: image & diagram switching --- */
  .dark-only {
    display: none;
  }
  :root[data-wh-theme="dark"] .light-only {
    display: none;
  }
  :root[data-wh-theme="dark"] .dark-only {
    display: inline;
  }
}
