/* ============================================================
   Darra Lock Light (darra-locklight.css)
   2026-08-05 · git.darra.xyz · GitLab CE 19.2
   锁定纯浅色主题 — 禁止任何深色显示 (含系统深色跟随 / 手动切换)

   深色三入口机制 (GitLab 19.2, 2026-08-05 实勘):
   1. 服务器渲染 <html class="gl-dark"> (users.color_mode_id=2)
      → 本文件 html.gl-dark 兜底把全部 design token 强制回浅色值
   2. application_dark-*.css 以 media="(prefers-color-scheme: dark)"
      条件加载 + 内联 JS (layouts/_application_color_mode_js.html.haml)
      监听 matchMedia 动态加/删 gl-dark 类
      → html { color-scheme: light !important } + darra-locklight.js
        主控移除 gl-dark 类 (dark CSS 的 :root.gl-dark 变量规则随之失效)
   3. 偏好设置"模式"区 (#js-color-mode-selector, Vue 组件) 手动切换
      → 整区隐藏

   配套文件: darra-locklight.js (移除 gl-dark / 注入本 CSS / 隐藏主题入口)
   部署: /srv/gitlab/data/nginx/html/ + gitlab.rb nginx custom config 追加
   ============================================================ */

/* ① 强制 color-scheme = light: 滚动条 / 表单 / 原生控件全走浅色渲染 */
html {
  color-scheme: light !important;
}

/* ①b 语法高亮 hljs token 变量 (dark highlight css 在 :root 定义深色值,
   若 JS 失效该 css 已加载, 此层强制回浅色 GitHub 系配色) */
:root {
  --color-hljs-comment: #998 !important;
  --color-hljs-meta: #999 !important;
  --color-hljs-keyword: #3a383f !important;
  --color-hljs-type: #458 !important;
  --color-hljs-attr: #0086b3 !important;
  --color-hljs-builtin: #3a383f !important;
  --color-hljs-title: #3a383f !important;
  --color-hljs-class: #458 !important;
  --color-hljs-function: #0086b3 !important;
  --color-hljs-tag: #0086b3 !important;
  --color-hljs-number: #099 !important;
  --color-hljs-subst: #18171d !important;
  --color-hljs-string: #d14 !important;
  --color-hljs-symbol: #d14 !important;
  --color-hljs-variable: teal !important;
  --color-hljs-operator: #0086b3 !important;
  --color-hljs-punctuation: #18171d !important;
  --color-hljs-regexp: #d14 !important;
  --color-hljs-constant: #0086b3 !important;
  --color-hljs-literal: #b294bb !important;
  --color-hljs-language: #0086b3 !important;
  --color-hljs-params: #0086b3 !important;
  --color-hljs-selector-doctag: #998 !important;
  --color-hljs-selector-tag: #0086b3 !important;
  --color-hljs-selector-class: #458 !important;
  --color-hljs-selector-id: #458 !important;
  --color-hljs-selector-attr: #0086b3 !important;
  --color-hljs-selector-pseudo: #0086b3 !important;
  --diff-addition-color: #ecfdf0 !important;
  --diff-deletion-color: #fbe9eb !important;
  --default-diff-color-deletion: #d1242f !important;
  --default-diff-color-addition: #108548 !important;
}

/* ①c 代码块 (.code.dark / .code-syntax-highlight-theme 变量回浅色;
   dark highlight css 的 .code.dark 块会设深色代码背景) */
.code.dark,
.code-syntax-highlight-theme {
  --code-background: #ffffff !important;
  --code-empty-background: #fbfafd !important;
  --code-border-color: #dcdcde !important;
  --code-changed-border-color: rgba(0, 0, 0, 0.1) !important;
  --code-line-number-background-color: #fbfafd !important;
  --code-line-number-color: #89888d !important;
  --code-line-number-hover-background-color: #e9f3fc !important;
  --code-line-number-hover-border-color: #63a6e9 !important;
  --code-line-number-hover-color: #18171d !important;
  --code-meta-diff-background-color: #fbfafd !important;
  --code-meta-diff-color: #626168 !important;
  --code-diff-hunk-header-background-color: #fbfafd !important;
  --code-diff-hunk-header-color: #626168 !important;
  --code-diff-expand-button-background-color: #ececef !important;
  --code-diff-expand-button-color: #3a383f !important;
  --code-diff-expand-button-hover-background-color: #dcdcde !important;
  --code-diff-expand-button-hover-color: #18171d !important;
  --code-highlighted-line-background-color: #e9f3fc !important;
  --code-highlighted-line-border-color: #63a6e9 !important;
  --code-old-diff-background-color: #fbe9eb !important;
  --code-old-diff-line-number-background-color: #f9d7dc !important;
  --code-old-diff-line-number-color: #806565 !important;
  --code-old-diff-sign-color: #806565 !important;
  --code-old-diff-color: #806565 !important;
  --code-old-inline-diff-background-color: #fac5cd !important;
  --code-new-diff-background-color: #ecfdf0 !important;
  --code-new-diff-line-number-background-color: #ddfbe6 !important;
  --code-new-diff-line-number-color: #627165 !important;
  --code-new-diff-sign-color: #627165 !important;
  --code-new-diff-color: #627165 !important;
  --code-new-inline-diff-background-color: #c7f0d2 !important;
  --diff-expansion-background-color: #dcdcde !important;
}
.code.dark,
.code-syntax-highlight-theme .hljs,
.code-syntax-highlight-theme code.hljs {
  color: #3a383f !important;
}
/* 代码块底色硬兜底 */
.code.dark pre,
.code.dark .blob-content,
.code-syntax-highlight-theme .blob-content,
.code-syntax-highlight-theme pre {
  background-color: #ffffff !important;
  color: #3a383f !important;
}

/* ② 兜底: 若 html.gl-dark 仍存在 (JS 失效/极端情况),
   把 GitLab 全部核心 design token 强制回浅色值。
   浅色基准 = 亮色档 neutral 0-950 (实测自 application-*.css :root) */
html.gl-dark {
  /* 中性色板回浅色 */
  --gl-color-neutral-0: #ffffff !important;
  --gl-color-neutral-10: #fbfafd !important;
  --gl-color-neutral-50: #ececef !important;
  --gl-color-neutral-100: #dcdcde !important;
  --gl-color-neutral-200: #bfbfc3 !important;
  --gl-color-neutral-300: #a4a3a8 !important;
  --gl-color-neutral-400: #89888d !important;
  --gl-color-neutral-500: #737278 !important;
  --gl-color-neutral-600: #626168 !important;
  --gl-color-neutral-700: #4c4b51 !important;
  --gl-color-neutral-800: #3a383f !important;
  --gl-color-neutral-900: #28272d !important;
  --gl-color-neutral-950: #18171d !important;
  /* 文字 / 背景 */
  --gl-text-color-default: var(--gl-color-neutral-800) !important;
  --gl-text-color-subtle: var(--gl-color-neutral-600) !important;
  --gl-text-color-strong: var(--gl-color-neutral-950) !important;
  --gl-text-color-heading: var(--gl-color-neutral-950) !important;
  --gl-background-color-default: var(--gl-color-neutral-0) !important;
  --gl-background-color-subtle: var(--gl-color-neutral-10) !important;
  --gl-background-color-strong: var(--gl-color-neutral-50) !important;
  --gl-background-color-section: var(--gl-color-neutral-0) !important;
  --gl-background-color-overlap: var(--gl-color-neutral-0) !important;
  --body-background-color: var(--gl-background-color-subtle) !important;
  /* 遗留 Bootstrap 变量 (dark.css :root.gl-dark 重定义的 --white/--black/--gray-*) */
  --white: #ffffff !important;
  --black: #18171d !important;
  --gray-10: #fbfafd !important;
}
/* 页面画布背景硬回浅色 */
html.gl-dark body {
  background-color: #fbfafd !important;
}

/* ③ 隐藏主题切换入口 (偏好设置"模式"区 = 亮色/深色/自动 选择器,
   含该区标题与说明, 彻底禁手动切换) */
#appearance,
#js-color-mode-selector {
  display: none !important;
}
