|
| 1 | +/* Digital Rain — pure CSS (no JS/images), accessible, reduced-motion friendly */ |
| 2 | + |
| 3 | +:root{ |
| 4 | + --bg: #070b18; |
| 5 | + --panel-1: #0c1434; |
| 6 | + --panel-2: #0a1128; |
| 7 | + --glyph-dim: #1cff6a; |
| 8 | + --glyph-bright: #caffde; |
| 9 | +} |
| 10 | + |
| 11 | +*{ box-sizing: border-box; } |
| 12 | +html, body{ |
| 13 | + height: 100%; |
| 14 | + margin: 0; |
| 15 | + background: radial-gradient(1200px 800px at 50% 42%, #0f1942, var(--bg)); |
| 16 | + color: #e9eefc; |
| 17 | + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; |
| 18 | +} |
| 19 | + |
| 20 | +.stage{ |
| 21 | + position: fixed; inset: 0; |
| 22 | + display: grid; place-items: center; |
| 23 | +} |
| 24 | + |
| 25 | +/* Framed scene with subtle star specks */ |
| 26 | +.matrix{ |
| 27 | + position: relative; |
| 28 | + width: min(860px, 92vw); |
| 29 | + height: min(520px, 68vh); |
| 30 | + border-radius: 18px; |
| 31 | + overflow: hidden; |
| 32 | + background: |
| 33 | + radial-gradient(90% 65% at 50% 55%, var(--panel-1) 0, var(--panel-2) 60%, #070b18 100%), |
| 34 | + radial-gradient(#ffffff20 1px, transparent 1px); |
| 35 | + background-size: auto, 3px 3px; |
| 36 | + background-position: 0 0, 0 0; |
| 37 | + box-shadow: 0 24px 72px #000a, inset 0 0 80px #0b102888; |
| 38 | + filter: saturate(120%); |
| 39 | +} |
| 40 | + |
| 41 | +/* Lay columns using grid so spacing scales with width */ |
| 42 | +.matrix{ |
| 43 | + display: grid; |
| 44 | + grid-auto-flow: column; |
| 45 | + grid-auto-columns: 1.35ch; |
| 46 | + gap: 0.65ch; |
| 47 | + align-items: stretch; |
| 48 | + padding: 18px 14px; |
| 49 | +} |
| 50 | + |
| 51 | +/* Each column is a clipping window; text scrolls inside the ::before */ |
| 52 | +.col{ |
| 53 | + position: relative; |
| 54 | + height: 100%; |
| 55 | + overflow: hidden; |
| 56 | + isolation: isolate; /* let ::after blend without affecting neighbors */ |
| 57 | +} |
| 58 | + |
| 59 | +/* Long “stream” of glyphs (katakana + latin + digits), written vertically */ |
| 60 | +.col::before{ |
| 61 | + content: |
| 62 | + "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン" |
| 63 | + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 64 | + "アカサタナハマヤラ0123456789タチツテトABCDEFウエオ" |
| 65 | + "MNOPQRSTUVWXハヒフヘホYZ0123456789" |
| 66 | + "アイウエオヤユヨワン0123456789ABCDEFGHJKLMNPQRSTUVWXZ"; |
| 67 | + position: absolute; |
| 68 | + left: 0; top: -110%; /* start above the window */ |
| 69 | + display: inline-block; |
| 70 | + min-height: 220%; /* long enough to scroll */ |
| 71 | + writing-mode: vertical-rl; |
| 72 | + text-orientation: upright; |
| 73 | + font-size: 16px; |
| 74 | + line-height: 1.08; |
| 75 | + letter-spacing: 0.06em; |
| 76 | + color: #0cff66; |
| 77 | + text-shadow: |
| 78 | + 0 0 8px #00ff88, |
| 79 | + 0 0 16px #00ff88; |
| 80 | + transform: translateY(0); |
| 81 | + animation: rain var(--dur, 7s) linear infinite; |
| 82 | + animation-delay: calc(var(--i) * -0.25s); |
| 83 | + /* fade top & bottom edges inside the window */ |
| 84 | + -webkit-mask: linear-gradient(180deg, transparent 0 6%, #000 12% 88%, transparent 94% 100%); |
| 85 | + mask: linear-gradient(180deg, transparent 0 6%, #000 12% 88%, transparent 94% 100%); |
| 86 | +} |
| 87 | + |
| 88 | +/* Column-specific timing (varies duration a little for organic look) */ |
| 89 | +.col:nth-child(odd)::before { animation-duration: 7.6s; } |
| 90 | +.col:nth-child(even)::before{ animation-duration: 6.8s; } |
| 91 | +.col:nth-child(3n)::before { animation-duration: 7.9s; } |
| 92 | + |
| 93 | +.col:nth-child(odd)::after { animation-duration: 7.6s; } |
| 94 | +.col:nth-child(even)::after { animation-duration: 6.8s; } |
| 95 | +.col:nth-child(3n)::after { animation-duration: 7.9s; } |
| 96 | + |
| 97 | +/* Motion */ |
| 98 | +@keyframes rain{ |
| 99 | + from{ transform: translateY(0); } |
| 100 | + to { transform: translateY(110%); } /* scroll fully through */ |
| 101 | +} |
| 102 | +@keyframes head{ |
| 103 | + from{ top: -18%; } |
| 104 | + to { top: 100%; } |
| 105 | +} |
| 106 | + |
| 107 | +/* Reduce motion: show a calm, readable grid */ |
| 108 | +@media (prefers-reduced-motion: reduce){ |
| 109 | + .col::before, .col::after { animation: none !important; top: 0; } |
| 110 | + .col::after{ display: none; } |
| 111 | +} |
0 commit comments