/* Appearance applies only on screen. Tale print layouts and downloadable PDFs stay white. */
@media screen {
 :root[data-theme="dark"]:not(.tale-sheet) { color-scheme:dark; --ink:#ece8df; --ink-soft:#b7b9af; --paper:#202824; --parch:#29332d; --desk:#151c18; --gold:#d6b875; --gold-2:#e4c987; --teal:#8dc8ba; --rule:rgba(229,235,220,.23); }
 .site-appearance-bar { display:flex; justify-content:flex-end; padding:8px max(18px,calc((100% - 1132px)/2)); background:var(--paper,#fff); border-bottom:1px solid var(--rule,#ddd); }
 .site-theme-toggle { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:36px; padding:7px 12px; border:1px solid var(--rule,#b7b9af); background:var(--paper,#fff); color:var(--ink,#23201c); font:12px/1.4 Consolas,monospace; cursor:pointer; }
 .site-theme-toggle[aria-pressed="true"] { background:#355449; border-color:#89b8a4; color:#f0eee5; }
 .site-theme-toggle:focus-visible { outline:2px solid var(--teal,#2f7f96); outline-offset:3px; }
 .sheet-theme-toggle { position:fixed; right:12px; bottom:12px; z-index:2147483647; box-shadow:0 2px 10px #0003; }
 :root[data-theme="dark"] .collection-mast,:root[data-theme="dark"] .library-filters,:root[data-theme="dark"] .listening { background:#202824; }
 :root[data-theme="dark"] .collection-note { background:#29352d; border-color:var(--rule); box-shadow:7px 7px 0 #111a14; }
 :root[data-theme="dark"] .collection-stats { border-color:var(--rule); }
 :root[data-theme="dark"] .hero-total strong { color:#a4d5bd; }
 :root[data-theme="dark"] .library-filters select,:root[data-theme="dark"] .listen-options select,:root[data-theme="dark"] .reader-controls button,:root[data-theme="dark"] .reader-controls>a,:root[data-theme="dark"] .listen-options button,:root[data-theme="dark"] .save-story { background:var(--paper); color:var(--ink); }
 :root[data-theme="dark"] .reader-controls [aria-pressed="true"],:root[data-theme="dark"] .save-story[aria-pressed="true"] { background:#355449; color:#f0eee5; }
 :root[data-theme="dark"] .story-status { color:#dfc482; }
 :root[data-theme="dark"] #audio-message { color:#f0bba4; }
 :root[data-theme="dark"] body.reader,:root[data-theme="dark"] .reader.text-mode .stage { background:#141b17; }
 :root[data-theme="dark"] .reading-text { background:#202824; color:#ece8df; }
 :root[data-theme="dark"] .reading-text blockquote { background:#2c372c; }
 :root[data-theme="dark"] .pager { background:#202824; color:var(--ink); border-top:1px solid var(--rule); }
 :root[data-theme="dark"] .pager a,:root[data-theme="dark"] .pager .mid,:root[data-theme="dark"] #storage-note { color:#d9ded1; }
 :root[data-theme="dark"] .langtab.on .tabplay { color:#24352c; }
 :root[data-theme="dark"] .tabs button[aria-selected="true"] .n { color:#24352c; }
 /* Invert only the A4 paper on screen; reverse the filter on artwork to retain its colours. */
 :root[data-theme="dark"].tale-sheet { background:#151c18; color-scheme:dark; }
 :root[data-theme="dark"].tale-sheet .page { filter:invert(1); }
 :root[data-theme="dark"].tale-sheet .page img { filter:invert(1); }
}
@media print {
 .site-theme-toggle,.site-appearance-bar { display:none !important; }
 html { color-scheme:light; }
}

@media screen and (max-width:720px) { .reader .site-theme-toggle .theme-toggle-label { display:none; } .reader .site-theme-toggle { width:36px; min-width:36px; padding:7px; } }

/* TeacherPenny wordmark: blend the source paper into each screen theme. */
@media screen {
 .site-appearance-bar { align-items:center; justify-content:space-between; gap:16px; padding-top:12px; padding-bottom:12px; }
 .site-brand { display:inline-flex; align-items:center; flex-shrink:0; padding:5px 0; line-height:0; }
 .site-brand img { display:block; width:156px; height:auto; mix-blend-mode:multiply; }
 .site-brand:focus-visible { outline:2px solid var(--teal,#2f7f96); outline-offset:5px; }
 .reader .site-brand img { width:145px; }
 .reader .site-brand { margin-right:8px; }
 :root[data-theme="dark"] .site-brand img { filter:grayscale(1) invert(1) brightness(1.6); mix-blend-mode:screen; }
 :root[data-theme="dark"] #storage-note:empty { display:none; }
}
@media screen and (max-width:560px) {
 .reader .site-brand { width:100%; }
 .site-brand img { width:156px; }
}
@media print { .site-brand { display:none !important; } }

@media screen {
 .collection-hero > .site-brand { grid-column:1 / -1; justify-self:start; margin-bottom:12px; }
 .hub-theme-toggle { position:fixed; top:12px; right:18px; z-index:50; }


 :root[data-theme="dark"].tale-sheet .page > .sheet-wordmark img { filter:none; mix-blend-mode:multiply; }
}

/* The wordmark occupies the existing top margin inside the 210 x 297mm page.
   Absolute placement contributes no height, padding, or extra printed page. */
.page > a.site-brand.sheet-wordmark {
 position:absolute !important; top:6mm !important; left:18mm !important;
 right:auto !important; bottom:auto !important;
 display:block; width:25mm !important; height:4.33mm !important;
 margin:0 !important; padding:0 !important; border:0 !important;
 background:transparent !important; box-shadow:none !important;
 line-height:0 !important; z-index:10;
}
.page > a.site-brand.sheet-wordmark img {
 display:block; width:100% !important; height:100% !important;
 object-fit:contain; margin:0 !important; padding:0 !important;
 mix-blend-mode:multiply;
}
@media print {
 .page > a.site-brand.sheet-wordmark { display:block !important; }
 .page > a.site-brand.sheet-wordmark img { filter:none !important; }
}

/* Native PNG alpha removes the old pale rectangle on every background. */
@media screen {
 .site-brand img { height:27px; object-fit:cover; object-position:center; mix-blend-mode:normal; }
 .reader .site-brand img { height:25.1px; }
 :root[data-theme="dark"] .site-brand img { filter:grayscale(1) invert(1) brightness(1.6); mix-blend-mode:normal; }
 :root[data-theme="dark"].tale-sheet .page > .sheet-wordmark img { filter:none; mix-blend-mode:normal; }
}
.page > a.site-brand.sheet-wordmark img { object-fit:cover; object-position:center; mix-blend-mode:normal; }
