/* Reading palettes. The original night palette remains untouched. */
:root{
  --theme-control-bg:#121a27;
  --theme-control-fg:#e8dfce;
  --theme-control-muted:#a7b0c0;
  --theme-control-border:#695d43;
  --theme-control-accent:#d2b783;
  --theme-control-shadow:0 14px 45px #0006;
}
html[data-theme="blue"]{
  color-scheme:dark;
  --paper:#091a30;--ink:#e4eaf0;--muted:#a6b4c7;--green:#bad0e6;--green-hover:#d1e2f2;--rule:#35475c;--wash:#10253d;--white:#163049;
  --palette-bg:#091a30;--palette-surface:#10253d;--palette-surface-soft:#10253dd9;--palette-surface-hover:#173149;
  --palette-ink:#e4eaf0;--palette-body:#bac8d9;--palette-muted:#a6b4c7;--palette-accent:#bad0e6;--palette-accent-hover:#e0ecf7;
  --palette-heading:#edf0ed;--palette-line:#52667c66;--palette-frame:#65809a80;--palette-button:#b6cde2;--palette-button-ink:#102238;
  --palette-input:#091b30;--palette-select:#87a9c466;--palette-danger:#dfb1a6;--palette-success:#abcbbd;--palette-glow:#9abede26;
  --palette-shadow:0 12px 50px #020a1659;--palette-backdrop:#020a1680;--palette-mark:#abc6df18;--palette-mark-active:#bed8ee35;
  --hover-star:#c9dded;--hover-star-soft:#9ebdd6;
  --theme-control-bg:#10253d;--theme-control-fg:#e4eaf0;--theme-control-muted:#a6b4c7;--theme-control-border:#52667c;--theme-control-accent:#bad0e6;--theme-control-shadow:0 14px 45px #020a1670;
}
html[data-theme="paper"]{
  color-scheme:light;
  --paper:#f4eedf;--ink:#40382f;--muted:#6d5d4c;--green:#795934;--green-hover:#634627;--rule:#cbbca5;--wash:#ebe2d1;--white:#f9f4e9;
  --palette-bg:#f4eedf;--palette-surface:#ede4d3;--palette-surface-soft:#f8f2e6;--palette-surface-hover:#e8ddc8;
  --palette-ink:#40382f;--palette-body:#53493d;--palette-muted:#6d5d4c;--palette-accent:#795934;--palette-accent-hover:#5f4223;
  --palette-heading:#352f29;--palette-line:#aa947152;--palette-frame:#ae916b99;--palette-button:#795934;--palette-button-ink:#fff9ed;
  --palette-input:#fcf7ed;--palette-select:#c9ad76;--palette-danger:#8e493f;--palette-success:#48664c;--palette-glow:#9d7d4a12;
  --palette-shadow:0 12px 45px #71512a14;--palette-backdrop:#34271955;--palette-mark:#b5914b16;--palette-mark-active:#b5914b38;
  --hover-star:#92703e;--hover-star-soft:#a88a58;
  --theme-control-bg:#f9f3e7;--theme-control-fg:#40382f;--theme-control-muted:#6d5d4c;--theme-control-border:#b8a17d;--theme-control-accent:#795934;--theme-control-shadow:0 14px 45px #71512a24;
}
html:is([data-theme="blue"],[data-theme="paper"]) body{background:var(--palette-bg);color:var(--palette-ink)}
html[data-theme="blue"] body::after{background:radial-gradient(ellipse at 78% 15%,#2647688a,transparent 60%),radial-gradient(ellipse at 8% 75%,#142f4d70,transparent 55%)}
html[data-theme="blue"] .ambient-star{background:#d1e6f8;box-shadow:0 0 6px #a6cbee66}
html[data-theme="blue"] .ambient-star:nth-child(4n){background:#c9d6e0;box-shadow:0 0 6px #bdd2e44d}
/* Paper has no animated sky or drifting layers; a still, faint grain stays at the edge of perception. */
html[data-theme="paper"] body::before{display:none}
html[data-theme="paper"] body::after{background-image:radial-gradient(#a1896020 .5px,transparent .65px);background-size:6px 6px;opacity:.22;transform:none}
html[data-theme="paper"] .ambient-sky{display:none}
html[data-theme="paper"] .hero-shell::before,html[data-theme="paper"] .page-heading::after{display:none}
html[data-theme="paper"] .closing-note{background:none}
html:is([data-theme="blue"],[data-theme="paper"]) ::selection{background:var(--palette-select);color:var(--palette-ink)}
html:is([data-theme="blue"],[data-theme="paper"]) :focus-visible{outline-color:var(--palette-accent)}

/* Shared page chrome, collections and long-form reading. */
html:is([data-theme="blue"],[data-theme="paper"]) :is(.site-header,.home-content,.article-row,.aside-title,.mini-note,.closing-note,.footer-top,.page-heading,.reading-layout,.reading-toc,.toc-note,.next-reading,.note-bottom){border-color:var(--palette-line)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.brand strong,.hero h1,.section-heading h2,.row-body h3,.aside-profile h2,.aside-title h2,.page-heading h1,.note-card h3,.empty-state h2,.about-sidebar h2,.about-prose h2,.read-heading h1,.reading-prose h2,.next-reading strong){color:var(--palette-heading)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.brand-mark,.eyebrow,.hero-copy>.eyebrow,.emphasis,.period,.category,.row-arrow,.text-link,.video-link,.note-bottom a,.art-corner,.aside-title>span,.mini-note .icon,.closing-note>span,.profile-social,.about-links a,.about-opening span,.reading-toc>p,.reading-toc nav a span,.reading-end span,.empty-state>span){color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.brand small,.hero-greeting,.hero-topics,.hero-topics>span:first-child,.hero-art figcaption,.hero-art figcaption span,.hero-footnote,.hero-footnote>span:first-child,.section-count,.section-intro,.row-number,.item-meta,.manuscript-version,.row-body>time,.aside-profile .eyebrow,.mini-note-index,.mini-note small,.site-footer,.footer-brand span,.footer-bottom,.back-top,.collection-status,.collection-status>span,.note-top .note-number,.note-bottom,.meta-separator,.collection-bottom,.about-sidebar>p,.about-sidebar h2 span,.constellation-legend,.back-link,.reading-toc nav a,.toc-note,.reading-end p,.next-reading small){color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.hero-description,.row-body>p,.aside-intro p:not(.eyebrow),.mini-note strong,.closing-note p,.page-heading>p:last-child,.note-card>p,.collection-bottom p,.empty-state p,.interest-list,.about-opening,.about-prose section>p:not(.eyebrow),.read-lead,.reading-prose section>p,.reading-prose ul,.reading-prose ol,.not-found>p:not(.eyebrow)){color:var(--palette-body)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.footer-brand,.reading-prose h3,.reading-prose blockquote){color:var(--palette-ink)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.small-line,.profile-rule,.menu-toggle span){background:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.about-links a,.profile-social,.constellation-legend i,.reading-prose blockquote){border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .primary-nav a[aria-current]::after{background:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .emphasis::after{border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .hero-footnote-line{background:linear-gradient(to right,var(--palette-frame),transparent)}
html:is([data-theme="blue"],[data-theme="paper"]) .primary-nav a{color:var(--palette-body)}
html:is([data-theme="blue"],[data-theme="paper"]) .primary-nav a:is(:hover,[aria-current]){color:var(--palette-accent-hover);text-shadow:none}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.row-body h3 a:hover,.note-card h3 a:hover,.mini-note:hover strong,.next-reading:hover strong,.back-top:hover,.reading-toc nav a:hover,.video-link:hover){color:var(--palette-accent-hover)}
html:is([data-theme="blue"],[data-theme="paper"]) .button-primary{background:var(--palette-button);border-color:var(--palette-button);color:var(--palette-button-ink)}
html:is([data-theme="blue"],[data-theme="paper"]) .button-primary:hover{background:var(--palette-accent-hover);border-color:var(--palette-accent-hover);color:var(--palette-button-ink)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.button-outline,.watch-video){background:var(--palette-surface-soft);border-color:var(--palette-frame);color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.button-outline:hover,.watch-video:hover){background:var(--palette-surface-hover);border-color:var(--palette-accent);color:var(--palette-accent-hover)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.topic,.status){background:var(--palette-surface-soft);border-color:var(--palette-frame);color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) .status-open{color:var(--palette-accent);border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.aside-intro,.note-card,.empty-state){background:var(--palette-surface-soft);border-color:var(--palette-line)}
html:is([data-theme="blue"],[data-theme="paper"]) .note-card:hover{background:var(--palette-surface);border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.illustration-frame,.profile-portrait){background:var(--palette-surface);border-color:var(--palette-frame);box-shadow:var(--palette-shadow)}
html:is([data-theme="blue"],[data-theme="paper"]) .illustration-frame::before{border-color:var(--palette-line)}
html:is([data-theme="blue"],[data-theme="paper"]) .art-corner{text-shadow:none}
html:is([data-theme="blue"],[data-theme="paper"]) .filter-tabs button{color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) .filter-tabs button:hover{background:var(--palette-surface);color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .filter-tabs button[aria-pressed=true]{background:var(--palette-button);color:var(--palette-button-ink)}
html:is([data-theme="blue"],[data-theme="paper"]) .search-field{color:var(--palette-muted);border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .search-field input{color:var(--palette-ink)}
html:is([data-theme="blue"],[data-theme="paper"]) .search-field input::placeholder{color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.preview-note,.manuscript-note){background:var(--palette-surface);border-left-color:var(--palette-frame);color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.preview-note>span,.manuscript-note span){color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .reading-prose{background:transparent;box-shadow:none}
html[data-theme="blue"] .reading-prose{background:#0a1b30e8;box-shadow:0 0 35px 35px #0a1b3080}
html:is([data-theme="blue"],[data-theme="paper"]) .skip-link{color:var(--palette-button-ink)}
html:is([data-theme="blue"],[data-theme="paper"]) .constellation-node{filter:none}

/* Private annotations: selected text, floating menu, editor and records drawer. */
html:is([data-theme="blue"],[data-theme="paper"]) .rn-entry{color:var(--palette-accent);background:var(--palette-mark);border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-entry:hover{background:var(--palette-mark-active);border-color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-entry-count{background:var(--palette-mark);color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-hint,.rn-eyebrow,.rn-private-note,.rn-empty,.rn-item-meta,.rn-export-note){color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-mark{background:var(--palette-mark);border-color:var(--palette-accent);box-shadow:inset 0 -4px 0 var(--palette-mark)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-mark-note{background:var(--palette-mark);border-bottom-color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-mark:is(:hover,:focus-visible){background:var(--palette-mark-active)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-mark-located{background:var(--palette-mark-active)!important;box-shadow:0 0 20px var(--palette-glow)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-toolbar,.rn-toast){background:var(--theme-control-bg);border-color:var(--palette-frame);box-shadow:var(--palette-shadow);color:var(--palette-ink)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-toolbar button{color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-toolbar button+button{border-left-color:var(--palette-line)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-toolbar button:hover{background:var(--palette-mark)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-toolbar button:focus-visible{outline-color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-backdrop{background:var(--palette-backdrop)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-drawer{background:var(--theme-control-bg);color:var(--palette-ink);border-color:var(--palette-frame);box-shadow:var(--palette-shadow)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-drawer-header,.rn-list-heading,.rn-list-item){border-color:var(--palette-line)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-drawer h2{color:var(--palette-heading)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-close,.rn-export,.rn-total,.rn-item-actions button){color:var(--palette-accent);border-color:var(--palette-line)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-close:hover{background:var(--palette-mark)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-storage-status,.rn-anchor-warning,.rn-item-meta .rn-unlocated){color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-storage-status{background:var(--palette-mark);border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-editor{background:var(--palette-surface);border-color:var(--palette-line)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-editor h3{color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-editor blockquote,.rn-item-quote){color:var(--palette-body);border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-editor label,.rn-list-heading h3,.rn-item-note){color:var(--palette-body)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-editor textarea{background:var(--palette-input);color:var(--palette-ink);border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-editor textarea::placeholder{color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-editor textarea:focus{border-color:var(--palette-accent);outline-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-editor-actions button{color:var(--palette-body);border-color:var(--palette-line)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-editor-actions .rn-primary{color:var(--palette-button-ink);background:var(--palette-button);border-color:var(--palette-button)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-editor-actions button:hover{background:var(--palette-mark-active)}
html:is([data-theme="blue"],[data-theme="paper"]) .rn-editor-actions .rn-primary:hover{background:var(--palette-accent-hover)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-editor-actions .rn-delete,.rn-item-actions .rn-item-delete){color:var(--palette-danger)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-export:hover,.rn-item-actions button:hover){color:var(--palette-accent-hover)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-export:disabled,.rn-item-actions button:disabled){color:var(--palette-muted);opacity:.7}

/* Public manuscript discussion, including quotation, fields and confirmation dialog. */
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-section,.rd-list-toolbar,.rd-thread,.rd-replies,.rd-reply+.rd-reply){border-color:var(--palette-line)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-heading .eyebrow,.rd-public-note,.rd-list-label,.rd-load-status,.rd-empty-hint,.rd-comment-meta,.rd-mine,.rd-quote-caption,.rd-draft-note){color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-heading h2,.rd-author,.rd-confirm-dialog h3){color:var(--palette-heading)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-count,.rd-compose-link,.rd-text-button,.rd-empty-star,.rd-kind-badge,.rd-composer h3,.rd-composer-mark,.rd-form-status,.rd-context,.rd-quote-label,.rd-entry){color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-compose-link:hover,.rd-text-button:hover){color:var(--palette-accent-hover)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-intro,.rd-empty,.rd-comment-body,.rd-comment-quote blockquote,.rd-quote-preview blockquote,.rd-confirm-dialog p){color:var(--palette-body)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-count,.rd-mine,.rd-kind-badge,.rd-context){border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-kind-badge{background:var(--palette-mark)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-kind-badge.rd-resolved{color:var(--palette-success);border-color:var(--palette-success);background:transparent}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-storage-notice,.rd-is-error){background:var(--palette-surface);border-color:var(--palette-frame);color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-is-error button{color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-avatar{background:var(--palette-surface);border-color:var(--palette-frame);color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-comment-actions .rd-danger,.rd-comment-actions .rd-danger:hover){color:var(--palette-danger)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-comment-quote,.rd-quote-preview){background:var(--palette-surface);border-left-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-composer{background:var(--palette-surface-soft);border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-form label{color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-form input,.rd-form select,.rd-form textarea){color:var(--palette-ink);background:var(--palette-input);border-color:var(--palette-frame)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-form select{color-scheme:inherit}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-form input:focus,.rd-form select:focus,.rd-form textarea:focus){border-color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-form textarea::placeholder,
html:is([data-theme="blue"],[data-theme="paper"]) .rd-form input::placeholder{color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-draft-note.rd-edit-warning{color:var(--palette-accent)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-submit{background:var(--palette-button);color:var(--palette-button-ink);border-color:var(--palette-button)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-submit:hover{background:var(--palette-accent-hover);box-shadow:0 0 18px var(--palette-glow)}
html:is([data-theme="blue"],[data-theme="paper"]) .reading-prose>section.rd-quoted-target{box-shadow:-10px 0 0 var(--palette-frame);background:linear-gradient(to right,var(--palette-mark),transparent 85%)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-confirm-dialog{background:var(--theme-control-bg);border-color:var(--palette-frame);color:var(--palette-ink);box-shadow:var(--palette-shadow)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-confirm-dialog::backdrop{background:var(--palette-backdrop)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-delete-confirm{background:var(--palette-danger);color:var(--palette-bg)}

@media(max-width:600px){
  html:is([data-theme="blue"],[data-theme="paper"]) .primary-nav{background:var(--theme-control-bg);border-color:var(--palette-frame);box-shadow:var(--palette-shadow)}
  html[data-theme="blue"] .reading-prose{background:transparent;box-shadow:none}
}
@media print{
  html:is([data-theme="blue"],[data-theme="paper"]) body::after{display:none}
  html:is([data-theme="blue"],[data-theme="paper"]) .reading-prose{background:transparent;box-shadow:none}
  html:is([data-theme="blue"],[data-theme="paper"]) :is(.read-heading h1,.read-lead,.reading-prose h2,.reading-prose h3,.reading-prose section>p,.reading-prose ul,.reading-prose ol,.reading-prose blockquote,.reading-end span,.reading-end p){color:#000}
  html:is([data-theme="blue"],[data-theme="paper"]) .manuscript-note{color:#333;background:transparent;border-color:#888}
  html:is([data-theme="blue"],[data-theme="paper"]) .manuscript-note span{color:#333}
  html:is([data-theme="blue"],[data-theme="paper"]) :is(.rn-mark,.rn-mark-located){background:transparent!important;box-shadow:none;border-color:#777}
}

/* Sharing a private mark remains readable in each alternate palette. */
html:is([data-theme="blue"],[data-theme="paper"]) .rd-share-notice{color:var(--palette-accent);border-color:var(--palette-frame);background:var(--palette-mark)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-share-quote-notice,.rd-body-guidance){color:var(--palette-muted)}
html:is([data-theme="blue"],[data-theme="paper"]) :is(.rd-body-limit,.rd-body-count.rd-over-limit){color:var(--palette-danger)}
html:is([data-theme="blue"],[data-theme="paper"]) .rd-form textarea[aria-invalid=true]{border-color:var(--palette-danger)}
