/* Five paired inks, drawn from the reference. Mono keeps its original chapter. */
html[data-theme="lime"] { --theme-paper:#0d1807; --theme-deep:#070e04; --theme-ink:#f4f8ee; --theme-muted:#afbea2; --theme-accent:#91ed57; --theme-signal:#ee70f5; }
html[data-theme="orchid"] { --theme-paper:#1c1020; --theme-deep:#100912; --theme-ink:#faf2fa; --theme-muted:#c1aec3; --theme-accent:#e887f0; --theme-signal:#ffcb35; }
html[data-theme="ember"] { --theme-paper:#20120b; --theme-deep:#120a06; --theme-ink:#fcf3ee; --theme-muted:#c6afa0; --theme-accent:#ff935b; --theme-signal:#35d2eb; }
html[data-theme="amber"] { --theme-paper:#1c1606; --theme-deep:#100c03; --theme-ink:#faf6e9; --theme-muted:#beb497; --theme-accent:#f7c43f; --theme-signal:#e878f1; }
html[data-theme="cyan"] { --theme-paper:#071b1e; --theme-deep:#041012; --theme-ink:#edf8f8; --theme-muted:#a0bcc0; --theme-accent:#39d2e7; --theme-signal:#8cf43f; }

html[data-theme]:not([data-theme="mono"]) body.editorial.atelier {
  --paper:var(--theme-paper); --ink:var(--theme-ink); --muted:var(--theme-muted);
  --accent:var(--theme-accent); --signal:var(--theme-signal);
  --pale:color-mix(in srgb,var(--paper),var(--accent) 7%);
  --hairline:color-mix(in srgb,var(--paper),var(--accent) 24%);
  color-scheme:dark;
}
html[data-theme]:not([data-theme="mono"]) body.atelier.is-dark-chapter { --paper:var(--theme-deep); }
html[data-theme]:not([data-theme="mono"]) .atelier ::selection { background:var(--accent); color:var(--paper); }
html[data-theme]:not([data-theme="mono"]) .atelier :focus-visible { outline-color:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .brand-pill { background:var(--paper); border-color:var(--hairline); box-shadow:0 4px 24px #0002; }
html[data-theme]:not([data-theme="mono"]) .atelier .brand-pill:hover { background:var(--paper); border-color:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .hero-title strong { color:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .color-wave.in-view .wave-char { animation-name:paired-ink-wave; }
@keyframes paired-ink-wave { 0%,100% { color:inherit; } 35% { color:var(--signal); } 65% { color:var(--accent); } }
html[data-theme]:not([data-theme="mono"]) .atelier :is(.status-dot,.primary-link .action-square) { background:var(--signal); }
html[data-theme]:not([data-theme="mono"]) .atelier :is(.hero-notation,.discipline-mark .tech-glyph,.process-line .tech-glyph,.contact-mechanism) { color:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .tech-glyph .mechanism-secondary,
html[data-theme]:not([data-theme="mono"]) .atelier .tech-glyph [fill="currentColor"] { color:var(--signal); }
html[data-theme]:not([data-theme="mono"]) .atelier .quiet-link:hover { color:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .preview-cursor { background:var(--paper); color:var(--ink); border-color:var(--hairline); }
html[data-theme]:not([data-theme="mono"]) .atelier .page-sweep { --transition-color:var(--paper); }

/* Keep the diagram's construction legible; only its ink and materials change. */
html[data-theme]:not([data-theme="mono"]) .atelier .layer-study { --layer-ink:var(--ink); background:var(--paper); border-color:var(--hairline); }
html[data-theme]:not([data-theme="mono"]) .atelier .layer-study::before { background-image:linear-gradient(color-mix(in srgb,var(--accent),transparent 97%) 1px,transparent 1px),linear-gradient(90deg,color-mix(in srgb,var(--accent),transparent 97%) 1px,transparent 1px); }
html[data-theme]:not([data-theme="mono"]) .atelier .layer-study-header .tech-glyph { color:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .plane>polygon:first-child { fill:var(--paper); stroke:var(--hairline); }
html[data-theme]:not([data-theme="mono"]) .atelier .plane-surface { fill:var(--pale); stroke:var(--hairline); }
html[data-theme]:not([data-theme="mono"]) .atelier .plane-detail { stroke:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .plane.is-active .plane-surface { fill:color-mix(in srgb,var(--paper),var(--accent) 15%); stroke:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .plane.is-active .plane-detail { stroke:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .plane-node { fill:var(--paper); stroke:var(--signal); }
html[data-theme]:not([data-theme="mono"]) .atelier .plane.is-active .plane-node { fill:var(--signal); stroke:var(--signal); }
html[data-theme]:not([data-theme="mono"]) .atelier .plane [fill="#e8e8e8"] { fill:var(--signal); }
html[data-theme]:not([data-theme="mono"]) .atelier .layer-leader { stroke:var(--hairline); }
html[data-theme]:not([data-theme="mono"]) .atelier .plane.is-active .layer-leader { stroke:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .layer-axis { stroke:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier :is(.layer-type,.layer-number) { fill:var(--muted); }
html[data-theme]:not([data-theme="mono"]) .atelier .plane.is-active .layer-type { fill:var(--ink); }
html[data-theme]:not([data-theme="mono"]) .atelier .layer-controls { border-color:var(--hairline); }
html[data-theme]:not([data-theme="mono"]) .atelier :is(.layer-controls button,.layer-caption) { color:var(--muted); }
html[data-theme]:not([data-theme="mono"]) .atelier .layer-controls button[aria-pressed="true"] { color:var(--accent); }
html[data-theme]:not([data-theme="mono"]) .atelier .layer-controls button::before { background:var(--accent); }

html[data-theme]:not([data-theme="mono"]) .atelier .work-gate-form input { background:var(--pale); color:var(--ink); }
html[data-theme]:not([data-theme="mono"]) .atelier .work-gate-form input::placeholder { color:var(--muted); }
html[data-theme]:not([data-theme="mono"]) .atelier .work-gate-form input:focus { border-color:var(--accent); outline-color:var(--accent); }
/* The legacy error rule is important; preserve its priority with readable ink. */
html[data-theme]:not([data-theme="mono"]) .atelier .work-gate-error { color:var(--signal) !important; }
html[data-theme]:not([data-theme="mono"]) .atelier .work-gate-form input:focus { box-shadow:0 0 0 3px color-mix(in srgb,var(--accent),transparent 85%); }
html[data-theme]:not([data-theme="mono"]) .atelier .work-meta-row { background:var(--pale); color:var(--muted); }
html[data-theme]:not([data-theme="mono"]) .atelier .work-view-toggle { background:var(--paper); color:var(--ink); }
html[data-theme]:not([data-theme="mono"]) .atelier :is(.button-dark,.button-light) { background:var(--accent); color:var(--paper); }
html[data-theme]:not([data-theme="mono"]) .atelier :is(.button-dark,.button-light):hover { background:var(--ink); color:var(--paper); }

/* One compact, keyboard-accessible palette selector inside the existing menu. */
.atelier .theme-picker { margin:0 30px 24px; padding-top:4px; }
.atelier .theme-picker-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:14px; color:var(--muted); font:400 11px/1.5 Inter,sans-serif; letter-spacing:.035em; }
.atelier .theme-current { letter-spacing:0; text-align:right; }
.atelier .theme-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.atelier .theme-option { display:flex; align-items:center; gap:10px; min-width:0; min-height:48px; padding:10px 12px; border:1px solid var(--hairline); border-radius:3px; background:transparent; color:var(--muted); font:400 13px/1.3 Inter,sans-serif; cursor:pointer; transition:border-color .2s,color .2s,background .2s; }
.atelier .theme-option:hover { background:var(--pale); color:var(--ink); }
.atelier .theme-option[aria-checked="true"] { border-color:var(--accent); color:var(--ink); background:var(--pale); }
.atelier .theme-option:focus-visible { outline:2px solid var(--ink); outline-offset:3px; }
.atelier .theme-swatch { width:19px; height:19px; position:relative; flex:0 0 19px; background:var(--swatch-paper); border:1px solid var(--swatch-a); }
.atelier .theme-swatch::before { content:''; position:absolute; top:3px; bottom:3px; left:4px; border-left:1px solid var(--swatch-a); }
.atelier .theme-swatch::after { content:''; position:absolute; width:6px; height:6px; right:3px; top:5px; background:var(--swatch-b); }
.atelier [data-theme-choice="mono"] { --swatch-paper:#141414; --swatch-a:#a3a3a3; --swatch-b:#fff; }
.atelier [data-theme-choice="lime"] { --swatch-paper:#0d1807; --swatch-a:#91ed57; --swatch-b:#ee70f5; }
.atelier [data-theme-choice="orchid"] { --swatch-paper:#1c1020; --swatch-a:#e887f0; --swatch-b:#ffcb35; }
.atelier [data-theme-choice="ember"] { --swatch-paper:#20120b; --swatch-a:#ff935b; --swatch-b:#35d2eb; }
.atelier [data-theme-choice="amber"] { --swatch-paper:#1c1606; --swatch-a:#f7c43f; --swatch-b:#e878f1; }
.atelier [data-theme-choice="cyan"] { --swatch-paper:#071b1e; --swatch-a:#39d2e7; --swatch-b:#8cf43f; }
body.atelier.menu-open .mobile-menu-panel { max-height:calc(100dvh - 48px); overflow-y:auto; overscroll-behavior:contain; }
@media(max-width:640px) {
  body.atelier.menu-open .mobile-menu-panel { max-height:calc(100dvh - 32px); }
  .atelier .theme-option { gap:7px; padding:10px 8px; font-size:12px; }
}
@media(max-width:360px) {
  .atelier .theme-picker { margin-inline:20px; }
  .atelier .theme-picker-heading { gap:8px; font-size:10px; }
  .atelier .theme-option { gap:6px; padding-inline:6px; }
}
@media(prefers-reduced-motion:reduce) { .atelier .theme-option { transition:none; } }

/* Remove the old frosted header's white inset highlight. */
body.atelier .mobile-menu-top { box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none; }
body.atelier .mobile-menu-nav a,
body.atelier .mobile-menu-nav a:is(:hover,:focus-visible,.is-active),
body.atelier .mobile-menu-nav:hover a.is-active:not(:hover) { background:transparent; }
body.atelier .mobile-menu-nav a:is(:hover,:focus-visible) { color:var(--accent); }
body.atelier .mobile-menu-nav a.is-active:not(:hover):not(:focus-visible) { color:var(--ink); }
body.atelier .mobile-menu-nav a:focus-visible { outline:1px solid var(--accent); outline-offset:-4px; }
body.atelier .theme-option:hover { background:transparent; color:var(--ink); }
body.atelier .theme-option[aria-checked="true"]:hover { background:var(--pale); }
html[data-theme] body.atelier .brand-pill:hover { background:var(--paper); }
