/* Load after hero.css and site.css. Product artwork keeps its original palette. */
html {
  color-scheme: light;
  --nortiva-theme-border: #d0d7e2;
  --nortiva-theme-hover: #e7ebf1;
}

.nortiva-header { column-gap: 24px; }
.nortiva-brand__mark { display: block; width: 44px; height: auto; flex-shrink: 0; }
.nortiva-brand__wordmark { display: block; width: 146px; height: auto; flex-shrink: 1; }
.nortiva-brand { gap: 11px; }
.footer-brand .nortiva-brand__mark { width: 48px; }
.footer-brand .nortiva-brand__wordmark { width: 160px; }
.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 1px solid var(--nortiva-theme-border);
  border-radius: 5px;
  background: transparent;
  color: var(--nortiva-ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.theme-toggle:hover { background: var(--nortiva-theme-hover); }
.theme-toggle:focus-visible { outline: 2px solid var(--nortiva-cobalt); outline-offset: 5px; }
.theme-toggle svg { width: 20px; height: 20px; flex-shrink: 0; }
.theme-toggle__sun { display: none; }
.theme-toggle__moon { display: block; }

html[data-theme="dark"] {
  color-scheme: dark;
  --nortiva-paper: #0d1420;
  --nortiva-ink: #eef3fc;
  --nortiva-cobalt: #83a1ff;
  --nortiva-muted: #a9b7cc;
  --nortiva-theme-border: #33425a;
  --nortiva-theme-hover: #1b283d;
  --nortiva-dark-surface: #152033;
  --nortiva-dark-surface-raised: #1a2940;
  --nortiva-dark-border: #33435c;
  --nortiva-dark-secondary: #b4c1d6;
  --nortiva-dark-muted: #94a5c1;
  --nortiva-button-fill: #3156df;
}
html[data-theme="dark"] .theme-toggle__sun { display: block; }
html[data-theme="dark"] .theme-toggle__moon { display: none; }
html[data-theme="dark"] body.nortiva-page { background: var(--nortiva-paper); color: var(--nortiva-ink); }
html[data-theme="dark"] .nortiva-hero,
html[data-theme="dark"] .nortiva-dialog { color-scheme: dark; }
html[data-theme="dark"] .nortiva-hero::before {
  opacity: .46;
  background-image: linear-gradient(rgba(238, 243, 252, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(238, 243, 252, .045) 1px, transparent 1px);
}
html[data-theme="dark"] .nortiva-description { color: var(--nortiva-dark-secondary); }
html[data-theme="dark"] .nortiva-header__cta,
html[data-theme="dark"] .nortiva-button--primary {
  border-color: var(--nortiva-button-fill);
  background: var(--nortiva-button-fill);
  color: #fff;
}
html[data-theme="dark"] .nortiva-header__cta:hover,
html[data-theme="dark"] .nortiva-button--primary:hover { border-color: #4166ee; background: #4166ee; }
html[data-theme="dark"] .nortiva-footer,
html[data-theme="dark"] .nortiva-footer > span + span { border-color: var(--nortiva-dark-border); }
html[data-theme="dark"] .nortiva-footer__index { color: var(--nortiva-dark-muted); }
html[data-theme="dark"] .skip-link { background: var(--nortiva-button-fill); color: #fff; }

/* Labs: change the card chrome and copy, preserving every product visual. */
html[data-theme="dark"] .section-meta { color: var(--nortiva-dark-muted); }
html[data-theme="dark"] .section-meta > span:first-child { color: var(--nortiva-cobalt); }
html[data-theme="dark"] .product-filters button { border-color: var(--nortiva-dark-border); color: var(--nortiva-dark-secondary); }
html[data-theme="dark"] .product-filters button[aria-pressed="true"] { border-color: var(--nortiva-button-fill); background: var(--nortiva-button-fill); color: #fff; }
html[data-theme="dark"] .product-filters button:hover:not([aria-pressed="true"]) { background: var(--nortiva-dark-surface-raised); color: var(--nortiva-ink); }
html[data-theme="dark"] .portfolio-count { color: var(--nortiva-dark-muted); }
html[data-theme="dark"] .product-card { border-color: #2b3950; background: var(--nortiva-dark-surface); }
html[data-theme="dark"] .product-card:hover { box-shadow: 0 16px 36px rgba(0, 0, 0, .24); }
html[data-theme="dark"] .product-copy { color: var(--nortiva-ink); }
html[data-theme="dark"] .product-category { color: var(--nortiva-dark-muted); }
html[data-theme="dark"] .product-copy > p { color: var(--nortiva-dark-secondary); }
html[data-theme="dark"] .product-link { border-color: var(--nortiva-dark-border); }
html[data-theme="dark"] .labs-closing { color: var(--nortiva-dark-muted); }
/* Timero uses inherited text on a deliberately pale branded visual. */
html[data-theme="dark"] .product-visual--timero { color: #101622; }

/* The existing robotics section stays dark; its white chrome artwork is untouched. */
html[data-theme="dark"] .robotics { background: #0a101a; color: var(--nortiva-ink); }
html[data-theme="dark"] .section-meta--light { color: var(--nortiva-dark-muted); }
html[data-theme="dark"] .robotics .section-kicker { color: var(--nortiva-cobalt); }
html[data-theme="dark"] .robotics .section-lede,
html[data-theme="dark"] .future-applications p { color: var(--nortiva-dark-secondary); }
html[data-theme="dark"] .direction-tag { border-color: #42536d; color: #b8c6de; }
html[data-theme="dark"] .future-applications article { border-color: var(--nortiva-dark-border); }
html[data-theme="dark"] .application-number { color: var(--nortiva-cobalt); }
html[data-theme="dark"] .topic-chips span { border-color: #33445e; color: #b9c8df; }
html[data-theme="dark"] .future-caption { color: var(--nortiva-dark-muted); }

/* Intelligence: separate the panel, stages and active engine by surface depth. */
html[data-theme="dark"] .intelligence-tabs button { border-color: var(--nortiva-dark-border); color: var(--nortiva-dark-secondary); }
html[data-theme="dark"] .intelligence-tabs button[aria-selected="true"] { border-color: var(--nortiva-cobalt); background: #1c2d4c; color: #b7c9ff; }
html[data-theme="dark"] .intelligence-tabs button:hover:not([aria-selected="true"]) { background: var(--nortiva-dark-surface); }
html[data-theme="dark"] .intelligence-panel { border-color: #364968; background: #142239; box-shadow: 0 25px 55px rgba(0, 0, 0, .18); }
html[data-theme="dark"] .panel-topline { color: #a2b6d5; }
html[data-theme="dark"] .intelligence-panel > p { color: #b4c5df; }
html[data-theme="dark"] .intelligence-flow > div { border-color: #3a4e6b; background: #1b2c44; }
html[data-theme="dark"] .flow-index { color: #a3b6d4; }
html[data-theme="dark"] .intelligence-flow strong { color: #e3ecfc; }
html[data-theme="dark"] .intelligence-flow > .flow-engine { border-color: #557af4; background: var(--nortiva-button-fill); }
html[data-theme="dark"] .flow-engine .flow-index,
html[data-theme="dark"] .flow-engine strong { color: #fff; }
html[data-theme="dark"] .flow-line { border-color: #617ca8; }
html[data-theme="dark"] .panel-bottomline { border-color: #354a69; color: #a4b6d1; }

html[data-theme="dark"] .vision { border-color: #2d3c53; background: #121d2e; }
html[data-theme="dark"] .vision-statement > p { color: var(--nortiva-dark-secondary); }
html[data-theme="dark"] .principles article { border-color: #34445d; }
html[data-theme="dark"] .principles article > span { color: #9eafc9; }
html[data-theme="dark"] .principles p { color: var(--nortiva-dark-secondary); }

html[data-theme="dark"] .site-footer { background: #080f19; color: var(--nortiva-ink); }
html[data-theme="dark"] .site-footer .section-kicker { color: var(--nortiva-cobalt); }
html[data-theme="dark"] .footer-invitation,
html[data-theme="dark"] .footer-baseline { border-color: #2a3a52; }
html[data-theme="dark"] .footer-cta { border-color: #738aaf; color: #e3edff; }
html[data-theme="dark"] .footer-brand { color: var(--nortiva-ink); }
html[data-theme="dark"] .footer-label { color: #9bacc7; }
html[data-theme="dark"] .footer-links > div a { color: #bfcee5; }
html[data-theme="dark"] .footer-links > div a:hover { color: #a9beff; }
html[data-theme="dark"] .footer-baseline { color: #9caecb; }
html[data-theme="dark"] .footer-baseline a { color: #c2d1e9; }

html[data-theme="dark"] .nortiva-dialog { border-color: #40516c; background: #132036; }
html[data-theme="dark"] .nortiva-dialog::backdrop { background: rgba(2, 7, 14, .73); }
html[data-theme="dark"] .nortiva-dialog__close { border-color: #43536c; }
html[data-theme="dark"] .nortiva-dialog__close:hover { background: #21314b; }
html[data-theme="dark"] .nortiva-dialog__body { color: #b9c8df; }
html[data-theme="dark"] :is(a, button, [tabindex]):focus-visible { outline: 2px solid #9db7ff; outline-offset: 5px; }

/* Keep a full-size toggle beside the CTA and move navigation to the next line. */
@media (max-width: 800px) {
  .nortiva-header .nortiva-brand__wordmark { width: 137px; }
  .nortiva-header { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 44px auto; column-gap: 12px; }
  .nortiva-header > .nortiva-brand { grid-column: 1; grid-row: 1; min-width: 0; }
  .nortiva-header > .theme-toggle { grid-column: 2; grid-row: 1; }
  .nortiva-header > .nortiva-header__cta { grid-column: 3; grid-row: 1; }
  .nortiva-nav { position: absolute; top: 84px; left: 0; margin-left: 0; }
  .nortiva-header .nortiva-brand > svg { max-width: 100%; flex-shrink: 1; }
}
@media (max-width: 640px) {
  .nortiva-header .nortiva-brand__mark { width: 31px; }
  .nortiva-header .nortiva-brand__wordmark { width: 103px; }
  .nortiva-header { column-gap: 8px; }
  .nortiva-header > .nortiva-brand { gap: 8px; }
  .nortiva-header .nortiva-brand > span { font-size: 16px; letter-spacing: .1em; }
  .nortiva-header > .nortiva-header__cta { min-height: 44px; padding: 9px 11px; gap: 9px; font-size: 11px; }
  .nortiva-nav { top: 82px; gap: 24px; }
}
@media (max-width: 350px) { .nortiva-header .nortiva-brand__wordmark { width: 90px; } }
@media (prefers-reduced-motion: reduce) { .theme-toggle { transition: none; } }
