/* ═══════════════════════════════════════════════════════════
   Karthikeyan K — Premium Portfolio
   Dark · Neon · Glass · Cinematic
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg: #050509;
    --bg-2: #0a0a14;
    --bg-3: #0e0e1c;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.07);
    --stroke: rgba(255, 255, 255, 0.09);
    --stroke-bright: rgba(167, 139, 250, 0.35);
    --text: #eef0ff;
    --text-dim: #9aa0b8;
    --text-faint: #7d83a3;
    --violet: #8b5cf6;
    --violet-soft: #a78bfa;
    --cyan: #22d3ee;
    --magenta: #e879f9;
    --green: #34d399;
    --grad: linear-gradient(120deg, #8b5cf6, #22d3ee);
    --grad-warm: linear-gradient(120deg, #e879f9, #8b5cf6);
    --glow-violet: 0 0 40px rgba(139, 92, 246, 0.35);
    --glow-cyan: 0 0 40px rgba(34, 211, 238, 0.25);
    --font-display: "Space Grotesk", system-ui, sans-serif;
    --font-body: "Sora", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
    --glass-a: rgba(255, 255, 255, 0.055);
    --glass-b: rgba(255, 255, 255, 0.02);
    --nav-bg: rgba(10, 10, 20, 0.66);
    --overlay-bg: rgba(5, 5, 9, 0.85);
    --panel-bg: rgba(12, 12, 22, 0.9);
    --label-patch: #0b0b16;
    --noise-opacity: 0.05;
    --aurora-opacity: 0.5;
    --spot: rgba(139, 92, 246, 0.08);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --radius: 20px;
    --radius-sm: 12px;
    --nav-h: 76px;
}

/* ── Light theme ───────────────────────────────────────── */
:root[data-theme="light"] {
    --bg: #f3f4fb;
    --bg-2: #eaecf7;
    --bg-3: #ffffff;
    --surface: rgba(20, 22, 50, 0.045);
    --surface-2: rgba(20, 22, 50, 0.08);
    --stroke: rgba(20, 22, 50, 0.12);
    --stroke-bright: rgba(124, 58, 237, 0.4);
    --text: #14162a;
    --text-dim: #454b66;
    --text-faint: #646a84;
    --violet: #7c3aed;
    --violet-soft: #6d28d9;
    --cyan: #0e7490;
    --magenta: #c026d3;
    --green: #059669;
    --grad: linear-gradient(120deg, #7c3aed, #0891b2);
    --glow-violet: 0 0 34px rgba(124, 58, 237, 0.18);
    --glow-cyan: 0 0 34px rgba(8, 145, 178, 0.15);
    --glass-a: rgba(255, 255, 255, 0.8);
    --glass-b: rgba(255, 255, 255, 0.5);
    --nav-bg: rgba(255, 255, 255, 0.72);
    --overlay-bg: rgba(243, 244, 251, 0.9);
    --panel-bg: rgba(255, 255, 255, 0.9);
    --label-patch: #ffffff;
    --noise-opacity: 0.03;
    --aurora-opacity: 0.4;
    --spot: rgba(124, 58, 237, 0.06);
}
:root[data-theme="light"] ::selection { background: rgba(124, 58, 237, 0.25); color: #14162a; }
:root[data-theme="light"] .nav-link:hover,
:root[data-theme="light"] .nav-link.active,
:root[data-theme="light"] .chip:hover,
:root[data-theme="light"] .p-link:hover,
:root[data-theme="light"] .m-link:hover,
:root[data-theme="light"] .footer-nav a:hover,
:root[data-theme="light"] .footer-social a:hover,
:root[data-theme="light"] .social-dock a:hover,
:root[data-theme="light"] .ai-close:hover,
:root[data-theme="light"] .ai-suggest button:hover { color: var(--text); }
:root[data-theme="light"] .marquee-track span:hover { color: var(--violet-soft); text-shadow: none; }
:root[data-theme="light"] .field input:focus ~ label,
:root[data-theme="light"] .field input:not(:placeholder-shown) ~ label,
:root[data-theme="light"] .field textarea:focus ~ label,
:root[data-theme="light"] .field textarea:not(:placeholder-shown) ~ label { background: var(--label-patch); }

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

html { scroll-behavior: smooth; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(139, 92, 246, 0.45); color: #fff; }

img { max-width: 100%; display: block; }
a { color: var(--violet-soft); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.mono { font-family: var(--font-mono); font-size: 0.82em; letter-spacing: 0.02em; }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #8b5cf6, #22d3ee); border-radius: 99px; }

.skip-link {
    position: fixed; top: -60px; left: 16px; z-index: 3000;
    background: var(--violet); color: #fff; padding: 10px 18px;
    border-radius: 8px; transition: top 0.25s;
}
.skip-link:focus { top: 12px; }

/* ── Ambient layers ────────────────────────────────────── */
.noise-overlay {
    position: fixed; inset: -50%; z-index: 2; pointer-events: none;
    opacity: var(--noise-opacity);
    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='2'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: noiseShift 0.6s steps(3) infinite;
}
@keyframes noiseShift {
    0% { transform: translate(0, 0); }
    33% { transform: translate(-2%, 1%); }
    66% { transform: translate(1%, -2%); }
    100% { transform: translate(0, 0); }
}

.spotlight {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(560px circle at var(--mx, 50%) var(--my, 30%),
        var(--spot), transparent 65%);
}

.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora-blob {
    position: absolute; border-radius: 50%; filter: blur(110px); opacity: var(--aurora-opacity);
    will-change: transform;
}
.a1 { width: 46vw; height: 46vw; background: rgba(124, 58, 237, 0.20); top: -12%; left: -8%; animation: drift1 26s ease-in-out infinite alternate; }
.a2 { width: 34vw; height: 34vw; background: rgba(34, 211, 238, 0.12); top: 42%; right: -10%; animation: drift2 32s ease-in-out infinite alternate; }
.a3 { width: 28vw; height: 28vw; background: rgba(232, 121, 249, 0.10); bottom: -10%; left: 28%; animation: drift1 38s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(9vw, 7vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-8vw, -9vh) scale(0.9); } }

/* ── Preloader ─────────────────────────────────────────── */
.preloader {
    position: fixed; inset: 0; z-index: 4000;
    display: grid; place-items: center;
    background: var(--bg);
    transition: opacity 0.5s ease, visibility 0.5s;
}
.preloader.done { opacity: 0; visibility: hidden; }
.preloader-inner { display: grid; justify-items: center; gap: 22px; z-index: 2; }
.pl-text {
    font-family: var(--font-display); font-size: 30px; font-weight: 700;
    fill: var(--text); letter-spacing: 2px;
}
.pl-ring { animation: ringDraw 1.8s var(--ease-out) forwards; transform-origin: center; }
@keyframes ringDraw { to { stroke-dashoffset: 0; } }
.preloader-logo { animation: plFloat 2.4s ease-in-out infinite alternate; filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.5)); }
@keyframes plFloat { to { transform: translateY(-6px); } }
.preloader-word { display: flex; font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.5em; color: var(--text-dim); }
.preloader-word span { opacity: 0; animation: charIn 0.5s var(--ease-out) forwards; }
.preloader-word span:nth-child(1) { animation-delay: 0.40s; } .preloader-word span:nth-child(2) { animation-delay: 0.45s; }
.preloader-word span:nth-child(3) { animation-delay: 0.50s; } .preloader-word span:nth-child(4) { animation-delay: 0.55s; }
.preloader-word span:nth-child(5) { animation-delay: 0.60s; } .preloader-word span:nth-child(6) { animation-delay: 0.65s; }
.preloader-word span:nth-child(7) { animation-delay: 0.70s; } .preloader-word span:nth-child(8) { animation-delay: 0.75s; }
.preloader-word span:nth-child(9) { animation-delay: 0.80s; } .preloader-word span:nth-child(10) { animation-delay: 0.85s; }
.preloader-word span:nth-child(11) { animation-delay: 0.90s; } .preloader-word span:nth-child(12) { animation-delay: 0.95s; }
.preloader-word span:nth-child(13) { animation-delay: 1.00s; } .preloader-word span:nth-child(14) { animation-delay: 1.05s; }
.preloader-word span:nth-child(15) { animation-delay: 1.10s; }
@keyframes charIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.preloader-track { width: 220px; height: 2px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
.preloader-fill { width: 0%; height: 100%; background: var(--grad); border-radius: 99px; box-shadow: 0 0 12px rgba(139,92,246,0.8); transition: width 0.2s ease; }
.preloader-percent { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-faint); }
.preloader-curtain {
    position: absolute; left: 0; width: 100%; height: 50%;
    background: var(--bg-2); z-index: 1; transition: transform 0.7s var(--ease-out) 0.15s;
}
.curtain-a { top: 0; } .curtain-b { bottom: 0; }
.preloader.done .curtain-a { transform: translateY(-100%); }
.preloader.done .curtain-b { transform: translateY(100%); }

/* ── Custom cursor ─────────────────────────────────────── */
.cursor-dot, .cursor-ring {
    position: fixed; top: 0; left: 0; z-index: 3500; pointer-events: none;
    border-radius: 50%; translate: -50% -50%;
}
.cursor-dot { width: 7px; height: 7px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.cursor-ring {
    width: 38px; height: 38px; border: 1.5px solid rgba(167, 139, 250, 0.6);
    transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out),
        border-color 0.25s, background 0.25s, opacity 0.3s;
}
.cursor-ring.is-hover { width: 62px; height: 62px; background: rgba(139, 92, 246, 0.12); border-color: var(--cyan); }
.cursor-ring.is-down { width: 26px; height: 26px; }
@media (hover: none), (pointer: coarse) { .cursor-dot, .cursor-ring { display: none; } }

/* ── Scroll orb ────────────────────────────────────────── */
.scroll-orb {
    position: fixed; right: 26px; bottom: 100px; z-index: 900;
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--panel-bg); backdrop-filter: blur(12px);
    border: 1px solid var(--stroke); color: var(--text);
    display: grid; place-items: center;
    opacity: 0; visibility: hidden; transform: translateY(14px);
    transition: opacity 0.35s, transform 0.35s var(--ease-out), visibility 0.35s;
}
.scroll-orb.show { opacity: 1; visibility: visible; transform: none; }
.scroll-orb svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.orb-track, .orb-progress { fill: none; stroke-width: 2.5; }
.orb-track { stroke: var(--stroke); }
.orb-progress { stroke: var(--violet); stroke-linecap: round; stroke-dasharray: 126; stroke-dashoffset: 126; filter: drop-shadow(0 0 4px rgba(139,92,246,0.8)); }
.scroll-orb i { font-size: 0.8rem; color: var(--violet-soft); }
.scroll-orb:hover { box-shadow: var(--glow-violet); }

/* ── Social dock ───────────────────────────────────────── */
.social-dock {
    position: fixed; left: 26px; bottom: 0; z-index: 900;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.social-dock a {
    width: 40px; height: 40px; display: grid; place-items: center;
    color: var(--text-dim); border-radius: 12px; position: relative;
    background: var(--surface); border: 1px solid transparent;
    transition: all 0.3s var(--ease-spring);
}
.social-dock a:hover {
    color: #fff; transform: translateY(-5px) scale(1.08);
    border-color: var(--stroke-bright); box-shadow: var(--glow-violet);
    background: rgba(139, 92, 246, 0.12);
}
.social-dock a::after {
    content: attr(data-tooltip); position: absolute; left: 120%; top: 50%;
    translate: 0 -50%; padding: 4px 10px; border-radius: 8px;
    font-size: 0.7rem; font-family: var(--font-mono); white-space: nowrap;
    background: var(--bg-3); border: 1px solid var(--stroke); color: var(--text);
    opacity: 0; pointer-events: none; transition: opacity 0.25s, translate 0.25s;
}
.social-dock a:hover::after { opacity: 1; translate: 6px -50%; }
.dock-line { width: 1px; height: 82px; background: linear-gradient(180deg, var(--violet), transparent); }
@media (max-width: 1420px) { .social-dock { display: none; } }

/* ── Header / Nav ──────────────────────────────────────── */
.site-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    display: flex; justify-content: center;
    padding: 14px 22px;
    transition: padding 0.4s var(--ease-out);
}
.nav-shell {
    width: 100%; max-width: 1200px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px; border-radius: 999px;
    border: 1px solid transparent;
    transition: all 0.45s var(--ease-out);
}
.site-header.scrolled { padding-top: 8px; }
.site-header.scrolled .nav-shell {
    background: var(--nav-bg);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-color: var(--stroke);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.brand { display: flex; align-items: center; gap: 8px; position: relative; }
.brand-mark {
    font-family: var(--font-display); font-weight: 700; font-size: 1.45rem;
    color: var(--text); letter-spacing: -0.02em;
}
.brand-accent { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-pulse {
    width: 7px; height: 7px; border-radius: 50%; background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan); animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }

.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; position: relative; }
.nav-link {
    display: block; padding: 8px 14px; border-radius: 999px;
    font-size: 0.86rem; font-weight: 500; color: var(--text-dim);
    transition: color 0.25s; position: relative; z-index: 1;
}
.nav-link:hover { color: #fff; }
.nav-link.active { color: #fff; }
.nav-glider {
    position: absolute; top: 0; height: 100%; border-radius: 999px;
    background: rgba(139, 92, 246, 0.16); border: 1px solid rgba(139, 92, 246, 0.3);
    opacity: 0; transition: left 0.4s var(--ease-spring), width 0.4s var(--ease-spring), opacity 0.3s;
    pointer-events: none;
}
.nav-glider.on { opacity: 1; }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--stroke);
    color: var(--text); font-size: 0.95rem;
    display: grid; place-items: center;
    transition: all 0.3s var(--ease-spring);
}
.theme-toggle:hover {
    border-color: var(--stroke-bright); box-shadow: var(--glow-violet);
    transform: translateY(-2px) rotate(12deg);
}
.theme-toggle .fa-sun { color: #fbbf24; }
.theme-toggle .fa-moon { color: var(--violet-soft); }
:root[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
:root[data-theme="light"] .theme-toggle .fa-sun { display: none; }

.menu-toggle {
    display: none; width: 42px; height: 42px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--stroke);
    flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.menu-toggle span { width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.35s var(--ease-out); }
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; scale: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 960px) {
    .nav-links, .btn-nav { display: none; }
    .menu-toggle { display: flex; }
}

/* Mobile menu */
.mobile-menu {
    position: fixed; inset: 0; z-index: 990;
    display: grid; place-items: center;
    visibility: hidden; pointer-events: none;
}
.mobile-menu.open { visibility: visible; pointer-events: auto; }
.mobile-menu-bg {
    position: absolute; inset: 0;
    background: var(--overlay-bg); backdrop-filter: blur(24px);
    clip-path: circle(0% at calc(100% - 44px) 40px);
    transition: clip-path 0.65s var(--ease-out);
}
.mobile-menu.open .mobile-menu-bg { clip-path: circle(150% at calc(100% - 44px) 40px); }
.mobile-menu-links { position: relative; display: grid; gap: 6px; text-align: center; }
.m-link {
    font-family: var(--font-display); font-size: clamp(1.7rem, 6vw, 2.4rem);
    font-weight: 600; color: var(--text-dim); padding: 6px 20px;
    opacity: 0; transform: translateY(24px);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out), color 0.3s;
}
.mobile-menu.open .m-link { opacity: 1; transform: none; }
.m-link:hover { color: #fff; text-shadow: 0 0 24px rgba(139, 92, 246, 0.8); }
.mobile-menu-footer { position: absolute; bottom: 46px; display: flex; gap: 22px; }
.mobile-menu-footer a { font-size: 1.25rem; color: var(--text-dim); }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    position: relative; display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 28px; border-radius: 999px; border: 1px solid transparent;
    font-family: var(--font-body); font-size: 0.92rem; font-weight: 600;
    color: var(--text); overflow: hidden; isolation: isolate;
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s, border-color 0.3s, background 0.3s;
    will-change: transform;
}
.btn-primary {
    background: linear-gradient(120deg, #7c3aed, #5b21b6);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover { box-shadow: 0 12px 44px rgba(124, 58, 237, 0.55), inset 0 1px 0 rgba(255,255,255,0.25); }
.btn-glow {
    position: absolute; inset: -2px; z-index: -1; border-radius: inherit;
    background: conic-gradient(from 0deg, #8b5cf6, #22d3ee, #e879f9, #8b5cf6);
    filter: blur(14px); opacity: 0; transition: opacity 0.4s;
}
.btn-primary:hover .btn-glow { opacity: 0.7; }
.btn-ghost {
    background: var(--surface); border-color: var(--stroke);
    backdrop-filter: blur(10px);
}
.btn-ghost:hover { border-color: var(--stroke-bright); background: var(--surface-2); box-shadow: var(--glow-violet); }
.btn-nav { padding: 9px 18px; font-size: 0.82rem; background: var(--surface); border-color: var(--stroke); }
.btn-nav:hover { border-color: var(--stroke-bright); box-shadow: var(--glow-violet); }

.ripple .ink {
    position: absolute; border-radius: 50%; translate: -50% -50%;
    background: rgba(255, 255, 255, 0.35); pointer-events: none;
    animation: ink 0.6s var(--ease-out) forwards;
}
@keyframes ink { from { width: 0; height: 0; opacity: 0.6; } to { width: 320px; height: 320px; opacity: 0; } }

/* ── Glass card ────────────────────────────────────────── */
.glass-card {
    position: relative;
    background: linear-gradient(160deg, var(--glass-a), var(--glass-b));
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: border-color 0.35s, box-shadow 0.35s, transform 0.35s var(--ease-out);
}
.glass-card::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
    background: radial-gradient(400px circle at var(--gx, 50%) var(--gy, 0%),
        rgba(139, 92, 246, 0.55), transparent 45%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0; transition: opacity 0.35s; pointer-events: none;
}
.glass-card:hover::before { opacity: 1; }
.glass-card:hover { border-color: rgba(139, 92, 246, 0.25); box-shadow: 0 18px 50px rgba(0,0,0,0.4), var(--glow-violet); }
.tilt-card { transform-style: preserve-3d; }

/* ── Section scaffolding ───────────────────────────────── */
.section { position: relative; padding: 120px 0; z-index: 3; }
.container { width: min(1160px, 92%); margin-inline: auto; }
.container-wide { width: min(1320px, 94%); margin-inline: auto; }
.section-head { margin-bottom: 56px; max-width: 720px; }
.section-tag {
    display: inline-block; padding: 6px 14px; border-radius: 999px;
    font-size: 0.72rem; color: var(--cyan); letter-spacing: 0.08em;
    background: rgba(34, 211, 238, 0.07); border: 1px solid rgba(34, 211, 238, 0.22);
    margin-bottom: 18px;
}
.section-title {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.12;
    letter-spacing: -0.03em;
}
.section-sub { color: var(--text-dim); margin-top: 14px; font-size: 1rem; }
.gradient-text {
    background: var(--grad); -webkit-background-clip: text;
    background-clip: text; color: transparent;
}

/* generic pills / tags */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
    background: var(--surface-2); border: 1px solid var(--stroke); color: var(--text-dim);
}
.pill-live { color: var(--green); border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.08); }
.pill-ai { color: var(--violet-soft); border-color: rgba(139,92,246,0.35); background: rgba(139,92,246,0.1); }
.pill-web { color: var(--cyan); border-color: rgba(34,211,238,0.35); background: rgba(34,211,238,0.08); }
.pill-game { color: var(--magenta); border-color: rgba(232,121,249,0.35); background: rgba(232,121,249,0.08); }
.pill-clone { color: #fbbf24; border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.07); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag-row span {
    font-family: var(--font-mono); font-size: 0.7rem; padding: 4px 10px;
    border-radius: 8px; color: var(--text-dim);
    background: var(--surface); border: 1px solid var(--stroke);
    transition: all 0.25s;
}
.tag-row span:hover { color: var(--cyan); border-color: rgba(34,211,238,0.4); }
.status-dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
    background: var(--green); box-shadow: 0 0 10px var(--green);
    animation: pulse 2s infinite;
}

/* ── HERO ──────────────────────────────────────────────── */
.hero {
    position: relative; min-height: 100svh;
    display: flex; flex-direction: column; justify-content: center;
    padding: calc(var(--nav-h) + 40px) 0 60px; z-index: 3;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-grid-lines {
    position: absolute; inset: 0; z-index: -1; opacity: 0.35;
    background-image:
        linear-gradient(rgba(139, 92, 246, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, 0.05) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 30%, transparent 75%);
}
.hero-inner {
    width: min(1200px, 92%); margin-inline: auto;
    display: grid; grid-template-columns: 1.25fr 0.85fr; gap: 56px; align-items: center;
}
.hero-status {
    display: inline-flex; align-items: center; gap: 10px; width: fit-content;
    padding: 8px 16px; border-radius: 999px; font-size: 0.8rem; color: var(--text-dim);
    background: var(--surface); border: 1px solid var(--stroke); backdrop-filter: blur(10px);
    margin-bottom: 26px;
}
.hero-title {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(3rem, 8.5vw, 6.2rem); line-height: 0.98;
    letter-spacing: -0.045em; margin-bottom: 22px;
}
.line-mask { display: block; overflow: hidden; padding-bottom: 0.08em; }
.reveal-line { display: inline-block; transform: translateY(115%); }
.hero-role {
    display: flex; align-items: baseline; gap: 12px;
    font-family: var(--font-display); font-weight: 500;
    font-size: clamp(1.1rem, 2.6vw, 1.6rem); color: var(--text-dim);
    min-height: 1.6em; margin-bottom: 20px;
}
.role-prefix { color: var(--cyan); }
#typedRole { color: var(--text); }
.typed-caret {
    width: 3px; height: 1.15em; background: var(--cyan); align-self: center;
    box-shadow: 0 0 12px var(--cyan); animation: caret 1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.typed-cursor { display: none; }
.hero-bio { max-width: 520px; color: var(--text-dim); font-size: 1.02rem; margin-bottom: 34px; }
.hero-bio strong { color: var(--text); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 44px; }
.hero-metrics {
    display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.metric { display: flex; align-items: baseline; gap: 2px; }
.metric .counter, .metric em {
    font-family: var(--font-display); font-size: 1.9rem; font-weight: 700;
    font-style: normal; background: var(--grad);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.metric small { display: block; margin-left: 10px; color: var(--text-faint); font-size: 0.78rem; align-self: center; max-width: 84px; line-height: 1.3; }
.metric-sep { width: 1px; height: 34px; background: var(--stroke); }

.hero-visual { position: relative; display: grid; place-items: center; }
.portrait-shell {
    position: relative; width: min(320px, 72vw); aspect-ratio: 1;
    border-radius: 30px;
}
.portrait-shell img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 30px;
    border: 1px solid var(--stroke-bright);
    box-shadow: 0 30px 80px rgba(0,0,0,0.55), var(--glow-violet);
}
.portrait-glow {
    position: absolute; inset: -6%; z-index: -1; border-radius: 40px;
    background: var(--grad); filter: blur(46px); opacity: 0.35;
    animation: breathe 5s ease-in-out infinite alternate;
}
@keyframes breathe { to { opacity: 0.55; transform: scale(1.05); } }
.portrait-scan {
    position: absolute; inset: 0; border-radius: 30px; overflow: hidden; pointer-events: none;
}
.portrait-scan::after {
    content: ""; position: absolute; left: 0; right: 0; height: 34%;
    background: linear-gradient(180deg, transparent, rgba(34, 211, 238, 0.14), transparent);
    animation: scan 4.4s ease-in-out infinite;
}
@keyframes scan { 0% { top: -35%; } 60%, 100% { top: 105%; } }
.float-chip {
    position: absolute; display: flex; align-items: center; gap: 8px;
    padding: 9px 15px; border-radius: 999px; font-size: 0.76rem; font-weight: 600;
    background: var(--panel-bg); backdrop-filter: blur(12px);
    border: 1px solid var(--stroke-bright); color: var(--text);
    box-shadow: 0 12px 30px rgba(0,0,0,0.4); white-space: nowrap;
    animation: chipFloat 5s ease-in-out infinite alternate;
}
.float-chip i { color: var(--violet-soft); }
.chip-1 { top: 4%; left: -16%; animation-delay: 0s; }
.chip-2 { bottom: 18%; right: -18%; animation-delay: 1.2s; }
.chip-3 { bottom: -5%; left: -6%; animation-delay: 2.1s; }
@keyframes chipFloat { to { transform: translateY(-12px); } }
.orbit-ring {
    position: absolute; border-radius: 50%; border: 1px dashed rgba(139, 92, 246, 0.25);
    pointer-events: none;
}
.r1 { width: 122%; height: 122%; animation: orbitSpin 30s linear infinite; }
.r2 { width: 148%; height: 148%; border-color: rgba(34, 211, 238, 0.14); animation: orbitSpin 46s linear infinite reverse; }
.r1::after, .r2::after {
    content: ""; position: absolute; top: 4%; left: 50%;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--cyan); box-shadow: 0 0 14px var(--cyan);
}
.r2::after { background: var(--magenta); box-shadow: 0 0 14px var(--magenta); }
@keyframes orbitSpin { to { transform: rotate(360deg); } }

.scroll-cue {
    position: absolute; bottom: 30px; left: 50%; translate: -50%;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    color: var(--text-faint); font-size: 0.7rem; letter-spacing: 0.3em;
}
.cue-line {
    width: 1px; height: 52px; background: var(--stroke); overflow: hidden; position: relative;
}
.cue-line::after {
    content: ""; position: absolute; top: -50%; left: 0; width: 100%; height: 50%;
    background: var(--grad); animation: cueDrop 1.8s var(--ease-out) infinite;
}
@keyframes cueDrop { to { top: 110%; } }

@media (max-width: 960px) {
    .scroll-cue { display: none; }
    .hero-inner { grid-template-columns: 1fr; gap: 60px; text-align: center; }
    .hero-copy { display: flex; flex-direction: column; align-items: center; }
    .hero-role { justify-content: center; }
    .hero-metrics { justify-content: center; }
    .hero-visual { order: -1; margin-top: 20px; }
    .chip-1 { left: -4%; } .chip-2 { right: -6%; } .chip-3 { left: 2%; }
}

/* reveal helpers */
.reveal-up { opacity: 0; transform: translateY(36px); }
body.no-motion .reveal-up, body.no-motion .reveal-line { opacity: 1 !important; transform: none !important; }

/* ── Marquee ───────────────────────────────────────────── */
.marquee {
    position: relative; z-index: 3; overflow: hidden; padding: 26px 0;
    border-block: 1px solid var(--stroke);
    background: var(--glass-b);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
    display: flex; align-items: center; gap: 34px; width: max-content;
    animation: marquee 36s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
    font-family: var(--font-display); font-size: 1.05rem; font-weight: 600;
    color: var(--text-faint); white-space: nowrap; transition: color 0.3s, text-shadow 0.3s;
}
.marquee-track span:hover { color: var(--text); text-shadow: 0 0 18px rgba(139, 92, 246, 0.9); }
.marquee-track i { font-style: normal; color: var(--violet); font-size: 0.6rem; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ── About ─────────────────────────────────────────────── */
.about-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 26px; }
.about-main { padding: 40px; display: flex; flex-direction: column; gap: 18px; }
.about-lede { font-size: 1.18rem; line-height: 1.6; color: var(--text); }
.about-main p { color: var(--text-dim); }
.about-main strong { color: var(--text); }
.about-role-chip {
    margin-top: auto; display: inline-flex; align-items: center; gap: 10px;
    padding: 12px 18px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600;
    background: rgba(52, 211, 153, 0.06); border: 1px solid rgba(52, 211, 153, 0.25);
    color: var(--text); width: fit-content;
}
.about-cells { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cell { padding: 26px 22px; }
.cell-icon {
    font-size: 1.3rem; color: var(--violet-soft); margin-bottom: 14px;
    display: inline-grid; place-items: center; width: 46px; height: 46px;
    border-radius: 14px; background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.25);
}
.cell h3 { font-family: var(--font-display); font-size: 1.02rem; margin-bottom: 8px; }
.cell p { font-size: 0.85rem; color: var(--text-dim); }
@media (max-width: 880px) {
    .about-grid { grid-template-columns: 1fr; }
    .about-cells { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* ── Timeline ──────────────────────────────────────────── */
.timeline { position: relative; display: grid; gap: 30px; padding-left: 44px; max-width: 820px; }
.timeline-rail {
    position: absolute; left: 12px; top: 8px; bottom: 8px; width: 2px;
    background: var(--stroke); border-radius: 99px; overflow: hidden;
}
.timeline-beam {
    width: 100%; height: 0%;
    background: linear-gradient(180deg, var(--violet), var(--cyan));
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.8);
}
.timeline-item { padding: 28px 30px; }
.timeline-node {
    position: absolute; left: -39px; top: 34px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--bg-3); border: 2px solid var(--violet);
    box-shadow: 0 0 0 5px rgba(139, 92, 246, 0.12), 0 0 16px rgba(139, 92, 246, 0.6);
}
.timeline-node.node-live { border-color: var(--green); box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.12), 0 0 16px rgba(52, 211, 153, 0.7); }
.tl-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tl-year { color: var(--cyan); font-size: 0.76rem; }
.timeline-item h3 { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: 6px; }
.tl-place { color: var(--violet-soft); font-size: 0.85rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.timeline-item > p:not(.tl-place) { color: var(--text-dim); font-size: 0.92rem; }

/* ── Skills ────────────────────────────────────────────── */
.skills-stage { position: relative; height: 460px; overflow: hidden; margin-bottom: 26px; }
.skills-orbit { width: 100%; height: 100%; display: block; }
.skills-stage-label {
    position: absolute; top: 18px; left: 22px; color: var(--text-faint); font-size: 0.75rem;
}
.skills-clusters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 18px; }
.cluster { padding: 26px 24px; }
.cluster h3 {
    font-family: var(--font-display); font-size: 1rem; margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px;
}
.cluster h3 i { color: var(--cyan); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 7px 14px; border-radius: 999px; font-size: 0.78rem; font-weight: 500;
    background: var(--surface); border: 1px solid var(--stroke); color: var(--text-dim);
    transition: all 0.3s var(--ease-spring); cursor: default;
}
.chip:hover {
    color: #fff; border-color: var(--stroke-bright); transform: translateY(-3px);
    background: rgba(139, 92, 246, 0.14); box-shadow: var(--glow-violet);
}
@media (max-width: 700px) { .skills-stage { height: 400px; } }

/* ── GitHub ────────────────────────────────────────────── */
.gh-grid {
    display: grid; gap: 22px;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "stats stats" "chart repos";
}
.gh-stats { grid-area: stats; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.gh-stat {
    position: relative; padding: 26px 24px; overflow: hidden;
    display: flex; flex-direction: column; gap: 6px;
}
.gh-num {
    font-family: var(--font-display); font-size: 2.1rem; font-weight: 700;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gh-stat small { color: var(--text-dim); font-size: 0.8rem; }
.gh-stat i {
    position: absolute; right: 18px; top: 20px; font-size: 1.4rem;
    color: rgba(139, 92, 246, 0.3);
}
.gh-chart-card, .gh-repos-card { padding: 30px; display: flex; flex-direction: column; gap: 20px; }
.gh-chart-card { grid-area: chart; }
.gh-repos-card { grid-area: repos; }
.gh-chart-card h3, .gh-repos-card h3 {
    font-family: var(--font-display); font-size: 1rem;
    display: flex; align-items: center; gap: 10px;
}
.gh-chart-card h3 i, .gh-repos-card h3 i { color: var(--magenta); }
.gh-chart-wrap { position: relative; height: 260px; }
.gh-repo-list { list-style: none; display: grid; gap: 12px; }
.gh-repo {
    display: block; padding: 14px 16px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--stroke);
    transition: all 0.3s;
}
a.gh-repo:hover { border-color: var(--stroke-bright); transform: translateX(6px); box-shadow: var(--glow-violet); }
.gh-repo-name { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text); display: flex; justify-content: space-between; gap: 10px; }
.gh-repo-name .stars { color: #fbbf24; font-size: 0.75rem; white-space: nowrap; }
.gh-repo-desc { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; }
.gh-repos-card .btn { margin-top: auto; align-self: flex-start; }

.skeleton { position: relative; }
.skeleton::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.06) 50%, transparent 70%);
    background-size: 220% 100%; animation: shimmer 1.6s infinite;
}
.skeleton-row { height: 56px; }
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }
.gh-stat.loaded::after, .gh-repo.loaded::after { display: none; }

@media (max-width: 880px) {
    .gh-grid { grid-template-columns: 1fr; grid-template-areas: "stats" "chart" "repos"; }
    .gh-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Projects ──────────────────────────────────────────── */
/* — AI System Map (projects ecosystem) — */
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.eco { display: grid; gap: 18px; }
.eco-hud {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}
.eco-status { color: var(--text-faint); font-size: 0.74rem; display: inline-flex; align-items: center; gap: 10px; }
.eco-legend { display: flex; gap: 8px; flex-wrap: wrap; }
.eco-legend button {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 15px; border-radius: 999px; font-size: 0.76rem; font-weight: 600;
    background: var(--surface); border: 1px solid var(--stroke); color: var(--text-dim);
    transition: all 0.3s var(--ease-out);
}
.eco-legend button:hover { color: var(--text); border-color: var(--stroke-bright); }
.eco-legend button.on {
    color: var(--text); background: rgba(139, 92, 246, 0.12);
    border-color: var(--stroke-bright); box-shadow: var(--glow-violet);
}
.ldot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--c); box-shadow: 0 0 9px var(--c);
}

.eco-body {
    display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; align-items: stretch;
}
.eco-stage {
    position: relative; min-height: 560px; overflow: hidden;
    border-radius: 24px; border: 1px solid var(--stroke);
    background:
        radial-gradient(ellipse 60% 55% at 50% 45%, rgba(139, 92, 246, 0.07), transparent 70%),
        linear-gradient(160deg, var(--glass-a), var(--glass-b));
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
#ecoCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.eco-hint {
    position: absolute; left: 20px; bottom: 16px; pointer-events: none;
    color: var(--text-faint); font-size: 0.72rem;
    transition: color 0.3s;
}

/* Inspector */
.eco-inspector {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column;
    border-radius: 24px; border: 1px solid var(--stroke);
    background: linear-gradient(160deg, var(--glass-a), var(--glass-b));
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    padding: 26px 26px 24px; min-height: 560px;
}
.eco-inspector::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--grad); opacity: 0.7;
}
.ins-prompt { color: var(--cyan); font-size: 0.78rem; margin-bottom: 14px; word-break: break-all; }
.ins-caret {
    display: inline-block; width: 8px; height: 1em; margin-left: 4px;
    background: var(--cyan); vertical-align: text-bottom;
    animation: caret 1s steps(2) infinite;
    box-shadow: 0 0 8px var(--cyan);
}
.ins-idle { display: flex; flex-direction: column; gap: 18px; margin: auto 0; }
.ins-idle p { color: var(--text-dim); font-size: 0.92rem; }
.ins-idle-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ins-stat {
    padding: 14px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--stroke);
}
.ins-stat strong {
    display: block; font-family: var(--font-display); font-size: 1.35rem;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ins-stat span { font-size: 0.7rem; color: var(--text-faint); }

.ins-row { opacity: 0; transform: translateY(12px); animation: insIn 0.5s var(--ease-out) forwards; }
@keyframes insIn { to { opacity: 1; transform: none; } }
.ins-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ins-thumb {
    width: 58px; height: 58px; border-radius: 14px; object-fit: cover; flex-shrink: 0;
    border: 1px solid var(--stroke-bright); box-shadow: var(--glow-violet);
}
.ins-head h3 { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.2; letter-spacing: -0.01em; }
.ins-type { color: var(--text-faint); font-size: 0.72rem; }
.ins-mission { color: var(--text-dim); font-size: 0.88rem; margin-bottom: 16px; }
.ins-label { color: var(--cyan); font-size: 0.68rem; letter-spacing: 0.08em; margin: 12px 0 8px; }

.ins-pipe { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pl-step {
    padding: 7px 12px; border-radius: 10px; font-family: var(--font-mono);
    font-size: 0.68rem; color: var(--text);
    background: rgba(139, 92, 246, 0.1); border: 1px solid rgba(139, 92, 246, 0.3);
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s;
}
.pl-step:hover { transform: translateY(-3px); box-shadow: var(--glow-violet); }
.pl-arrow { position: relative; width: 20px; height: 2px; overflow: hidden; background: rgba(139, 92, 246, 0.25); border-radius: 2px; }
.pl-arrow::after {
    content: ""; position: absolute; top: 0; left: -60%; width: 55%; height: 100%;
    background: var(--cyan); box-shadow: 0 0 6px var(--cyan);
    animation: plFlow 1.6s linear infinite;
}
@keyframes plFlow { to { left: 110%; } }

.ins-metrics { display: flex; gap: 8px; flex-wrap: wrap; }
.ins-metric {
    flex: 1 1 80px; padding: 10px 12px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--stroke);
}
.ins-metric strong { display: block; font-family: var(--font-display); font-size: 0.95rem; color: var(--text); }
.ins-metric span { font-size: 0.64rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }

.eco-inspector .tag-row { margin-top: 0; }
.eco-inspector .p-links { margin-top: auto; padding-top: 18px; }
.ins-wake { color: var(--text-faint); font-size: 0.68rem; margin-top: 10px; }

@media (max-width: 980px) {
    .eco-body { grid-template-columns: 1fr; }
    .eco-stage { min-height: 420px; }
    .eco-inspector { min-height: 0; }
}
@media (max-width: 640px) {
    .eco-stage { min-height: 360px; }
    .eco-inspector { padding: 20px 18px; }
    .eco-hud { flex-direction: column; align-items: flex-start; }
    .eco-hint { left: auto; right: 14px; bottom: auto; top: 14px; font-size: 0.66rem; }
}

.p-links { display: flex; gap: 12px; margin-top: 18px; }
.p-link {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: 10px; font-size: 0.8rem; font-weight: 600;
    color: var(--text-dim); background: var(--surface);
    border: 1px solid var(--stroke); transition: all 0.3s;
}
.p-link:hover { color: #fff; border-color: var(--stroke-bright); transform: translateY(-2px); box-shadow: var(--glow-violet); }
.p-link.live { color: var(--cyan); border-color: rgba(34, 211, 238, 0.3); }
.p-link.live:hover { box-shadow: var(--glow-cyan); }
.projects-cta { margin-top: 48px; text-align: center; }

/* ── Credentials ───────────────────────────────────────── */
.cred-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 36px; }
.cred-tab {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 10px 20px; border-radius: 999px; font-size: 0.84rem; font-weight: 600;
    background: var(--surface); border: 1px solid var(--stroke); color: var(--text-dim);
    transition: all 0.3s var(--ease-out);
}
.cred-tab:hover { color: var(--text); border-color: var(--stroke-bright); }
.cred-tab.active {
    color: var(--text); background: rgba(139, 92, 246, 0.14);
    border-color: rgba(139, 92, 246, 0.5); box-shadow: var(--glow-violet);
}
.tcount {
    font-family: var(--font-mono); font-size: 0.68rem; padding: 2px 9px;
    border-radius: 999px; background: rgba(139, 92, 246, 0.16);
    border: 1px solid rgba(139, 92, 246, 0.3); color: var(--violet-soft);
}
.cred-tab.active .tcount { background: var(--grad); color: #fff; border-color: transparent; }
.cred-pane { display: none; }
.cred-pane.active { display: block; animation: insIn 0.5s var(--ease-out); }
.cred-group + .cred-group { margin-top: 34px; }
.cred-group-title {
    color: var(--cyan); font-size: 0.72rem; letter-spacing: 0.1em;
    margin-bottom: 14px; text-transform: lowercase;
}
.creds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.cred { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.cred-issuer {
    font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em;
    color: var(--cyan); text-transform: uppercase;
}
.cred h3 { font-size: 0.9rem; font-weight: 600; line-height: 1.45; }
.cred-verify { font-size: 0.75rem; color: var(--green); display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
.honors-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px; margin-top: 40px; }
.honor { padding: 28px 26px; }
.honor-icon {
    font-size: 1.35rem; margin-bottom: 16px; color: #fbbf24;
    display: inline-grid; place-items: center; width: 48px; height: 48px;
    border-radius: 14px; background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
}
.honor h3 { font-family: var(--font-display); font-size: 1.02rem; margin-bottom: 8px; }
.honor p { font-size: 0.85rem; color: var(--text-dim); }

/* ── Contact ───────────────────────────────────────────── */
.contact-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 26px; align-items: start; }
.contact-side { display: grid; gap: 14px; }
.c-item {
    display: flex; align-items: center; gap: 18px; padding: 18px 22px;
    color: var(--text); border-radius: var(--radius-sm);
}
.c-item i {
    font-size: 1.05rem; color: var(--violet-soft);
    width: 44px; height: 44px; display: grid; place-items: center; flex-shrink: 0;
    border-radius: 12px; background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.25);
}
.c-item small { display: block; color: var(--text-faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.c-item span { font-size: 0.92rem; font-weight: 500; word-break: break-word; }
.resume-cta { justify-content: center; margin-top: 8px; }

.contact-form { padding: 36px; display: grid; gap: 24px; }
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }
.field { position: relative; }
.field input, .field textarea {
    width: 100%; padding: 16px 18px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--stroke);
    color: var(--text); font-family: var(--font-body); font-size: 0.95rem;
    outline: none; resize: vertical;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}
.field label {
    position: absolute; left: 18px; top: 16px; color: var(--text-faint);
    font-size: 0.92rem; pointer-events: none;
    transition: all 0.25s var(--ease-out);
    background: transparent; padding: 0 6px;
}
.field input:focus, .field textarea:focus {
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12), var(--glow-violet);
    background: rgba(139, 92, 246, 0.05);
}
.field input:focus ~ label, .field input:not(:placeholder-shown) ~ label,
.field textarea:focus ~ label, .field textarea:not(:placeholder-shown) ~ label {
    top: -9px; left: 12px; font-size: 0.72rem; color: var(--violet-soft);
    background: var(--label-patch); border-radius: 6px;
}
.field.invalid input, .field.invalid textarea { border-color: rgba(248, 113, 113, 0.65); box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.1); }
.submit-btn { justify-content: center; width: 100%; }
.form-status { font-size: 0.85rem; min-height: 1.4em; text-align: center; }
.form-status.ok { color: var(--green); }
.form-status.err { color: #f87171; }
@media (max-width: 880px) { .contact-grid { grid-template-columns: 1fr; } }

/* ── Footer ────────────────────────────────────────────── */
.site-footer {
    position: relative; z-index: 3; padding: 60px 0 30px;
    border-top: 1px solid var(--stroke);
    background: linear-gradient(180deg, transparent, rgba(139, 92, 246, 0.04));
}
.footer-inner {
    width: min(1160px, 92%); margin-inline: auto;
    display: flex; justify-content: space-between; align-items: center; gap: 30px; flex-wrap: wrap;
}
.footer-brand p { color: var(--text-faint); font-size: 0.75rem; margin-top: 6px; }
.footer-nav { display: flex; gap: 22px; }
.footer-nav a { color: var(--text-dim); font-size: 0.86rem; transition: color 0.25s; }
.footer-nav a:hover { color: #fff; }
.footer-social { display: flex; gap: 14px; }
.footer-social a {
    width: 40px; height: 40px; display: grid; place-items: center;
    border-radius: 12px; color: var(--text-dim);
    background: var(--surface); border: 1px solid var(--stroke);
    transition: all 0.3s var(--ease-spring);
}
.footer-social a:hover { color: #fff; transform: translateY(-4px); box-shadow: var(--glow-violet); border-color: var(--stroke-bright); }
.footer-copy { text-align: center; margin-top: 36px; color: var(--text-faint); font-size: 0.72rem; }

/* ── AI Assistant ──────────────────────────────────────── */
.ai-fab {
    position: fixed; right: 26px; bottom: 30px; z-index: 950;
    width: 58px; height: 58px; border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    border: 1px solid rgba(167, 139, 250, 0.5);
    color: #fff; font-size: 1.25rem; display: grid; place-items: center;
    box-shadow: 0 12px 34px rgba(124, 58, 237, 0.45);
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s;
}
.ai-fab:hover { transform: translateY(-4px) scale(1.06); box-shadow: 0 18px 44px rgba(124, 58, 237, 0.65); }
.ai-fab-pulse {
    position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid rgba(139, 92, 246, 0.6);
    animation: fabPulse 2.2s ease-out infinite;
}
@keyframes fabPulse { from { transform: scale(1); opacity: 1; } to { transform: scale(1.55); opacity: 0; } }

.ai-panel {
    position: fixed; right: 26px; bottom: 102px; z-index: 950;
    width: min(380px, calc(100vw - 40px)); height: min(540px, 70vh);
    display: flex; flex-direction: column;
    background: var(--panel-bg);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border: 1px solid var(--stroke-bright); border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), var(--glow-violet);
    opacity: 0; visibility: hidden; transform: translateY(26px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-spring), visibility 0.35s;
}
.ai-panel.open { opacity: 1; visibility: visible; transform: none; }
.ai-head {
    display: flex; align-items: center; gap: 12px; padding: 16px 18px;
    border-bottom: 1px solid var(--stroke);
}
.ai-avatar {
    width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
    background: var(--grad); color: #fff; font-size: 1rem;
    box-shadow: var(--glow-violet);
}
.ai-id strong { font-family: var(--font-display); font-size: 0.9rem; display: block; }
.ai-id small { color: var(--text-dim); font-size: 0.72rem; display: flex; align-items: center; gap: 6px; }
.ai-close {
    margin-left: auto; width: 34px; height: 34px; border-radius: 10px;
    background: var(--surface); border: 1px solid var(--stroke); color: var(--text-dim);
    transition: all 0.25s;
}
.ai-close:hover { color: #fff; border-color: var(--stroke-bright); }
.ai-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.ai-msg {
    max-width: 86%; padding: 12px 15px; border-radius: 16px;
    font-size: 0.85rem; line-height: 1.55;
    animation: msgIn 0.35s var(--ease-out);
}
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
.ai-msg.bot {
    align-self: flex-start; background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25); border-bottom-left-radius: 4px;
}
.ai-msg.user {
    align-self: flex-end; background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.25); border-bottom-right-radius: 4px;
}
.ai-msg a { color: var(--cyan); text-decoration: underline; }
.ai-typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.ai-typing i {
    width: 7px; height: 7px; border-radius: 50%; background: var(--violet-soft);
    animation: typing 1.1s ease-in-out infinite;
}
.ai-typing i:nth-child(2) { animation-delay: 0.15s; }
.ai-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 40% { transform: translateY(-6px); opacity: 0.5; } }
.ai-suggest { display: flex; gap: 8px; padding: 0 18px 12px; flex-wrap: wrap; }
.ai-suggest button {
    padding: 6px 13px; border-radius: 999px; font-size: 0.72rem;
    background: var(--surface); border: 1px solid var(--stroke); color: var(--text-dim);
    transition: all 0.25s;
}
.ai-suggest button:hover { color: #fff; border-color: var(--stroke-bright); box-shadow: var(--glow-violet); }
.ai-input {
    display: flex; gap: 10px; padding: 14px 16px;
    border-top: 1px solid var(--stroke);
}
.ai-input input {
    flex: 1; padding: 12px 16px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--stroke);
    color: var(--text); font-family: inherit; font-size: 0.85rem; outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.ai-input input:focus { border-color: rgba(139, 92, 246, 0.55); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12); }
.ai-input button {
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background: var(--grad); color: #fff; font-size: 0.9rem;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
}
.ai-input button:hover { transform: scale(1.1); box-shadow: var(--glow-violet); }

/* ── Toast ─────────────────────────────────────────────── */
.toast {
    position: fixed; left: 50%; bottom: 34px; translate: -50% 0; z-index: 2000;
    padding: 14px 24px; border-radius: 14px; font-size: 0.88rem;
    background: var(--panel-bg); backdrop-filter: blur(16px);
    border: 1px solid var(--stroke-bright); color: var(--text);
    box-shadow: 0 18px 50px rgba(0,0,0,0.5), var(--glow-violet);
    opacity: 0; visibility: hidden; transform: translateY(16px);
    transition: all 0.4s var(--ease-spring);
}
.toast.show { opacity: 1; visibility: visible; transform: none; }

/* ── Section separators ────────────────────────────────── */
.section::before {
    content: ""; position: absolute; top: 0; left: 50%; translate: -50%;
    width: min(720px, 80%); height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.35), transparent);
}
.hero::before { display: none; }

/* ── Case-study pages ──────────────────────────────────── */
.cs-header {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px clamp(20px, 5vw, 48px);
    background: var(--nav-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--stroke);
}
.cs-back {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 0.88rem; font-weight: 600; color: var(--text-dim);
    transition: color 0.25s, transform 0.3s var(--ease-out);
}
.cs-back:hover { color: var(--text); transform: translateX(-4px); }
.cs-main { width: min(820px, 92%); margin: 0 auto; padding: 64px 0 90px; position: relative; z-index: 3; }
.cs-kicker { color: var(--cyan); font-size: 0.76rem; letter-spacing: 0.08em; }
.cs-main h1 {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(2rem, 5.4vw, 3.1rem); letter-spacing: -0.03em;
    line-height: 1.1; margin: 14px 0 18px;
}
.cs-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.cs-lede { font-size: 1.12rem; color: var(--text); line-height: 1.7; margin-bottom: 34px; }
.cs-shot {
    width: 100%; border-radius: 20px; border: 1px solid var(--stroke-bright);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4), var(--glow-violet);
    margin-bottom: 44px;
}
.cs-main h2 {
    font-family: var(--font-display); font-size: 1.35rem; letter-spacing: -0.01em;
    margin: 40px 0 14px; display: flex; align-items: center; gap: 12px;
}
.cs-main h2 .mono { color: var(--cyan); font-size: 0.72rem; }
.cs-main p, .cs-main li { color: var(--text-dim); font-size: 0.98rem; line-height: 1.75; }
.cs-main ul { padding-left: 22px; display: grid; gap: 8px; margin: 12px 0; }
.cs-main strong { color: var(--text); }
.cs-pipe { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.cs-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; }
.cs-metric {
    padding: 18px; border-radius: var(--radius-sm); text-align: center;
    background: var(--surface); border: 1px solid var(--stroke);
}
.cs-metric strong {
    display: block; font-family: var(--font-display); font-size: 1.6rem;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cs-metric span { font-size: 0.74rem; color: var(--text-faint); }
.cs-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 36px; }
.cs-footer {
    border-top: 1px solid var(--stroke); padding: 28px 0; text-align: center;
    color: var(--text-faint); font-size: 0.78rem; position: relative; z-index: 3;
}
.cs-footer a { color: var(--violet-soft); }

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
    .reveal-up, .reveal-line { opacity: 1 !important; transform: none !important; }
}

/* ── Touch devices: bigger targets, lighter effects ────── */
@media (hover: none), (pointer: coarse) {
    .p-link, .eco-legend button, .ai-suggest button, .theme-toggle,
    .footer-social a, .mobile-menu-footer a { min-height: 44px; }
    .p-link { display: inline-flex; align-items: center; }
    .nav-link { padding: 10px 14px; }
    .chip { padding: 9px 15px; }
    .c-item { padding: 16px 18px; }
}

/* ── Tablet & below: performance + layout ──────────────── */
@media (max-width: 960px) {
    .noise-overlay { animation: none; }
    .aurora-blob { filter: blur(70px); }
    .hero { padding-top: calc(var(--nav-h) + 24px); }
    .hero-inner { gap: 44px; }
    .hero-visual { margin-top: 34px; }
    .portrait-shell { width: min(260px, 62vw); }
    .float-chip { font-size: 0.68rem; padding: 7px 12px; }
    .chip-1 { top: -4%; left: 0; }
    .chip-2 { bottom: 14%; right: 0; }
    .chip-3 { bottom: -6%; left: 6%; }
    .orbit-ring.r2 { display: none; }
    .section-head { margin-bottom: 42px; }
    .gh-chart-wrap { height: 230px; }
}

/* ── Small screens ─────────────────────────────────────── */
@media (max-width: 640px) {
    .section { padding: 80px 0; }
    .container, .container-wide { width: 92%; }
    .hero-title { font-size: clamp(2.5rem, 12.5vw, 3.6rem); }
    .hero-role { font-size: clamp(1rem, 4.6vw, 1.25rem); }
    .hero-bio { font-size: 0.95rem; }
    .hero-status { font-size: 0.72rem; padding: 7px 13px; }
    .hero-cta { gap: 12px; margin-bottom: 36px; }
    .hero-cta .btn { flex: 1 1 auto; justify-content: center; padding: 13px 18px; font-size: 0.86rem; }
    .hero-metrics { gap: 14px 22px; row-gap: 14px; }
    .metric .counter, .metric em { font-size: 1.55rem; }
    .metric small { font-size: 0.7rem; margin-left: 7px; }
    .metric-sep { display: none; }
    .marquee { padding: 18px 0; }
    .marquee-track span { font-size: 0.92rem; }
    .section-title { font-size: clamp(1.75rem, 8vw, 2.3rem); }
    .section-sub { font-size: 0.92rem; }
    .about-lede { font-size: 1.05rem; }
    .about-main { padding: 26px 22px; }
    .cell { padding: 22px 18px; }
    .timeline { padding-left: 30px; gap: 22px; }
    .timeline-item { padding: 22px 20px; }
    .timeline-node { left: -25px; top: 28px; width: 12px; height: 12px; }
    .timeline-rail { left: 6px; }
    .timeline-item h3 { font-size: 1.1rem; }
    .cluster { padding: 22px 18px; }
    .gh-stat { padding: 20px 18px; }
    .gh-num { font-size: 1.7rem; }
    .gh-chart-card, .gh-repos-card { padding: 22px 18px; }
    .p-links { flex-wrap: wrap; }
    .eco-legend button { padding: 8px 12px; font-size: 0.7rem; }
    .cred { padding: 16px; }
    .honor { padding: 22px 20px; }
    .contact-form { padding: 24px 18px; gap: 20px; }
    .c-item { gap: 14px; }
    .c-item span { font-size: 0.86rem; }
    .footer-inner { flex-direction: column; text-align: center; }
    .footer-brand p { margin-inline: auto; }
    .scroll-orb { right: 16px; bottom: 94px; width: 44px; height: 44px; }
    .scroll-orb svg { width: 44px; height: 44px; }
    .ai-fab { right: 16px; bottom: 22px; width: 54px; height: 54px; }
    .ai-panel { right: 10px; bottom: 86px; height: min(500px, 66vh); }
    .toast { width: max-content; max-width: 92vw; font-size: 0.8rem; }
}

/* ── Very small screens (≤ 400px) ──────────────────────── */
@media (max-width: 400px) {
    .nav-shell { padding: 8px 12px; }
    .nav-actions { gap: 7px; }
    .btn-nav span { display: none; }
    .btn-nav { padding: 11px 13px; }
    .theme-toggle, .menu-toggle { width: 40px; height: 40px; }
    .brand-mark { font-size: 1.25rem; }
    .hero-title { font-size: clamp(2.2rem, 13vw, 2.9rem); }
    .portrait-shell { width: min(220px, 66vw); }
    .float-chip { font-size: 0.62rem; padding: 6px 10px; }
    .hero-metrics { gap: 12px 18px; }
    .metric .counter, .metric em { font-size: 1.35rem; }
    .gh-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .skills-stage { height: 360px; }
    .ai-suggest { padding: 0 14px 10px; }
    .ai-input { padding: 12px; }
}
