/* 与流光使用同一时长和 ease-in-out；只过渡配色，不改变布局和悬停位移。 */
html[data-theme-ready="true"] :is(body, .site-header, .mobile-nav, .mobile-nav a,
  .theme-switch, .theme-switch button, .signal-top, .signal-bottom,
  .field-axis, .signal-intro p, .signal-cta, .title-dot,
  .applications,
  .section-head > p, .application-label,
  .about-copy > p, .contact, .contact .button, .page-footer, .image-fallback),
html[data-theme-ready="true"] .image-fallback::after {
  transition: color var(--theme-duration, 650ms) ease-in-out,
    background-color var(--theme-duration, 650ms) ease-in-out,
    border-color var(--theme-duration, 650ms) ease-in-out;
}
html[data-theme-ready="true"] :is(.hero, .application, .about-practices) {
  transition: border-color var(--theme-duration, 650ms) ease-in-out;
}
.signal-cta { color: var(--ink); }
html[data-theme-ready="true"] .about-photo { transition: filter var(--theme-duration, 650ms) ease-in-out; }
.brand-logo { position: relative; display: block; flex: none; width: 146px; }
.brand-logo img { width: 100%; }
.brand-logo-night { position: absolute; inset: 0; opacity: 0; }
.brand-logo-day { opacity: 1; }
html[data-theme="night"] .brand-logo-night { opacity: 1; }
html[data-theme-ready="true"] :is(.brand-logo img, .signal-fallback) {
  transition: opacity var(--theme-duration, 650ms) ease-in-out;
}
html[data-theme-ready="true"] :is(.signal-title-left, .signal-title-right)::before {
  transition: opacity var(--theme-duration, 650ms) ease-in-out;
}
html[data-theme="night"] :is(.signal-title-left, .signal-title-right)::before { opacity: .6; }
.header-actions { display: flex; align-items: center; gap: 24px; flex: none; }
.theme-switch {
  position: relative; isolation: isolate;
  display: inline-grid; grid-template-columns: repeat(2, 1fr); align-items: center; flex: none;
  border-radius: 24px; background: #e7ebef;
}
/* 底片内缩但不撑大控件，保留手机导航依赖的 88px 总宽。 */
.theme-switch::before {
  content: "";
  position: absolute; z-index: 0; inset: 3px auto 3px 3px;
  width: calc(50% - 6px); border-radius: 24px;
  background: #cfdbea; pointer-events: none;
  transform: translateX(0);
}
html[data-theme-ready="true"] .theme-switch::before {
  transition: transform var(--theme-slide-duration, 300ms) cubic-bezier(.16, 1, .3, 1),
    background-color var(--theme-duration, 650ms) ease-in-out;
}
.motion-paused .theme-switch { --theme-slide-duration: 0ms; }
.theme-switch button {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 44px; min-height: 44px; padding: 8px 10px;
  border-radius: 24px; background: transparent; color: #5b6470;
}
.theme-switch button:hover { color: #172029; }
.theme-switch button[aria-pressed="true"] { color: #172029; }
.theme-switch svg { width: 16px; height: 16px; flex: none; }
/* 两张静态图叠放淡入淡出，显卡回退时也保持相同的切换节奏。 */
.signal-stage .signal-fallback { display: block; }
.signal-fallback-day { opacity: 1; }
.signal-fallback-night { opacity: 0; }
html[data-theme="night"] .signal-fallback-night { opacity: 1; }
.signal-stage[data-ready=true] .signal-fallback { display: none; }

html[data-theme="night"] { color-scheme: dark; color: #f5f4ef; }
html[data-theme="night"] body {
  --paper: #10151d; --ink: #f5f4ef; --muted: #b7c0cc;
  --line: #34404d; --blue: #a0baff; color-scheme: dark;
}
html[data-theme="night"] .site-header {
  --paper: #141b24; --ink: #f5f4ef; --line: #34404d;
  color-scheme: dark;
}
/* Logo 使用原始透明矢量，让夜间导航的深色背景透出。 */
html[data-theme="night"] .brand img { background: transparent; }
html[data-theme="night"] .theme-switch { background: #1c2734; }
html[data-theme="night"] .theme-switch::before {
  background: #33465e;
  /* 补回底片内缩的 6px，准确移动到另一半的中心。 */
  transform: translateX(calc(100% + 6px));
}
html[data-theme="night"] .theme-switch button { color: #b7c0cc; }
html[data-theme="night"] .theme-switch button:hover { color: #f5f4ef; }
html[data-theme="night"] .theme-switch button[aria-pressed="true"] { color: #fff; }
html[data-theme="night"] .signal-top,
html[data-theme="night"] .signal-bottom { color: #b7c0cc; }
html[data-theme="night"] .field-axis { color: #9cabbe; }
html[data-theme="night"] .signal-cta { border-color: #758499; }
html[data-theme="night"] .signal-cta:hover { color: #d0dfff; }
html[data-theme="night"] .applications {
  background: #151e2b; --ink: #f5f4ef; --muted: #b7c0cc; --line: #3b485a;
}
html[data-theme="night"] .about-photo { filter: brightness(.9); }
html[data-theme="night"] .contact { background: #1a222c; }
html[data-theme="night"] .contact .button { background: #a0baff; color: #101a2a; }
html[data-theme="night"] .contact .button:hover { background: #c5d5ff; }
html[data-theme="night"] .image-fallback { background: #243348; }
html[data-theme="night"] .image-fallback::after { color: #d8e3f4; }

@media (max-width: 1080px) {
  /* 宽度不够并排时，公司名作为 Logo 下方的小字，避免顶栏折成两截。 */
  .brand { flex-direction: column; align-items: flex-start; gap: 2px; }

  .theme-choice-label { display: none; }
  .theme-switch button { padding: 8px; }
  .header-actions { gap: 16px; }
}
@media (max-width: 760px) {
  .brand-logo { width: 128px; }
  .brand-logo img { width: 100%; }
}
@media (max-width: 460px) {
  /* 窄屏仍显示完整公司名，并保留全部触控目标。 */
  .header-inner { gap: 8px; }
  .header-actions { gap: 12px; }
}
@media (max-width: 360px) {
  .header-inner { padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-switch { --theme-slide-duration: 0ms; }
}
