/* ==========================================
   Tokens
   ========================================== */
:root {
    --bg: #07070b;
    --bg-2: #0d0d14;
    --surface: rgba(255, 255, 255, 0.035);
    --surface-2: rgba(255, 255, 255, 0.06);
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.18);
    --text: #f3f3f8;
    --muted: #9b9bb0;
    --faint: #5f5f73;
    --accent: #8b6cff;
    --accent-2: #22d3ee;
    --accent-3: #f472b6;
    --gradient: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
    --glow: 0 0 40px rgba(139, 108, 255, 0.35);
    --code-bg: #0b0b12;

    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --nav-h: 72px;
    --gutter: clamp(16px, 4vw, 48px);
    --radius: 22px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f5f5fa;
    --bg-2: #eaeaf2;
    --surface: rgba(20, 20, 50, 0.035);
    --surface-2: rgba(20, 20, 50, 0.06);
    --line: rgba(20, 20, 50, 0.1);
    --line-strong: rgba(20, 20, 50, 0.2);
    --text: #0c0c16;
    --muted: #55556c;
    --faint: #8d8da3;
    --accent: #5b3fff;
    --accent-2: #0891b2;
    --accent-3: #db2777;
    --glow: 0 0 40px rgba(91, 63, 255, 0.22);
    color-scheme: light;
}

/* ==========================================
   Base
   ========================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-padding-top: var(--nav-h); -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    font-size: 1rem;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.4s ease, color 0.4s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--accent); color: #fff; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 6px; }

.container { width: min(1240px, 100% - 2 * var(--gutter)); margin-inline: auto; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: fixed; top: 12px; left: 12px; z-index: 10001;
    padding: 10px 16px; border-radius: 10px; background: var(--accent); color: #fff;
    transform: translateY(-200%); transition: transform 0.2s ease;
}
.skip-link:focus { transform: translateY(0); }

.gradient-text {
    background: linear-gradient(100deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-pan 10s linear infinite;
}
@keyframes gradient-pan { to { background-position: 300% 0; } }

/* ==========================================
   Preloader
   ========================================== */
.preloader { display: none; }
.js .preloader {
    position: fixed; inset: 0; z-index: 10000;
    display: grid; place-items: center;
    background: var(--bg);
    /* failsafe: never block the page if the script breaks */
    animation: preloader-failsafe 0.4s ease 6s forwards;
}
@keyframes preloader-failsafe { to { opacity: 0; visibility: hidden; } }

.boot { width: min(420px, 100% - 48px); font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); }
.boot-lines { min-height: 7.5em; }
.boot-line { white-space: nowrap; overflow: hidden; }
.boot-line .ok { color: var(--accent-2); }
.boot-bar { height: 2px; margin: 18px 0 10px; background: var(--line); overflow: hidden; border-radius: 2px; }
.boot-bar span { display: block; height: 100%; width: 0; background: var(--gradient); box-shadow: var(--glow); }
.boot-count { text-align: right; color: var(--text); font-size: 0.9rem; }

/* ==========================================
   Cursor, progress, grain
   ========================================== */
.cursor { display: none; }
.has-cursor .cursor { display: block; }
.has-cursor body, .has-cursor a, .has-cursor button { cursor: none; }
.has-cursor input, .has-cursor textarea { cursor: text; }

.cursor-dot, .cursor-ring {
    position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none;
    border-radius: 50%; will-change: transform;
}
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--text); }
.cursor-ring {
    width: 38px; height: 38px; margin: -19px 0 0 -19px;
    border: 1px solid var(--line-strong);
    display: grid; place-items: center;
    transition: width 0.35s var(--ease-out), height 0.35s var(--ease-out), margin 0.35s var(--ease-out),
                background-color 0.35s ease, border-color 0.35s ease;
}
.cursor-label {
    font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.04em;
    color: #fff; opacity: 0; transform: scale(0.6); transition: opacity 0.25s ease, transform 0.35s var(--ease-out);
}
.cursor.is-hover .cursor-ring { width: 56px; height: 56px; margin: -28px 0 0 -28px; border-color: var(--accent); }
.cursor.is-label .cursor-ring {
    width: 86px; height: 86px; margin: -43px 0 0 -43px;
    background: var(--accent); border-color: transparent; box-shadow: var(--glow);
}
.cursor.is-label .cursor-label { opacity: 1; transform: scale(1); }
.cursor.is-label .cursor-dot { opacity: 0; }
.cursor.is-down .cursor-ring { transform-origin: center; scale: 0.85; }

.scroll-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 1001; pointer-events: none; }
.scroll-progress span { display: block; height: 100%; background: var(--gradient); transform-origin: 0 50%; transform: scaleX(0); }

.grain {
    position: fixed; inset: -50%; z-index: 9000; pointer-events: none; opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 0.8s steps(5) infinite;
}
[data-theme="light"] .grain { opacity: 0.045; }
@keyframes grain {
    0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
    60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    position: relative; display: inline-flex; align-items: center; gap: 0.6rem;
    padding: 0.95rem 1.6rem; border-radius: 999px;
    font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em;
    overflow: hidden; isolation: isolate;
    transition: box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.btn i { font-size: 0.85em; transition: transform 0.3s var(--ease-out); }
.btn:hover i { transform: translateX(3px); }
.btn-primary { background: var(--gradient); background-size: 200% 100%; color: #fff; box-shadow: 0 10px 30px -10px rgba(139, 108, 255, 0.6); }
.btn-primary::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
    transform: translateX(-120%); transition: transform 0.7s var(--ease-out);
}
.btn-primary:hover::after { transform: translateX(120%); }
.btn-primary:hover { box-shadow: 0 14px 40px -10px rgba(139, 108, 255, 0.85); }
.btn-ghost { border: 1px solid var(--line-strong); background: var(--surface); backdrop-filter: blur(8px); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-small { padding: 0.55rem 1.1rem; font-size: 0.85rem; border: 1px solid var(--line-strong); }
.btn-small:hover { border-color: var(--accent); background: var(--surface-2); }
.btn-block { width: 100%; justify-content: center; }
.magnetic { will-change: transform; }

/* ==========================================
   Navigation
   ========================================== */
.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000; height: var(--nav-h);
    transition: transform 0.45s var(--ease-out), background-color 0.3s ease, border-color 0.3s ease;
    border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom-color: var(--line);
}
.nav.is-hidden { transform: translateY(-100%); }
.nav-inner {
    height: 100%; width: min(1240px, 100% - 2 * var(--gutter)); margin-inline: auto;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.nav-logo { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; letter-spacing: -0.04em; }
.nav-logo span { color: var(--accent-2); }
.nav-links { display: flex; gap: 0.25rem; }
.nav-link {
    position: relative; display: block; padding: 0.5rem 0.9rem;
    font-size: 0.9rem; font-weight: 500; color: var(--muted); transition: color 0.25s ease;
}
.nav-link::after {
    content: ""; position: absolute; left: 0.9rem; right: 0.9rem; bottom: 0.3rem; height: 1px;
    background: var(--gradient); transform: scaleX(0); transform-origin: right; transition: transform 0.4s var(--ease-out);
}
.nav-link:hover, .nav-link.is-active { color: var(--text); }
.nav-link:hover::after, .nav-link.is-active::after { transform: scaleX(1); transform-origin: left; }
.nav-actions { position: relative; z-index: 2; display: flex; align-items: center; gap: 0.6rem; }
/* backdrop-filter would make the fixed mobile menu size itself to the nav bar */
.nav.menu-open { backdrop-filter: none; -webkit-backdrop-filter: none; background: transparent; border-bottom-color: transparent; transform: none; }

.theme-toggle {
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
    border: 1px solid var(--line); color: var(--muted); transition: color 0.25s ease, border-color 0.25s ease, transform 0.5s var(--ease-out);
}
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); transform: rotate(25deg); }
.theme-toggle .fa-moon { display: none; }
[data-theme="light"] .theme-toggle .fa-moon { display: inline-block; }
[data-theme="light"] .theme-toggle .fa-sun { display: none; }

.menu-toggle { display: none; width: 40px; height: 40px; position: relative; z-index: 2; }
.menu-toggle span {
    position: absolute; left: 10px; right: 10px; height: 2px; border-radius: 2px; background: var(--text);
    transition: transform 0.4s var(--ease-out), top 0.4s var(--ease-out);
}
.menu-toggle span:first-child { top: 15px; }
.menu-toggle span:last-child { top: 23px; }
.menu-toggle[aria-expanded="true"] span:first-child { top: 19px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { top: 19px; transform: rotate(-45deg); }

/* ==========================================
   Hero
   ========================================== */
.hero {
    position: relative; min-height: 100vh; min-height: 100svh;
    display: flex; flex-direction: column; justify-content: center;
    padding: calc(var(--nav-h) + 24px) 0 110px; overflow: hidden;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-glow {
    position: absolute; inset: -20%; pointer-events: none; filter: blur(60px); opacity: 0.55;
    background:
        radial-gradient(40% 35% at 20% 30%, rgba(139, 108, 255, 0.35), transparent 70%),
        radial-gradient(35% 30% at 80% 20%, rgba(34, 211, 238, 0.22), transparent 70%),
        radial-gradient(40% 35% at 65% 85%, rgba(244, 114, 182, 0.2), transparent 70%);
    animation: glow-drift 18s ease-in-out infinite alternate;
}
[data-theme="light"] .hero-glow { opacity: 0.45; }
@keyframes glow-drift { to { transform: translate3d(4%, -3%, 0) rotate(8deg) scale(1.05); } }

.hero-inner { position: relative; z-index: 2; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 0.6rem; margin-bottom: 1.6rem;
    padding: 0.45rem 0.95rem; border-radius: 999px; border: 1px solid var(--line);
    background: var(--surface); backdrop-filter: blur(8px);
    font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

.hero-title {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(3.4rem, 12.5vw, 10.5rem); line-height: 0.88; letter-spacing: -0.05em;
    margin-bottom: 1.6rem;
}
.hero-line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero-line .split { display: inline-block; }
.char { display: inline-block; will-change: transform; }

.hero-role { font-size: clamp(1.1rem, 2.3vw, 1.55rem); font-weight: 500; margin-bottom: 1.1rem; }
.role-cycle { font-family: var(--font-mono); color: var(--accent-2); }
.role-caret { display: inline-block; width: 0.55em; height: 1.1em; margin-left: 4px; vertical-align: -0.18em; background: var(--accent-2); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.hero-lede { max-width: 38rem; color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.12rem); margin-bottom: 2.2rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 2.2rem; }
.hero-social { display: flex; gap: 0.6rem; }
.hero-social a {
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
    border: 1px solid var(--line); color: var(--muted); background: var(--surface);
    transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.hero-social a:hover { color: var(--text); border-color: var(--accent); box-shadow: var(--glow); }
.hf-link { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; }

.hero-meta {
    position: absolute; left: 0; right: 0; bottom: 32px; z-index: 2;
    display: flex; align-items: center; gap: 2rem;
    font-family: var(--font-mono); font-size: 0.75rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em;
}
.scroll-cue { margin-left: auto; display: inline-flex; align-items: center; gap: 0.8rem; color: var(--muted); }
.scroll-cue i { position: relative; width: 1px; height: 46px; background: var(--line); overflow: hidden; }
.scroll-cue i::after {
    content: ""; position: absolute; left: 0; top: -50%; width: 100%; height: 50%;
    background: var(--gradient); animation: cue 1.8s var(--ease-out) infinite;
}
@keyframes cue { to { top: 100%; } }

/* ==========================================
   Stats
   ========================================== */
.stats { border-block: 1px solid var(--line); background: var(--bg-2); position: relative; z-index: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.stat { padding: clamp(28px, 4vw, 48px) clamp(16px, 3vw, 36px); }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-value {
    font-family: var(--font-display); font-weight: 700; letter-spacing: -0.04em;
    font-size: clamp(2.2rem, 4.6vw, 3.8rem); line-height: 1; margin-bottom: 0.8rem;
    font-variant-numeric: tabular-nums;
}
.stat-arrow { color: var(--accent-2); margin: 0 0.2em; font-size: 0.7em; vertical-align: 0.1em; }
.stat-label { color: var(--muted); font-size: 0.92rem; max-width: 22rem; }

/* ==========================================
   Marquee
   ========================================== */
.marquee { padding: clamp(40px, 7vw, 90px) 0; overflow: hidden; display: grid; gap: 0.4rem; user-select: none; }
.marquee-row { overflow: hidden; }
.marquee-track { display: flex; width: max-content; will-change: transform; }
.marquee-track span {
    font-family: var(--font-display); font-weight: 700; letter-spacing: -0.04em;
    font-size: clamp(2.6rem, 7.5vw, 6.4rem); line-height: 1.05; white-space: nowrap;
    padding-right: 0.5em; display: inline-flex; align-items: center;
}
.marquee-track span::after { content: "\2726"; font-size: 0.35em; margin-left: 0.5em; color: var(--accent); -webkit-text-stroke: 0; }
.marquee-track .outline { color: transparent; -webkit-text-stroke: 1.2px var(--faint); }

/* ==========================================
   Sections
   ========================================== */
.section { position: relative; padding: clamp(90px, 13vw, 160px) 0; }
.section-head { display: flex; align-items: baseline; gap: 1.1rem; margin-bottom: clamp(40px, 6vw, 76px); }
.section-index { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent-2); }
.section-title {
    font-family: var(--font-display); font-weight: 700; letter-spacing: -0.045em; line-height: 0.95;
    font-size: clamp(2.8rem, 7.5vw, 6rem);
}

/* About */
.about-grid { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(32px, 6vw, 90px); align-items: start; }
.about-photo { position: sticky; top: calc(var(--nav-h) + 24px); }
.about-photo-inner { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 5; background: var(--surface); }
.about-photo-inner::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    box-shadow: inset 0 0 0 1px var(--line-strong);
    background: linear-gradient(180deg, transparent 55%, rgba(7, 7, 11, 0.55));
}
.about-photo img { width: 100%; height: 118%; object-fit: cover; will-change: transform; }
.about-copy { display: grid; gap: 1.4rem; color: var(--muted); font-size: 1.05rem; }
.about-big { font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2.3rem); line-height: 1.2; letter-spacing: -0.025em; color: var(--text); font-weight: 500; }
.about-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-top: 0.8rem; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--line); }
.about-facts div { padding: 1rem 1.2rem; background: var(--bg); }
.about-facts dt { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.about-facts dd { color: var(--text); font-weight: 500; }

/* Research */
.research { background: linear-gradient(180deg, transparent, var(--bg-2) 30%, var(--bg-2) 70%, transparent); }
.research-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.research-copy { display: grid; gap: 1.2rem; color: var(--muted); font-size: 1.05rem; }
.kicker { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent-2); letter-spacing: 0.02em; }
.research-title { font-family: var(--font-display); color: var(--text); font-size: clamp(1.8rem, 3.6vw, 2.8rem); line-height: 1.05; letter-spacing: -0.035em; }
.research-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.5rem; margin-top: 0.6rem; }
.research-facts li { display: grid; gap: 0.15rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.research-facts strong {
    font-family: var(--font-display); font-size: 1.55rem; letter-spacing: -0.03em; color: var(--text);
}
.research-facts span { font-size: 0.85rem; }

.chart-card {
    position: relative; padding: clamp(20px, 3vw, 32px); border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(10px);
    overflow: hidden;
}
.chart-card::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s ease;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(139, 108, 255, 0.16), transparent 60%);
}
.chart-card:hover::before { opacity: 1; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); margin-bottom: 1.6rem; }
.chart-legend { display: inline-flex; align-items: center; gap: 0.45rem; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-base { background: var(--faint); }
.lg-filter { background: var(--gradient); margin-left: 0.6rem; }
.chart {
    position: relative; height: clamp(240px, 32vw, 340px);
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6%;
    padding: 0 4% 30px 36px;
}
.chart-grid { position: absolute; inset: 0 0 30px 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-grid span { position: relative; font-family: var(--font-mono); font-size: 0.68rem; color: var(--faint); line-height: 0; }
.chart-grid span::after { content: ""; position: absolute; left: 30px; right: 0; top: 0; border-top: 1px dashed var(--line); }
.chart-group { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 12%; z-index: 1; }
.bar {
    position: relative; width: 40%; height: calc(var(--v, 0) / 80 * 100%);
    border-radius: 10px 10px 4px 4px; transform-origin: bottom;
}
.bar-base { background: var(--faint); opacity: 0.55; }
.bar-filter { background: var(--gradient); background-size: 100% 300%; box-shadow: 0 0 30px -4px rgba(139, 108, 255, 0.6); }
.bar-label {
    position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
    font-family: var(--font-mono); font-size: 0.82rem; font-weight: 500; color: var(--text);
}
.bar-base .bar-label { color: var(--muted); }
.chart-x { position: absolute; bottom: -28px; left: 0; right: 0; text-align: center; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.chart-note { margin-top: 1.4rem; font-size: 0.8rem; color: var(--faint); }

/* Work */
.work { padding-bottom: clamp(60px, 9vw, 120px); }
.work-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.work-counter { font-family: var(--font-mono); font-size: 0.9rem; color: var(--muted); margin-bottom: clamp(40px, 6vw, 76px); font-variant-numeric: tabular-nums; }
.work-counter span:first-child { color: var(--text); font-size: 1.4rem; }
.work-track {
    width: min(1240px, 100% - 2 * var(--gutter)); margin-inline: auto;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 24px;
}

.h-scroll .work { padding: 0; }
.h-scroll .work-pin { height: 100vh; display: flex; flex-direction: column; padding-top: calc(var(--nav-h) + 28px); padding-bottom: 40px; }
.h-scroll .work-viewport { flex: 1; min-height: 0; overflow: hidden; }
.h-scroll .work-track {
    width: max-content; height: 100%; margin: 0; display: flex; gap: 28px;
    padding-left: max(var(--gutter), (100vw - 1240px) / 2); padding-right: var(--gutter);
}
.h-scroll .work-card { width: clamp(340px, 31vw, 460px); height: 100%; }
.h-scroll .work-card .work-visual { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; }
.h-scroll .work .section-head { margin-bottom: 28px; }
.h-scroll .work-counter { margin-bottom: 28px; }

.work-card {
    position: relative; display: flex; flex-direction: column; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line); overflow: hidden;
    transform-style: preserve-3d; will-change: transform;
    transition: border-color 0.35s ease, box-shadow 0.35s ease;
}
.work-card::before {
    content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.4s ease;
    background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(139, 108, 255, 0.18), transparent 55%);
}
.work-card:hover { border-color: var(--line-strong); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6); }
.work-card:hover::before { opacity: 1; }

.work-visual { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--code-bg); border-bottom: 1px solid var(--line); }
.visual-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform 0.8s var(--ease-out); }
.visual-shot .shot-left { object-position: left top; }
.visual-shot-center { background: #eef0fb; }
.visual-shot-center img { object-fit: contain; object-position: center; }
.work-card:hover .visual-shot img { transform: scale(1.06); }

.work-body { position: relative; z-index: 1; padding: 22px 24px 24px; display: grid; gap: 0.75rem; }
.work-top { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: 0.75rem; color: var(--faint); }
.work-status { padding: 0.2rem 0.6rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.live-dot::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); margin-right: 6px; vertical-align: 1px; animation: caret 1.4s steps(1) infinite; }
.work-body h3 { font-family: var(--font-display); font-size: 1.55rem; letter-spacing: -0.03em; line-height: 1.1; }
.work-body p { color: var(--muted); font-size: 0.93rem; line-height: 1.6; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li { font-family: var(--font-mono); font-size: 0.72rem; padding: 0.25rem 0.6rem; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.work-links { display: flex; gap: 1.2rem; margin-top: 0.2rem; }
.work-links a { font-size: 0.88rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.4rem; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.35s var(--ease-out), color 0.25s ease; }
.work-links a i { font-size: 0.7em; }
.work-links a:hover { background-size: 100% 1px; color: var(--accent-2); }

/* Card visuals */
.term {
    position: absolute; inset: 18px; border-radius: 12px; background: #0f0f18; border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.8);
}
.term-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-family: var(--font-mono); font-size: 0.7rem; color: #6b6b80; }
.term-bar i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: 8px; }
.term-body { padding: 12px 14px; font-family: var(--font-mono); font-size: clamp(0.66rem, 0.85vw, 0.78rem); line-height: 1.75; color: #d6d6e4; white-space: pre; overflow: hidden; }
.t-prompt { color: #8b6cff; }
.t-ok { color: #4ade80; }
.t-dim { color: #6b6b80; }
.t-key { color: #f472b6; }
.t-str { color: #22d3ee; }
.t-cursor { display: inline-block; width: 7px; height: 1em; background: #d6d6e4; vertical-align: -0.15em; margin-left: 3px; animation: caret 1s steps(1) infinite; }

.visual-desktop { background: radial-gradient(120% 120% at 0% 0%, #2a1f5e, #0b0b12 60%), #0b0b12; }
.mini-desktop { position: absolute; inset: 0; }
.mini-window {
    position: absolute; left: 12%; top: 16%; width: 62%; height: 64%; border-radius: 10px; background: #f4f4f8; color: #1a1a24;
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.8); overflow: hidden;
}
.mini-bar { display: flex; align-items: center; gap: 5px; padding: 7px 9px; background: #e4e4ec; font-family: var(--font-mono); font-size: 0.62rem; color: #6a6a7a; }
.mini-bar i { width: 7px; height: 7px; border-radius: 50%; background: #c9c9d4; }
.mini-bar span { margin-left: 6px; }
.mini-text { padding: 12px; font-family: var(--font-mono); font-size: 0.75rem; }
.mini-typed { display: inline-block; overflow: hidden; white-space: nowrap; vertical-align: bottom; border-right: 2px solid #5b3fff; animation: mini-type 6s steps(17) infinite; width: 0; }
@keyframes mini-type { 0%, 20% { width: 0; } 50%, 100% { width: 17ch; } }
.mini-btn { position: absolute; right: 10px; bottom: 10px; padding: 5px 12px; border-radius: 6px; background: #5b3fff; color: #fff; font-size: 0.68rem; font-weight: 600; animation: mini-press 6s infinite; }
@keyframes mini-press { 0%, 74% { transform: scale(1); } 77% { transform: scale(0.88); background: #22d3ee; } 82%, 100% { transform: scale(1); } }
.crosshair {
    position: absolute; width: 26px; height: 26px; left: 0; top: 0; margin: -13px 0 0 -13px;
    animation: crosshair-move 6s var(--ease-out) infinite;
}
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: #ff4d6d; }
.crosshair::before { left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.crosshair::after { top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; }
@keyframes crosshair-move {
    0% { transform: translate(380%, 340%); }
    15% { transform: translate(140%, 200%); }
    55% { transform: translate(140%, 200%); }
    75% { transform: translate(640%, 590%); }
    100% { transform: translate(640%, 590%); }
}

.visual-bits { display: grid; place-items: center; background: radial-gradient(100% 100% at 100% 0%, #0f2a3a, #0b0b12 60%); }
.bits { position: absolute; inset: 16px; display: grid; grid-template-columns: repeat(16, 1fr); align-content: center; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.6; text-align: center; color: rgba(34, 211, 238, 0.35); }
.bits span.on { color: #22d3ee; text-shadow: 0 0 8px rgba(34, 211, 238, 0.8); }
.ket { position: relative; padding: 0.5rem 1rem; border-radius: 10px; background: rgba(11, 11, 18, 0.85); border: 1px solid rgba(255, 255, 255, 0.1); font-family: var(--font-mono); font-size: 0.85rem; color: #f3f3f8; }

.work-more {
    justify-content: center; align-items: center; gap: 1.2rem; min-height: 220px; text-align: center;
    background: var(--gradient); background-size: 200% 200%; border: 0; color: #fff;
    animation: gradient-pan 10s linear infinite;
}
.work-more-label { font-family: var(--font-display); font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 700; letter-spacing: -0.04em; }
.work-more-arrow { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.18); transition: transform 0.4s var(--ease-out); }
.work-more:hover .work-more-arrow { transform: rotate(-45deg) scale(1.1); }

/* Experience */
.timeline { position: relative; max-width: 860px; padding-left: 56px; }
.timeline-line { position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.timeline-line span { position: absolute; inset: 0; background: var(--gradient); transform-origin: top; }
.tl-item { position: relative; padding-bottom: clamp(40px, 6vw, 64px); }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
    position: absolute; left: -51px; top: 6px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--bg); border: 2px solid var(--line-strong); transition: border-color 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
}
.tl-item.is-active .tl-dot { border-color: var(--accent-2); background: var(--accent-2); box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.15), 0 0 24px rgba(34, 211, 238, 0.6); }
.tl-date { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-2); margin-bottom: 0.4rem; }
.tl-item h3 { font-family: var(--font-display); font-size: clamp(1.3rem, 2.4vw, 1.8rem); letter-spacing: -0.03em; line-height: 1.15; margin-bottom: 0.5rem; }
.tl-item h3 span { display: block; font-family: var(--font-body); font-size: 0.95rem; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-top: 0.2rem; }
.tl-item p { color: var(--muted); max-width: 44rem; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.skill-group {
    position: relative; padding: clamp(22px, 3vw, 32px); border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line); overflow: hidden;
}
.skill-group::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s ease;
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(34, 211, 238, 0.12), transparent 60%);
}
.skill-group:hover::before { opacity: 1; }
.skill-group h3 { font-family: var(--font-display); font-size: 1.2rem; letter-spacing: -0.02em; margin-bottom: 1.2rem; display: flex; align-items: center; gap: 0.6rem; }
.skill-group h3 i { color: var(--accent); font-size: 0.95rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; position: relative; }
.chips li {
    padding: 0.45rem 0.9rem; border-radius: 999px; border: 1px solid var(--line); font-size: 0.88rem; color: var(--muted);
    background: var(--bg); transition: color 0.25s ease, border-color 0.25s ease, transform 0.35s var(--ease-out), box-shadow 0.25s ease;
}
.chips li:hover { color: var(--text); border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 20px -10px rgba(139, 108, 255, 0.7); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(32px, 6vw, 90px); align-items: start; }
.contact-copy { display: grid; gap: 1.8rem; }
.contact-big { font-family: var(--font-display); font-size: clamp(2rem, 4.8vw, 3.8rem); line-height: 1.02; letter-spacing: -0.045em; font-weight: 700; }
.email-copy {
    justify-self: start; display: inline-flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: 1rem 1.3rem; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--surface);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.email-copy:hover { border-color: var(--accent); box-shadow: var(--glow); }
.email-text { font-family: var(--font-mono); font-size: clamp(0.9rem, 1.8vw, 1.15rem); word-break: break-all; text-align: left; }
.email-hint { font-size: 0.8rem; color: var(--muted); padding: 0.25rem 0.6rem; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.email-hint.is-done { color: #22c55e; }
.contact-links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; }
.contact-links a { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--muted); font-weight: 500; transition: color 0.25s ease; }
.contact-links a:hover { color: var(--text); }
.hf-mini { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; }

.contact-form { display: grid; gap: 1.1rem; padding: clamp(22px, 3vw, 32px); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.field { position: relative; }
.field input, .field textarea {
    width: 100%; padding: 1.35rem 1rem 0.6rem; border-radius: 12px; border: 1px solid var(--line);
    background: var(--bg); color: var(--text); font: inherit; resize: vertical;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.field label {
    position: absolute; left: 1rem; top: 1rem; color: var(--faint); pointer-events: none; font-size: 0.95rem;
    transform-origin: left top; transition: transform 0.25s var(--ease-out), color 0.25s ease;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(139, 108, 255, 0.15); }
.field input:focus + label, .field input:not(:placeholder-shown) + label,
.field textarea:focus + label, .field textarea:not(:placeholder-shown) + label { transform: translateY(-0.6rem) scale(0.75); color: var(--accent-2); }
.form-status { min-height: 1.4em; font-size: 0.9rem; }
.form-status.success { color: #22c55e; }
.form-status.error { color: #ef4444; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 36px 0; }
.footer-inner { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.footer-name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.03em; }
.footer-meta { color: var(--faint); font-size: 0.85rem; }
.footer-top { margin-left: auto; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); transition: border-color 0.25s ease, box-shadow 0.25s ease; }
.footer-top:hover { border-color: var(--accent); box-shadow: var(--glow); }

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 1023px) {
    .research-grid, .contact-grid { grid-template-columns: 1fr; }
    .about-grid { grid-template-columns: 1fr; }
    .about-photo { position: relative; top: 0; max-width: 420px; }
}

@media (max-width: 860px) {
    .menu-toggle { display: block; }
    .nav-links {
        position: fixed; inset: 0; z-index: 1; flex-direction: column; justify-content: center; gap: 0.4rem;
        padding: 0 var(--gutter); background: var(--bg);
        clip-path: circle(0 at calc(100% - 40px) 36px); transition: clip-path 0.7s var(--ease-out);
    }
    .nav-links.is-open { clip-path: circle(150% at calc(100% - 40px) 36px); }
    .nav-link { font-family: var(--font-display); font-size: clamp(2.2rem, 10vw, 3.4rem); font-weight: 700; letter-spacing: -0.04em; color: var(--text); padding: 0.2rem 0; }
    .nav-link::after { display: none; }
    .nav-actions .btn-small { display: none; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat + .stat { border-left: 0; border-top: 1px solid var(--line); }
    .skills-grid { grid-template-columns: 1fr; }
    .hero-meta span:nth-child(2) { display: none; }
}

@media (max-width: 520px) {
    .hero-cta .btn { width: 100%; justify-content: center; }
    .about-facts { grid-template-columns: 1fr; }
    .research-facts { grid-template-columns: 1fr; }
    .timeline { padding-left: 40px; }
    .tl-dot { left: -35px; }
    .timeline-line { left: 3px; }
    .work-head { flex-direction: column; align-items: flex-start; }
    .work-counter { display: none; }
}

/* ==========================================
   Reduced motion
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .grain { display: none; }
    .mini-typed { width: 17ch; }
}
