/* GematriaRTM V154 — true dark theme + mobile discovery rail
   Presentation/navigation only. No RTM scientific logic is changed. */

/* ---------- Theme: make the toggle visibly meaningful ---------- */
html[data-theme="dark"]{color-scheme:dark}
html[data-theme="dark"] body:not(.rtm-lab-page){background:#080e18!important;color:#eef4ff!important}
html[data-theme="dark"] body:not(.rtm-lab-page) .header{
  background:rgba(9,16,27,.975)!important;
  border-bottom-color:#26354a!important;
  box-shadow:0 8px 28px rgba(0,0,0,.28)!important;
}
html[data-theme="dark"] body:not(.rtm-lab-page) .brand strong{color:#f4f8ff!important;-webkit-text-fill-color:#f4f8ff!important}
html[data-theme="dark"] body:not(.rtm-lab-page) .brand small{color:#7f91aa!important}
html[data-theme="dark"] body:not(.rtm-lab-page) .v13-command-btn,
html[data-theme="dark"] body:not(.rtm-lab-page) .v13-lang-btn,
html[data-theme="dark"] body:not(.rtm-lab-page) .v13-menu-btn,
html[data-theme="dark"] body:not(.rtm-lab-page) .icon-btn{
  background:#101a2a!important;border-color:#29394f!important;color:#dce7f7!important;
}
html[data-theme="dark"] body:not(.rtm-lab-page) .v13-command-btn kbd{background:#172337!important;border-color:#304057!important;color:#9eb0c8!important}
html[data-theme="dark"] body:not(.rtm-lab-page) .nav a.nav-core,
html[data-theme="dark"] body:not(.rtm-lab-page) .nav a.nav-tool:not(.nav-lab){color:#afbdd0!important;-webkit-text-fill-color:#afbdd0!important;background:transparent!important}
html[data-theme="dark"] body:not(.rtm-lab-page) .nav a.nav-core:hover,
html[data-theme="dark"] body:not(.rtm-lab-page) .nav a.nav-tool:not(.nav-lab):hover{background:#152237!important;border-color:#2a3b54!important;color:#f2f6fd!important;-webkit-text-fill-color:#f2f6fd!important}
html[data-theme="dark"] body:not(.rtm-lab-page) .nav a.nav-current:not(.nav-lab){background:#17264a!important;border-color:#30477a!important;color:#b9c8ff!important;-webkit-text-fill-color:#b9c8ff!important}
html[data-theme="dark"] body:not(.rtm-lab-page) .nav .nav-divider{background:linear-gradient(to bottom,transparent,#34445c 18%,#34445c 82%,transparent)!important}

/* Home / guide surfaces already use variables in most places; these make the change obvious below the hero. */
html[data-theme="dark"] body.portal-home .portal-section,
html[data-theme="dark"] body.guide-home .guide-main,
html[data-theme="dark"] body.guide-home main{background:#080e18!important}
html[data-theme="dark"] body.portal-home .portal-section-soft{background:#0c1421!important}
html[data-theme="dark"] body.portal-home :is(.portal-card,.portal-steps article,.portal-principles article,.findings-mini-card,.pattern-card,.portal-note,.validation-band){
  background:#101a29!important;border-color:#28384e!important;box-shadow:0 12px 34px rgba(0,0,0,.18)!important;
}
html[data-theme="dark"] body.portal-home :is(.portal-card,.portal-steps article,.portal-principles article,.findings-mini-card,.pattern-card,.portal-note,.validation-band) :is(h2,h3,strong,b){color:#eef4ff!important;-webkit-text-fill-color:#eef4ff!important}
html[data-theme="dark"] body.portal-home :is(.portal-card,.portal-steps article,.portal-principles article,.findings-mini-card,.pattern-card,.portal-note,.validation-band) p{color:#aebdd0!important}

/* Findings landing — V142 has intentionally hard-coded white cards, so theme them explicitly. */
html[data-theme="dark"] body.rtm-findings-page :is(.findings-index-card,.findings-intro-card,.pattern-section,.reading-guide,.findings-control-band,.findings-card){
  background:#101a29!important;border-color:#29394f!important;color:#eef4ff!important;
}
html[data-theme="dark"] body.rtm-findings-page :is(.findings-index-card,.findings-intro-card,.pattern-section,.reading-guide,.findings-card) p{color:#adbbcd!important}

/* Gematria workbench — override the later white-only workspace layers. */
html[data-theme="dark"] body.gematria-workspace-v150 :is(.v15-intro,.v14-explore,.seo-gematria-guide,.vfinal-history-section,main>.section.alt:last-of-type){background:#080e18!important;border-color:#26354a!important}
html[data-theme="dark"] body.gematria-workspace-v150 #calculator .calc-shell,
html[data-theme="dark"] body.gematria-workspace-v150 #calculator .calc-main,
html[data-theme="dark"] body.gematria-workspace-v150 .v15-analysis>.container,
html[data-theme="dark"] body.gematria-workspace-v150 :is(.v14-explore-card,.seo-table-wrap,.workspace-bar-actions a,.advanced-toggle,.calc-archive-link){
  background:#101a29!important;border-color:#29394f!important;color:#eef4ff!important;box-shadow:0 12px 34px rgba(0,0,0,.16)!important;
}
html[data-theme="dark"] body.gematria-workspace-v150 #calculator .main-input{background:#0c1523!important;border-color:#31435d!important;color:#eef4ff!important}
html[data-theme="dark"] body.gematria-workspace-v150 .v15-proof span{background:#101a29!important;border-color:#29394f!important;color:#aebdd0!important}
html[data-theme="dark"] body.archive-page :is(.archive-toolbar,.archive-card){background:#101a29!important;border-color:#29394f!important;color:#eef4ff!important}

/* Generic recent public surfaces. Avoid heroes and deliberately dark evidence panels. */
html[data-theme="dark"] body:not(.rtm-lab-page) main :is(.research-card,.quantum-card,.profile-card,.method-card,.guide-card,.info-card,.content-card){
  background:#101a29!important;border-color:#29394f!important;color:#eef4ff!important;
}
html[data-theme="dark"] body:not(.rtm-lab-page) main :is(.research-card,.quantum-card,.profile-card,.method-card,.guide-card,.info-card,.content-card) p{color:#adbbcd!important}

/* ---------- Mobile: compact visible tool rail ---------- */
.v154-mobile-quickbar{display:none}
@media(max-width:1080px){
  .v154-mobile-quickbar{
    display:flex;align-items:center;gap:7px;overflow-x:auto;overscroll-behavior-inline:contain;
    scrollbar-width:none;scroll-snap-type:x proximity;padding:8px max(12px,env(safe-area-inset-right)) 9px;
    background:rgba(248,250,253,.97);border-bottom:1px solid #dde6ef;box-shadow:0 5px 16px rgba(17,38,63,.045);
    direction:rtl;position:relative;z-index:72;
  }
  .v154-mobile-quickbar::-webkit-scrollbar{display:none}
  .v154-mobile-quickbar a,.v154-mobile-quickbar button{
    flex:0 0 auto;scroll-snap-align:start;min-height:38px;padding:0 13px;border:1px solid #d7e1eb;border-radius:11px;
    background:#fff;color:#30445f;font:850 12px/1 var(--x-font,system-ui);white-space:nowrap;text-decoration:none;
    display:inline-flex;align-items:center;justify-content:center;gap:6px;box-shadow:0 2px 8px rgba(17,38,63,.03);
  }
  .v154-mobile-quickbar .v154-q-lab{background:linear-gradient(135deg,#3655e8,#6351e7);border-color:transparent;color:#fff;box-shadow:0 6px 15px rgba(72,73,205,.18)}
  .v154-mobile-quickbar .v154-q-ai{background:#0d1c31;border-color:#23405e;color:#6fe3d9}
  .v154-mobile-quickbar .is-current{background:#eef3ff;border-color:#cad8ff;color:#284bd3}
  body.v154-mobile-quickbar-ready .rtm-ai-v33-launcher{display:none!important}

  html[data-theme="dark"] .v154-mobile-quickbar{background:rgba(9,16,27,.98);border-bottom-color:#27374e;box-shadow:0 7px 20px rgba(0,0,0,.18)}
  html[data-theme="dark"] .v154-mobile-quickbar a,
  html[data-theme="dark"] .v154-mobile-quickbar button{background:#111c2c;border-color:#2b3c53;color:#c7d3e3}
  html[data-theme="dark"] .v154-mobile-quickbar .is-current{background:#18284a;border-color:#334d82;color:#b9c8ff}
  html[data-theme="dark"] .v154-mobile-quickbar .v154-q-lab{background:linear-gradient(135deg,#3655e8,#6351e7);color:#fff;border-color:transparent}
  html[data-theme="dark"] .v154-mobile-quickbar .v154-q-ai{background:#102439;border-color:#25506b;color:#66e4da}
}

/* Mobile header: search should look like search, not like a desktop keyboard shortcut. */
@media(max-width:780px){
  body:not(.rtm-lab-page) .v13-command-btn{width:44px!important;min-width:44px!important;padding:0!important;justify-content:center!important}
  body:not(.rtm-lab-page) .v13-command-btn span,
  body:not(.rtm-lab-page) .v13-command-btn kbd{display:none!important}
  body:not(.rtm-lab-page) .v13-command-btn:before{content:"⌕";font-size:21px;line-height:1;font-weight:800;color:currentColor}
  body:not(.rtm-lab-page) .header-actions :is(.v13-lang-btn,.icon-btn,.v13-menu-btn){height:44px!important;min-width:44px!important;border-radius:11px!important}
  body:not(.rtm-lab-page) .brand{margin-inline-end:0!important}
  body:not(.rtm-lab-page) .brand img{width:40px!important;height:40px!important}
  body:not(.rtm-lab-page) .brand strong{font-size:17px!important}
  body:not(.rtm-lab-page) .header-inner{height:66px!important;min-height:66px!important;width:min(100% - 22px,1420px)!important;gap:8px!important}
  .research-strip,.research-strip-inner{min-height:36px!important}
  .research-strip-inner{padding-block:2px!important;gap:5px!important;overflow-x:auto!important;scrollbar-width:none!important}
  .research-strip-inner::-webkit-scrollbar{display:none}
  .research-strip-label,.research-link{min-height:28px!important;padding-inline:8px!important;font-size:10px!important;white-space:nowrap!important}
  body:not(.rtm-lab-page) .header{top:36px!important}
  .v13-mobile-nav{top:102px!important}
}

@media(max-width:430px){
  body:not(.rtm-lab-page) .brand small{display:none!important}
  body:not(.rtm-lab-page) .brand strong{font-size:16px!important}
  body:not(.rtm-lab-page) .brand img{width:38px!important;height:38px!important}
  body:not(.rtm-lab-page) .header-actions{gap:6px!important}
  .v154-mobile-quickbar{padding-inline:10px!important;gap:6px!important}
  .v154-mobile-quickbar a,.v154-mobile-quickbar button{min-height:37px;padding-inline:12px;font-size:11.5px}
}
