summaryrefslogtreecommitdiff
path: root/internal/generator/templates/themes/ocean.tmpl
blob: 8422398b6b2a44eae29c7bd7323634ed1b387748 (plain)
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>snonux.foo ~ OCEAN</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
    <style>
        :root { --teal:#00b4d8; --aqua:#48cae4; --deep:#023e8a; --navy:#03045e; --foam:#caf0f8; }
        * { margin:0; padding:0; box-sizing:border-box; }
        body { font-family:'Segoe UI',system-ui,sans-serif; background:var(--navy);
               color:var(--foam); overflow:hidden; height:100vh; }
        #three-canvas { position:fixed; top:0; left:0; width:100%; height:100%; z-index:1; }
        .overlay { position:relative; z-index:10; height:100vh; display:flex; flex-direction:column; }
        header { padding:16px 28px; background:rgba(3,4,94,0.82); backdrop-filter:blur(12px);
                 border-bottom:1px solid rgba(0,180,216,0.3); display:flex; align-items:center; justify-content:space-between; }
        .logo { display:flex; align-items:center; gap:14px; }
        .logo-mark { font-size:2rem; font-weight:800; color:var(--aqua); text-shadow:0 0 16px var(--teal); }
        .logo-title h1 { font-size:1.5rem; font-weight:700; color:var(--foam); letter-spacing:1px; }
        .logo-title .subtitle { font-size:0.75rem; color:rgba(202,240,248,0.55); margin-top:2px; }
        .logo-title .subtitle a { color:var(--aqua); text-decoration:none; }
        .logo-title .subtitle a:hover { text-shadow:0 0 8px var(--teal); }
        .transmit-btn { border:1px solid var(--teal); color:var(--teal); padding:9px 20px;
                        border-radius:20px; text-decoration:none; font-size:0.85rem; transition:all 0.2s; }
        .transmit-btn:hover { background:var(--teal); color:var(--navy); }
        a.header-feed-link { color:var(--aqua); }
        a.header-feed-link:hover { color:var(--foam); }
        .nav-hints { background:rgba(3,4,94,0.65); border-bottom:1px solid rgba(0,180,216,0.18);
                     color:rgba(202,240,248,0.45); padding:5px 28px; display:flex; gap:18px;
                     font-size:0.68rem; flex-wrap:wrap; }
        .nav-hints kbd { background:rgba(0,180,216,0.12); border:1px solid rgba(0,180,216,0.35);
                         color:var(--aqua); border-radius:3px; padding:0 5px; margin:0 2px; }
        .content { flex:1; overflow-y:auto; padding:20px 28px;
                   scrollbar-width:thin; scrollbar-color:var(--teal) var(--navy); }
        .page-nav { display:flex; justify-content:center; margin:14px 0; }
        .page-nav a { border:1px solid var(--deep); color:var(--aqua); padding:8px 20px;
                      border-radius:20px; text-decoration:none; font-size:0.82rem; }
        .page-nav a:hover { background:var(--teal); color:var(--navy); }
        .page-nav-footer { flex-shrink:0; padding:8px 28px; display:flex; justify-content:center;
            background:rgba(3,4,94,0.82); backdrop-filter:blur(12px);
            border-top:1px solid rgba(0,180,216,0.3); }
        .post { background:rgba(3,4,94,0.55); border:1px solid rgba(0,180,216,0.22); border-radius:10px;
                padding:20px; margin-bottom:14px; cursor:pointer;
                transition:all 0.25s; backdrop-filter:blur(6px); }
        .post:hover { border-color:var(--teal); box-shadow:0 4px 24px rgba(0,180,216,0.22); transform:translateY(-2px); }
        .post-active { border-color:var(--aqua) !important; background:rgba(0,100,150,0.55) !important;
                       box-shadow:0 0 22px rgba(72,202,228,0.35),inset 3px 0 0 var(--aqua) !important; }
        .post-header { display:flex; justify-content:space-between; margin-bottom:12px; font-size:0.88rem; }
        .post-time { color:var(--teal); font-family:monospace; font-size:0.8rem; }
        .post-text { line-height:1.65; font-size:0.95rem; }
        .post-text a { color:var(--aqua); text-decoration:none; }
        .post-text a:hover { text-shadow:0 0 8px var(--teal); }
        .post-audio { width:100%; margin-top:10px; }
        .post-modal { display:none; position:fixed; inset:0; z-index:100;
                      overflow-y:auto; padding:40px 20px; }
        .post-modal.active { display:block; }
        .modal-inner { max-width:760px; margin:0 auto; background:rgba(2,30,80,0.92);
                       border:1px solid var(--teal); border-radius:12px; backdrop-filter:blur(16px);
                       box-shadow:0 0 60px rgba(0,180,216,0.3); padding:40px; }
        .modal-close { float:right; background:none; border:none; color:var(--teal);
                       font-size:0.9rem; cursor:pointer; letter-spacing:1px; }
        @media(max-width:640px) { .nav-hints{display:none;} header{padding:12px 18px;} .content{padding:14px 18px;} }
        .splash-overlay.splash-ocean {
            background: linear-gradient(180deg, var(--navy) 0%, var(--deep) 45%, #001a3d 100%);
        }
        .splash-ocean .splash-wave {
            width:min(320px,88vw); height:14px; margin:0 auto 1.2rem; border-radius:50%;
            background: radial-gradient(ellipse at 50% 0%, var(--aqua), transparent 70%);
            opacity:0.7; animation: splashWaveBob 2.8s ease-in-out infinite;
            box-shadow: 0 8px 40px rgba(0,180,216,0.35);
        }
        @keyframes splashWaveBob { 0%,100%{ transform: translateY(0) scaleX(1); } 50%{ transform: translateY(-6px) scaleX(1.05); } }
        .splash-ocean .splash-title { font-size:clamp(1.45rem,4.5vw,2rem); color:var(--foam);
            text-shadow:0 0 18px var(--teal); }
        .splash-ocean .splash-tag { color:var(--aqua); letter-spacing:0.2em; }
        .splash-ocean .splash-hint { color:rgba(202,240,248,0.88); }
        .splash-ocean .splash-inner { text-shadow: 0 2px 16px rgba(3,4,94,0.9); }
{{template "navSharedCSSInner"}}
    </style>
</head>
<body>
    {{template "splashGate"}}
    <div id="splash-overlay" class="splash-overlay splash-ocean" role="dialog" aria-modal="true" aria-label="Open microblog" tabindex="-1">
        <canvas class="splash-gl-canvas" id="splash-gl-canvas" aria-hidden="true"></canvas>
        <div class="splash-inner">
            <div class="splash-wave" aria-hidden="true"></div>
            <div class="splash-title">snonux.foo</div>
            <div class="splash-tag">Deep channel</div>
            <div class="splash-hint">Surface — click or Enter</div>
        </div>
    </div>
    <script>
    (function(){
        if(document.documentElement.classList.contains('sno-splash-skip'))return;
        var cv=document.getElementById('splash-gl-canvas');
        if(!cv||typeof THREE==='undefined')return;
        var raf,ren,sc,ca,g=new THREE.Group(),t0=performance.now(),i;
        function cleanup(){window.removeEventListener('resize',sz);if(raf)cancelAnimationFrame(raf);raf=null;if(ren)ren.dispose();ren=null;window._snonuxSplashWebGLCleanup=null;}
        window._snonuxSplashWebGLCleanup=cleanup;
        function sz(){var w=cv.clientWidth||2,h=cv.clientHeight||2;if(ren)ren.setSize(w,h,false);if(ca){ca.aspect=w/h;ca.updateProjectionMatrix();}}
        ren=new THREE.WebGLRenderer({canvas:cv,antialias:true,alpha:true});ren.setClearColor(0,0);ren.setPixelRatio(Math.min(window.devicePixelRatio||1,2));
        sc=new THREE.Scene();ca=new THREE.PerspectiveCamera(50,1,0.1,70);ca.position.set(0,0.2,9);
        for(i=0;i<5;i++){var b=new THREE.Mesh(new THREE.SphereGeometry(0.25+Math.random()*0.35,12,12),new THREE.MeshBasicMaterial({color:0x48cae4,transparent:true,opacity:0.65}));
            b.position.set((Math.random()-0.5)*7,(Math.random()-0.5)*4,(Math.random()-0.5)*3);b.userData.dy=0.02+Math.random()*0.03;b.userData.x=b.position.x;b.userData.y0=b.position.y;g.add(b);}
        var jelly=new THREE.Mesh(new THREE.SphereGeometry(1.1,16,16),new THREE.MeshBasicMaterial({color:0x00b4d8,transparent:true,opacity:0.35,wireframe:true}));
        g.add(jelly);sc.add(g);sz();window.addEventListener('resize',sz);
        function loop(now){raf=requestAnimationFrame(loop);var t=(now-t0)*0.001;jelly.rotation.y=t*0.4;
            g.children.forEach(function(c){if(c.userData.dy){c.position.y+=Math.sin(t*2+c.userData.x)*0.008;c.position.x=c.userData.x+Math.sin(t+c.userData.y0)*0.15;}});ren.render(sc,ca);}
        raf=requestAnimationFrame(loop);
    })();
    </script>
    <canvas id="three-canvas"></canvas>
    <div class="overlay">
        <header>
            <div class="logo">
                <span class="logo-mark">SN</span>
                <div class="logo-title">
                    <h1>snonux.foo</h1>
                    <p class="subtitle">microblog &mdash; <a href="https://foo.zone">foo.zone</a> is the real blog</p>
                    <p class="logo-host">Served by NetBSD on a Raspberry Pi 3</p>
                </div>
            </div>
            <div class="nav">
                <a href="atom.xml" class="header-feed-link" rel="alternate" title="Atom feed" type="application/atom+xml">Atom feed</a>
                <a href="https://foo.zone/about" class="transmit-btn">Transmit</a>
            </div>
        </header>
        {{template "navhints" .}}
        <div class="content" id="post-content">
            {{range $i, $post := .Posts}}
            <div class="post" id="post-{{$post.ID}}" data-index="{{$i}}">
                <div class="post-header">
                    <div><strong>@snonux</strong></div>
                    <div class="post-time">{{$post.FormattedTime}}</div>
                </div>
                <div class="post-text">{{$post.ContentHTML}}</div>
            </div>
            {{end}}
        </div>
        {{if or .PrevPage .NextPage}}
        <footer class="page-nav-footer" aria-label="Pagination">
            <div class="page-nav page-nav-dual">
                {{if .PrevPage}}<a href="{{.PrevPage}}">&larr; Newer</a>{{end}}
                {{if .NextPage}}<a href="{{.NextPage}}">Older &rarr;</a>{{end}}
            </div>
        </footer>
        {{end}}
    </div>
    {{template "navmodal" .}}
    <script>
    // Ocean WebGL: dramatic wave surface + sea rock spires + bioluminescent
    // jellyfish + rising bubbles + a slow whale cruising the deep.
    (function() {
        var _wild = false, _snoTOffset = 0, _snoLastT = 0;
        var scene, camera, renderer, clock;
        var waveGeo, waveMesh, sunLight;
        var whale, jellyfish = [];
        var BUBBLE_COUNT = 600;
        var bubblePos, bubbleVY;

        function buildWaves() {
            // High-density plane for smooth vertex displacement
            waveGeo = new THREE.PlaneGeometry(300, 300, 100, 100);
            waveMesh = new THREE.Mesh(waveGeo, new THREE.MeshPhongMaterial({
                color: 0x0077b6, emissive: 0x023e8a, emissiveIntensity: 0.25,
                transparent: true, opacity: 0.88, side: THREE.DoubleSide, shininess: 80
            }));
            waveMesh.rotation.x = -Math.PI / 2;
            waveMesh.position.y = 0;
            scene.add(waveMesh);
        }

        function buildRocks() {
            // 5 jagged sea rock spires poking above the wave baseline
            var rockPositions = [[-30,0,-30],[20,-2,-20],[-15,2,-45],[35,-1,-35],[-45,1,-25]];
            rockPositions.forEach(function(p) {
                var h = 8 + Math.random() * 10;
                var rock = new THREE.Mesh(
                    new THREE.ConeGeometry(2 + Math.random(), h, 6),
                    new THREE.MeshPhongMaterial({ color: 0x023e8a, emissive: 0x00b4d8, emissiveIntensity: 0.15 })
                );
                rock.position.set(p[0], p[1] + h / 2 - 3, p[2]);
                scene.add(rock);
            });
        }

        function buildJellyfish() {
            // Bioluminescent jellyfish: torus body + cone cap, additive blending
            var jPos = [[-12, 6,-15],[18,10,-22],[-25,4,-18],[8,8,-30]];
            jPos.forEach(function(p) {
                var body = new THREE.Mesh(
                    new THREE.TorusGeometry(2.2, 0.5, 12, 24),
                    new THREE.MeshBasicMaterial({ color: 0x48cae4, transparent: true, opacity: 0.5, blending: THREE.AdditiveBlending, depthWrite: false })
                );
                var cap = new THREE.Mesh(
                    new THREE.SphereGeometry(2.2, 12, 8, 0, Math.PI * 2, 0, Math.PI / 2),
                    new THREE.MeshBasicMaterial({ color: 0x00b4d8, transparent: true, opacity: 0.35, blending: THREE.AdditiveBlending, depthWrite: false, side: THREE.DoubleSide })
                );
                cap.position.y = 0.5;
                body.add(cap);
                body.position.set(p[0], p[1], p[2]);
                jellyfish.push({ mesh: body, baseY: p[1], phase: Math.random() * Math.PI * 2 });
                scene.add(body);
            });
        }

        function buildWhale() {
            // Dark elongated flattened sphere — whale silhouette in the deep
            var geo = new THREE.SphereGeometry(1, 16, 8);
            whale = new THREE.Mesh(geo, new THREE.MeshBasicMaterial({ color: 0x011f40, transparent: true, opacity: 0.7 }));
            whale.scale.set(12, 3, 5);
            whale.position.set(-60, -8, -20);
            scene.add(whale);
        }

        function buildBubbles() {
            bubblePos = new Float32Array(BUBBLE_COUNT * 3);
            bubbleVY  = new Float32Array(BUBBLE_COUNT);
            for (var i = 0; i < BUBBLE_COUNT; i++) {
                bubblePos[i*3]   = (Math.random() - 0.5) * 100;
                bubblePos[i*3+1] = -15 - Math.random() * 15;
                bubblePos[i*3+2] = (Math.random() - 0.5) * 60 - 10;
                bubbleVY[i] = 0.04 + Math.random() * 0.06;
            }
            var geo = new THREE.BufferGeometry();
            geo.setAttribute('position', new THREE.BufferAttribute(bubblePos, 3));
            scene.add(new THREE.Points(geo, new THREE.PointsMaterial({
                color: 0xcaf0f8, size: 0.18, transparent: true, opacity: 0.6
            })));
            return geo;
        }

        var bubbleGeo;

        function initThree() {
            scene = new THREE.Scene();
            scene.background = new THREE.Color(0x03045e);
            scene.fog = new THREE.Fog(0x03045e, 40, 130);

            camera = new THREE.PerspectiveCamera(60, window.innerWidth/window.innerHeight, 0.1, 220);
            camera.position.set(0, 20, 55);
            camera.lookAt(0, 0, 0);

            renderer = new THREE.WebGLRenderer({ canvas: document.getElementById('three-canvas'), antialias: true });
            renderer.setSize(window.innerWidth, window.innerHeight);
            renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
            clock = new THREE.Clock();

            scene.add(new THREE.AmbientLight(0x023e8a, 0.5));
            sunLight = new THREE.PointLight(0x48cae4, 2.5, 100);
            sunLight.position.set(0, 30, 10);
            scene.add(sunLight);
            var deepLight = new THREE.PointLight(0x0077b6, 1.5, 60);
            deepLight.position.set(0, -10, 0);
            scene.add(deepLight);

            buildWaves();
            buildRocks();
            buildJellyfish();
            buildWhale();
            bubbleGeo = buildBubbles();

            window.addEventListener('resize', onResize);
            animate();
        }

        function onResize() {
            camera.aspect = window.innerWidth / window.innerHeight;
            camera.updateProjectionMatrix();
            renderer.setSize(window.innerWidth, window.innerHeight);
        }

        function animate() {
            requestAnimationFrame(animate);
            var realT = clock.getElapsedTime();
            _snoTOffset += (realT - _snoLastT) * (_wild ? 6 : 0);
            _snoLastT = realT;
            var t = realT + _snoTOffset;
            var waveAmp = _wild ? 2.8 : 1; // tsunami amplitude in wild mode
            var pos = waveGeo.attributes.position;

            // Dramatic overlapping waves — tsunami amplitude in wild mode
            for (var i = 0; i < pos.count; i++) {
                var x = pos.getX(i), z = pos.getZ(i);
                pos.setY(i,
                    Math.sin(x * 0.04 + t * 1.1) * 3.2 * waveAmp +
                    Math.cos(z * 0.06 + t * 0.85) * 2.4 * waveAmp +
                    Math.sin((x + z) * 0.025 + t * 0.6) * 1.5 * waveAmp
                );
            }
            pos.needsUpdate = true;
            waveGeo.computeVertexNormals();

            // Jellyfish bob and slowly drift horizontally
            jellyfish.forEach(function(j) {
                j.mesh.position.y = j.baseY + Math.sin(t * 0.8 + j.phase) * 1.2;
                j.mesh.position.x += 0.005 * Math.sin(t * 0.3 + j.phase);
                j.mesh.rotation.y += 0.006;
            });

            // Whale cruises across at depth, wraps around
            whale.position.x += 0.04;
            if (whale.position.x > 80) whale.position.x = -80;
            whale.position.y = -8 + Math.sin(t * 0.15) * 2;

            // Rising bubbles — explode upward in wild tsunami mode
            var bp = bubbleGeo.attributes.position;
            var bMult = _wild ? 8 : 1;
            for (var bi = 0; bi < BUBBLE_COUNT; bi++) {
                bubblePos[bi*3+1] += bubbleVY[bi] * bMult;
                if (bubblePos[bi*3+1] > 8) {
                    bubblePos[bi*3]   = (Math.random() - 0.5) * 100;
                    bubblePos[bi*3+1] = -15 - Math.random() * 10;
                }
            }
            bp.needsUpdate = true;

            // Sunlight orbits above
            sunLight.position.x = Math.cos(t * 0.2) * 35;
            sunLight.position.z = Math.sin(t * 0.2) * 35;

            renderer.render(scene, camera);
        }

        initThree();

        // Ocean nav/wild effects — wave surge on navigate, tsunami on wild
        window.snonuxOpenEffect = function(post) {
            // Fly up from depth — like surfacing from the ocean
            var modal = document.getElementById('post-modal');
            if (modal) { modal.classList.add('sno-modal-fly'); setTimeout(function() { modal.classList.remove('sno-modal-fly'); }, 390); }
            // Bubble burst from post
            var r = post ? post.getBoundingClientRect() : {left: window.innerWidth/2, top: window.innerHeight/2, width: 0, height: 0};
            for (var i = 0; i < 8; i++) {
                (function(i) {
                    var b = document.createElement('div');
                    var sz = 4 + Math.random() * 8;
                    b.style.cssText = 'position:fixed;top:' + (r.top + r.height * 0.7) + 'px;left:' + (r.left + r.width * 0.3 + Math.random() * r.width * 0.4) + 'px;z-index:997;pointer-events:none;width:' + sz + 'px;height:' + sz + 'px;border-radius:50%;border:1px solid rgba(72,202,228,0.7);background:rgba(0,180,216,0.2);transition:all 0.5s ease,opacity 0.5s';
                    document.body.appendChild(b);
                    setTimeout(function() { b.style.transform='translateY(-' + (60+Math.random()*60) + 'px) scale(1.5)'; b.style.opacity='0'; setTimeout(function() { b.remove(); }, 560); }, 20 + i*40);
                })(i);
            }
        };
        window.snonuxCloseEffect = function() {
            var d = document.createElement('div');
            d.style.cssText = 'position:fixed;inset:0;z-index:998;pointer-events:none;background:rgba(0,180,216,0.12);transition:opacity 0.2s';
            document.body.appendChild(d);
            setTimeout(function() { d.style.opacity='0'; setTimeout(function() { d.remove(); }, 230); }, 15);
        };
        window.snonuxScrollEffect = function(dir) {
            var isDown = dir === 'down';
            var thick = _wild ? '14px' : '5px';
            var d = document.createElement('div');
            d.style.cssText = 'position:fixed;left:0;right:0;height:' + thick + ';z-index:9000;pointer-events:none;' +
                'background:linear-gradient(90deg,transparent,rgba(0,119,182,0.9),rgba(0,180,216,0.9),rgba(0,119,182,0.9),transparent);' +
                (isDown ? 'top:0;' : 'bottom:0;') +
                'transition:transform 0.32s ease,opacity 0.32s ease;';
            document.body.appendChild(d);
            setTimeout(function() { d.style.transform = isDown ? 'translateY(100vh)' : 'translateY(-100vh)'; d.style.opacity='0'; }, 16);
            setTimeout(function() { d.remove(); }, 400);
        };
        window.snonuxWildToggle = function() {
            _wild = !_wild;
            var b = document.getElementById('sno-wild-badge');
            if (b) b.classList.toggle('sno-wild-on', _wild);
        };
        window.snonuxNavEffect = function() {
            // Wave surge: content skews briefly
            var ov = document.querySelector('.overlay');
            if (!ov) return;
            ov.style.transition = 'transform 0.1s';
            ov.style.transform = 'skewX(-1.5deg) translateY(-3px)';
            setTimeout(function() { ov.style.transform = ''; setTimeout(function() { ov.style.transition = ''; }, 180); }, 110);
            var d = document.createElement('div');
            d.style.cssText = 'position:fixed;inset:0;z-index:998;pointer-events:none;background:rgba(0,180,216,0.18);transition:opacity 0.22s';
            document.body.appendChild(d);
            setTimeout(function() { d.style.opacity='0'; setTimeout(function() { d.remove(); }, 250); }, 30);
        };
        window.snonuxPageEffect = function() {
            var ov = document.querySelector('.overlay');
            if (ov) { ov.classList.add('sno-fx-zoom'); setTimeout(function() { ov.classList.remove('sno-fx-zoom'); }, 330); }
        };
    })();
    </script>
    {{template "navscript" .}}
</body>
</html>