/* DELTA V89 — stable theme, readable light menu, no background jump */
:root{color-scheme:light;--delta-bg:#f4f8fc;--delta-surface:#fff;--delta-text:#102f49;--delta-muted:#5e7486;--delta-line:#d8e5ed}
html[data-theme="dark"]{color-scheme:dark;--delta-bg:#071421;--delta-surface:#0c1c2a;--delta-text:#eefaff;--delta-muted:#b8cedb;--delta-line:rgba(144,205,235,.18)}
html,body{background:var(--delta-bg)!important;color:var(--delta-text)!important}
body{transition:background-color .32s ease,color .32s ease!important}
body::before{content:"";position:fixed;inset:0;z-index:-20;background:var(--delta-bg);pointer-events:none}
/* One predictable switch: dark knob LEFT, light knob RIGHT. */
.theme-toggle .theme-track,.gateway-theme-toggle .theme-track{position:relative!important;display:block!important;width:72px!important;height:32px!important;padding:0!important;border-radius:999px!important;overflow:hidden!important;box-sizing:border-box!important;background:#173247!important;border:1px solid rgba(120,205,235,.22)!important;transition:background-color .32s ease,border-color .32s ease,box-shadow .32s ease!important}
.theme-toggle .theme-knob,.gateway-theme-toggle .theme-knob{position:absolute!important;top:3px!important;left:3px!important;width:24px!important;height:24px!important;margin:0!important;transform:none!important;border-radius:50%!important;z-index:3!important;transition:left .38s cubic-bezier(.22,.8,.24,1),background .25s ease,box-shadow .25s ease!important;background:#75d7ff!important;box-shadow:0 3px 14px rgba(61,190,235,.32)!important}
html[data-theme="dark"] .theme-toggle .theme-track,html[data-theme="dark"] .gateway-theme-toggle .theme-track{background:#102b3e!important}
html[data-theme="dark"] .theme-toggle .theme-knob,html[data-theme="dark"] .gateway-theme-toggle .theme-knob{left:3px!important;background:#71d6ff!important}
html[data-theme="light"] .theme-toggle .theme-track,html[data-theme="light"] .gateway-theme-toggle .theme-track{background:#e7eef3!important;border-color:#c8d8e2!important}
html[data-theme="light"] .theme-toggle .theme-knob,html[data-theme="light"] .gateway-theme-toggle .theme-knob{left:45px!important;background:#ffc95d!important;box-shadow:0 3px 14px rgba(221,157,35,.25)!important}
.theme-toggle .theme-track::before,.gateway-theme-toggle .theme-track::before{content:"☾"!important;position:absolute!important;left:9px!important;top:5px!important;font-size:13px!important;line-height:20px!important;opacity:.95!important;z-index:2!important;pointer-events:none!important}
.theme-toggle .theme-track::after,.gateway-theme-toggle .theme-track::after{content:"☀"!important;position:absolute!important;right:9px!important;top:5px!important;font-size:13px!important;line-height:20px!important;opacity:.75!important;z-index:2!important;pointer-events:none!important}
html[data-theme="light"] .theme-toggle .theme-track::before,html[data-theme="light"] .gateway-theme-toggle .theme-track::before{opacity:.35!important}
html[data-theme="dark"] .theme-toggle .theme-track::after,html[data-theme="dark"] .gateway-theme-toggle .theme-track::after{opacity:.35!important}
/* Light header/menu must always have readable contrast. */
html[data-theme="light"] .header.page,html[data-theme="light"] .header.scrolled{background:rgba(255,255,255,.97)!important;border-bottom:1px solid #d5e3eb!important;box-shadow:0 10px 32px rgba(25,65,90,.09)!important}
html[data-theme="light"] .header.page .links a,html[data-theme="light"] .header.page .lang-current,html[data-theme="light"] .header.page .menu{color:#163b55!important;text-shadow:none!important}
html[data-theme="light"] .header.page .menu{background:#fff!important;border-color:#cbdce6!important}
html[data-theme="light"] .header.page .lang-menu{background:#fff!important;border-color:#cbdce6!important;box-shadow:0 20px 50px rgba(25,65,90,.14)!important}
html[data-theme="light"] .header.page .lang-menu a{color:#163b55!important}
html[data-theme="light"] .header.page .lang-menu a:hover{background:#edf5fa!important;color:#0b5d84!important}
html[data-theme="dark"] .header.page .links a,html[data-theme="dark"] .header.page .lang-current,html[data-theme="dark"] .header.page .menu{color:#eefaff!important}
html[data-theme="dark"] .header.page .menu{background:#0c1c2a!important;border-color:rgba(144,205,235,.2)!important}
/* Mobile menu: never inherit the dark-only panel from older layers. */
@media(max-width:1020px){
  .header.page .links{position:fixed!important;inset:72px 10px auto 10px!important;max-height:calc(100vh - 84px)!important;overflow:auto!important;padding:10px!important;border-radius:20px!important;display:none!important;flex-direction:column!important;z-index:9999!important}
  body.mobile-open .header.page .links{display:flex!important}
  html[data-theme="light"] body.mobile-open .header.page .links{background:#fff!important;border:1px solid #d3e2ea!important;box-shadow:0 24px 70px rgba(20,60,85,.16)!important}
  html[data-theme="dark"] body.mobile-open .header.page .links{background:#0a1a28!important;border:1px solid rgba(144,205,235,.18)!important;box-shadow:0 24px 70px rgba(0,0,0,.38)!important}
  .header.page .links a{width:100%!important;min-height:46px!important;display:flex!important;align-items:center!important;padding:11px 14px!important;border-radius:12px!important;box-sizing:border-box!important}
  html[data-theme="light"] .header.page .links a{color:#163b55!important;background:transparent!important}
  html[data-theme="light"] .header.page .links a:hover{background:#edf5fa!important}
  html[data-theme="dark"] .header.page .links a{color:#eefaff!important}
}
/* Keep major sections stable when theme changes; do not animate layout/position. */
.section,.header,.footer,.card,.service,.product-card,.project,.domain-feature,.stat,.cta,.intro-video-card{transition:background-color .32s ease,color .32s ease,border-color .32s ease,box-shadow .32s ease!important}
@media(max-width:560px){
  .theme-toggle .theme-track{width:60px!important;height:30px!important}.theme-toggle .theme-knob{width:22px!important;height:22px!important;top:3px!important}.theme-toggle .theme-knob{left:3px!important}html[data-theme="light"] .theme-toggle .theme-knob{left:35px!important}
  .header.page .lang-current{min-width:42px!important;width:42px!important;height:40px!important;padding:0 7px!important;font-size:0!important}.header.page .lang-current::after{content:'文'!important;font-size:16px!important}
}
