Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -221,27 +221,40 @@
.marquee-container:hover .marquee-track,
.marquee-container:focus-within .marquee-track { animation-play-state: paused; }

/* Crow silhouettes scatter once as each new 404 thought appears. */
/* Crow flight, feather drift, and a two-stage quote handoff. */
@keyframes crow-flight {
0% { opacity: 0; transform: translate(0, 12px) scale(0.35); }
18% { opacity: 1; }
100% { opacity: 0; transform: translate(var(--crow-x), var(--crow-y)) rotate(var(--crow-turn)) scale(0.8); }
0% { opacity: 0; transform: translate(0, 12px) scale(0.3); }
12% { opacity: 1; }
40% { opacity: 0.95; transform: translate(var(--crow-mid-x), var(--crow-mid-y)) rotate(-8deg) scale(var(--crow-scale)); }
100% { opacity: 0; transform: translate(var(--crow-x), var(--crow-y)) rotate(var(--crow-turn)) scale(0.45); }
}
@keyframes crow-wings {
from { transform: scaleY(1) rotate(-6deg); }
to { transform: scaleY(0.35) rotate(6deg); }
from { transform: scaleY(1) rotate(-8deg); }
to { transform: scaleY(0.4) rotate(8deg); }
}
@keyframes feather-drift {
0% { opacity: 0; transform: translate(0, 0) rotate(-20deg); }
20% { opacity: 0.8; }
100% { opacity: 0; transform: translate(var(--crow-x), var(--crow-y)) rotate(var(--crow-turn)); }
}
@keyframes quote-dissolve {
0% { opacity: 1; transform: translateY(0); filter: blur(0); }
35%, 100% { opacity: 0; transform: translateY(-8px); filter: blur(3px); }
}
@keyframes quote-materialize {
0%, 25% { opacity: 0; filter: blur(4px); transform: translateY(5px); }
0%, 35% { opacity: 0; filter: blur(3px); transform: translateY(10px); }
100% { opacity: 1; filter: blur(0); transform: translateY(0); }
}
.crow-flight { color: hsl(var(--ink)); animation: crow-flight 1.2s ease-out both; }
.crow-wings { animation: crow-wings 0.16s ease-in-out 8 alternate; }
.quote-transition .quote-copy { animation: quote-materialize 1.1s ease-out both; }
html.safe-mode .crow-scatter { display: none; }
.crow-flight { color: hsl(var(--ink)); animation: crow-flight 1.6s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.crow-wings { animation: crow-wings var(--wing-speed, 0.18s) ease-in-out 10 alternate; }
.crow-feather { animation: feather-drift 1.8s ease-out both; }
.quote-transition .quote-outgoing { animation: quote-dissolve 1.6s ease-out both; }
.quote-transition .quote-copy { animation: quote-materialize 1.6s ease-out both; }
html.safe-mode .crow-scatter,
html.safe-mode .quote-outgoing { display: none; }
html.safe-mode .quote-copy { animation: none; }
@media (prefers-reduced-motion: reduce) {
.crow-scatter { display: none; }
.crow-scatter, .quote-outgoing { display: none; }
.quote-transition .quote-copy { animation: none; }
}

Expand Down
33 changes: 33 additions & 0 deletions src/components/cyber/__tests__/home-footer-quote.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { act, render, screen } from '@testing-library/react';
import { HomeFooterQuote } from '../home-footer-quote';
import { NOT_FOUND_QUOTES } from '@/lib/not-found-quotes';

let pathname = '/';
jest.mock('next/navigation', () => ({ usePathname: () => pathname }));

beforeEach(() => {
pathname = '/';
sessionStorage.clear();
jest.useFakeTimers();
jest.setSystemTime(new Date('2026-10-07T13:00:00Z'));
});
afterEach(() => jest.useRealTimers());

test('shows the larger home quote, hands off the outgoing quote, and keeps the clock', () => {
const view = render(<HomeFooterQuote />);
expect(screen.getByText(/One last thought/)).toBeVisible();
expect(screen.getByRole('blockquote')).toHaveClass('text-2xl');
act(() => jest.advanceTimersByTime(10000));
expect(view.container.querySelector('.quote-copy')).toHaveTextContent(NOT_FOUND_QUOTES[1]);
expect(view.container.querySelector('.quote-outgoing')).toHaveTextContent(NOT_FOUND_QUOTES[0]);
expect(view.container.querySelector('.quote-outgoing')).toHaveAttribute('aria-hidden', 'true');
view.unmount();
expect(jest.getTimerCount()).toBe(0);
});

test.each(['/admin', '/blog/post', '/missing-page'])('does not duplicate quotes on %s', (path) => {
pathname = path;
const view = render(<HomeFooterQuote />);
expect(view.container).toBeEmptyDOMElement();
expect(jest.getTimerCount()).toBe(0);
});
23 changes: 20 additions & 3 deletions src/components/cyber/crow-scatter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,31 @@ export function CrowScatter() {
'--crow-x': `${Math.cos(angle) * radius}px`,
'--crow-y': `${Math.sin(angle) * radius - 35}px`,
'--crow-turn': `${Math.cos(angle) * 35}deg`,
animationDelay: `${(index % 5) * 35}ms`,
'--crow-mid-x': `${Math.cos(angle + 0.3) * radius * 0.4}px`,
'--crow-mid-y': `${Math.sin(angle + 0.3) * radius * 0.3 - 20}px`,
'--crow-scale': String(0.65 + (index % 4) * 0.16),
'--wing-speed': `${0.14 + (index % 4) * 0.025}s`,
animationDuration: `${1.45 + (index % 4) * 0.12}s`,
animationDelay: `${(index % 5) * 45}ms`,
} as CSSProperties;
return <span key={index} className="crow-flight absolute" style={style}>
<span className="crow-wings block"><svg viewBox="0 0 64 48" className="h-9 w-12" fill="currentColor" stroke="hsl(var(--bone) / 0.45)" strokeWidth="0.7">
<path d="M31 25 C23 19 18 5 2 3 L8 14 L4 13 L15 24 L10 24 Q20 34 30 31 L26 45 L32 41 L38 45 L35 31 Q45 34 55 24 L50 24 L61 13 L56 14 L62 3 C46 5 41 19 33 25 Z" />
<span className="crow-wings block"><svg viewBox="0 0 64 48" className="h-9 w-12" fill="currentColor" stroke="hsl(var(--bone) / 0.6)" strokeWidth="0.8">
<path d="M31 25 C23 19 18 5 2 3 L8 14 L4 13 L12 21 L8 20 L18 28 L13 27 Q20 34 30 31 L26 45 L32 41 L38 45 L35 31 Q45 34 55 24 L51 27 L46 28 L56 20 L52 21 L60 13 L56 14 L62 3 C46 5 41 19 33 25 Z" />
<path d="M29 29 Q27 20 32 17 Q37 17 38 21 L44 24 L37 25 L35 32 Z" />
<circle cx="35" cy="21" r="1" fill="hsl(var(--red))" stroke="none" />
</svg></span>
</span>;
})}
{Array.from({ length: 7 }, (_, index) => <span key={`feather-${index}`} className="crow-feather absolute" style={{
left: `${25 + index * 8}%`, top: '45%',
'--crow-x': `${(index - 3) * 38}px`,
'--crow-y': `${40 + (index % 3) * 22}px`,
'--crow-turn': `${(index % 2 ? -1 : 1) * 130}deg`,
animationDelay: `${index * 65}ms`,
} as CSSProperties}>
<svg viewBox="0 0 16 40" className="h-7 w-3" fill="hsl(var(--ink))" stroke="hsl(var(--bone) / 0.45)" strokeWidth="0.8">
<path d="M8 38 C2 27 -1 12 7 2 C17 11 15 27 8 38 Z M8 38 L8 9" />
</svg>
</span>)}
</div>;
}
10 changes: 10 additions & 0 deletions src/components/cyber/home-footer-quote.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use client';

import { usePathname } from 'next/navigation';
import { RotatingQuote } from './rotating-quote';

export function HomeFooterQuote() {
const pathname = usePathname();
if (pathname !== '/') return null;
return <div className="mb-8 mt-10 max-w-4xl sm:mt-12"><RotatingQuote large label="One last thought" /></div>;
}
49 changes: 2 additions & 47 deletions src/components/cyber/not-found-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,14 @@

import dynamic from 'next/dynamic';
import Link from 'next/link';
import { useEffect, useState } from 'react';
import { NOT_FOUND_QUOTES, getQuoteClock, quoteIndexAt, QUOTE_INTERVAL_MS } from '@/lib/not-found-quotes';
import { CrowScatter } from './crow-scatter';
import { RotatingQuote } from './rotating-quote';

const SharinganEye = dynamic(() => import('./sharingan').then((module) => module.SharinganEye), {
ssr: false,
loading: () => <div className="flex h-full items-center justify-center monofont text-[10px] uppercase tracking-[0.3em]">Opening eye…</div>,
});

// In-memory continuity for browsers that block storage.
let fallbackAnchor: number | undefined;

export function NotFoundScreen() {
const [quoteIndex, setQuoteIndex] = useState(0);
const [ready, setReady] = useState(false);
const [paused, setPaused] = useState(false);

useEffect(() => {
if (paused) return;
const now = Date.now();
let anchor: number;
try {
anchor = getQuoteClock(window.sessionStorage, now);
} catch {
fallbackAnchor ??= now;
anchor = fallbackAnchor;
}
let timer: ReturnType<typeof setTimeout>;
const update = () => {
clearTimeout(timer);
const current = Date.now();
setQuoteIndex(quoteIndexAt(anchor, current));
setReady(true);
timer = setTimeout(update, QUOTE_INTERVAL_MS - (Math.max(0, current - anchor) % QUOTE_INTERVAL_MS));
};
update();
document.addEventListener('visibilitychange', update);
return () => {
clearTimeout(timer);
document.removeEventListener('visibilitychange', update);
};
}, [paused]);

return (
<main className="relative overflow-hidden bg-ink text-bone">
<div aria-hidden className="pointer-events-none absolute inset-0 grid-cross" />
Expand Down Expand Up @@ -73,17 +38,7 @@ export function NotFoundScreen() {
<SharinganEye className="relative h-[280px] w-full sm:h-[360px] lg:h-[400px]" />
<p className="relative border-t border-ink/40 px-5 py-4 monofont text-[10px] uppercase tracking-[0.2em]">Even this eye cannot locate your page.</p>
</div>
<div className="relative mt-6 border-l-2 border-signal pl-5">
<p className="monofont text-[10px] uppercase tracking-[0.2em] text-signal">Intercepted thought // {String(quoteIndex + 1).padStart(2, '0')} / {NOT_FOUND_QUOTES.length}</p>
<div key={quoteIndex} className={ready ? 'quote-transition relative' : 'relative'}>
{ready && <CrowScatter />}
<blockquote className="quote-copy mt-3 min-h-[4.5rem] font-display text-lg leading-relaxed sm:text-xl">“{NOT_FOUND_QUOTES[quoteIndex]}”</blockquote>
</div>
<p className="mt-2 monofont text-[9px] uppercase tracking-[0.2em] text-bone/50">Original words // new thought every 10 seconds</p>
<button type="button" aria-pressed={paused} onClick={() => setPaused((value) => !value)} className="mt-3 border-b border-signal/40 py-1 monofont text-[10px] uppercase tracking-wider text-signal hover:text-bone focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-signal">
{paused ? 'Resume quotes' : 'Pause quotes'}
</button>
</div>
<div className="mt-6"><RotatingQuote /></div>
</div>
</div>
</div>
Expand Down
60 changes: 60 additions & 0 deletions src/components/cyber/rotating-quote.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
'use client';

import { useEffect, useState } from 'react';
import { NOT_FOUND_QUOTES, getQuoteClock, quoteIndexAt, QUOTE_INTERVAL_MS } from '@/lib/not-found-quotes';
import { CrowScatter } from './crow-scatter';

// Used only in the browser when storage is unavailable.
let fallbackAnchor: number | undefined;

export function RotatingQuote({ large = false, label = 'Intercepted thought' }: { large?: boolean; label?: string }) {
const [quote, setQuote] = useState({ index: 0, previous: null as number | null, ready: false });
const [paused, setPaused] = useState(false);

useEffect(() => {
if (paused) return;
const now = Date.now();
let anchor: number;
try {
anchor = getQuoteClock(window.sessionStorage, now);
} catch {
fallbackAnchor ??= now;
anchor = fallbackAnchor;
}
let timer: ReturnType<typeof setTimeout>;
const update = () => {
clearTimeout(timer);
const current = Date.now();
const index = quoteIndexAt(anchor, current);
setQuote((old) => old.ready && old.index === index ? old : {
index,
previous: old.ready ? old.index : null,
ready: true,
});
timer = setTimeout(update, QUOTE_INTERVAL_MS - (Math.max(0, current - anchor) % QUOTE_INTERVAL_MS));
};
update();
document.addEventListener('visibilitychange', update);
return () => {
clearTimeout(timer);
document.removeEventListener('visibilitychange', update);
};
}, [paused]);

return <section aria-label="Rotating thoughts" className="relative border-l-2 border-signal pl-5 sm:pl-6">
<p className="monofont text-[10px] uppercase tracking-[0.2em] text-signal">{label}{' // '}{String(quote.index + 1).padStart(2, '0')} / {NOT_FOUND_QUOTES.length}</p>
<div key={quote.index} className={quote.ready ? 'quote-transition relative' : 'relative'}>
{quote.ready && <CrowScatter />}
<blockquote className={`relative mt-4 grid font-display leading-relaxed ${large ? 'min-h-[10rem] text-2xl sm:min-h-[6rem] sm:text-[1.75rem]' : 'min-h-[7.5rem] text-xl sm:text-2xl'}`}>
{quote.previous !== null && <span aria-hidden className="quote-outgoing col-start-1 row-start-1 self-start">“{NOT_FOUND_QUOTES[quote.previous]}”</span>}
<span className="quote-copy col-start-1 row-start-1 self-start">“{NOT_FOUND_QUOTES[quote.index]}”</span>
</blockquote>
</div>
<div className="mt-3 flex flex-wrap items-center gap-x-6 gap-y-2">
<p className="monofont text-[9px] uppercase tracking-[0.2em] text-bone/50">Original words // new thought every 10 seconds</p>
<button type="button" aria-pressed={paused} onClick={() => setPaused((value) => !value)} className="border-b border-signal/40 py-1 monofont text-[10px] uppercase tracking-wider text-signal hover:text-bone focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-signal">
{paused ? 'Resume quotes' : 'Pause quotes'}
</button>
</div>
</section>;
}
3 changes: 3 additions & 0 deletions src/components/site-footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { cn } from '@/lib/utils';
import Link from 'next/link';
import { Github, Linkedin, Mail, FileText, type LucideIcon } from 'lucide-react';
import { HomeFooterQuote } from '@/components/cyber/home-footer-quote';

interface PersonalData {
name: string;
Expand Down Expand Up @@ -72,6 +73,8 @@ export function SiteFooter({ className, personalData }: React.HTMLAttributes<HTM
</p>
)}

<HomeFooterQuote />

<div className="mt-6 flex items-center justify-between border-t border-signal/30 pt-4 monofont text-[10px] uppercase tracking-[0.3em] text-muted-foreground">
<span>END OF TRANSMISSION</span>
<span className="font-jp">通信終了</span>
Expand Down
Loading