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
26 changes: 26 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,32 @@
.animate-marquee { animation: marquee 32s linear infinite; }
.animate-marquee-fast { animation: marquee 18s linear infinite; }
.animate-marquee-rev { animation: marquee-rev 36s linear infinite; }
.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. */
@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); }
}
@keyframes crow-wings {
from { transform: scaleY(1) rotate(-6deg); }
to { transform: scaleY(0.35) rotate(6deg); }
}
@keyframes quote-materialize {
0%, 25% { opacity: 0; filter: blur(4px); transform: translateY(5px); }
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; }
html.safe-mode .quote-copy { animation: none; }
@media (prefers-reduced-motion: reduce) {
.crow-scatter { display: none; }
.quote-transition .quote-copy { animation: none; }
}

@keyframes glitch-layer {
0%, 86%, 95%, 100% { clip-path: inset(0 0 100% 0); transform: translate(0); }
Expand Down
26 changes: 26 additions & 0 deletions src/components/cyber/__tests__/marquee.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { act, render } from '@testing-library/react';
import { Marquee } from '../primitives';

test('maintains a steady pixel speed as the strip grows and disconnects its observer', () => {
let measure: () => void = () => {};
const disconnect = jest.fn();
const original = global.ResizeObserver;
global.ResizeObserver = jest.fn().mockImplementation((callback) => {
measure = callback;
return { observe: jest.fn(), disconnect };
});
const width = jest.spyOn(HTMLElement.prototype, 'scrollWidth', 'get').mockReturnValue(960);
try {
const view = render(<Marquee items={['Python', 'Nmap']} pixelsPerSecond={24} />);
const track = view.container.querySelector('.marquee-track') as HTMLElement;
expect(track.style.animationDuration).toBe('20s');
width.mockReturnValue(1920);
act(() => measure());
expect(track.style.animationDuration).toBe('40s');
view.unmount();
expect(disconnect).toHaveBeenCalledTimes(1);
} finally {
width.mockRestore();
global.ResizeObserver = original;
}
});
36 changes: 36 additions & 0 deletions src/components/cyber/__tests__/not-found-screen.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { act, fireEvent, render, screen } from '@testing-library/react';
import { NotFoundScreen } from '../not-found-screen';
import { NOT_FOUND_QUOTES } from '@/lib/not-found-quotes';

jest.mock('next/dynamic', () => () => function Eye() { return <div />; });

describe('404 quote rotation', () => {
beforeEach(() => {
sessionStorage.clear();
jest.useFakeTimers();
jest.setSystemTime(new Date('2026-10-07T13:00:00Z'));
});
afterEach(() => jest.useRealTimers());

it('rotates on schedule, keeps the refresh cadence, and clears its timer on unmount', () => {
const first = render(<NotFoundScreen />);
act(() => jest.advanceTimersByTime(17000));
expect(screen.getByRole('blockquote')).toHaveTextContent(NOT_FOUND_QUOTES[1]);
first.unmount();
expect(jest.getTimerCount()).toBe(0);
const refreshed = render(<NotFoundScreen />);
expect(screen.getByRole('blockquote')).toHaveTextContent(NOT_FOUND_QUOTES[1]);
act(() => jest.advanceTimersByTime(3000));
expect(screen.getByRole('blockquote')).toHaveTextContent(NOT_FOUND_QUOTES[2]);
refreshed.unmount();
});

it('lets readers pause and resume the changing quotes', () => {
render(<NotFoundScreen />);
fireEvent.click(screen.getByRole('button', { name: 'Pause quotes' }));
act(() => jest.advanceTimersByTime(30000));
expect(screen.getByRole('blockquote')).toHaveTextContent(NOT_FOUND_QUOTES[0]);
fireEvent.click(screen.getByRole('button', { name: 'Resume quotes' }));
expect(screen.getByRole('blockquote')).toHaveTextContent(NOT_FOUND_QUOTES[3]);
});
});
26 changes: 26 additions & 0 deletions src/components/cyber/crow-scatter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { CSSProperties } from 'react';

// Original vector silhouettes, inspired by Itachi's crow-scattering illusion.
// Reference: https://tenor.com/view/sharingan-genjutsu-itachi-crow-corvos-gif-19016658
export function CrowScatter() {
return <div aria-hidden className="crow-scatter pointer-events-none absolute inset-0 z-10">
{Array.from({ length: 18 }, (_, index) => {
const angle = (index / 18) * Math.PI * 2;
const radius = 100 + (index % 4) * 35;
const style = {
left: `${20 + (index % 6) * 11}%`,
top: `${25 + (index % 3) * 20}%`,
'--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`,
} 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" />
<path d="M29 29 Q27 20 32 17 Q37 17 38 21 L44 24 L37 25 L35 32 Z" />
</svg></span>
</span>;
})}
</div>;
}
53 changes: 38 additions & 15 deletions src/components/cyber/not-found-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,48 @@

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

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>,
});

// Also keeps rotation working when the browser blocks session storage.
let fallbackIndex = 0;
// In-memory continuity for browsers that block storage.
let fallbackAnchor: number | undefined;

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

useEffect(() => {
if (selected.current) return;
selected.current = true;
if (paused) return;
const now = Date.now();
let anchor: number;
try {
setQuoteIndex(takeNotFoundQuote(window.sessionStorage));
anchor = getQuoteClock(window.sessionStorage, now);
} catch {
setQuoteIndex(fallbackIndex);
fallbackIndex = (fallbackIndex + 1) % NOT_FOUND_QUOTES.length;
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">
Expand Down Expand Up @@ -56,10 +73,16 @@ 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="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')} / 10</p>
<blockquote className="mt-3 min-h-[4.5rem] font-display text-lg leading-relaxed sm:text-xl">“{NOT_FOUND_QUOTES[quoteIndex]}”</blockquote>
<p className="mt-2 monofont text-[9px] uppercase tracking-[0.2em] text-bone/50">Original words // another thought on your next visit</p>
<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>
</div>
Expand Down
17 changes: 15 additions & 2 deletions src/components/cyber/primitives.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,30 @@ export function Marquee({
itemClassName,
reverse = false,
separator = '•',
pixelsPerSecond,
}: {
items: string[];
className?: string;
itemClassName?: string;
reverse?: boolean;
separator?: ReactNode;
pixelsPerSecond?: number;
}) {
const trackRef = useRef<HTMLDivElement>(null);
const [duration, setDuration] = useState<number | null>(null);
useEffect(() => {
const track = trackRef.current;
if (!track || !pixelsPerSecond || pixelsPerSecond <= 0) return;
const measure = () => setDuration(track.scrollWidth / 2 / pixelsPerSecond);
measure();
const observer = new ResizeObserver(measure);
observer.observe(track);
return () => observer.disconnect();
}, [pixelsPerSecond, items]);
const list = [...items, ...items];
return (
<div className={cn('relative overflow-hidden', className)}>
<div className={cn('flex w-max items-center whitespace-nowrap', reverse ? 'animate-marquee-rev' : 'animate-marquee')}>
<div className={cn('relative overflow-hidden', pixelsPerSecond && 'marquee-container', className)}>
<div ref={trackRef} style={pixelsPerSecond ? { animationDuration: duration ? `${duration}s` : undefined, animationPlayState: duration ? undefined : 'paused' } : undefined} className={cn('marquee-track flex w-max items-center whitespace-nowrap', reverse ? 'animate-marquee-rev' : 'animate-marquee')}>
{list.map((item, i) => (
<span key={`${item}-${i}`} className={cn('flex items-center gap-6 px-3', itemClassName)}>
{item}
Expand Down
27 changes: 27 additions & 0 deletions src/components/sections/__tests__/certificate-list.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { render, screen } from '@testing-library/react';
import type { ReactNode } from 'react';
import { CertificateList } from '../certificate-list';

jest.mock('@/components/cyber/primitives', () => ({
Reveal: ({ children }: { children: ReactNode }) => <li>{children}</li>,
}));

test('shows four certificates and preserves the rest behind a native disclosure', () => {
const certificates = Array.from({ length: 9 }, (_, i) => ({ name: `Certificate ${i + 1}`, issuer: 'Issuer', year: 2026, url: `https://example.com/${i}` }));
render(<CertificateList certificates={certificates} />);
expect(screen.getByText('Certificate 1').closest('ul')?.children).toHaveLength(4);
expect(screen.getByText('Show all 9 certificates (+5)')).toBeVisible();
expect(screen.getByText('Certificate 9')).not.toBeVisible();
const details = screen.getByText('Certificate 9').closest('details')!;
details.open = true;
expect(screen.getByText('Certificate 9')).toBeVisible();
expect(screen.getByRole('link', { name: /Certificate 9/ })).toHaveAttribute('href', 'https://example.com/8');
details.open = false;
expect(screen.getByText('Certificate 1').closest('ul')?.children).toHaveLength(4);
});

test('does not add an unnecessary disclosure for a short list', () => {
render(<CertificateList certificates={[{ name: 'CEH', issuer: 'EC-Council', year: 2026 }]} />);
expect(screen.getAllByRole('listitem')).toHaveLength(1);
expect(screen.queryByText(/Show all/)).not.toBeInTheDocument();
});
38 changes: 3 additions & 35 deletions src/components/sections/about.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CertificateList, type Certificate } from './certificate-list';
import { Github, Linkedin, ArrowUpRight } from 'lucide-react';
import { Reveal, ScrambleText, TiltCard } from '@/components/cyber/primitives';

Expand All @@ -16,12 +17,7 @@ interface Education {
duration: string;
}

interface Certificate {
name: string;
issuer: string;
year: number;
url?: string | null;
}


export function AboutSection({
personalData,
Expand Down Expand Up @@ -164,35 +160,7 @@ export function AboutSection({
<span>{'// clearances'}</span>
<span className="font-jp">資格</span>
</h3>
<ul className="space-y-3">
{certificates.map((cert, i) => (
<Reveal as="li" key={cert.name} delay={i * 0.06}>
{(() => {
const body = (
<>
<div>
<p className="text-sm font-semibold">{cert.name}</p>
<p className="monofont text-[10px] uppercase tracking-widest text-muted-foreground group-hover:text-ink/70">
{cert.issuer}
{cert.url && ' · verify ↗'}
</p>
</div>
<span className="font-display text-xl font-bold text-signal group-hover:text-ink">{cert.year}</span>
</>
);
const cls =
'clip-notch-sm group relative flex items-center justify-between gap-4 bg-card px-4 py-3 transition-colors hover:bg-signal hover:text-ink';
return cert.url ? (
<a href={cert.url} target="_blank" rel="noopener noreferrer" className={cls}>
{body}
</a>
) : (
<div className={cls}>{body}</div>
);
})()}
</Reveal>
))}
</ul>
<CertificateList certificates={certificates} />
</div>
)}
</div>
Expand Down
42 changes: 42 additions & 0 deletions src/components/sections/certificate-list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Reveal } from '@/components/cyber/primitives';

export interface Certificate {
name: string;
issuer: string;
year: number;
url?: string | null;
}

function CertificateCards({ certificates }: { certificates: Certificate[] }) {
return (
<ul className="space-y-3">
{certificates.map((cert, i) => {
const body = <>
<div className="min-w-0">
<p className="break-words text-sm font-semibold">{cert.name}</p>
<p className="break-words monofont text-[10px] uppercase tracking-widest text-muted-foreground group-hover:text-ink/70">{cert.issuer}{cert.url && ' · verify ↗'}</p>
</div>
<span className="shrink-0 font-display text-xl font-bold text-signal group-hover:text-ink">{cert.year}</span>
</>;
const className = 'clip-notch-sm group relative flex items-center justify-between gap-4 bg-card px-4 py-3 transition-colors hover:bg-signal hover:text-ink';
return <Reveal as="li" key={`${cert.name}-${cert.issuer}-${i}`} delay={Math.min(i, 3) * 0.06}>
{cert.url ? <a href={cert.url} target="_blank" rel="noopener noreferrer" className={className}>{body}</a> : <div className={className}>{body}</div>}
</Reveal>;
})}
</ul>
);
}

export function CertificateList({ certificates }: { certificates: Certificate[] }) {
const limit = 4;
return <>
<CertificateCards certificates={certificates.slice(0, limit)} />
{certificates.length > limit && <details className="group/certificates mt-4">
<summary className="cursor-pointer border border-signal/30 px-3 py-3 monofont text-xs uppercase tracking-wider text-signal hover:bg-signal/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-signal">
<span className="group-open/certificates:hidden">Show all {certificates.length} certificates (+{certificates.length - limit})</span>
<span className="hidden group-open/certificates:inline">Show fewer certificates</span>
</summary>
<div className="mt-3"><CertificateCards certificates={certificates.slice(limit)} /></div>
</details>}
</>;
}
4 changes: 2 additions & 2 deletions src/components/sections/skills.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export function SkillsSection({ skills }: { skills: Skills | null }) {

{all.length > 0 && (
<div className="-mx-6 space-y-2 border-y border-signal/40 py-4 sm:-mx-10">
<Marquee items={all} itemClassName="font-display text-4xl font-bold uppercase text-outline-red sm:text-6xl" separator="×" />
<Marquee items={[...all].reverse()} reverse itemClassName="font-display text-4xl font-bold uppercase text-bone/90 sm:text-6xl" separator="/" />
<Marquee pixelsPerSecond={24} items={all} itemClassName="font-display text-4xl font-bold uppercase text-outline-red sm:text-6xl" separator="×" />
<Marquee pixelsPerSecond={24} items={[...all].reverse()} reverse itemClassName="font-display text-4xl font-bold uppercase text-bone/90 sm:text-6xl" separator="/" />
</div>
)}
</section>
Expand Down
Loading
Loading