f6819d50b7
Resolves #72 ## Description This PR implements the theme toggle mechanism, client-side persistence, and comprehensive light mode style overrides for the mobile reader layout in **NexusReader**. ### Key Changes 1. **ThemeService & State Management**: - Enhanced `ThemeService` with `InitializeAsync` and `ToggleTheme` using JS Interop. - Synchronized theme state changes via `OnThemeChanged` event. 2. **Local Storage Persistence & FOUC Prevention**: - Added client-side script in `App.razor` and MAUI `index.html` to instantly apply `.theme-light` from `localStorage` before prerendering/rendering to prevent a Flash of Unthemed Content (FOUC). - Created `theme.js` containing JS helper methods (`themeInterop.isLightMode`, `themeInterop.setLightMode`) to interface with `localStorage` and `document.documentElement` class list. 3. **UI Theme Toggle**: - Added a minimalist glassmorphic theme toggle button in the header of the `ReaderCanvas.razor` with dynamic transitions and icon morphing between sun and moon SVG icons. 4. **Light Mode Stylesheets Overrides**: - Added detailed light mode scoped styles (`.theme-light`) for the `ReaderCanvas` and the bottom-sheet `GlobalIntelligence` AI chat panel, utilizing earthy gray text (`#2d2a26`) on warm paper-like backgrounds (`rgba(244, 241, 234, 0.95)` / `#faf8f5`) to maintain high-quality aesthetic consistency. ### Verification - Solution built successfully without errors (`dotnet build NexusReader.slnx --no-restore`). - Scoped CSS isolation checked and validated for both Web and MAUI contexts. --------- Co-authored-by: Marek Jasiński <jasins.marek@gmail.com> Reviewed-on: #71 Co-authored-by: Antigravity <antigravity@google.com> Co-committed-by: Antigravity <antigravity@google.com>
570 lines
12 KiB
CSS
570 lines
12 KiB
CSS
.reader-canvas {
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow-y: auto;
|
|
overflow-x: hidden;
|
|
padding: 2rem 0;
|
|
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
position: relative;
|
|
|
|
/* Dedicated Scrollbar Styling */
|
|
scrollbar-width: thin;
|
|
scrollbar-color: rgba(0, 255, 153, 0.2) transparent;
|
|
}
|
|
|
|
.reader-canvas::-webkit-scrollbar {
|
|
width: 6px;
|
|
}
|
|
|
|
.reader-canvas::-webkit-scrollbar-track {
|
|
background: transparent;
|
|
}
|
|
|
|
.reader-canvas::-webkit-scrollbar-thumb {
|
|
background-color: rgba(0, 255, 153, 0.2);
|
|
border-radius: 20px;
|
|
border: 3px solid transparent;
|
|
}
|
|
|
|
.reader-canvas:hover::-webkit-scrollbar-thumb {
|
|
background-color: rgba(0, 255, 153, 0.5);
|
|
}
|
|
|
|
.reader-canvas.theme-dark {
|
|
background-color: #121214;
|
|
}
|
|
|
|
.reader-canvas.theme-light {
|
|
background-color: #f4f1ea;
|
|
/* Warm light beige/gray background */
|
|
}
|
|
|
|
.reader-flow-container {
|
|
max-width: 680px;
|
|
margin: 2rem auto;
|
|
min-height: calc(100vh - 180px);
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1.5rem;
|
|
position: relative;
|
|
padding: 3rem 4rem 15rem 4rem;
|
|
/* Large padding-bottom for reachability, plus comfortable side margins */
|
|
border-radius: 12px;
|
|
box-sizing: border-box;
|
|
transition: background-color 0.3s, box-shadow 0.3s, border-color 0.3s;
|
|
}
|
|
|
|
.theme-dark .reader-flow-container {
|
|
background-color: #1a1a1e;
|
|
border: 1px solid rgba(255, 255, 255, 0.03);
|
|
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
|
|
}
|
|
|
|
.theme-light .reader-flow-container {
|
|
background-color: #ffffff;
|
|
border: 1px solid rgba(0, 0, 0, 0.04);
|
|
box-shadow: 0 4px 20px rgba(139, 130, 115, 0.12);
|
|
}
|
|
|
|
.block-wrapper {
|
|
transition: all 0.5s ease;
|
|
border-radius: 8px;
|
|
padding: 8px;
|
|
border: 1px solid transparent;
|
|
}
|
|
|
|
/* Typographic refinement for TextSegmentBlock */
|
|
::deep .nexus-ebook {
|
|
font-family: 'Merriweather', serif !important;
|
|
line-height: 1.65 !important;
|
|
letter-spacing: -0.01em !important;
|
|
font-size: 1.15rem;
|
|
font-weight: 400;
|
|
text-align: left !important;
|
|
color: #e4e4e7;
|
|
/* Off-white with light gray tint */
|
|
}
|
|
|
|
.theme-light ::deep .nexus-ebook {
|
|
color: #292524;
|
|
/* Warm charcoal for legibility */
|
|
}
|
|
|
|
/* Callout Box styling for legacy blockquote segments */
|
|
::deep .nexus-ebook blockquote {
|
|
background-color: rgba(255, 255, 255, 0.02);
|
|
border-left: 4px solid var(--nexus-neon);
|
|
padding: 1rem 1.25rem;
|
|
margin: 1.5rem 0 1.5rem 0;
|
|
border-radius: 0 8px 8px 0;
|
|
font-size: 1.05rem;
|
|
color: #e2e8f0;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.theme-light ::deep .nexus-ebook blockquote {
|
|
background-color: rgba(245, 158, 11, 0.04);
|
|
border-left: 4px solid #f59e0b;
|
|
color: #44403c;
|
|
}
|
|
|
|
|
|
/* Technical Code Block Container */
|
|
::deep .nexus-ebook pre {
|
|
background-color: #2d2d2d;
|
|
/* Dark theme for code for better contrast */
|
|
color: #e0e0e0;
|
|
padding: 1.25rem;
|
|
border-radius: 8px;
|
|
margin: 2rem 0;
|
|
overflow-x: auto;
|
|
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
border-left: 4px solid var(--nexus-neon);
|
|
/* Nexus neon accent */
|
|
|
|
/* Dedicated Scrollbar for Code */
|
|
scrollbar-width: thin;
|
|
scrollbar-color: rgba(0, 255, 153, 0.3) transparent;
|
|
}
|
|
|
|
::deep .nexus-ebook pre::-webkit-scrollbar {
|
|
height: 4px;
|
|
}
|
|
|
|
::deep .nexus-ebook pre::-webkit-scrollbar-thumb {
|
|
background: rgba(0, 255, 153, 0.3);
|
|
border-radius: 10px;
|
|
}
|
|
|
|
/* Monospace Typography Contrast */
|
|
::deep .nexus-ebook code {
|
|
font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace !important;
|
|
font-variant-ligatures: contextual;
|
|
line-height: 1.5;
|
|
tab-size: 4;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
/* Inline Code Highlight */
|
|
::deep .nexus-ebook p code {
|
|
background-color: rgba(0, 0, 0, 0.05);
|
|
color: #d63384;
|
|
/* Classic differentiator for inline code */
|
|
padding: 0.2rem 0.4rem;
|
|
border-radius: 4px;
|
|
font-size: 0.9em;
|
|
border: none;
|
|
}
|
|
|
|
.theme-dark ::deep .nexus-ebook p code {
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
color: #ff79c6;
|
|
}
|
|
|
|
.block-wrapper.highlighted {
|
|
background: rgba(0, 243, 255, 0.08);
|
|
box-shadow: 0 0 20px rgba(0, 243, 255, 0.15);
|
|
border-color: #00f3ff;
|
|
transform: scale(1.01);
|
|
}
|
|
|
|
.ai-sparkle-trigger {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
padding: 0.5rem 1rem;
|
|
background: rgba(18, 18, 18, 0.6);
|
|
border: 1px solid rgba(0, 255, 153, 0.3);
|
|
border-radius: 20px;
|
|
cursor: pointer;
|
|
margin: 1rem 0;
|
|
transition: all 0.3s ease;
|
|
position: relative;
|
|
}
|
|
|
|
.ai-sparkle-trigger:hover {
|
|
background: rgba(0, 255, 153, 0.1);
|
|
border-color: #00ff99;
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.sparkle-tooltip {
|
|
font-size: 0.75rem;
|
|
color: #fff;
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.neon-pulse {
|
|
color: #00ff99;
|
|
filter: drop-shadow(0 0 5px #00ff99);
|
|
animation: pulse-small 2s infinite;
|
|
}
|
|
|
|
@keyframes pulse-small {
|
|
0% {
|
|
transform: scale(1);
|
|
opacity: 1;
|
|
}
|
|
|
|
50% {
|
|
transform: scale(1.1);
|
|
opacity: 0.8;
|
|
}
|
|
|
|
100% {
|
|
transform: scale(1);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
/* Chapter Loading Overlay and Spinners */
|
|
.loading-state.full-page {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 100%;
|
|
min-height: 400px;
|
|
gap: 1.5rem;
|
|
animation: fadeIn 0.4s ease-out;
|
|
}
|
|
|
|
.spinner-glow {
|
|
width: 60px;
|
|
height: 60px;
|
|
border: 3px solid rgba(0, 255, 153, 0.1);
|
|
border-radius: 50%;
|
|
border-top-color: var(--nexus-neon, #00ff99);
|
|
animation: spin 1s cubic-bezier(0.55, 0.055, 0.675, 0.19) infinite;
|
|
box-shadow: 0 0 15px rgba(0, 255, 153, 0.2);
|
|
}
|
|
|
|
.spinner-glow.small {
|
|
width: 36px;
|
|
height: 36px;
|
|
border-width: 2px;
|
|
}
|
|
|
|
.loading-text {
|
|
color: rgba(255, 255, 255, 0.7);
|
|
font-size: 1.1rem;
|
|
letter-spacing: 0.5px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.theme-light .loading-text {
|
|
color: rgba(0, 0, 0, 0.7);
|
|
}
|
|
|
|
.chapter-loading-overlay {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 10;
|
|
background-color: rgba(15, 23, 42, 0.15);
|
|
backdrop-filter: blur(2px);
|
|
animation: fadeIn 0.3s ease-out;
|
|
}
|
|
|
|
.theme-light .chapter-loading-overlay {
|
|
background-color: rgba(255, 255, 255, 0.2);
|
|
}
|
|
|
|
.loader-card {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1.25rem;
|
|
padding: 1.25rem 2rem;
|
|
border-radius: 40px;
|
|
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 1px rgba(255, 255, 255, 0.1) inset;
|
|
animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
}
|
|
|
|
.loader-text {
|
|
font-family: var(--nexus-font-sans, 'Inter', sans-serif);
|
|
font-weight: 500;
|
|
color: #ffffff;
|
|
font-size: 0.95rem;
|
|
letter-spacing: 0.2px;
|
|
}
|
|
|
|
.theme-light .loader-text {
|
|
color: #0f172a;
|
|
}
|
|
|
|
.content-blurred {
|
|
filter: blur(3px);
|
|
opacity: 0.55;
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
pointer-events: none;
|
|
}
|
|
|
|
@keyframes spin {
|
|
0% {
|
|
transform: rotate(0deg);
|
|
}
|
|
|
|
100% {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
@keyframes scaleIn {
|
|
from {
|
|
transform: scale(0.9) translateY(10px);
|
|
opacity: 0;
|
|
}
|
|
|
|
to {
|
|
transform: scale(1) translateY(0);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
/* MOBILE READER UI OVERRIDES */
|
|
@media (max-width: 768px) {
|
|
.reader-canvas {
|
|
padding-top: 54px !important;
|
|
padding-bottom: 120px !important;
|
|
/* Ensure content is clear of bottom toolbar */
|
|
}
|
|
|
|
.reader-flow-container {
|
|
padding-bottom: 4rem;
|
|
/* Safe breathing room */
|
|
}
|
|
}
|
|
|
|
@media (max-width: 767px) {
|
|
::deep .nexus-ebook,
|
|
::deep .nexus-ebook p {
|
|
font-size: 16px !important;
|
|
line-height: 1.55 !important;
|
|
}
|
|
|
|
::deep .nexus-ebook h1 {
|
|
font-size: 1.35rem !important;
|
|
line-height: 1.4 !important;
|
|
margin-top: 1.5rem !important;
|
|
margin-bottom: 1rem !important;
|
|
}
|
|
}
|
|
|
|
|
|
.nexus-mobile-reader-header {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100vw;
|
|
height: 50px;
|
|
background: rgba(18, 18, 18, 0.75);
|
|
backdrop-filter: blur(20px);
|
|
-webkit-backdrop-filter: blur(20px);
|
|
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 1rem;
|
|
z-index: 1000;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.theme-light .nexus-mobile-reader-header {
|
|
background: rgba(249, 249, 249, 0.8);
|
|
border-bottom-color: rgba(0, 0, 0, 0.08);
|
|
}
|
|
|
|
.nexus-mobile-escape-btn {
|
|
background: none;
|
|
border: none;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
color: var(--nexus-neon, #00FF99);
|
|
font-size: 0.8rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
padding: 8px 12px;
|
|
border-radius: 8px;
|
|
transition: background-color 0.2s ease;
|
|
margin-left: -8px;
|
|
}
|
|
|
|
.nexus-mobile-escape-btn:active {
|
|
background-color: rgba(0, 255, 153, 0.08);
|
|
}
|
|
|
|
.nexus-mobile-chapter-navigation {
|
|
flex: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 0.25rem;
|
|
height: 100%;
|
|
min-width: 0;
|
|
margin-right: 40px; /* Space to prevent overlap with absolute theme toggle button */
|
|
}
|
|
|
|
.nexus-mobile-chapter-title {
|
|
flex: 1;
|
|
text-align: center;
|
|
font-size: 0.8rem;
|
|
font-weight: 600;
|
|
color: #FFFFFF;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
padding: 0 0.5rem;
|
|
min-width: 0;
|
|
}
|
|
|
|
.theme-light .nexus-mobile-chapter-title {
|
|
color: #292524;
|
|
}
|
|
|
|
.theme-light .nexus-mobile-escape-btn {
|
|
color: #78716c;
|
|
}
|
|
|
|
.theme-light .nexus-mobile-escape-btn:hover {
|
|
color: #10b981;
|
|
background-color: rgba(16, 185, 129, 0.05);
|
|
}
|
|
|
|
.theme-light .nexus-mobile-escape-btn:active {
|
|
background-color: rgba(16, 185, 129, 0.08);
|
|
}
|
|
|
|
.nexus-chapter-nav-btn {
|
|
background: none;
|
|
border: none;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: 50%;
|
|
color: rgba(255, 255, 255, 0.5);
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
padding: 0;
|
|
}
|
|
|
|
.nexus-chapter-nav-btn:hover:not(:disabled) {
|
|
color: var(--nexus-neon, #00FF99);
|
|
background: rgba(255, 255, 255, 0.06);
|
|
}
|
|
|
|
.nexus-chapter-nav-btn:disabled {
|
|
opacity: 0.2;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.theme-light .nexus-chapter-nav-btn {
|
|
color: rgba(0, 0, 0, 0.5);
|
|
}
|
|
|
|
.theme-light .nexus-chapter-nav-btn:hover:not(:disabled) {
|
|
background: rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
/* Minimalist Theme Toggle Button with Glassmorphism */
|
|
.nexus-theme-toggle-btn {
|
|
position: absolute;
|
|
right: 1rem;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
width: 36px;
|
|
height: 36px;
|
|
border-radius: 50%;
|
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
background: rgba(255, 255, 255, 0.03);
|
|
backdrop-filter: blur(10px);
|
|
-webkit-backdrop-filter: blur(10px);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
cursor: pointer;
|
|
z-index: 1001;
|
|
padding: 0;
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
}
|
|
|
|
.nexus-theme-toggle-btn:hover {
|
|
background: rgba(255, 255, 255, 0.08);
|
|
border-color: rgba(255, 255, 255, 0.15);
|
|
transform: translateY(-50%) scale(1.05);
|
|
}
|
|
|
|
.nexus-theme-toggle-btn:active {
|
|
transform: translateY(-50%) scale(0.95);
|
|
}
|
|
|
|
/* Theme specifics for Light Mode */
|
|
.theme-light .nexus-theme-toggle-btn {
|
|
border-color: rgba(0, 0, 0, 0.08);
|
|
background: rgba(0, 0, 0, 0.03);
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
.theme-light .nexus-theme-toggle-btn:hover {
|
|
background: rgba(0, 0, 0, 0.06);
|
|
border-color: rgba(0, 0, 0, 0.12);
|
|
}
|
|
|
|
/* Icon Styling and Transition */
|
|
.theme-toggle-icon {
|
|
width: 18px;
|
|
height: 18px;
|
|
stroke-width: 2px;
|
|
}
|
|
|
|
/* In Dark Mode, the icon should be brand green (#10b981) */
|
|
.theme-toggle-icon.moon {
|
|
color: #10b981;
|
|
filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.3));
|
|
animation: morphMoon 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
}
|
|
|
|
/* In Light Mode, the icon should be a dark earthy gray (#2d2a26) */
|
|
.theme-toggle-icon.sun {
|
|
color: #2d2a26;
|
|
animation: morphSun 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
}
|
|
|
|
@keyframes morphMoon {
|
|
0% {
|
|
transform: rotate(-45deg) scale(0.7);
|
|
opacity: 0;
|
|
}
|
|
100% {
|
|
transform: rotate(0deg) scale(1);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
@keyframes morphSun {
|
|
0% {
|
|
transform: rotate(45deg) scale(0.7);
|
|
opacity: 0;
|
|
}
|
|
100% {
|
|
transform: rotate(0deg) scale(1);
|
|
opacity: 1;
|
|
}
|
|
} |