/* Approved dark-r2 palette. Loaded only by the public corporate shell, after
   page-specific CSS so the legacy mobile landing keeps its composition. */
html[data-theme="dark"] {
  color-scheme: dark;
  background: #18282f;
  --p-bg: #18282f;
  --p-surface: #21363e;
  --p-raised: #2b4149;
  --p-ink: #eef2ef;
  --p-muted: #b5c3bf;
  --p-accent: #b3d0e0;
  --p-accent-ink: #18282f;
  --p-action: #b3c8a5;
  --p-action-hover: #c4d6b9;
  --p-action-ink: #18282f;
  --p-inv-bg: #21363e;
  --p-inv-surface: #2b4149;
  --p-inv-ink: #eef2ef;
  --p-inv-muted: #b5c3bf;
  --p-inv-accent: #b3d0e0;
  --p-inv-accent-ink: #18282f;
  --p-inv-action: #b3c8a5;
  --p-inv-action-ink: #18282f;
  --sage: #b3c8a5;
  --line: #425960;
  --p-control-border: #7f969d;
  --p-focus: #c1d9e6;
  --p-error: #ffb4a9;
  --p-error-bg: #493634;
  --surface: var(--p-surface);
  --ink: var(--p-ink);
}

/* Both assets occupy identical geometry; CSS selects before the first paint. */
.corporate-site .logo .logo-dark { display: none; }
html[data-theme="dark"] .corporate-site .logo .logo-light { display: none; }
html[data-theme="dark"] .corporate-site .logo .logo-dark { display: block; }
.corporate-site .theme-toggle {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--p-accent);
}
.corporate-site .theme-toggle[hidden] { display: none; }
.corporate-site .theme-toggle:hover { background: var(--p-surface); }
.corporate-site .theme-sun { display: none; }
html[data-theme="dark"] .theme-moon { display: none; }
html[data-theme="dark"] .theme-sun { display: block; }

html[data-theme="dark"] .hero-plane { background: var(--p-surface); }
/* Home only: same approved photo, crop and content with the 40% night veil.
   The isolated hero keeps both negative layers behind normal-flow content. */
html[data-theme="dark"] .home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(24, 40, 47, .40);
  pointer-events: none;
}
html[data-theme="dark"] .certificates { background: var(--p-bg); }
/* Third-party marks and scanned documents retain their original white ground. */
html[data-theme="dark"] .partner-place { background: #fff; }
html[data-theme="dark"] .primary,
html[data-theme="dark"] .reading.revision-r2 .reading-head .fragment > a,
html[data-theme="dark"] .reading .sunflower-utility .sale-prompt > a {
  background: var(--p-action);
  color: var(--p-action-ink);
}
html[data-theme="dark"] .primary:hover,
html[data-theme="dark"] .reading.revision-r2 .reading-head .fragment > a:hover,
html[data-theme="dark"] .reading .sunflower-utility .sale-prompt > a:hover {
  background: var(--p-action-hover);
  color: var(--p-action-ink);
}
html[data-theme="dark"] .secondary:hover { background: var(--p-raised); }
html[data-theme="dark"] :is(.field input, .local-contact-form input, .local-contact-form textarea) {
  background: var(--p-bg);
  color: var(--p-ink);
  border-color: var(--p-control-border);
  caret-color: var(--p-focus);
}
html[data-theme="dark"] :is(input, textarea)::placeholder { color: var(--p-muted); opacity: 1; }
html[data-theme="dark"] .field input:hover { background: var(--p-raised); }
html[data-theme="dark"] :is(a, button, summary, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--p-focus);
  outline-offset: 5px;
}
html[data-theme="dark"] :is(input, textarea)[aria-invalid="true"] { border-color: var(--p-error); }
html[data-theme="dark"] :is(.field-error, .form-status.is-error, .form-status--error, .lead-feedback--error) {
  color: var(--p-error);
}
html[data-theme="dark"] .lead-feedback--error {
  background: var(--p-error-bg);
  border-color: var(--p-error);
}
html[data-theme="dark"] .lead-feedback--success {
  color: var(--p-ink);
  background: var(--p-surface);
  border-color: var(--p-action);
}
html[data-theme="dark"] .desktop-page :is(.lead-form-note, .term dt) { color: var(--p-muted); }
html[data-theme="dark"] .desktop-page .offer { border-color: var(--line); }
html[data-theme="dark"] .contact-channels .contact-icon { border-color: var(--p-control-border); }
html[data-theme="dark"] .contact-channels .contact-icon:hover,
html[data-theme="dark"] .contact-channels .contact-icon:active { background: var(--p-raised); }
html[data-theme="dark"] .contact-tooltip {
  background: var(--p-raised);
  color: var(--p-ink);
  box-shadow: none;
}
html[data-theme="dark"] dialog { background: var(--p-surface); color: var(--p-ink); }
html[data-theme="dark"] dialog::backdrop { background: #101e27dd; }
html[data-theme="dark"] table { font-variant-numeric: tabular-nums; }
html[data-theme="dark"] table thead { background: var(--p-surface); }
html[data-theme="dark"] ::selection { background: var(--p-action); color: var(--p-action-ink); }
html[data-theme="dark"] { scrollbar-color: #7f969d #18282f; }
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--p-ink);
  -webkit-box-shadow: 0 0 0 1000px var(--p-bg) inset;
  caret-color: var(--p-focus);
}

@media (max-width: 1199px) {
  .corporate-site > header .header-actions { gap: 14px; }
}
@media (max-width: 767px) {
  /* Keep the existing compact action row and its main CTA. */
  .corporate-site > header .header-actions { gap: 8px; }
}

/* The separate mobile selling page predates the corporate tokens. Remap its
   color roles only; preserve its fonts, dimensions, fixed dock and photography. */
@media (max-width: 767.98px) {
  /* The shared desktop photo class has z-index:-1. Keep the existing mobile
     background photo inside its own opaque hero, in either color theme. */
  .corporate-site .mobile-page .hero-photo { z-index: 0; }
  html[data-theme="dark"] {
    --bg: var(--p-bg);
    --bg-raised: var(--p-surface);
    --bg-sunken: var(--p-raised);
    --fg-1: var(--p-ink);
    --fg-2: var(--p-muted);
    --fg-3: var(--p-muted);
    --fg-muted: var(--p-muted);
    --fg-brand: var(--p-accent);
    --fg-on-steel: var(--p-ink);
    --ngk-steel: var(--p-accent);
    --ngk-charcoal: var(--p-ink);
    --rule: var(--line);
    --rule-strong: var(--p-control-border);
    --error: var(--p-error);
    --error-soft: var(--p-error-bg);
  }
  html[data-theme="dark"] .mobile-page {
    --steel: var(--p-accent);
    --steel-50: var(--p-raised);
    --steel-100: var(--p-muted);
    --steel-200: var(--p-muted);
    --steel-600: var(--p-raised);
    --steel-700: var(--p-surface);
    --steel-900: var(--p-bg);
    --sage: var(--p-action);
    --sage-50: var(--p-surface);
    --sage-100: var(--p-raised);
    --sage-700: var(--p-action);
    --ink: var(--p-ink);
    --ink-2: var(--p-muted);
    --ink-3: var(--p-muted);
    --ink-4: var(--p-muted);
    --snow: var(--p-bg);
    --paper: var(--p-surface);
    --paper-2: var(--p-raised);
    --rule: var(--line);
    --rule-strong: var(--p-control-border);
    background: var(--p-bg);
  }
  html[data-theme="dark"] .mobile-page :is(.action-card, .proof-tile, .flow .node, .tcard,
    .factor, .quick, .lead-form, .kv > div, .dock .icontile, .closing .row3 .btn,
    .btn-light, .btn-secondary, .btn-onsteel) {
    background: var(--p-surface);
  }
  html[data-theme="dark"] .mobile-page :is(.price-card, .contacts, .closing) {
    background: var(--p-surface);
    color: var(--p-ink);
  }
  html[data-theme="dark"] .mobile-page :is(.price-card h3, .contacts .head h2,
    .closing h2, .panel .row, a.panel-link) { color: var(--p-ink); }
  html[data-theme="dark"] .mobile-page :is(.eyebrow.snow, .price-card p,
    .price-card .reassure, .contacts .head p, .panel .row .label,
    .panel .row .hint, .panel .row .go, .closing .eyebrow, .closing p) { color: var(--p-muted); }
  html[data-theme="dark"] .mobile-page .panel { background: var(--p-bg); border-color: var(--line); }
  html[data-theme="dark"] .mobile-page .panel .row { border-color: var(--line); }
  html[data-theme="dark"] .mobile-page .panel .row .ic { background: var(--p-raised); }
  html[data-theme="dark"] .mobile-page .dock { background: rgba(24, 40, 47, .97); }
  html[data-theme="dark"] .mobile-page :is(.btn-primary, .closing .btn-primary, .indicative-price-cta) {
    background: var(--p-action);
    color: var(--p-action-ink);
    border-color: var(--p-action);
  }
  html[data-theme="dark"] .mobile-page :is(.btn-primary, .closing .btn-primary, .indicative-price-cta):is(:hover, :active) {
    background: var(--p-action-hover);
    color: var(--p-action-ink);
    border-color: var(--p-action-hover);
  }
  html[data-theme="dark"] .mobile-page .lead-field input {
    background: var(--p-bg);
    color: var(--p-ink);
    border-color: var(--p-control-border);
    caret-color: var(--p-focus);
  }
  html[data-theme="dark"] .mobile-page .lead-feedback--success {
    color: var(--p-ink);
    background: var(--p-surface);
    border-color: var(--p-action);
  }
  html[data-theme="dark"] .mobile-page .lead-feedback--error {
    color: var(--p-error);
    background: var(--p-error-bg);
    border-color: var(--p-error);
  }
}
@media print { .corporate-site .theme-toggle { display: none; } }

/* Printed reading/specification pages stay legible with background printing off.
   This is a media-only palette; the visitor's stored theme is untouched. */
@media print {
  html[data-theme="dark"] {
    color-scheme: light;
    background: #fff;
    --p-bg: #fff;
    --p-surface: #edf1e9;
    --p-raised: #edf1e9;
    --p-ink: #263c43;
    --p-muted: #56665b;
    --p-accent: #25486b;
    --p-accent-ink: #263c43;
    --p-action: #edf1e9;
    --p-action-hover: #edf1e9;
    --p-action-ink: #263c43;
    --p-inv-bg: #edf1e9;
    --p-inv-surface: #edf1e9;
    --p-inv-ink: #263c43;
    --p-inv-muted: #56665b;
    --p-inv-accent: #25486b;
    --p-inv-accent-ink: #263c43;
    --p-inv-action: #edf1e9;
    --p-inv-action-ink: #263c43;
    --sage: #9cac91;
    --line: #cdd5cc;
    --p-control-border: #56665b;
    --p-focus: #25486b;
    --p-error: #aa2c24;
    --p-error-bg: #f1dad3;
  }
  html[data-theme="dark"] .home-hero::after { content: none; }
  html[data-theme="dark"] .corporate-site .logo .logo-dark { display: none; }
  html[data-theme="dark"] .corporate-site .logo .logo-light { display: block; }
  html[data-theme="dark"] .mobile-page .dock { display: none; }
}
