/* Adaptive palette layer v3. Loaded AFTER declarative theme styles. */
html { color-scheme: light dark; }
html[data-color-resolved="light"] { color-scheme: light; }
html[data-color-resolved="dark"] { color-scheme: dark; }
/* Each established theme retains its own identity; layout selectors are untouched. */
html[data-color-resolved="light"] body[data-theme="original"] {--bg:#f1f3f4;--ink:#1c2429;--soft:#50616a;--accent:#267d83;--panel:#e1e7e9;--line:#aebdc3}
html[data-color-resolved="dark"] body[data-theme="original"] {--bg:#101317;--ink:#f4f5f5;--soft:#aebdc4;--accent:#8bd6d5;--panel:#20272c;--line:#4a565d}
html[data-color-resolved="light"] body[data-theme="obsidian"] {--bg:#f0f6f3;--ink:#193027;--soft:#4b6257;--accent:#28785d;--panel:#e0eae4;--line:#a9c2b5}
html[data-color-resolved="dark"] body[data-theme="obsidian"] {--bg:#11171a;--ink:#f6f4e9;--soft:#abb6b3;--accent:#aee7c1;--panel:#1f292c;--line:#52615b}
html[data-color-resolved="light"] body[data-theme="atelier"] {--bg:#f3efe6;--ink:#292a26;--soft:#666159;--accent:#9d4634;--panel:#e8dfd1;--line:#bcb1a2}
html[data-color-resolved="dark"] body[data-theme="atelier"] {--bg:#201e1d;--ink:#f6eadd;--soft:#d0bfb1;--accent:#ffad91;--panel:#322b28;--line:#68564d}
html[data-color-resolved="light"] body[data-theme="nexus"] {--bg:#ebf3ff;--ink:#12264d;--soft:#4c6283;--accent:#145ea8;--panel:#dce9fd;--line:#a6b9d5}
html[data-color-resolved="dark"] body[data-theme="nexus"] {--bg:#080f29;--ink:#f5f9ff;--soft:#b2c3e5;--accent:#71d7ff;--panel:#112247;--line:#3a4f7c}
html[data-color-resolved="light"] body[data-theme="offset"] {--bg:#eeeae0;--ink:#1c1a19;--soft:#625c59;--accent:#bc391b;--panel:#e0d9cc;--line:#a9a091}
html[data-color-resolved="dark"] body[data-theme="offset"] {--bg:#211e1b;--ink:#f1ebe1;--soft:#c4b8ac;--accent:#ff8963;--panel:#302b25;--line:#776a5d}
html[data-color-resolved="light"] body[data-theme="signal"] {--bg:#f1f3e6;--ink:#252e22;--soft:#515c4d;--accent:#416d00;--panel:#e3e7d6;--line:#a8b49a}
html[data-color-resolved="dark"] body[data-theme="signal"] {--bg:#111610;--ink:#e6ead7;--soft:#acb99c;--accent:#c2fa57;--panel:#1c2419;--line:#69715c}
html[data-color-resolved="light"] body[data-theme="drift"] {--bg:#f5eddb;--ink:#263328;--soft:#536051;--accent:#96500c;--panel:#e7dfc9;--line:#b4b7a5}
html[data-color-resolved="dark"] body[data-theme="drift"] {--bg:#202b23;--ink:#f5eddb;--soft:#d0c6b2;--accent:#f1b976;--panel:#374238;--line:#7e877c}
html[data-color-resolved="light"] body[data-theme="parallax"] {--bg:#eaf0f7;--ink:#17283d;--soft:#57687b;--accent:#b85515;--panel:#d8e5f1;--line:#9dadc0}
html[data-color-resolved="dark"] body[data-theme="parallax"] {--bg:#0b1424;--ink:#f3f4f4;--soft:#abbace;--accent:#f19651;--panel:#162a3e;--line:#4a5f76}
html[data-color-resolved="light"] body:not([data-theme="original"],[data-theme="obsidian"],[data-theme="atelier"],[data-theme="nexus"],[data-theme="offset"],[data-theme="signal"],[data-theme="drift"],[data-theme="parallax"]){--bg:color-mix(in srgb,var(--dw-source-bg,#cccccc) 22%,#f5f5f1);--ink:color-mix(in srgb,var(--dw-source-ink,#222222) 75%,#192626);--soft:#506063;--accent:var(--dw-source-accent,#236a7a);--panel:color-mix(in srgb,var(--dw-source-panel,#dddddd) 28%,#eceee9);--line:color-mix(in srgb,var(--dw-source-line,#aaaaaa) 32%,#b8c3c0)}
html[data-color-resolved="dark"] body:not([data-theme="original"],[data-theme="obsidian"],[data-theme="atelier"],[data-theme="nexus"],[data-theme="offset"],[data-theme="signal"],[data-theme="drift"],[data-theme="parallax"]){--bg:color-mix(in srgb,var(--dw-source-bg,#222222) 24%,#11171b);--ink:color-mix(in srgb,var(--dw-source-ink,#eeeeee) 20%,#f0f2f0);--soft:#aebfc3;--accent:var(--dw-source-accent,#82cfcd);--panel:color-mix(in srgb,var(--dw-source-panel,#333333) 32%,#232c31);--line:color-mix(in srgb,var(--dw-source-line,#666666) 30%,#48555d)}
/* Keep the hero photographic and readable while surrounding surfaces change. */
body[data-theme="original"] .hero { background:#11171b; }
body[data-theme="original"] .hero-copy,body[data-theme="original"] .hero .lead { color:#fff; }
body[data-theme="original"] .hero .eyebrow { color:#e1e7e7; }
/* Previously fixed dark panels now follow the active palette. */
html[data-color-resolved] .switcher { background:var(--panel);color:var(--ink);border-color:var(--line); }
html[data-color-resolved] .switcher button { color:var(--ink); }
html[data-color-resolved] .switcher button[aria-pressed="true"] { background:var(--accent);color:var(--bg); }
html[data-color-resolved] .switcher label,html[data-color-resolved] .switcher small { color:var(--soft); }
html[data-color-resolved] .color-preference select { background:var(--panel);color:var(--ink);border-color:var(--line); }
html[data-color-resolved] .contact-form input,html[data-color-resolved] .contact-form textarea { background:var(--panel);color:var(--ink); }
html[data-color-resolved] .section,html[data-color-resolved] .footer { border-color:var(--line); }
html[data-color-resolved] body { background-color:var(--bg);color:var(--ink);transition:background-color .3s,color .3s; }
