/* Light reading mode (rm5). Dark stays the default. Paper is opt-in via the header icon. */
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}}

/* Theme control: a bare icon in the nav, no box or border. 44px tap target, 15px icon. */
button.rm-toggle,.rm-toggle{
  appearance:none;-webkit-appearance:none;
  display:inline-flex;align-items:center;justify-content:center;
  flex:0 0 auto;
  box-sizing:border-box;
  width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;max-width:44px;
  margin:-10px 0 -10px 0;padding:0!important;
  border:0!important;border-radius:0!important;
  background:transparent!important;box-shadow:none!important;
  color:var(--fg,currentColor)!important;opacity:.58;
  cursor:pointer;vertical-align:middle;line-height:1;position:relative;
  text-decoration:none!important;
  transition:color .15s ease,opacity .15s ease;
}
.nav .rm-toggle,.mast .nav .rm-toggle{align-self:center}
button.rm-toggle:hover,.rm-toggle:hover,
button.rm-toggle:focus-visible,.rm-toggle:focus-visible{
  color:var(--accent,currentColor)!important;opacity:1;
  background:transparent!important;border:0!important;box-shadow:none!important;
}
button.rm-toggle:active,.rm-toggle:active{
  color:var(--accent-hi,var(--accent,currentColor))!important;opacity:1;
  background:transparent!important;
}
.rm-toggle:focus{outline:none}
.rm-toggle:focus-visible{outline:2px solid var(--accent,currentColor);outline-offset:2px}
.rm-toggle svg{width:15px;height:15px;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){
  .mast-in > .rm-toggle.rm-in-mast{
    margin:-4px 0 -4px auto;
    align-self:center;
  }
}
.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}
