/* ============================================================
   NJ Small Business Playbook: theme system (2026-07-23)
   Light is the default everywhere. Dark applies ONLY when the
   user clicks the toggle (html[data-theme="dark"], persisted in
   localStorage "njpb-theme"). No prefers-color-scheme anywhere.
   Scoped to @media screen so printing always uses light.
   ============================================================ */

/* Toggle button (injected by theme.js into .top-in or .nav-in) */
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:40px;padding:0 12px;background:rgba(255,255,255,.08);border:1.5px solid rgba(243,239,226,.38);border-radius:999px;color:#F3EFE2;cursor:pointer;font:inherit;flex:none}
.theme-toggle:hover{box-shadow:0 0 0 2.5px var(--gold,#C9A84C)}
.theme-toggle svg{width:16px;height:16px;flex:none}
.theme-toggle .tt-sun{display:none}
[data-theme="dark"] .theme-toggle .tt-sun{display:block}
[data-theme="dark"] .theme-toggle .tt-moon{display:none}
/* Order in the wrapping .top-in nav: logo, links, toggle on wide;
   logo + toggle on row one, links below, on narrow. */
.top-in .logo{order:1}
.top-in .top-links{order:2}
.top-in .theme-toggle{order:3}
@media(max-width:950px){
  .top-in .theme-toggle{order:2;margin-left:auto}
  .top-in .top-links{order:3}
}
.nav-in .theme-toggle{margin-left:12px}

@media screen{

/* ---- shared token remap (index / getstarted / taxguide / contracts)
       plus detail.html's parallel token family ---- */
[data-theme="dark"]{
  /* shared family */
  --ink:#E9E5DA; --ink2:#B7BEB1; --ink3:#99A295;
  --bg:#131A16; --card:#1C2620; --line:#455D50; --soft:#2C3A31;
  --gold:#D3B35C; --goldbg:#312A15; --golddk:#E2C97E;
  --open:#8CD9A4; --openbg:#1B3626; --warn:#EFC078; --warnbg:#3B2F19;
  --closed:#F2A6A6; --closedbg:#3D2323;
  /* detail.html family (its --em/--ed/--el stay dark green for
     surfaces; text usages are overridden per selector below) */
  --s:#1C2620; --s2:#243129; --bd:#455D50;
  --tx:#E9E5DA; --t2:#B7BEB1; --t3:#99A295;
  /* light-green link/heading ink used by the dark overrides */
  --lg:#A9CFBA;
}

/* ---- index family: components with hardcoded light backgrounds ---- */
[data-theme="dark"] .hero-search{background:var(--card)}
[data-theme="dark"] .hero-search i{color:var(--ink3)}
[data-theme="dark"] .search-box,
[data-theme="dark"] select.f-select{background:var(--card);color:var(--ink)}
[data-theme="dark"] .stat b{color:var(--gold)}
[data-theme="dark"] .row-name{color:var(--lg)}
[data-theme="dark"] .row-date{color:var(--ink2)}
[data-theme="dark"] .f-opt input{accent-color:#5FA97E}
[data-theme="dark"] .f-opt:hover input{accent-color:var(--gold)}
[data-theme="dark"] .p-soon{background:#3A2130;color:#F2A6C8}

/* chat widget (index + detail share these class names) */
[data-theme="dark"] .ai-panel{background:var(--card)}
[data-theme="dark"] .ai-msgs{background:var(--bg)}
[data-theme="dark"] .ai-m.bot{background:var(--card);border-color:var(--line);color:var(--ink)}
[data-theme="dark"] .ai-m.bot a{color:var(--lg)}
[data-theme="dark"] .ai-chips{background:var(--bg)}
[data-theme="dark"] .ai-chips button{background:var(--card);border-color:var(--line);color:var(--lg)}
[data-theme="dark"] .ai-note{background:var(--goldbg);border-color:var(--soft);color:var(--ink2)}
[data-theme="dark"] .ai-row{background:var(--card);border-color:var(--soft)}
[data-theme="dark"] .ai-row input{background:var(--soft);border-color:var(--line);color:var(--ink)}

/* ---- detail.html: hardcoded light surfaces and chip palettes ---- */
[data-theme="dark"] .pg-detail{background:var(--bg)}
[data-theme="dark"] .pg-detail a{color:var(--lg)}
[data-theme="dark"] .pg-detail .nav-home,
[data-theme="dark"] .pg-detail .nav-back{color:rgba(255,255,255,.8)}
[data-theme="dark"] .pg-detail .nav-home:hover,
[data-theme="dark"] .pg-detail .nav-back:hover{color:#fff}
[data-theme="dark"] .pg-detail .skip{color:#fff}
[data-theme="dark"] .pg-detail .fact,
[data-theme="dark"] .pg-detail .sec{background:var(--s);border-color:var(--bd)}
[data-theme="dark"] .pg-detail .sec h2,
[data-theme="dark"] .pg-detail details.sec>summary,
[data-theme="dark"] .pg-detail details.evidence-card>summary{color:var(--lg)}
[data-theme="dark"] .pg-detail .d-amount{background:#22352A;color:var(--lg)}
[data-theme="dark"] .pg-detail .evidence-card{background:#1A2620;border-color:#3A4F42}
[data-theme="dark"] .pg-detail .evidence-card h2{color:var(--lg)}
[data-theme="dark"] .pg-detail .footer-top strong{color:var(--lg)}
[data-theme="dark"] .pg-detail .evidence-row{border-top-color:#33463B}
[data-theme="dark"] .pg-detail .evidence-status.follow{background:#3B2F19;color:#EFC078}
[data-theme="dark"] .pg-detail .btn-visit{color:#fff}
[data-theme="dark"] .pg-detail .btn-call{background:var(--s);color:var(--lg);border-color:#4E6B5C}
[data-theme="dark"] .pg-detail .c-grants{background:#22352A;color:var(--lg)}
[data-theme="dark"] .pg-detail .c-government,
[data-theme="dark"] .pg-detail .c-techstack{background:#1E2A3F;color:#9DBEF2}
[data-theme="dark"] .pg-detail .c-financial,
[data-theme="dark"] .pg-detail .c-education{background:#3B2F19;color:#EFC078}
[data-theme="dark"] .pg-detail .c-legal{background:#3D2323;color:#F2A6A6}
[data-theme="dark"] .pg-detail .c-communities{background:#173430;color:#7FD6C9}
[data-theme="dark"] .pg-detail .c-marketing{background:#2C2440;color:#C7B2F2}
[data-theme="dark"] .pg-detail .c-ai{background:#252345;color:#B3B0F2}
[data-theme="dark"] .pg-detail .s-rolling{background:#22352A;color:var(--lg)}
[data-theme="dark"] .pg-detail .s-open{background:#1B3626;color:#8CD9A4}
[data-theme="dark"] .pg-detail .s-upcoming{background:#1E2A3F;color:#9DBEF2}
[data-theme="dark"] .pg-detail .s-check{background:#3B2F19;color:#EFC078}
[data-theme="dark"] .pg-detail .s-closed{background:#3D2323;color:#F2A6A6}

/* ---- taxguide.html: --em text (aliased to brand green) needs light ink;
       --em backgrounds (step numbers, CTA) stay dark green on purpose ---- */
[data-theme="dark"] .pg-taxguide .tc-h1,
[data-theme="dark"] .pg-taxguide .tc-section h2,
[data-theme="dark"] .pg-taxguide .tc-section h3,
[data-theme="dark"] .pg-taxguide .tc-section li strong,
[data-theme="dark"] .pg-taxguide .tc-section a,
[data-theme="dark"] .pg-taxguide details.tc-section>summary,
[data-theme="dark"] .pg-taxguide .legal-group>summary,
[data-theme="dark"] .pg-taxguide .tc-step-body strong,
[data-theme="dark"] .pg-taxguide .tc-contact-v a,
[data-theme="dark"] .pg-taxguide .tc-link-list li a{color:var(--lg)}
[data-theme="dark"] .pg-taxguide .panel ol.tc-steps>li{background:var(--card)}
[data-theme="dark"] .pg-taxguide .tc-callout strong{color:var(--golddk)}

/* ---- getstarted.html: links are brand green, invisible on dark cards ---- */
[data-theme="dark"] .pg-getstarted a{color:var(--lg)}
[data-theme="dark"] .pg-getstarted .top-links a{color:#DCD6C4}
[data-theme="dark"] .pg-getstarted .top-links a:hover,
[data-theme="dark"] .pg-getstarted .top-links a.on{color:#fff}
[data-theme="dark"] .pg-getstarted .footer a{color:#EFE9D6}
[data-theme="dark"] .pg-getstarted .logo{color:#fff}

/* ---- sources.html: no token system, override selectors directly ---- */
[data-theme="dark"] .pg-sources{background:#131A16;color:#E9E5DA}
[data-theme="dark"] .pg-sources a{color:#A9CFBA}
[data-theme="dark"] .pg-sources .brand,
[data-theme="dark"] .pg-sources .nav-links a{color:#DCD6C4}
[data-theme="dark"] .pg-sources .nav-links a:hover,
[data-theme="dark"] .pg-sources .nav-links a.on{color:#fff}
[data-theme="dark"] .pg-sources .eyebrow{color:#A9CFBA}
[data-theme="dark"] .pg-sources .hero p{color:#B7BEB1}
[data-theme="dark"] .pg-sources .stat,
[data-theme="dark"] .pg-sources .card,
[data-theme="dark"] .pg-sources .empty{background:#1C2620;border-color:#455D50}
[data-theme="dark"] .pg-sources .stat b{color:#D3B35C}
[data-theme="dark"] .pg-sources .stat span,
[data-theme="dark"] .pg-sources .result-meta,
[data-theme="dark"] .pg-sources .meta{color:#99A295}
[data-theme="dark"] .pg-sources .controls{background:rgba(19,26,22,.96);border-bottom-color:#2C3A31}
[data-theme="dark"] .pg-sources .controls input{background:#1C2620;border-color:#455D50;color:#E9E5DA}
[data-theme="dark"] .pg-sources .footer{background:#1C2620;border-top-color:#2C3A31;color:#99A295}

}
