/* Shared palette. Light defaults stay in each original declaration. */
html[data-theme="dark"] {
  color-scheme:dark;
  --theme-accent:#e2bb7d;
  --theme-accent-a720:rgba(226,187,125,0.72);
  --theme-accent-a780:rgba(226,187,125,0.78);
  --theme-accent-surface:#393125;
  --theme-blue:#95bde5;
  --theme-canvas:#171c21;
  --theme-canvas-a220:rgba(23,28,33,0.2196);
  --theme-green:#85caaa;
  --theme-green-surface:#203b32;
  --theme-line:#3d4954;
  --theme-line-a800:rgba(61,73,84,0.8);
  --theme-line-strong:#667481;
  --theme-muted:#a8b5c0;
  --theme-muted-a180:rgba(168,181,192,0.1804);
  --theme-on-dark:#f4f6f8;
  --theme-on-dark-a502:rgba(244,246,248,0.502);
  --theme-on-dark-a720:rgba(244,246,248,0.72);
  --theme-on-dark-a722:rgba(244,246,248,0.7216);
  --theme-on-dark-a760:rgba(244,246,248,0.76);
  --theme-on-dark-a780:rgba(244,246,248,0.7804);
  --theme-on-dark-a863:rgba(244,246,248,0.8627);
  --theme-on-dark-a949:rgba(244,246,248,0.949);
  --theme-primary:#e3e8ec;
  --theme-raised:#252e37;
  --theme-red:#f0a2a0;
  --theme-secondary:#b7c2cb;
  --theme-soft:#202830;
  --theme-soft-a560:rgba(32,40,48,0.56);
  --theme-soft-a860:rgba(32,40,48,0.86);
  --theme-soft-a890:rgba(32,40,48,0.89);
  --theme-soft-a910:rgba(32,40,48,0.9098);
  --theme-soft-a940:rgba(32,40,48,0.94);
  --theme-soft-a960:rgba(32,40,48,0.96);
  --theme-soft-a970:rgba(32,40,48,0.97);
  --theme-surface:#1d242b;
  --theme-surface-a314:rgba(29,36,43,0.3137);
  --theme-surface-a680:rgba(29,36,43,0.68);
  --theme-surface-a800:rgba(29,36,43,0.8);
  --theme-surface-a820:rgba(29,36,43,0.82);
  --theme-surface-a860:rgba(29,36,43,0.86);
  --theme-surface-a941:rgba(29,36,43,0.9412);
  --theme-surface-a960:rgba(29,36,43,0.96);
  --theme-surface-a970:rgba(29,36,43,0.97);
  --theme-surface-a980:rgba(29,36,43,0.98);
  --theme-surface-a990:rgba(29,36,43,0.99);
  --theme-tool:#11171c;
  --theme-tool-a102:rgba(17,23,28,0.102);
  --theme-tool-a320:rgba(17,23,28,0.32);
  --theme-tool-a333:rgba(17,23,28,0.3333);
  --theme-tool-a420:rgba(17,23,28,0.4196);
  --theme-tool-a460:rgba(17,23,28,0.46);
  --theme-tool-a620:rgba(17,23,28,0.62);
  --theme-tool-a680:rgba(17,23,28,0.68);
  --theme-tool-a702:rgba(17,23,28,0.702);
  --theme-tool-a878:rgba(17,23,28,0.8784);
}

/* Tools use the same square, gap and baseline as the existing calculator/up. */
body .theme-toggle {
  position:fixed; z-index:919;
  right:calc(var(--smc-tool-right,24px) + var(--smc-tool-size,44px) + 8px);
  bottom:var(--smc-tool-bottom,24px); width:var(--smc-tool-size,44px); height:var(--smc-tool-size,44px);
  display:grid; place-items:center; padding:10px; border:1px solid #171a1f; border-radius:5px;
  background:#171a1f; color:#fff; cursor:pointer;
}
body:not([data-metal-calculator]) .theme-toggle,body.branch-view .theme-toggle { right:var(--smc-tool-right,24px); }
body .theme-toggle svg { width:22px; height:22px; }
body .theme-toggle:hover { border-color:#d3af74; background:#2b3037; }
body .theme-toggle:focus-visible { outline:2px solid #d3af74; outline-offset:3px; }
body .back-to-top { right:calc(var(--smc-tool-right,24px) + var(--smc-tool-size,44px) + 8px); }
body[data-metal-calculator]:not(.branch-view) .back-to-top { right:calc(var(--smc-tool-right,24px) + 2 * (var(--smc-tool-size,44px) + 8px)); }
body:has(.calculator-surface.is-open) .theme-toggle,
body.request-open .theme-toggle,body.mobile-sheet-open .theme-toggle,
body:has(.mobile-marketplace.has-overlay) .theme-toggle { visibility:hidden; }
html[data-theme=dark] { background:#171c21; }
html[data-theme=dark] body { background:#171c21; }
html[data-theme=dark] body .theme-toggle,html[data-theme=dark] body .calculator-surface:not(.is-open),html[data-theme=dark] body .back-to-top { background:#252e37; border-color:#667481; color:#f4f6f8; }
html[data-theme=dark] body .back-to-top span { border-color:#f4f6f8; }
/* Metal photography must not blend with a dark surface. No brightness/inversion. */
html[data-theme=dark] :is(.shape-button,.product-main,.group-title,.details-product-visual,.m-product-thumb,.m-category-tile,.group-subforms,.mc-shapes,.mobile-shape-options) img { mix-blend-mode:normal!important; }
html[data-theme=dark] .details-product-visual { background:#252e37; }
html[data-theme=dark] .cert-mark { mix-blend-mode:normal; }
html[data-theme=dark] .cert-mark--rs,html[data-theme=dark] .cert-mark--iso { background:#f3f5f6; border-radius:4px; }
/* Preserve the original brand art and its yellow; the supplied asset has dark type. */
html[data-theme=dark] :is(.brand,.footer-brand,.company-brand,.home-header h1) img { mix-blend-mode:normal; filter:url(#smc-theme-logo); }
html[data-theme=dark] .opening-logo-original { mix-blend-mode:normal; filter:url(#smc-theme-logo); }
html[data-theme=dark] .direction:is(:hover,:focus-visible,.is-preview) .direction-arrow { color:#273029; }
html[data-theme=dark] :is(.stock-status,.m-product-meta>b) { color:#85caaa; }
html[data-theme=dark] .stock-status.is-production { color:#e2bb7d; }
/* Browser-native snapshots fade as one layer, without affecting scroll/layout. */
::view-transition-old(root) { z-index:1; animation:smc-theme-out 180ms ease both; mix-blend-mode:normal; }
::view-transition-new(root) { z-index:0; animation:none; mix-blend-mode:normal; }
::view-transition-group(root) { animation-duration:180ms; }
@keyframes smc-theme-out { to { opacity:0; } }
@media(max-width:900px) {
  /* A fixed control belongs above navigation, outside the warehouse/search header. */
  body .theme-toggle { bottom:var(--smc-tool-bottom,calc(82px + env(safe-area-inset-bottom))); }
  body:not([data-metal-calculator]) { --smc-tool-right:16px; --smc-tool-size:42px; --smc-tool-bottom:20px; }
}
@media(prefers-reduced-motion:reduce) { ::view-transition-old(root),::view-transition-new(root),::view-transition-group(root) { animation:none; } }
html[data-theme=dark] #company-title img { mix-blend-mode:normal; filter:url(#smc-theme-logo); }
