-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbionic.css
More file actions
393 lines (345 loc) · 10.3 KB
/
bionic.css
File metadata and controls
393 lines (345 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
/* TRUE Bionic Reading Extension Styles - Based on Official Implementation */
/* Fixation styling - the core of Bionic Reading */
.bionic-fixation {
font-weight: 600 !important;
color: inherit !important;
/* Softer, more natural bolding */
text-rendering: optimizeLegibility !important;
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;
}
/* Enhanced wrapper styling with proper text selection */
.bionic-wrapper {
display: inline;
background: none !important;
border: none !important;
padding: 0 !important;
margin: 0 !important;
/* CRITICAL: Enable text selection */
user-select: text !important;
-webkit-user-select: text !important;
-moz-user-select: text !important;
-ms-user-select: text !important;
}
/* Main bionic reading state */
.bionic-reading-enabled .bionic-fixation {
/* More natural, readable bold weight */
font-weight: 600 !important;
/* Ensure fixation parts are also selectable */
user-select: text !important;
-webkit-user-select: text !important;
-moz-user-select: text !important;
-ms-user-select: text !important;
}
/* Theme adaptations */
.bionic-reading-enabled[data-theme="light"] .bionic-fixation,
.bionic-reading-enabled .bionic-fixation {
opacity: 1 !important;
/* Slightly stronger contrast for light themes */
font-weight: 650 !important;
}
/* Dark theme compatibility - softer approach */
.bionic-reading-enabled[data-theme="dark"] .bionic-fixation,
body.dark .bionic-fixation,
.dark .bionic-fixation,
[data-theme="dark"] .bionic-fixation {
/* Softer weight for dark themes to reduce eye strain */
font-weight: 550 !important;
opacity: 0.92 !important;
}
/* High contrast mode support */
@media (prefers-contrast: high) {
.bionic-fixation {
font-weight: 700 !important;
opacity: 1 !important;
}
}
/* Ensure elements that should NOT be processed stay normal */
h1 .bionic-fixation,
h2 .bionic-fixation,
h3 .bionic-fixation,
h4 .bionic-fixation,
h5 .bionic-fixation,
h6 .bionic-fixation,
.title .bionic-fixation,
.heading .bionic-fixation,
.page-title .bionic-fixation,
.post-title .bionic-fixation,
.article-title .bionic-fixation {
font-weight: inherit !important; /* Disable bionic in titles */
opacity: 1 !important;
}
/* Skip navigation and UI elements */
nav .bionic-fixation,
.nav .bionic-fixation,
.menu .bionic-fixation,
.breadcrumb .bionic-fixation,
.navigation .bionic-fixation,
button .bionic-fixation,
.btn .bionic-fixation,
.button .bionic-fixation {
font-weight: inherit !important;
}
/* Handle code blocks - disable bionic completely */
code .bionic-fixation,
pre .bionic-fixation,
.code .bionic-fixation,
.hljs .bionic-fixation,
.language-* .bionic-fixation,
kbd .bionic-fixation,
samp .bionic-fixation,
.CodeMirror .bionic-fixation,
.highlight .bionic-fixation {
font-weight: inherit !important;
opacity: 1 !important;
}
/* Form elements should not be processed */
input .bionic-fixation,
textarea .bionic-fixation,
select .bionic-fixation,
[contenteditable="true"] .bionic-fixation {
font-weight: inherit !important;
}
/* Links maintain their styling while preserving fixation */
a .bionic-fixation {
color: inherit !important;
text-decoration: inherit !important;
}
/* Ensure perfect text selection across all browsers */
.bionic-wrapper *,
.bionic-fixation {
user-select: text !important;
-webkit-user-select: text !important;
-moz-user-select: text !important;
-ms-user-select: text !important;
}
/* Beautiful text selection styling */
.bionic-fixation::selection,
.bionic-wrapper::selection {
background: #3390ff !important;
color: white !important;
}
.bionic-fixation::-moz-selection,
.bionic-wrapper::-moz-selection {
background: #3390ff !important;
color: white !important;
}
/* Smooth transitions when toggling */
.bionic-fixation {
transition: font-weight 0.15s ease-out, opacity 0.15s ease-out !important;
}
/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
.bionic-fixation {
transition: none !important;
}
}
/* Special handling for different content types */
/* Articles and main content - optimal readability */
article .bionic-fixation,
main .bionic-fixation,
.content .bionic-fixation,
.post-content .bionic-fixation,
.entry-content .bionic-fixation {
/* Slightly more prominent in main content */
font-weight: 620 !important;
}
/* Comments and secondary content - lighter touch */
.comments .bionic-fixation,
.comment .bionic-fixation,
aside .bionic-fixation,
.sidebar .bionic-fixation {
font-weight: 580 !important;
opacity: 0.88 !important;
}
/* Table content - maintain readability */
table .bionic-fixation,
td .bionic-fixation,
th .bionic-fixation {
font-weight: 590 !important;
}
/* Blockquotes - distinctive but readable */
blockquote .bionic-fixation,
.quote .bionic-fixation {
font-weight: 600 !important;
opacity: 0.9 !important;
}
/* Lists - balanced approach */
li .bionic-fixation,
ol .bionic-fixation,
ul .bionic-fixation {
font-weight: 600 !important;
}
/* Captions and small text */
.caption .bionic-fixation,
.small .bionic-fixation,
small .bionic-fixation,
.text-sm .bionic-fixation {
font-weight: 640 !important; /* Slightly stronger for small text */
}
/* Print styles - ensure readability when printed */
@media print {
.bionic-fixation {
font-weight: 700 !important;
opacity: 1 !important;
color: #000 !important;
}
.bionic-wrapper {
color: inherit !important;
}
}
/* Font-specific optimizations */
/* Georgia, Times - serif fonts need slightly different treatment */
.bionic-reading-enabled[style*="Georgia"] .bionic-fixation,
.bionic-reading-enabled[style*="Times"] .bionic-fixation,
.bionic-reading-enabled[style*="serif"] .bionic-fixation {
font-weight: 640 !important;
letter-spacing: 0.01em !important;
}
/* Sans-serif fonts - cleaner approach */
.bionic-reading-enabled[style*="Arial"] .bionic-fixation,
.bionic-reading-enabled[style*="Helvetica"] .bionic-fixation,
.bionic-reading-enabled[style*="sans-serif"] .bionic-fixation {
font-weight: 600 !important;
}
/* Monospace fonts - should generally be avoided but handle gracefully */
.bionic-reading-enabled[style*="monospace"] .bionic-fixation,
.bionic-reading-enabled[style*="Courier"] .bionic-fixation {
font-weight: 550 !important;
opacity: 0.85 !important;
}
/* Mobile responsiveness */
@media (max-width: 768px) {
.bionic-fixation {
/* Slightly lighter on mobile to reduce eye strain on small screens */
font-weight: 580 !important;
}
/* Larger text on mobile can handle slightly more weight */
.bionic-reading-enabled[style*="font-size: 1.2"] .bionic-fixation,
.bionic-reading-enabled[style*="font-size: 1.3"] .bionic-fixation,
.bionic-reading-enabled[style*="font-size: 1.4"] .bionic-fixation {
font-weight: 610 !important;
}
}
/* Very small screens - ultra-conservative approach */
@media (max-width: 480px) {
.bionic-fixation {
font-weight: 570 !important;
opacity: 0.9 !important;
}
}
/* Large screens - can handle more prominent fixation */
@media (min-width: 1200px) {
.bionic-fixation {
font-weight: 630 !important;
}
}
/* High DPI screens - refined rendering */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
.bionic-fixation {
-webkit-font-smoothing: antialiased !important;
-moz-osx-font-smoothing: grayscale !important;
text-rendering: optimizeLegibility !important;
}
}
/* Focus states for accessibility */
.bionic-wrapper:focus-within .bionic-fixation,
.bionic-fixation:focus {
outline: 2px solid #3390ff !important;
outline-offset: 1px !important;
border-radius: 2px !important;
}
/* Support for reader mode detection */
body.reader-mode .bionic-fixation,
.reader-mode .bionic-fixation,
[data-reader-mode="true"] .bionic-fixation {
/* Even softer approach for reader modes */
font-weight: 560 !important;
opacity: 0.85 !important;
}
/* Animation and interaction states */
.bionic-wrapper:hover .bionic-fixation {
/* Subtle hover effect for interactive content */
opacity: 1 !important;
transition: opacity 0.1s ease !important;
}
/* RTL (Right-to-Left) language support */
[dir="rtl"] .bionic-fixation,
.rtl .bionic-fixation {
font-weight: 600 !important;
text-align: inherit !important;
}
/* Specific website adaptations */
/* Wikipedia - needs lighter touch due to dense content */
body[class*="mediawiki"] .bionic-fixation {
font-weight: 580 !important;
opacity: 0.88 !important;
}
/* Medium, Substack - article-focused sites */
body[class*="medium"] .bionic-fixation,
body[class*="substack"] .bionic-fixation {
font-weight: 620 !important;
}
/* News sites - rapid reading optimization */
body[class*="news"] .bionic-fixation,
body[class*="cnn"] .bionic-fixation,
body[class*="bbc"] .bionic-fixation {
font-weight: 610 !important;
}
/* Social media - minimal interference */
body[class*="twitter"] .bionic-fixation,
body[class*="facebook"] .bionic-fixation,
body[class*="linkedin"] .bionic-fixation {
font-weight: 570 !important;
opacity: 0.85 !important;
}
/* Academic and technical sites - enhanced readability */
body[class*="arxiv"] .bionic-fixation,
body[class*="jstor"] .bionic-fixation,
body[class*="scholar"] .bionic-fixation {
font-weight: 640 !important;
}
/* Error states and fallbacks */
.bionic-wrapper.error .bionic-fixation {
font-weight: inherit !important;
opacity: 1 !important;
color: inherit !important;
}
/* Ensure compatibility with popular CSS frameworks */
/* Bootstrap */
.bootstrap .bionic-fixation,
[class*="bootstrap"] .bionic-fixation {
font-weight: 600 !important;
}
/* Tailwind CSS */
.tailwind .bionic-fixation,
[class*="tailwind"] .bionic-fixation {
font-weight: 600 !important;
}
/* Material Design */
.material .bionic-fixation,
[class*="material"] .bionic-fixation {
font-weight: 590 !important;
}
/* Final catch-all for any missed edge cases */
.bionic-reading-enabled .bionic-wrapper {
line-height: inherit !important;
letter-spacing: inherit !important;
word-spacing: inherit !important;
text-transform: inherit !important;
text-decoration: inherit !important;
}
/* Ensure no layout shifts occur */
.bionic-wrapper,
.bionic-fixation {
display: inline !important;
position: static !important;
float: none !important;
clear: none !important;
margin: 0 !important;
padding: 0 !important;
border: none !important;
background: transparent !important;
box-shadow: none !important;
transform: none !important;
}