/* First AI Agent public two-theme rollout, 2026-10-14.
   Only Dark Glass / Light Glass. Pure CSS, original site.css unchanged.
   Tokens adapted from accepted X5 FAI Spatial UI implementation.
 */
html[data-theme] {
  --bg:#080f20;--surface:#101c32;--surface-2:#172744;--line:#344a65;
  --soft-line:#263850;--ink:#eff6ff;--muted:#bdcce2;--subtle:#99b2c9;
  --cyan:#74b9ff;--blue:#74b9ff;--gold:#f8c26b;--focus:#91e6fa;
  --spatial-glow:rgba(37,112,214,.25);--spatial-shade:rgba(0,5,23,.34);
  --spatial-blur:18px;--spatial-rgb:116,185,255;--radius:20px;color-scheme:dark;
}
html[data-theme="dark-glass"] {
  --bg:#06131c;--surface:#102d3b;--surface-2:#194057;--line:#417383;
  --soft-line:#274e5d;--ink:#e7ffff;--muted:#b7d9e4;--subtle:#98bdce;
  --cyan:#5bdfe5;--blue:#5bdfe5;--gold:#f6c57f;--focus:#90ffea;
  --spatial-glow:rgba(35,201,207,.2);--spatial-shade:rgba(0,16,25,.39);
  --spatial-blur:25px;--spatial-rgb:91,223,229;--radius:20px;color-scheme:dark;
}
html[data-theme="light-glass"] {
  --bg:#e7f2ef;--surface:#f8fffc;--surface-2:#e6f6f3;--line:#b6cfcf;
  --soft-line:#cfe0dd;--ink:#14323b;--muted:#486770;--subtle:#556e74;
  --cyan:#007e88;--blue:#007e88;--gold:#965e0a;--focus:#006f83;
  --spatial-glow:rgba(32,193,161,.17);--spatial-shade:rgba(45,113,117,.13);
  --spatial-blur:22px;--spatial-rgb:0,126,136;--radius:20px;color-scheme:light;
}
html[data-theme="dark-glass"]{
 --cyan:#57dabc;--spatial-rgb:87,218,188;--focus:#86f0d8;
}
html[data-theme="light-glass"]{
 --cyan:#0b7463;--spatial-rgb:11,116,99;--focus:#086451;
}
/* Token adapter maps site values into the shared FAI MultiTheme semantic palette. */
html[data-theme] {
 --panel:var(--surface);--panel2:var(--surface-2);--text:var(--ink);
 --accent:var(--cyan);--accent2:var(--blue);--shadow:0 18px 44px var(--spatial-shade);
 --fai-field:var(--surface-2);--fai-panel:var(--surface);--fai-rgb:var(--spatial-rgb);
}
html[data-theme] body{
 background:radial-gradient(ellipse at 75% 0,var(--spatial-glow),transparent 44%),var(--bg);
 color:var(--text);color-scheme:inherit;min-width:0;
}
html[data-theme] header{background:var(--surface);border-color:var(--line);backdrop-filter:blur(var(--spatial-blur))}
html[data-theme] nav{color:var(--muted)}
html[data-theme] nav a:hover, html[data-theme] .brand, html[data-theme] h1,html[data-theme] h2,html[data-theme] h3 {color:var(--text)}
html[data-theme] .hero,html[data-theme] .page-hero{color:var(--text)}
html[data-theme] .eyebrow,.zhkh-presentation-meta{background:var(--surface-2);color:var(--accent);border:1px solid var(--line)}
html[data-theme] .btn{background:var(--accent);color:var(--bg);border-color:var(--accent)}
html[data-theme] .btn.secondary{background:var(--surface-2);color:var(--text);border:1px solid var(--line)}
html[data-theme] .btn:hover{filter:brightness(1.12)}
html[data-theme] .mock,html[data-theme] .card,html[data-theme] .step,
html[data-theme] .upload-panel,html[data-theme] .quiz-question,
html[data-theme] .research-panel,html[data-theme] .research-detail,html[data-theme] .branch-card,
html[data-theme] .app-card,html[data-theme] .audiobook-panel,html[data-theme] .tts-card,
html[data-theme] .zhkh-flow,html[data-theme] .zhkh-flow-step,
html[data-theme] .zhkh-kb-card,html[data-theme] .zhkh-knowledge-tools,
html[data-theme] .zhkh-faq details,html[data-theme] .zhkh-presentation-card,
html[data-theme] .zhkh-presentation-slide,html[data-theme] .audiobook-status-card,
html[data-theme] .audiobook-chapter,html[data-theme] .tts-preview,html[data-theme] .tts-advanced,
html[data-theme] .video-shell,html[data-theme] .cta,html[data-theme] .zhkh-empty-case{
 color:var(--text);background:var(--panel);border-color:var(--line);box-shadow:var(--shadow);
}
html[data-theme] .mock-row{border-color:var(--line)}
html[data-theme] .ok,html[data-theme] .step:before,html[data-theme] .zhkh-flow-step b{
 color:var(--accent);background:var(--panel2)
}
html[data-theme] .drop-zone,html[data-theme] .app-drop-zone,html[data-theme] .document-preview,
html[data-theme] .job-status,html[data-theme] .tts-result{
 color:var(--text);background:var(--panel2);border-color:var(--line)
}
html[data-theme] .breadcrumb,html[data-theme] footer{color:var(--muted);border-color:var(--line)}
html[data-theme] .zhkh-article ul,html[data-theme] .zhkh-related a,
html[data-theme] .zhkh-filter-btn,html[data-theme] .zhkh-tag,
html[data-theme] .zhkh-presentation-cover-subtitle{
 color:var(--text)
}
html[data-theme] .zhkh-related a,html[data-theme] .zhkh-filter-btn,
html[data-theme] .zhkh-tag{background:var(--panel2);border-color:var(--line)}
html[data-theme] .zhkh-filter-btn[aria-pressed=true]{
 color:var(--accent);border-color:var(--accent);background:var(--panel2)
}
html[data-theme] .field-label select,html[data-theme] .tts-field :is(textarea,select),
html[data-theme] .audiobook-form :is(textarea,select),
html[data-theme] .research-search :is(input,select),
html[data-theme] .research-notes textarea,html[data-theme] .research-verdict select,
html[data-theme] .zhkh-search-input,html[data-theme] .tts-speed-presets button,
html[data-theme] input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
html[data-theme] textarea,html[data-theme] select{
 background:var(--fai-field);color:var(--text);border-color:var(--line)
}
html[data-theme] select option{background:var(--panel);color:var(--text)}
html[data-theme] .tts-preview pre,html[data-theme] .tts-detected-profile,
html[data-theme] .tts-speed-presets button:hover,html[data-theme] .research-link,
html[data-theme] .state-pill{color:var(--text);background:var(--panel2);border-color:var(--line)}
html[data-theme] :is(a,button,input,select,textarea,summary):focus-visible{
 outline:3px solid var(--focus);outline-offset:3px
}
html[data-theme] [hidden]{display:none!important}
/* Spatial graphics deliberately limited to cards/hero: no 3D control surfaces or tabular data. */
html[data-render-mode=spatial] .hero-grid .mock,html[data-render-mode=spatial] .zhkh-hero-grid .zhkh-flow{
 transform:perspective(1300px) rotateY(-4deg) rotateX(1deg);
 box-shadow:0 26px 64px var(--spatial-shade),0 0 50px var(--spatial-glow);
}
html[data-render-mode=spatial] .cards .card,html[data-render-mode=spatial] .zhkh-kb-card{
 transition:transform .18s ease,box-shadow .18s ease;border-top-color:var(--accent);
}
html[data-render-mode=spatial] .cards .card:hover,html[data-render-mode=spatial] .zhkh-kb-card:hover{
 transform:translateY(-3px);box-shadow:0 20px 48px var(--spatial-shade)
}
/* Independent QA 2026-10-12: explicit dark-only legacy labels and hover states
 * were unreadable on the new light surfaces. Preserve old CSS, override only
 * the visual colours of affected legacy controls in this TEST candidate. */
html[data-theme] .nav-tree-item:hover > .nav-tree-root,
html[data-theme] .nav-tree-item:hover > .nav-tree-root-row,
html[data-theme] .nav-tree-root:hover,
html[data-theme] .nav-tree-item:focus-within > .nav-tree-root,
html[data-theme] .nav-tree-root-row:hover .nav-tree-root,
html[data-theme] .nav-tree-root-row:hover .nav-tree-caret,
html[data-theme] .nav-tree-item.is-open .nav-tree-root,
html[data-theme] .nav-tree-submenu a:hover,
html[data-theme] .nav-tree-submenu a:focus-visible,
html[data-theme] .nav-tree-submenu a[aria-current="page"],
html[data-theme] .legal-footer-links a:hover {
 color:var(--text);
 background:var(--surface-2);
}
html[data-theme] .nav-tree-submenu,
html[data-theme] .nav-tree-submenu a {
 background:var(--surface);
 color:var(--text);
 border-color:var(--line);
}
html[data-theme] .nav-tree-submenu a:hover,
html[data-theme] .nav-tree-submenu a[aria-current="page"] {
 background:var(--surface-2);
}
html[data-theme] .zhkh-presentation-columns li,
html[data-theme] .zhkh-presentation-tags span,
html[data-theme] .toggle-row,
html[data-theme] .legal-footer-links a,
html[data-theme] .quiz-question label {
 color:var(--text);
}
html[data-theme] .zhkh-presentation-tags span,
html[data-theme] .quality-feedback-details,
html[data-theme] .quality-feedback-details select {
 background:var(--surface-2);
 border-color:var(--line);
}
html[data-theme] .consultation-form :is(input,select,textarea),
html[data-theme] .quality-feedback-details select,
html[data-theme] .research-search :is(input,select),
html[data-theme] .research-notes textarea,
html[data-theme] .research-verdict select {
 background:var(--fai-field);
 color:var(--text);
 border-color:var(--line);
}
html[data-theme] .tts-status.ready,
html[data-theme] .audiobook-health.ready,
html[data-theme] .job-status.success,
html[data-theme] .state-pill {
 color:var(--text);
}
html[data-theme] .tts-status.error,
html[data-theme] .audiobook-error,
html[data-theme] .job-status.error,
html[data-theme] .research-warning {
 color:var(--text);
}
html[data-theme] .legal-footer-links a:hover,
html[data-theme] .nav-tree-submenu a:focus-visible {
 text-decoration:underline;
 outline-color:var(--focus);
}
/* Only TWO controls: Night / Light. Do not expose theme/palette/3D settings. */
.fai-dual-theme-bar{
 display:flex;justify-content:flex-end;align-items:center;gap:10px;
 padding:9px max(14px,calc((100% - 1180px)/2));
 background:var(--surface);color:var(--ink);border-bottom:1px solid var(--line);
 min-height:49px;box-sizing:border-box;
}
.fai-dual-theme-label{font:700 12px/1.4 system-ui,"Segoe UI",sans-serif;color:var(--muted)}
.fai-dual-theme-switch{
 display:inline-flex;gap:3px;padding:3px;border:1px solid var(--line);
 border-radius:13px;background:var(--surface-2);max-width:100%;
}
.fai-dual-theme-switch button{
 appearance:none;min-height:39px;min-width:96px;display:inline-flex;
 align-items:center;justify-content:center;gap:7px;
 padding:7px 12px;border:1px solid transparent;border-radius:9px;
 background:transparent;color:var(--ink);font:700 13px/1.2 system-ui,"Segoe UI",sans-serif;
 white-space:nowrap;cursor:pointer;
}
.fai-dual-theme-switch button[aria-pressed="true"]{
 background:var(--cyan);color:var(--bg);border-color:var(--cyan);
}
.fai-dual-theme-switch button:focus-visible{
 outline:3px solid var(--focus);outline-offset:2px;
}
.fai-dual-theme-switch button:hover:not([aria-pressed="true"]){
 background:var(--surface);border-color:var(--line)
}
/* Critical screenshot 3 fix: the site's original price amounts were nearly white
   (#f4f8ff) and disappeared on Light Glass cards. */
html[data-theme="light-glass"] .pricing-inline-item span,
html[data-theme="light-glass"] .pricing-value{
 color:#14323b;
 text-shadow:none;
}
html[data-theme="dark-glass"] .pricing-inline-item span,
html[data-theme="dark-glass"] .pricing-value{color:#effdff}
html[data-theme="light-glass"] .pricing-card,
html[data-theme="light-glass"] .pricing-inline-item{
 background:var(--surface);border-color:var(--line);
}
/* The dark display and light display retain comfortable, legible controls
   without exposing other selectable visual modes. */
@media(max-width:760px){
 .fai-dual-theme-bar{padding:7px 12px;gap:7px}
 .fai-dual-theme-switch button{min-height:42px;min-width:93px}
}
@media(max-width:350px){
 .fai-dual-theme-label{display:none}
 .fai-dual-theme-bar{justify-content:center}
}
@media(prefers-reduced-motion:reduce){
 html[data-render-mode="spatial"] *{
  animation:none!important;transition:none!important;
 }
}
@media print{.fai-dual-theme-bar{display:none!important}}
