-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path10-reading-states.css
More file actions
1537 lines (1459 loc) · 58.8 KB
/
10-reading-states.css
File metadata and controls
1537 lines (1459 loc) · 58.8 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
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Module: 10-reading-states.css */
/* Reader phrase grouping, pauses, and active word state styling. */
/* ── TPS Pronunciation guide (primary rehearsal text) ── */
.tps-pronunciation,
.tps-phonetic {
border-bottom: 0;
cursor: help;
}
/* ── Card-based layout: cards slide up one by one ──
Balanced ease-in-out so the block moves at a consistent rate through the
middle of the travel and arrives decisively on the focus line instead of
stalling in the last 20 % of the animation. Same duration for transform
and opacity keeps the two tracks locked — the card finishes fading at
the same instant it lands, so the operator never sees a half-faded block
lingering near the guide. */
.rd-card {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
transition:
transform .7s cubic-bezier(.4, 0, .6, 1),
opacity .7s cubic-bezier(.4, 0, .6, 1);
will-change: transform, opacity;
overflow: visible;
}
.rd-card-static {
transition: none;
}
.rd-card-active {
transform: translate3d(0,0,0);
opacity: 1;
z-index: 2;
}
.rd-card-prev {
transform: translate3d(0,-104%,0);
opacity: 0;
z-index: 1;
pointer-events: none;
}
.rd-card-next {
transform: translate3d(0,104%,0);
opacity: 0;
z-index: 1;
pointer-events: none;
}
/* Active cluster — no visible border, text floats over gradient */
.rd-cluster-active {
padding: 36px 0;
box-sizing: border-box;
background: transparent;
border: none;
border-radius: 0;
position: relative;
box-shadow: none;
}
.rd-cluster-emotion {
position: fixed;
top: 60px;
left: 50%;
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 8px;
z-index: 10;
opacity: .55;
transition: opacity .3s;
}
.rd-cluster-emotion:hover { opacity: .7; }
.rd-emo-marker {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.4em;
height: 1.4em;
font-size: 15px;
line-height: 1;
}
.rd-emo-name {
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1px;
color: var(--t4);
}
.rd-attachments {
position: fixed;
top: 104px;
left: 50%;
transform: translateX(-50%);
z-index: 10;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
max-width: min(760px, calc(100vw - 160px));
pointer-events: none;
}
.rd-attachment {
display: grid;
grid-template-columns: 42px minmax(0, 1fr);
column-gap: 10px;
align-items: center;
min-width: 176px;
max-width: 280px;
padding: 8px 10px;
border: 1px solid rgba(255,255,255,.12);
border-radius: 8px;
background: rgba(12,12,12,.68);
box-shadow: 0 12px 34px rgba(0,0,0,.22);
color: rgba(246,244,239,.88);
backdrop-filter: blur(10px);
}
.rd-attachment-thumb,
.rd-attachment-icon {
grid-row: span 2;
width: 42px;
height: 42px;
border-radius: 6px;
}
.rd-attachment-thumb {
object-fit: cover;
}
.rd-attachment-icon {
display: inline-grid;
place-items: center;
background: rgba(255,255,255,.09);
color: rgba(246,244,239,.72);
font-size: 16px;
}
.rd-attachment-name {
min-width: 0;
overflow: hidden;
font-size: 13px;
font-weight: 780;
line-height: 1.2;
text-overflow: ellipsis;
white-space: nowrap;
}
.rd-attachment-meta {
color: rgba(246,244,239,.5);
font-family: var(--font-mono);
font-size: 10px;
font-weight: 700;
line-height: 1.2;
text-transform: uppercase;
}
.rd-cluster-text {
font-size: var(--rd-font-size, 36px);
width: 100%;
max-width: min(100%, var(--rd-stage-content-width, 940px));
box-sizing: border-box;
/* relative positioning anchors the absolutely-placed `.rd-focus-lens`
child — the lens glides between active words in the lens's local
coordinate space so it scrolls up with the text automatically. */
position: relative;
font-weight: 700;
line-height: 1.9;
color: rgba(242,230,204,.22);
letter-spacing: 0.01em;
word-spacing: 0.08em;
margin-inline: auto;
overflow-wrap: break-word;
hyphens: none;
text-align: center;
text-wrap: pretty;
font-kerning: normal;
font-feature-settings: "kern" 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* The cluster-text transform is the word-level scroll inside a block.
A longer ease-out glide makes the line step feel like one smooth
slide onto the focal guide instead of a hard 1-line snap. Color /
text-shadow / opacity are NOT transitioned here — they snap
instantly when the card class changes so there is no faster "flash"
of the previous block's text brightening at the tail of the card
transition. Per-word tone fades still happen via .rd-w's own
transition block (fast, word-scoped). */
transition: transform .52s cubic-bezier(.22, 1, .36, 1);
will-change: transform;
}
.rd-card-prev .rd-cluster-text,
.rd-card-next .rd-cluster-text {
color: rgba(232,213,176,.2);
text-shadow: none;
}
.rd-card-prev .rd-cluster-emotion,
.rd-card-next .rd-cluster-emotion {
opacity: .16;
}
.rd-card-prev .rd-g-emphasis,
.rd-card-next .rd-g-emphasis {
text-decoration-color: rgba(232,213,176,.08);
}
/* ── Semantic word groups — prevent mid-phrase line breaks ──
Research: eyes read in 2-5 word "thought groups"; breaking mid-phrase
causes stumbling. white-space:nowrap keeps each group atomic so the
browser wraps BETWEEN groups (at pause points), never inside them.
If a single group exceeds container width, overflow-wrap on the parent
(.rd-cluster-text) allows it to break as a last resort. */
.rd-g {
display: inline;
white-space: nowrap;
}
.rd-g-highlight {
border-radius: .2em;
display: inline-block;
isolation: isolate;
padding-inline: .08em;
position: relative;
}
.rd-g-highlight::before {
content: "";
position: absolute;
z-index: -1;
inset: .12em -.06em .16em;
border-radius: .18em;
background:
linear-gradient(180deg, rgba(255,232,148,.22), rgba(238,173,69,.2)),
linear-gradient(90deg, rgba(255,235,180,.06), rgba(255,214,77,.18), rgba(255,235,180,.06));
box-shadow:
inset 0 0 0 1px rgba(255,224,102,.2),
0 .08em .38em rgba(0,0,0,.14);
pointer-events: none;
}
.rd-g-active.rd-g-highlight::before {
background:
linear-gradient(180deg, rgba(255,238,171,.28), rgba(238,173,69,.28)),
linear-gradient(90deg, rgba(255,235,180,.08), rgba(255,214,77,.24), rgba(255,235,180,.08));
box-shadow:
inset 0 0 0 1px rgba(255,224,102,.28),
0 .1em .42em rgba(0,0,0,.16);
}
.rd-g-highlight:not(.rd-g-active):not(:has(.rd-w:not(.rd-read)))::before {
opacity: .2;
}
.rd-g-legato {
display: inline-block;
position: relative;
}
.rd-g-building {
display: inline-block;
position: relative;
}
/* Group crescendo hairpin — opening `<` shape below the phrase. Thin
vector stroke so it reads as music notation, not a decorative blob. */
.rd-g-building::after {
content: "";
position: absolute;
left: -.06em;
right: -.06em;
bottom: -.56em;
height: .72em;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 60' preserveAspectRatio='none' fill='none'%3E%3Cpath d='M6 30 L394 6 M6 30 L394 54' stroke='%23F3DA9A' stroke-opacity='.78' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
background-position: center;
background-repeat: no-repeat;
background-size: 100% 100%;
pointer-events: none;
}
.rd-g-active.rd-g-building::after {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 60' preserveAspectRatio='none' fill='none'%3E%3Cpath d='M6 30 L394 6 M6 30 L394 54' stroke='%23F6E0A8' stroke-opacity='.96' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* Group-level legato slur — a single smooth SVG arc spanning the whole
phrase. Vector stroke so it stays crisp at README screenshot scale. */
.rd-g-legato::after {
content: "";
position: absolute;
left: -.04em;
right: -.04em;
bottom: -.16em;
height: .28em;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 28' preserveAspectRatio='none' fill='none'%3E%3Cpath d='M4 6 Q 100 24 196 6' stroke='%238DD5E2' stroke-opacity='.74' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
pointer-events: none;
}
.rd-g-active.rd-g-legato::after {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 28' preserveAspectRatio='none' fill='none'%3E%3Cpath d='M4 6 Q 100 24 196 6' stroke='%23A4E4F1' stroke-opacity='.96' stroke-width='2.8' stroke-linecap='round'/%3E%3C/svg%3E");
}
.rd-g-emphasis {
text-decoration-line: none;
}
.rd-g-emphasis:not(.rd-g-active):not(:has(.rd-w:not(.rd-read))) {
text-decoration-line: none;
}
/* ── Pause, breath, silence markers ──
Every pause kind shows a readable symbol so the reader sees breathing
points at a glance instead of an invisible gap. Markers inherit the
word's line-height so baseline stays stable. */
.rd-pause {
display: inline-flex;
align-items: center;
justify-content: center;
position: relative;
user-select: none;
vertical-align: baseline;
color: rgba(238,219,150,.42);
font-size: inherit;
line-height: 1;
}
/* Short pause (/ → ~300ms): caesura-style double dot, inline */
.rd-pause[data-pause-kind="short"] {
width: 0.68em;
height: 0.9em;
margin-inline: 0.28em;
}
.rd-pause[data-pause-kind="short"]::before {
content: "··";
font-size: 0.95em;
letter-spacing: 0.08em;
/* letter-spacing adds a trailing gap only after the last glyph, which
would offset the "··" pair to the left inside the flex box. Balance
it with an equal leading padding so the symbol sits optically centered
with identical gaps to the neighbouring words. */
padding-inline-start: 0.08em;
line-height: 0.8;
opacity: 0.6;
text-shadow: 0 0 6px rgba(238,219,150,.18);
animation: rd-pause-glow var(--tps-pause-duration, 0.45s) ease-in-out;
}
/* Breath mark: curved SVG breath comma — open arc facing upward */
.rd-pause-breath {
width: 0.9em;
height: 0.9em;
margin-inline: 0.1em;
}
.rd-pause-breath::before {
content: "";
display: block;
width: 0.72em;
height: 0.56em;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 32' fill='none'%3E%3Cpath d='M5 22 Q 20 3 35 22' stroke='%23EEDB96' stroke-opacity='.62' stroke-width='2.8' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: center;
background-size: contain;
pointer-events: none;
animation: rd-pause-breath-inhale 0.9s ease-in-out;
}
/* Medium pause (// → ~600ms): block divider with fading lines.
Block + text-align: center keeps the pair centered at every width. */
span.rd-pause.rd-pause-med {
display: block;
width: 100%;
margin: 0.18em 0;
text-align: center;
line-height: 1;
position: relative;
}
span.rd-pause.rd-pause-med::before,
span.rd-pause.rd-pause-med::after {
content: "";
display: inline-block;
width: 2.4em;
height: 2px;
margin: 0 0.2em;
vertical-align: middle;
background: rgba(238,219,150,.28);
border-radius: 1px;
animation: rd-pause-divider var(--tps-pause-duration, 0.6s) ease-out;
}
span.rd-pause.rd-pause-med::before {
mask-image: linear-gradient(90deg, transparent 0%, black 80%);
-webkit-mask-image: linear-gradient(90deg, transparent 0%, black 80%);
}
span.rd-pause.rd-pause-med::after {
mask-image: linear-gradient(90deg, black 20%, transparent 100%);
-webkit-mask-image: linear-gradient(90deg, black 20%, transparent 100%);
}
/* Silence (≥1000ms): block-level readable pause pill.
The previous whole-rest SVG glyph and tiny "1000MS" caption were
unreadable at reader scale — the operator could not tell at a glance
that the block was a pause. One centered pill with the pause glyph ⏸,
the uppercase word PAUSE, and a readable duration makes the intent
unmistakable in a single sweep. */
span.rd-pause.rd-pause-long {
display: block;
width: 100%;
margin: 0.5em 0;
padding: 0;
text-align: center;
line-height: 1;
}
span.rd-pause.rd-pause-long::before {
content: "⏸ pause " attr(data-pause-ms) " ms";
display: inline-flex;
align-items: center;
gap: 0.4em;
background: rgba(238,219,150,.1);
border: 1px solid rgba(238,219,150,.34);
border-radius: 999px;
padding: 0.4em 1.1em;
color: rgba(248,236,210,.88);
font-size: 0.42em;
font-weight: 700;
letter-spacing: 0.14em;
text-transform: uppercase;
white-space: nowrap;
animation: rd-pause-silence var(--tps-pause-duration, 1.5s) ease-in-out;
}
span.rd-pause.rd-pause-long::after {
content: none;
}
/* Previous / next card pauses — subtler */
.rd-card-prev .rd-pause,
.rd-card-next .rd-pause {
opacity: 0.22;
}
/* ── Pause lifecycle ──
Words live inside a .rd-g group wrapper so the active word's rd-now
class is NOT a direct sibling of surrounding pauses. Every :has()
selector therefore steps through the group wrapper to detect where the
playhead is:
* passed pause — any pause with a later sibling group that holds
rd-now or rd-read;
* active pause — pause directly after the group that holds rd-now
(the reader is currently serving it);
* upcoming pause — none of the above; stays idle.
All three states are derived from DOM relationships so the renderer
never has to emit a separate pause-state attribute. */
/* Passed pause — playhead has moved past this gap. Dim to the read tier. */
.rd-pause:has(~ .rd-g .rd-w.rd-now),
.rd-pause:has(~ .rd-g .rd-w.rd-read) {
opacity: 0.3;
}
.rd-pause:has(~ .rd-g .rd-w.rd-now)::before,
.rd-pause:has(~ .rd-g .rd-w.rd-read)::before,
.rd-pause:has(~ .rd-g .rd-w.rd-now)::after,
.rd-pause:has(~ .rd-g .rd-w.rd-read)::after {
animation: none;
box-shadow: none;
}
/* ── Active pause beat ──
The pause is its own "word" in the reading flow. The reader playback
loop marks exactly one pause as `.rd-pause-active` during the pause's
own wall-clock duration. Styling is split by pause kind so each
marker brightens in its own visual language instead of getting a
one-size-fits-all yellow pill:
short pause (··) — brighter dots, no box
breath (svg arc) — brighter curve, no box
medium (dividers) — lit line fill, still line-shaped
long (pill) — bright warm fill keeps the pill silhouette
Shared parent glow + soft pulse tie them together so all four kinds
read as "this beat is current" at a glance.
.rd-pause carries a transition so the active state fades in instead
of snapping on when the pause becomes the current beat. */
.rd-pause {
transition:
color .28s cubic-bezier(.25,.8,.25,1),
opacity .28s cubic-bezier(.25,.8,.25,1),
filter .28s cubic-bezier(.25,.8,.25,1);
}
.rd-pause.rd-pause-active {
opacity: 1;
color: rgba(255,232,164,.98);
animation: rd-pause-active-pulse 2.8s ease-in-out infinite;
}
/* Short pause (··) — lit dots, no background box. */
.rd-pause.rd-pause-active[data-pause-kind="short"]::before {
opacity: 1;
color: rgba(255,232,164,.98);
text-shadow: 0 0 14px rgba(255,214,120,.6);
}
/* Breath curve — brighten stroke via filter, no box. */
.rd-pause.rd-pause-active.rd-pause-breath::before {
opacity: 1;
filter: brightness(1.55) drop-shadow(0 0 6px rgba(255,214,120,.45));
}
/* Medium pause dividers — lit line fill, keep the line silhouette. */
span.rd-pause.rd-pause-active.rd-pause-med::before,
span.rd-pause.rd-pause-active.rd-pause-med::after {
background: rgba(255,214,120,.92);
opacity: 1;
}
/* Long pause pill — bright warm fill, pill shape preserved. */
span.rd-pause.rd-pause-active.rd-pause-long::before {
background: rgba(255,214,120,.96);
border-color: rgba(255,214,120,.7);
color: rgba(30,20,8,.92);
opacity: 1;
}
@keyframes rd-pause-active-pulse {
0%, 100% { filter: brightness(1) drop-shadow(0 0 8px rgba(255,214,120,.35)); }
50% { filter: brightness(1.2) drop-shadow(0 0 16px rgba(255,214,120,.7)); }
}
@keyframes rd-pause-glow {
0% { opacity: 0.32; }
40% { opacity: 0.9; }
100% { opacity: 0.6; }
}
@keyframes rd-pause-divider {
0% { opacity: 0.2; }
60% { opacity: 0.9; }
100% { opacity: 1; }
}
@keyframes rd-pause-breath-inhale {
0% { opacity: 0.28; }
45% { opacity: 1; }
100% { opacity: 0.7; }
}
@keyframes rd-pause-silence {
0% { opacity: 0.22; }
30% { opacity: 1; }
80% { opacity: 1; }
100% { opacity: 0.78; }
}
/* ── Reading flashlight sweep ──
A soft warm circle that sweeps left → right inside the active word.
Implemented as a pseudo-element positioned ABSOLUTELY over the
word, sized 2 em × 2 em with a soft radial gradient inside it.
The pseudo is centred horizontally on its `left` percentage via
`transform: translateX(-50%)`, and the `left` property is animated
from 0 % to 100 % of the parent word's width. Because the pseudo
floats above the word and can extend beyond its bounding box (no
overflow clipping), there is no hard edge — the gradient ring
fades smoothly no matter how close the centre is to a word edge.
Cue classes that already use `::before` for their own glyph
(staccato dot, sarcasm quotes, aside parens, stress accent,
highlight yellow rect, building hairpin, legato arc) are
excluded from this rule so the beam never overrides cue chrome;
those cues communicate through their own visual character. */
/* Beam is scoped to `.rd-stage.rd-reading-active` so it only fires
DURING actual playback — at the start of a segment (new card just
appeared, or playback stopped) there is no beam, only the word's
own colour + text-shadow. The `.rd-reading-active` class is added
to `.rd-stage` only while `_isReaderPlaying` is true in C#. */
.rd-stage.rd-reading-active .rd-w.rd-now.rd-kinetic-active:not(.tps-staccato):not(.tps-sarcasm):not(.tps-aside):not(.tps-stress):not(.tps-highlight):not(.tps-building):not(.tps-legato):not(.tps-pronunciation):not(.tps-phonetic)::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
/* The beam is intentionally subtle: slightly wider than the cue
word, very soft, and animated with transform instead of `left`
so the sweep glides without the old ticky feel. */
width: calc(100% + 1.1em);
height: 2.15em;
transform: translate3d(-68%, -50%, 0) scale(.92);
background: radial-gradient(
ellipse at center,
rgba(255, 230, 150, 0.08) 0%,
rgba(255, 230, 150, 0.04) 38%,
rgba(255, 230, 150, 0.015) 64%,
transparent 86%
);
filter: blur(1.5px);
opacity: 0;
animation: rd-flashlight-sweep var(--rd-beam-duration, 420ms) var(--rd-beam-easing, cubic-bezier(.28, .12, .22, 1)) forwards;
pointer-events: none;
z-index: -1;
}
@keyframes rd-flashlight-sweep {
0% {
transform: translate3d(-68%, -50%, 0) scale(.92);
opacity: .16;
}
38% {
opacity: .24;
}
100% {
transform: translate3d(-32%, -50%, 0) scale(1.01);
opacity: 0;
}
}
/* ── Speed cues ──
Speed is communicated through letter-spacing only. No font-stretch,
no font-variation-settings, no padding — every one of those shifts the
word's layout metrics between cards or between idle/active states.
A single letter-spacing value per speed is static, stable, and reads
clearly: tight=fast, wide=slow. No streaks or chips either. */
.rd-w.tps-xslow { letter-spacing: 0.075em; }
.rd-w.tps-slow { letter-spacing: 0.035em; }
.rd-w.tps-fast { letter-spacing: -0.025em; }
.rd-w.tps-xfast { letter-spacing: -0.05em; }
.rd-w.tps-normal { letter-spacing: 0; }
/* ── WPM badge in emotion header ── */
.rd-emo-wpm {
font-size: 10px;
font-weight: 600;
color: var(--t5);
margin-left: auto;
letter-spacing: 0.5px;
opacity: .5;
}
.rd-emo-wpm small {
font-size: 8px;
font-weight: 400;
letter-spacing: 1px;
}
/* ── Phrase-group highlighting ──
Research: single-word highlighting suppresses parafoveal preview and
hurts comprehension. Elevating the entire thought-group lets the eye
preview upcoming words within the phrase while the speaker reads.
4-level hierarchy: read (15%) → upcoming (40%) → active group (75%) → current word (100%) */
.rd-g-active > .rd-w:not(.rd-now):not(.rd-read) {
color: rgba(242,230,204,.42);
}
/* ── Cue colour in preview ──
Cue words show a muted tint of their hue AS SOON AS the card is
active — scope is `.rd-card-active` (not `.rd-g-active`) so the
operator doesn't see cue colours appear only after the first word
activates. Otherwise the new card looks "plain" for a moment and
the cue colours pop in later ("коли заліте єкстаре — слова всі в
активні ап отм стають приглушені"). 0.45 keeps the tint gentle.
The `.rd-g-active > .rd-w ...` rule further below applies a slight
brightness boost to the CURRENT group's plain words — cue words
keep their hue constant and rely on the focus lens + rd-now rules
to show which word is the current beat. */
.rd-card-active .rd-w.tps-warm:not(.rd-now):not(.rd-read) { color: rgba(255,184,99,.45); }
.rd-card-active .rd-w.tps-concerned:not(.rd-now):not(.rd-read) { color: rgba(242,139,184,.45); }
.rd-card-active .rd-w.tps-focused:not(.rd-now):not(.rd-read) { color: rgba(124,255,178,.45); }
.rd-card-active .rd-w.tps-motivational:not(.rd-now):not(.rd-read) { color: rgba(191,164,255,.45); }
.rd-card-active .rd-w.tps-neutral:not(.rd-now):not(.rd-read) { color: rgba(237,242,247,.45); }
.rd-card-active .rd-w.tps-urgent:not(.rd-now):not(.rd-read) { color: rgba(255,120,120,.45); }
.rd-card-active .rd-w.tps-happy:not(.rd-now):not(.rd-read) { color: rgba(255,230,109,.45); }
.rd-card-active .rd-w.tps-excited:not(.rd-now):not(.rd-read) { color: rgba(255,144,220,.45); }
.rd-card-active .rd-w.tps-sad:not(.rd-now):not(.rd-read) { color: rgba(157,182,255,.45); }
.rd-card-active .rd-w.tps-calm:not(.rd-now):not(.rd-read) { color: rgba(118,228,197,.45); }
.rd-card-active .rd-w.tps-energetic:not(.rd-now):not(.rd-read) { color: rgba(255,150,110,.45); }
.rd-card-active .rd-w.tps-professional:not(.rd-now):not(.rd-read) { color: rgba(125,182,255,.45); }
.rd-card-active .rd-w.tps-loud:not(.rd-now):not(.rd-read) { color: rgba(242,193,139,.45); }
.rd-card-active .rd-w.tps-soft:not(.rd-now):not(.rd-read) { color: rgba(199,221,245,.45); }
.rd-card-active .rd-w.tps-whisper:not(.rd-now):not(.rd-read) { color: rgba(207,203,215,.45); }
.rd-card-active .rd-w.tps-aside:not(.rd-now):not(.rd-read) { color: rgba(183,199,205,.45); }
.rd-card-active .rd-w.tps-rhetorical:not(.rd-now):not(.rd-read) { color: rgba(205,179,233,.45); }
.rd-card-active .rd-w.tps-sarcasm:not(.rd-now):not(.rd-read) { color: rgba(255,138,163,.45); }
.rd-card-active .rd-w.tps-building:not(.rd-now):not(.rd-read) { color: rgba(240,212,141,.45); }
.rd-card-active .rd-w.tps-legato:not(.rd-now):not(.rd-read) { color: rgba(141,213,226,.45); }
.rd-card-active .rd-w.tps-staccato:not(.rd-now):not(.rd-read) { color: rgba(236,181,216,.45); }
.rd-card-active .rd-w.tps-energy:not(.rd-now):not(.rd-read) {
color: hsl(calc(72 + (12 * var(--tps-energy, 0))) 100% calc(76% - (10% * var(--tps-energy, 0))) / calc(.34 + (.24 * var(--tps-energy, 0))));
}
.rd-card-active .rd-w.tps-melody:not(.rd-now):not(.rd-read) {
color: hsl(calc(202 + (10 * var(--tps-melody, 0))) 100% calc(82% - (10% * var(--tps-melody, 0))) / calc(.34 + (.24 * var(--tps-melody, 0))));
}
.rd-card-active .rd-w.tps-stress:not(.rd-now):not(.rd-read) {
text-decoration-color: rgba(255,208,96,.2);
color: rgba(242,230,204,.45);
}
.rd-g-active.rd-g-emphasis { text-decoration-line: none; }
.rd-card-active .rd-w.tps-highlight:not(.rd-now):not(.rd-read) { color: rgba(255,235,184,.45); }
/* ── Focus lens (slide flow) ──
A single translucent warm ellipse that glides between active words.
The lens is the SOLE source of "slide flow" motion through the text:
· Preview words keep their stable cluster dimming.
· The focus word's own color change is crisp (.22s transition).
· The lens carries the visual sense of motion by smoothly sliding
from the previous word's position to the new word's position
over .55s (a bit longer than a typical word at 140 WPM so the
glide always feels gentler than the word rhythm).
Pure transform + width transitions — no layout side-effects, no
baseline shift, no impact on neighbouring words. */
.rd-focus-lens {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
pointer-events: none;
opacity: 0;
background:
radial-gradient(ellipse at center,
rgba(255,220,160,.09) 0%,
rgba(255,214,120,.045) 44%,
rgba(255,214,120,.015) 74%,
transparent 92%);
border-radius: 28px;
filter: blur(10px);
transform: translate3d(0, 0, 0);
/* Dynamic transition — JS sets `--rd-lens-duration` and
`--rd-lens-easing` per move based on the target word's cue so the
glide matches cue psychology:
staccato / xfast → snap (0.15s / 0.22s)
loud / stress / default → 0.42s ease-out
soft / calm / slow / sad → 0.55s ease-out (gentler)
legato → 0.6s linear (smoothest glide)
The lens is the only visible "motion" between words, so its
timing carries the whole feel of the reading rhythm. */
transition:
transform var(--rd-lens-duration, .42s) var(--rd-lens-easing, cubic-bezier(.22, 1, .36, 1)),
width var(--rd-lens-duration, .42s) var(--rd-lens-easing, cubic-bezier(.22, 1, .36, 1)),
height var(--rd-lens-duration, .42s) var(--rd-lens-easing, cubic-bezier(.22, 1, .36, 1)),
opacity .34s ease-out;
will-change: transform, width, height, opacity;
/* z-index 0 leaves the lens behind in-flow (statically-positioned)
children like `.rd-w`, so the word glyphs render on top of the
soft glow. */
z-index: 0;
}
.rd-focus-lens-active {
opacity: 1;
}
/* Word states — layout-stable visual transitions only.
0.32s transition keeps up with reader pace (typical word 350-500ms) so
consecutive words don't overlap in fade. `filter` is in the transition
list so per-emotion animations don't snap when the word leaves rd-now.
`display: inline-block` is required for the kinetic transform on
`.rd-w.rd-now` to apply — inline boxes ignore transform. Words still
wrap at whitespace between siblings the same way they did as inline. */
.rd-w {
display: inline-block;
position: relative;
/* Scale growth anchors at the text baseline (line-box bottom) so
a bigger/smaller word grows upward or shrinks upward — the
baseline stays pinned and neighbouring words never shift. */
transform-origin: center bottom;
/* Short, crisp transitions so words do NOT leave bright trails
behind the focus. The sense of "slide-flow" is carried by the
separate `.rd-focus-lens` element which glides between active
words, not by stretching per-word color fades. */
transition:
color .22s cubic-bezier(.25,.8,.25,1),
background-color .22s cubic-bezier(.25,.8,.25,1),
opacity .22s cubic-bezier(.25,.8,.25,1),
text-decoration-color .22s cubic-bezier(.25,.8,.25,1),
text-shadow .22s cubic-bezier(.25,.8,.25,1),
transform .28s cubic-bezier(.25,.8,.25,1),
filter .22s cubic-bezier(.25,.8,.25,1);
}
.rd-emotion-marker {
position: absolute;
left: -.9em;
top: .18em;
width: 0;
height: 0;
line-height: 1;
pointer-events: none;
}
.rd-emotion-marker::before {
content: attr(data-reader-emotion-marker);
display: block;
font-size: .52em;
line-height: 1;
opacity: .82;
}
.rd-w[data-tps-volume],
.rd-w[data-tps-delivery],
.rd-w[data-tps-articulation],
.rd-w[data-tps-energy],
.rd-w[data-tps-melody],
.rd-w[data-tps-speed],
.rd-w[data-tps-emphasis],
.rd-w.tps-pronunciation,
.rd-w.tps-phonetic,
.rd-w[data-tps-stress="true"] {
--tps-cue-opacity: 1;
display: inline-block;
font-weight: var(--tps-cue-weight, inherit);
opacity: var(--tps-cue-opacity);
vertical-align: baseline;
}
.rd-speed-cue-label {
display: inline-flex;
align-items: center;
justify-content: center;
margin-inline: .22em .08em;
padding: .12em .38em;
border: 1px solid rgba(238,219,177,.2);
border-radius: 6px;
background: rgba(16,15,13,.42);
color: rgba(244,226,184,.78);
font-family: var(--mono);
font-size: .28em;
font-weight: 700;
line-height: 1;
pointer-events: none;
transform: translateY(-.46em);
vertical-align: baseline;
white-space: nowrap;
}
.rd-w.rd-now + .rd-speed-cue-label {
border-color: rgba(246,225,174,.42);
background: rgba(246,225,174,.16);
color: rgba(255,242,208,.96);
}
/* ── Volume ──
Volume cues encode loudness through font-weight, letter-spacing, opacity,
and text-shadow ONLY. They MUST NOT change font-size, line-height, margin,
or any transform that could shift the word's baseline or visual height —
the active focus word must never hop up or down when it becomes rd-now.
Layout-affecting properties (font-weight, font-style, letter-spacing)
are applied on the BASE cue class (preview + active both) so a word's
width never changes when it becomes rd-now. Otherwise the neighbouring
words visibly slide as each cue word activates — the user's complaint:
"ці віперали лауди не мають змінювати позицію інших слів". Only
colour, glow, filter, opacity — properties that stay inside the word's
box — differ between preview and active. */
.rd-w.tps-loud {
font-weight: var(--tps-cue-weight, 820);
letter-spacing: .018em;
}
.rd-w.rd-now.tps-loud {
text-shadow:
0 1px 0 rgba(0,0,0,.24),
0 0 22px rgba(245,200,139,.38),
0 0 12px rgba(255,214,146,.2);
}
.rd-w.tps-soft {
font-weight: var(--tps-cue-weight, 520);
opacity: var(--tps-cue-opacity, 1);
}
.rd-w.rd-now.tps-soft {
opacity: .92;
text-shadow: 0 0 14px rgba(199,221,245,.2);
}
/* Whisper carries its full layout signature (italic, light weight,
dotted underline, soft mask) in EVERY state so width stays stable.
rd-now adds the kinetic opacity shimmer only. */
.rd-w.tps-whisper {
font-style: italic;
font-weight: var(--tps-cue-weight, 480);
text-decoration-line: underline;
text-decoration-style: dotted;
text-decoration-color: rgba(207,203,215,.22);
text-decoration-thickness: 1px;
text-underline-offset: .32em;
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.94) 0%, #000 20%, #000 80%, rgba(0,0,0,.94) 100%);
mask-image: linear-gradient(90deg, rgba(0,0,0,.94) 0%, #000 20%, #000 80%, rgba(0,0,0,.94) 100%);
}
.rd-w.rd-now.tps-whisper {
opacity: .82;
}
/* ── Editorial marks — each must be obviously distinct from the others ──
emphasis = warm amber glow (soft shimmer around the word)
strong (**bold**) = heavy weight + bright warm white, drop shadow
italic (*word*) = real italic glyph + violet tint
highlight = yellow rectangle behind (see .tps-highlight)
Layout properties (font-weight, font-style, letter-spacing) live on
the BASE cue class so width stays stable across preview/active —
changing weight between states would shift neighbouring words. Only
colour, glow, and text-shadow differ between preview and rd-now. */
.rd-w.tps-emphasis {
font-weight: var(--tps-cue-weight, 720);
letter-spacing: .01em;
text-decoration-line: none;
}
.rd-w.rd-now.tps-emphasis {
color: rgba(255,228,162,.94);
text-shadow: 0 0 14px rgba(255,210,128,.22), 0 0 22px rgba(232,170,80,.14);
}
.rd-w.tps-strong {
font-weight: var(--tps-cue-weight, 880);
letter-spacing: .014em;
text-decoration-line: none;
}
.rd-w.rd-now.tps-strong {
color: rgba(255,240,196,.96);
text-shadow: 0 1px 0 rgba(0,0,0,.26), 0 0 18px rgba(255,230,184,.22);
}
.rd-w.tps-italic {
font-style: italic;
font-synthesis-style: auto;
font-weight: var(--tps-cue-weight, 600);
letter-spacing: .012em;
text-decoration-line: none;
}
.rd-w.rd-now.tps-italic {
color: rgba(218,210,255,.92);
text-shadow: 0 0 12px rgba(198,210,255,.14);
}
.rd-w.tps-highlight {
background: none;
border-radius: .18em;
display: inline-block;
isolation: isolate;
padding-inline: .04em;
position: relative;
vertical-align: baseline;
}
.rd-w.tps-highlight::before {
content: "";
position: absolute;
z-index: -1;
inset: .1em -.06em .14em;
border-radius: .16em;
background:
linear-gradient(180deg, rgba(255,232,148,.2), rgba(238,173,69,.18)),
linear-gradient(90deg, rgba(255,235,180,.06), rgba(255,214,77,.18), rgba(255,235,180,.06));
box-shadow:
inset 0 0 0 1px rgba(255,224,102,.18),
0 .08em .34em rgba(0,0,0,.12);
pointer-events: none;
}
.rd-g-highlight > .rd-w.tps-highlight::before {
background: none;
box-shadow: none;
content: none;
}
/* Per-word building — text glow grows with crescendo progress. Hairpin
comes from the group (.rd-g-building); single-word fallback is a mini
opening `<` under the word. */
.rd-w.tps-building {
font-weight: var(--tps-cue-weight, 700);
position: relative;
text-shadow:
0 0 calc(5px + (12px * var(--tps-build-progress, 0))) rgba(240,212,141, calc(.08 + (.16 * var(--tps-build-progress, 0))));
}
.rd-g:not(.rd-g-building) > .rd-w.tps-building::before {
content: "";
position: absolute;
left: -.04em;
right: -.04em;
bottom: -.38em;
height: .38em;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 40' preserveAspectRatio='none' fill='none'%3E%3Cpath d='M4 20 L116 4 M4 20 L116 36' stroke='%23F3DA9A' stroke-opacity='.82' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
background-position: center;
background-repeat: no-repeat;
background-size: 100% 100%;
pointer-events: none;
}
.rd-g-building > .rd-w.tps-building::before {
content: none;
}
.rd-w.tps-melody {
position: relative;
text-decoration-line: none;
text-shadow: 0 0 calc(4px + (10px * var(--tps-melody, 0))) rgba(125,219,255, calc(.06 + (.12 * var(--tps-melody, 0))));
}
/* Per-word legato — the visual slur is drawn at the group level
(.rd-g-legato::after). Single-word legato gets a mini arc so it's
still visible outside a group context. */
.rd-w.tps-legato {
letter-spacing: 0;
position: relative;
text-decoration-line: none;
}
.rd-g:not(.rd-g-legato) > .rd-w.tps-legato::before {
content: "";
position: absolute;
left: -.04em;
right: -.04em;
bottom: -.16em;
height: .22em;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 22' preserveAspectRatio='none' fill='none'%3E%3Cpath d='M4 5 Q 50 18 96 5' stroke='%238DD5E2' stroke-opacity='.72' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: center;
background-size: 100% 100%;
pointer-events: none;
}
.rd-g-legato > .rd-w.tps-legato::before {
content: none;
}
/* Staccato — musical staccato notation places a DOT ABOVE each word.
Slight tightened tracking reinforces the "separate, punchy" feel. */
.rd-w.tps-staccato {
font-weight: var(--tps-cue-weight, 720);