/* Light reading mode (rm3). Dark stays the default. Paper is opt-in via the header icon button. */
html[data-reading="paper"]{
  color-scheme:light;
  --bg:#f5eedc;--bg-2:#ede4cd;--bg-3:#e4dac0;--bg-4:#d9ceb2;
  --fg:#241f17;--fg-2:#4a4235;--fg-3:#665c4a;
  --paper:#e8dfc6;--paper-2:#dcd1b3;--ink:#241f17;--ink-2:#4a4235;--ink-3:#665c4a;
  --black:#241f17;--white:#fbf7ec;
  --line:rgba(36,31,23,.14);--line-2:rgba(36,31,23,.32);
  --accent-hi:color-mix(in srgb,var(--accent) 52%,#1a1408);
  --accent-ink:color-mix(in srgb,var(--accent) 45%,#1a1408);
  --accent-dim:color-mix(in srgb,var(--accent) 55%,var(--bg));
  --scrim:color-mix(in srgb,#241f17 55%,transparent);
  --c-a:#8a6a14;--c-b:#2c6f9e;--c-c:#a8432e;--c-mid:#8f8672;
}
html[data-reading="paper"] body{background:var(--bg);color:var(--fg)}
html[data-reading="paper"] ::selection{background:#f1d27a;color:#241f17}
html.rm-fade,html.rm-fade body,html.rm-fade *{transition:background-color .2s ease,color .2s ease,border-color .2s ease!important}
@media (prefers-reduced-motion:reduce){html.rm-fade,html.rm-fade body,html.rm-fade *{transition:none!important}}

/* the control: a 36px rounded square icon button, same box in dark and light */
.rm-toggle{appearance:none;-webkit-appearance:none;display:inline-flex;align-items:center;justify-content:center;flex:0 0 36px;
  width:36px!important;height:36px!important;min-width:36px!important;min-height:36px!important;max-width:36px;margin:0 0 0 6px;padding:0;border:1px solid var(--line-2,rgba(127,127,127,.4));border-radius:9px;
  background:transparent;color:var(--fg-2,currentColor);cursor:pointer;vertical-align:middle;line-height:1;position:relative;
  transition:color .15s ease,background-color .15s ease,border-color .15s ease}
.rm-toggle:hover{color:var(--fg,currentColor);border-color:var(--fg-3,currentColor);background:color-mix(in srgb,var(--fg,#fff) 8%,transparent)}
.rm-toggle:active{background:color-mix(in srgb,var(--fg,#fff) 14%,transparent)}
.rm-toggle:focus-visible{outline:2px solid var(--accent-hi,#56bcdc);outline-offset:2px}
.rm-toggle svg{width:18px;height:18px;display:block;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.rm-toggle .rm-moon{display:none}
html[data-reading="paper"] .rm-toggle .rm-sun{display:none}
html[data-reading="paper"] .rm-toggle .rm-moon{display:block}
@media (prefers-reduced-motion:reduce){.rm-toggle{transition:none}}
@media (max-width:640px){.rm-toggle{margin-left:4px}.rm-toggle.rm-corner{position:absolute;top:6px;right:max(var(--pad,16px),12px);margin:0;z-index:2}}
.rm-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* readable pieces on paper */
html[data-reading="paper"] .mast{background:color-mix(in srgb,var(--bg) 86%,transparent)!important;border-bottom-color:var(--line-2)!important}
html[data-reading="paper"] img,html[data-reading="paper"] svg image,html[data-reading="paper"] iframe,html[data-reading="paper"] video{filter:none}
html[data-reading="paper"] .sg-btn,html[data-reading="paper"] button.sg-btn{color:#241f17}
html[data-reading="paper"] .mast .mast-in a.wordmark{color:color-mix(in srgb,var(--accent,#1591b8) 55%,#1a1408)!important}
html[data-reading="paper"] .mast .nav a[data-subscribe]{color:var(--accent-hi)!important;text-decoration-color:var(--accent-hi)!important}
html[data-reading="paper"] .csec,html[data-reading="paper"] .csec+.csec,html[data-reading="paper"] .csec+.csec+.csec{background:color-mix(in srgb,var(--c-a) 7%,var(--bg))!important}
html[data-reading="paper"] .ts-exit i{background:var(--bg)}
html[data-reading="paper"] sup.cite a,html[data-reading="paper"] .gd sup.cite a{color:var(--accent-ink)}
html[data-reading="paper"] .tgroup-l,html[data-reading="paper"] .tgroup:nth-of-type(n) .tgroup-l{color:color-mix(in srgb,var(--c-a) 55%,#1a1408)!important}
html[data-reading="paper"] .clabel,html[data-reading="paper"] .csec .clabel,html[data-reading="paper"] .chead .clabel{color:color-mix(in srgb,var(--accent,#8a6a14) 50%,#1a1408)!important}

/* Cowen only: the page paints its section bands in fixed near-black, so map them to paper tones in light mode */
html[data-reading="paper"] #topics,html[data-reading="paper"] #latest,html[data-reading="paper"] #questions,
html[data-reading="paper"] .ins #ideas,html[data-reading="paper"] .ins #people,html[data-reading="paper"] .ins #books,
html[data-reading="paper"] .ins #visit,html[data-reading="paper"] .ins #countries{background:var(--bg-2)!important}
html[data-reading="paper"] #gems,html[data-reading="paper"] #start,html[data-reading="paper"] #people,html[data-reading="paper"] #collection,
html[data-reading="paper"] .ins #questions,html[data-reading="paper"] .ins #facts,html[data-reading="paper"] section[aria-labelledby="yb-h"]{background:var(--bg)!important}
html[data-reading="paper"] #more{background:var(--bg-3)!important}
