/* =========================================================
   主题系统：白天 / 黑夜（颜色属性可插值，切换时渐变过渡）
   被 / 与 /scrap/ 共用。依赖 theme.js 设置 :root[data-theme]。
   ========================================================= */

/* 把配色变量注册成可动画的 <color>，才能平滑过渡 */
@property --bg { syntax: '<color>'; inherits: true; initial-value: #0f1216; }
@property --bg-glow { syntax: '<color>'; inherits: true; initial-value: #18222e; }
@property --panel { syntax: '<color>'; inherits: true; initial-value: #161b22; }
@property --panel2 { syntax: '<color>'; inherits: true; initial-value: #1c232c; }
@property --panel-2 { syntax: '<color>'; inherits: true; initial-value: #1f2732; }
@property --surface { syntax: '<color>'; inherits: true; initial-value: #141920; }
@property --line { syntax: '<color>'; inherits: true; initial-value: #2a333f; }
@property --line-strong { syntax: '<color>'; inherits: true; initial-value: #3a4654; }
@property --text { syntax: '<color>'; inherits: true; initial-value: #e6edf3; }
@property --muted { syntax: '<color>'; inherits: true; initial-value: #a4b0bd; }
@property --dim { syntax: '<color>'; inherits: true; initial-value: #8b98a5; }
@property --accent { syntax: '<color>'; inherits: true; initial-value: #2f81f7; }
@property --accent-soft { syntax: '<color>'; inherits: true; initial-value: rgba(47,129,247,.13); }
@property --accent-text { syntax: '<color>'; inherits: true; initial-value: #8fc2ff; }
@property --action { syntax: '<color>'; inherits: true; initial-value: #1f6feb; }
@property --ok { syntax: '<color>'; inherits: true; initial-value: #3fb950; }
@property --ok-soft { syntax: '<color>'; inherits: true; initial-value: rgba(63,185,80,.12); }
@property --warn { syntax: '<color>'; inherits: true; initial-value: #d29922; }
@property --warn-soft { syntax: '<color>'; inherits: true; initial-value: rgba(210,153,34,.12); }
@property --danger { syntax: '<color>'; inherits: true; initial-value: #ff7b72; }
@property --danger-soft { syntax: '<color>'; inherits: true; initial-value: rgba(255,123,114,.12); }
@property --table-head { syntax: '<color>'; inherits: true; initial-value: #1b222b; }
@property --table-hover { syntax: '<color>'; inherits: true; initial-value: #1b222b; }
@property --row-line { syntax: '<color>'; inherits: true; initial-value: #252e38; }
@property --notice-bg { syntax: '<color>'; inherits: true; initial-value: #1a2028; }
@property --badge-bg { syntax: '<color>'; inherits: true; initial-value: #252e38; }
@property --skeleton-bg { syntax: '<color>'; inherits: true; initial-value: #27313c; }
@property --field-focus-bg { syntax: '<color>'; inherits: true; initial-value: #181f28; }
@property --scroll-thumb { syntax: '<color>'; inherits: true; initial-value: #3b4654; }
@property --focus-ring { syntax: '<color>'; inherits: true; initial-value: rgba(47,129,247,.15); }

/* 1.3s：慢慢变亮 / 慢慢变黑 */
html {
  transition:
    --bg 1.3s ease,
    --bg-glow 1.3s ease,
    --panel 1.3s ease,
    --panel2 1.3s ease,
    --panel-2 1.3s ease,
    --surface 1.3s ease,
    --line 1.3s ease,
    --line-strong 1.3s ease,
    --text 1.3s ease,
    --muted 1.3s ease,
    --dim 1.3s ease,
    --accent 1.3s ease,
    --accent-soft 1.3s ease,
    --accent-text 1.3s ease,
    --action 1.3s ease,
    --ok 1.3s ease,
    --ok-soft 1.3s ease,
    --warn 1.3s ease,
    --warn-soft 1.3s ease,
    --danger 1.3s ease,
    --danger-soft 1.3s ease,
    --table-head 1.3s ease,
    --table-hover 1.3s ease,
    --row-line 1.3s ease,
    --notice-bg 1.3s ease,
    --badge-bg 1.3s ease,
    --skeleton-bg 1.3s ease,
    --field-focus-bg 1.3s ease,
    --scroll-thumb 1.3s ease,
    --focus-ring 1.3s ease;
}

/* 背景光斑也跟着颜色渐变，而不是瞬切 */
body,
.ambient__blob,
.ambient {
  transition: background 1.3s ease, background-color 1.3s ease, opacity 1.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  html,
  body,
  .ambient,
  .ambient__blob { transition: none !important; }
}

/* ---------------- 主题切换按钮 ---------------- */
.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}
.theme-btn:hover { border-color: var(--accent); }
.theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-btn svg { width: 14px; height: 14px; flex: none; }
.theme-btn .theme-btn-text { font-size: 12.5px; }
.theme-btn[data-mode="auto"] .theme-btn-text { color: var(--dim); }

.theme-slot { display: flex; align-items: center; }
.sitebar .theme-slot { margin-left: auto; }

/* 报废页里几个浅色下对比度不够的小徽章 */
:root[data-theme="light"] .summary-foot .data-session { background: rgba(26, 127, 55, .1); color: #1a7f37; }
:root[data-theme="light"] .summary-foot .data-session.warn { background: rgba(154, 103, 0, .12); color: #8a5a00; }
