:root{--bg:#f1eee4;--fg:#141412;--muted:#55524a;--grey:#8a8579;--pale:#b9b3a3;--rule:#ddd7c8;--hi:#d2f25a;color-scheme:light}
:root[data-theme=dark]{--bg:#1b1815;--fg:#f1eee4;--muted:#cbc5b6;--grey:#948d80;--pale:#5f594f;--rule:#2f2b26;--hi:#5a6b1c;color-scheme:dark}
html{background:var(--bg);color:var(--fg)}
.switch{position:fixed;top:clamp(1.25rem,4vw,2.5rem);right:clamp(1.75rem,7vw,6rem);z-index:5;width:22px;height:34px;padding:0;border:1px solid var(--pale);border-radius:5px;background:transparent;cursor:pointer;transition:border-color .2s}
/* On list pages the switch lives in the title header. It sticks to the top
   only while that header is on screen, then scrolls away with the title. */
body.sub .switch{position:sticky;top:clamp(1.25rem,4vw,2.5rem);right:auto;grid-column:2;grid-row:1;align-self:start;justify-self:end}
.switch:hover{border-color:var(--grey)}
.switch:focus-visible{outline:1px solid var(--grey);outline-offset:3px}
.switch::before,.switch::after{content:"";position:absolute;left:50%;width:2px;height:2px;border-radius:50%;background:var(--pale);transform:translateX(-50%)}
.switch::before{top:3px}.switch::after{bottom:3px}
.lever{position:absolute;left:50%;top:6px;width:8px;height:12px;margin-left:-4px;border-radius:2px;background:var(--grey);transition:top .16s cubic-bezier(.5,2.2,.55,1),background .2s}
:root[data-theme=dark] .lever{top:14px}
.switch:active .lever{transform:scaleY(.85)}
.dim{position:fixed;inset:0;z-index:4;pointer-events:none;opacity:0}
.dim.off{background:#0c0a08;animation:off .38s steps(1,end) 1,offfade .38s ease-out 1}
.dim.on{background:#fff6dc;animation:on .32s ease-out 1}
@keyframes off{0%{opacity:0}18%{opacity:.92}34%{opacity:.35}50%{opacity:.88}100%{opacity:0}}
@keyframes offfade{to{opacity:0}}
@keyframes on{0%{opacity:0}20%{opacity:.55}40%{opacity:.15}55%{opacity:.4}100%{opacity:0}}
@media (prefers-reduced-motion:reduce){.lever{transition:none}.dim{display:none}}
