/* =========================================================
   Ayan Panda — Portfolio styles
   Dark by default, light via prefers-color-scheme or toggle
   ========================================================= */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #818cf8;
    --primary-strong: #6366f1;
    --secondary: #22d3ee;
    --accent: #f472b6;
    --success: #34d399;
    --warning: #fbbf24;

    --bg: #0b0d17;
    --bg-elev: #12152a;
    --bg-card: rgba(255, 255, 255, 0.035);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #e8eaf6;
    --text-muted: #a1a6c4;
    --text-faint: #6b7095;
    --grid-line: rgba(255, 255, 255, 0.035);
    --glow-1: rgba(99, 102, 241, 0.35);
    --glow-2: rgba(34, 211, 238, 0.22);
    --nav-bg: rgba(11, 13, 23, 0.72);
    --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.6);

    --c0: rgba(255, 255, 255, 0.06);
    --c1: #1e3a5f;
    --c2: #3b5bdb;
    --c3: #6366f1;
    --c4: #a5b4fc;

    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --radius: 16px;
    --radius-sm: 10px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --gradient: linear-gradient(135deg, #818cf8 0%, #22d3ee 50%, #f472b6 100%);
    color-scheme: dark;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --primary: #4f46e5; --primary-strong: #4338ca; --secondary: #0891b2; --accent: #db2777;
        --success: #059669; --warning: #d97706;
        --bg: #f7f8fc; --bg-elev: #ffffff; --bg-card: rgba(255, 255, 255, 0.75); --bg-card-hover: #ffffff;
        --border: rgba(15, 23, 42, 0.08); --border-strong: rgba(15, 23, 42, 0.16);
        --text: #0f172a; --text-muted: #475569; --text-faint: #94a3b8;
        --grid-line: rgba(15, 23, 42, 0.04);
        --glow-1: rgba(99, 102, 241, 0.18); --glow-2: rgba(34, 211, 238, 0.14);
        --nav-bg: rgba(247, 248, 252, 0.75);
        --shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
        --c0: #ebedf0; --c1: #c7d2fe; --c2: #818cf8; --c3: #6366f1; --c4: #3730a3;
        --gradient: linear-gradient(135deg, #4f46e5 0%, #0891b2 55%, #db2777 100%);
        color-scheme: light;
    }
}
:root[data-theme="light"] {
    --primary: #4f46e5; --primary-strong: #4338ca; --secondary: #0891b2; --accent: #db2777;
    --success: #059669; --warning: #d97706;
    --bg: #f7f8fc; --bg-elev: #ffffff; --bg-card: rgba(255, 255, 255, 0.75); --bg-card-hover: #ffffff;
    --border: rgba(15, 23, 42, 0.08); --border-strong: rgba(15, 23, 42, 0.16);
    --text: #0f172a; --text-muted: #475569; --text-faint: #94a3b8;
    --grid-line: rgba(15, 23, 42, 0.04);
    --glow-1: rgba(99, 102, 241, 0.18); --glow-2: rgba(34, 211, 238, 0.14);
    --nav-bg: rgba(247, 248, 252, 0.75);
    --shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
    --c0: #ebedf0; --c1: #c7d2fe; --c2: #818cf8; --c3: #6366f1; --c4: #3730a3;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #0891b2 55%, #db2777 100%);
    color-scheme: light;
}

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}
body.menu-open { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--secondary); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--primary-strong); color: #fff; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; color: var(--text); }
p { color: var(--text-muted); }
strong { color: var(--text); font-weight: 600; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); }

/* ---------- Background decoration ---------- */
.bg-grid {
    position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
}
.bg-glow {
    position: fixed; z-index: -1; pointer-events: none; border-radius: 50%;
    filter: blur(90px); width: 520px; height: 520px;
    animation: float 18s ease-in-out infinite;
}
.bg-glow-1 { background: var(--glow-1); top: -160px; left: -120px; }
.bg-glow-2 { background: var(--glow-2); top: 30%; right: -200px; animation-delay: -9s; }
@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(60px, 80px) scale(1.1); }
}

.scroll-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1001;
    background: var(--gradient); transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- Layout ---------- */
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.section { padding: 110px 0; position: relative; }
.projects { padding: 110px 0; } /* used by blog pages */

.section-head { margin-bottom: 56px; }
.eyebrow {
    display: inline-block; font-family: var(--mono); font-size: 0.8rem; font-weight: 500;
    color: var(--secondary); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px;
}
.section-title {
    font-size: clamp(1.9rem, 4vw, 2.75rem); font-weight: 700; max-width: 760px;
}
.gradient-text {
    background: var(--gradient); background-size: 200% 200%;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: shimmer 8s ease infinite;
}
@keyframes shimmer { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 13px 24px; border-radius: 12px; font-weight: 600; font-size: 0.95rem;
    text-decoration: none !important; transition: transform 0.25s var(--ease), box-shadow 0.25s, background 0.25s, border-color 0.25s;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
    color: #fff; background: linear-gradient(135deg, #6366f1, #06b6d4);
    box-shadow: 0 8px 24px -8px rgba(99, 102, 241, 0.7);
}
.btn-primary:hover { box-shadow: 0 14px 34px -8px rgba(99, 102, 241, 0.85); }
.btn-secondary, .btn-outline {
    color: var(--text); background: var(--bg-card); border: 1px solid var(--border-strong);
    backdrop-filter: blur(8px);
}
.btn-secondary:hover, .btn-outline:hover { border-color: var(--primary); background: var(--bg-card-hover); }

/* ---------- Badges & tags ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 600;
    padding: 4px 10px; border-radius: 999px; white-space: nowrap; vertical-align: middle;
    color: var(--text-muted); background: var(--bg-card); border: 1px solid var(--border);
    font-family: var(--mono); letter-spacing: 0.02em;
}
.badge-live { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); background: color-mix(in srgb, var(--success) 10%, transparent); }
.badge-done { color: var(--secondary); border-color: color-mix(in srgb, var(--secondary) 35%, transparent); }
.badge-accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span {
    font-size: 0.75rem; font-family: var(--mono); padding: 4px 10px; border-radius: 8px;
    color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 28px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    transition: border-color 0.3s, background 0.3s, transform 0.3s var(--ease);
}
.card:hover { border-color: var(--border-strong); }
.card h3 { font-size: 1.15rem; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.card h3 i { color: var(--primary); }
.card ul { padding-left: 18px; margin: 12px 0 16px; }
.card li { color: var(--text-muted); margin-bottom: 6px; }
.card li::marker { color: var(--primary); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }

/* ---------- Navigation ---------- */
.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    transition: background 0.3s, border-color 0.3s, padding 0.3s;
    border-bottom: 1px solid transparent; padding: 8px 0;
}
.nav.scrolled {
    background: var(--nav-bg); border-bottom-color: var(--border); padding: 0;
    backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%);
}
.nav-container {
    max-width: 1160px; margin: 0 auto; padding: 0 24px; height: 68px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none !important; }
.logo-mark {
    display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
    background: var(--gradient); color: #fff; font-size: 0.85rem; font-weight: 800; letter-spacing: 0;
}
.nav-menu { display: flex; align-items: center; gap: 4px; }
.nav-link {
    position: relative; padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; font-weight: 500;
    color: var(--text-muted); text-decoration: none !important; transition: color 0.2s, background 0.2s;
}
.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
    content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
    border-radius: 2px; background: var(--gradient);
}
.nav-cta { color: var(--text); border: 1px solid var(--border-strong); margin-left: 8px; }
.nav-cta.active::after { display: none; }
.nav-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
    width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted);
    transition: color 0.2s, border-color 0.2s, transform 0.3s var(--ease);
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); transform: rotate(15deg); }
.theme-toggle .fa-sun { display: none; }
:root[data-theme="light"] .theme-toggle .fa-sun { display: block; }
:root[data-theme="light"] .theme-toggle .fa-moon { display: none; }
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .theme-toggle .fa-sun { display: block; }
    :root:not([data-theme="dark"]) .theme-toggle .fa-moon { display: none; }
}

.nav-toggle { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.nav-toggle .bar { width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }
.nav-toggle.active .bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.active .bar:nth-child(2) { opacity: 0; }
.nav-toggle.active .bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { min-height: min(100vh, 980px); display: flex; flex-direction: column; justify-content: center; padding: 120px 0 60px; }
.hero-container {
    max-width: 1160px; margin: 0 auto; padding: 0 24px; width: 100%;
    display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 64px; align-items: center;
}
.status-pill {
    display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 999px;
    font-size: 0.82rem; font-weight: 500; color: var(--text-muted);
    background: var(--bg-card); border: 1px solid var(--border); margin-bottom: 28px;
    animation: rise 0.8s var(--ease) both;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--success); position: relative; }
.pulse::after {
    content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--success);
    animation: ping 2s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(0.5); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }

.hero-title {
    font-size: clamp(2.6rem, 6.5vw, 4.6rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05;
    margin-bottom: 18px; animation: rise 0.8s 0.1s var(--ease) both;
}
.hero-subtitle {
    font-family: var(--mono); font-size: clamp(1.05rem, 2.4vw, 1.35rem); color: var(--secondary);
    margin-bottom: 22px; min-height: 1.6em; animation: rise 0.8s 0.2s var(--ease) both;
}
.caret { animation: blink 1s steps(1) infinite; margin-left: 2px; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.hero-description { font-size: 1.1rem; max-width: 560px; margin-bottom: 34px; animation: rise 0.8s 0.3s var(--ease) both; }
.hero-buttons { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 34px; animation: rise 0.8s 0.4s var(--ease) both; }
.hero-social { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; animation: rise 0.8s 0.5s var(--ease) both; }
.hero-social a {
    width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem;
    color: var(--text-muted); background: var(--bg-card); border: 1px solid var(--border);
    transition: color 0.2s, border-color 0.2s, transform 0.25s var(--ease);
}
.hero-social a:hover { color: var(--text); border-color: var(--primary); transform: translateY(-3px); text-decoration: none; }
.hero-location { font-size: 0.85rem; color: var(--text-faint); margin-left: 6px; }
.hero-location i { margin-right: 4px; }

@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.hero-content, .hero-visual { min-width: 0; }
.hero-visual { position: relative; display: flex; justify-content: center; animation: rise 1s 0.3s var(--ease) both; }
.avatar-ring {
    position: relative; width: min(300px, 70vw); aspect-ratio: 1; border-radius: 50%; padding: 5px;
    background: conic-gradient(from 0deg, #6366f1, #22d3ee, #f472b6, #6366f1);
    animation: spin 10s linear infinite;
    box-shadow: 0 0 80px -10px var(--glow-1);
}
.avatar-ring .avatar-img {
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 6px solid var(--bg);
    animation: spin 10s linear infinite reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }

.terminal {
    position: absolute; bottom: -40px; left: -30px; width: 290px;
    background: rgba(13, 16, 32, 0.92); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 12px;
    box-shadow: var(--shadow); overflow: hidden; backdrop-filter: blur(10px);
    animation: bob 6s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.terminal-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.terminal-bar span:nth-child(2) { background: #febc2e; }
.terminal-bar span:nth-child(3) { background: #28c840; }
.terminal-bar em { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: 0.7rem; color: #6b7095; }
.terminal-body { margin: 0; padding: 14px; font-family: var(--mono); font-size: 0.74rem; line-height: 1.7; color: #c9cdf0; white-space: pre; overflow: hidden; }
.t-prompt { color: #34d399; }
.t-out { color: #a1a6c4; }
.t-key { color: #818cf8; }

.hero-stats {
    max-width: 1160px; margin: 90px auto 0; padding: 0 24px; width: 100%;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.hero-stat {
    padding: 22px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 4px; backdrop-filter: blur(10px);
    animation: rise 0.8s 0.7s var(--ease) both;
}
.hero-stat strong { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; background: var(--gradient); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-stat span { font-size: 0.85rem; color: var(--text-muted); }
.hero-stat strong span { font-size: inherit; color: inherit; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; }
.about-text p { font-size: 1.05rem; margin-bottom: 18px; }
.about-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-card {
    padding: 22px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border);
    transition: transform 0.3s var(--ease), border-color 0.3s;
}
.mini-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--primary) 50%, transparent); }
.mini-card i {
    width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 14px;
    color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); font-size: 1.05rem;
}
.mini-card h3 { font-size: 1rem; margin-bottom: 6px; }
.mini-card p { font-size: 0.85rem; line-height: 1.5; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 36px; }
.timeline::before {
    content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px;
    background: linear-gradient(var(--primary), var(--secondary), transparent);
}
.timeline-item { position: relative; margin-bottom: 28px; }
.timeline-dot {
    position: absolute; left: -36px; top: 30px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--bg); border: 3px solid var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}
.timeline-item:first-child .timeline-dot { border-color: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 20%, transparent); }
.org { font-size: 0.92rem; color: var(--text-muted); }
.org i { color: var(--text-faint); margin-right: 6px; }
.subproject {
    margin-top: 18px; padding: 20px; border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--primary) 4%, transparent); border: 1px solid var(--border);
}
.subproject-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.subproject h4 { font-size: 1rem; display: flex; align-items: center; gap: 10px; }
.subproject h4 i { color: var(--secondary); }
.subproject ul { margin-bottom: 14px; }

/* ---------- Open source ---------- */
.feature-card {
    display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; padding: 40px; border-radius: 22px;
    position: relative; overflow: hidden;
    background: linear-gradient(var(--bg-elev), var(--bg-elev)) padding-box, var(--gradient) border-box;
    border: 1px solid transparent; box-shadow: var(--shadow);
}
.feature-card::before {
    content: ''; position: absolute; width: 400px; height: 400px; right: -120px; top: -120px; border-radius: 50%;
    background: var(--glow-1); filter: blur(80px); pointer-events: none;
}
.feature-left, .feature-right { position: relative; }
.feature-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.feature-card h3 { font-size: 1.6rem; margin-bottom: 12px; }
.check-list { list-style: none; margin: 18px 0 26px; }
.check-list li { position: relative; padding-left: 28px; margin-bottom: 12px; color: var(--text-muted); }
.check-list li::before {
    content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; left: 0; top: 2px;
    font-size: 0.75rem; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
    color: var(--success); background: color-mix(in srgb, var(--success) 15%, transparent);
}
.feature-links { display: flex; flex-wrap: wrap; gap: 12px; }
.flow { display: flex; flex-direction: column; align-items: stretch; gap: 0; height: 100%; justify-content: center; }
.flow-step {
    display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 12px;
    background: var(--bg-card); border: 1px solid var(--border); font-weight: 500; font-size: 0.92rem;
}
.flow-step i { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #6366f1, #06b6d4); }
.flow-arrow { width: 2px; height: 22px; margin-left: 34px; background: linear-gradient(var(--primary), var(--secondary)); position: relative; }
.flow-arrow::after { content: ''; position: absolute; bottom: -2px; left: -4px; border: 5px solid transparent; border-top-color: var(--secondary); }

.achievement-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.achievement {
    display: flex; gap: 16px; padding: 22px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
}
.achievement > i { font-size: 1.3rem; color: var(--warning); margin-top: 3px; }
.achievement h4 { font-size: 0.98rem; margin-bottom: 6px; }
.achievement p { font-size: 0.85rem; line-height: 1.55; }

/* ---------- Projects ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip {
    padding: 8px 16px; border-radius: 999px; font-size: 0.85rem; font-weight: 500; color: var(--text-muted);
    background: var(--bg-card); border: 1px solid var(--border); transition: all 0.2s;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { color: #fff; background: linear-gradient(135deg, #6366f1, #06b6d4); border-color: transparent; }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.project-card {
    --mx: 50%; --my: 50%;
    position: relative; display: flex; flex-direction: column; gap: 14px; padding: 26px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border); overflow: hidden;
    transition: transform 0.35s var(--ease), border-color 0.3s, box-shadow 0.3s;
}
.project-card::before {
    content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s;
    background: radial-gradient(400px circle at var(--mx) var(--my), color-mix(in srgb, var(--primary) 14%, transparent), transparent 45%);
}
.project-card:hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--primary) 45%, transparent); box-shadow: var(--shadow); }
.project-card:hover::before { opacity: 1; }
.project-card.hidden { display: none; }
.project-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.project-icon {
    width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem;
    color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}
.project-links { display: flex; gap: 6px; position: relative; z-index: 1; }
.project-links a {
    width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
    color: var(--text-muted); border: 1px solid var(--border); transition: all 0.2s;
}
.project-links a:hover { color: var(--text); border-color: var(--primary); text-decoration: none; }
.project-title { font-size: 1.18rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.project-description { font-size: 0.92rem; line-height: 1.6; flex: 1; margin: 0; }
.project-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-faint); padding-top: 12px; border-top: 1px solid var(--border); font-family: var(--mono); }
.project-meta i { margin-right: 4px; }
.project-stars { color: var(--warning); }
.project-tech { font-size: 0.8rem; color: var(--text-faint); font-family: var(--mono); } /* blog list date */

/* ---------- GitHub ---------- */
.gh-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.gh-stat {
    padding: 22px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border);
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
}
.gh-stat i { grid-row: span 2; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; color: var(--secondary); background: color-mix(in srgb, var(--secondary) 12%, transparent); }
.gh-stat strong { font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.gh-stat span { font-size: 0.8rem; color: var(--text-muted); }

.contrib-card { margin-bottom: 20px; }
.contrib-card .card-top { align-items: center; }
.link-muted { font-size: 0.85rem; color: var(--text-muted); font-family: var(--mono); }
.contrib-scroll { overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.contrib-graph {
    display: grid; grid-template-rows: repeat(7, 12px); grid-auto-flow: column; grid-auto-columns: 12px; gap: 3px;
    width: max-content; min-height: 102px;
}
.contrib-graph i { border-radius: 3px; background: var(--c0); transition: transform 0.15s; }
.contrib-graph i:hover { transform: scale(1.35); outline: 1px solid var(--text-faint); }
.contrib-graph i.empty { background: transparent; }
.contrib-graph i.l1, .contrib-legend .l1 { background: var(--c1); }
.contrib-graph i.l2, .contrib-legend .l2 { background: var(--c2); }
.contrib-graph i.l3, .contrib-legend .l3 { background: var(--c3); }
.contrib-graph i.l4, .contrib-legend .l4 { background: var(--c4); }
.contrib-loading { grid-row: 1 / -1; color: var(--text-faint); font-size: 0.9rem; padding: 12px 0; white-space: nowrap; }
.contrib-fallback { max-width: none; height: 110px; }
.contrib-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 12px; font-size: 0.75rem; color: var(--text-faint); }
.contrib-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.contrib-legend .l0 { background: var(--c0); }
.contrib-legend span { margin: 0 4px; }

.gh-split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.gh-split .card > h3 { margin-bottom: 18px; }
.recent-repos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recent-repo {
    display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 12px;
    border: 1px solid var(--border); color: var(--text); text-decoration: none !important; transition: all 0.2s;
}
.recent-repo:hover { border-color: var(--primary); background: var(--bg-card-hover); transform: translateY(-2px); }
.recent-repo-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.recent-repo strong { font-size: 0.92rem; font-family: var(--mono); color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-repo .time { font-size: 0.72rem; color: var(--text-faint); white-space: nowrap; }
.recent-repo p { font-size: 0.8rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recent-repo-meta { display: flex; gap: 14px; font-size: 0.75rem; color: var(--text-muted); margin-top: auto; }
.recent-repo-meta .fa-star { color: var(--warning); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

.lang-row { margin-bottom: 14px; }
.lang-label { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 6px; color: var(--text); }
.lang-label span:last-child { color: var(--text-faint); font-family: var(--mono); font-size: 0.75rem; }
.lang-track { height: 8px; border-radius: 99px; background: var(--c0); overflow: hidden; }
.lang-fill { height: 100%; width: var(--w); border-radius: 99px; animation: grow 1.2s var(--ease) both; }
@keyframes grow { from { width: 0; } }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-category {
    padding: 24px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border);
    transition: border-color 0.3s, transform 0.3s var(--ease);
}
.skill-category:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.skill-category h3 { font-size: 1rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.skill-category h3 i { color: var(--primary); }
.skill-items { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-items span {
    font-size: 0.8rem; padding: 6px 12px; border-radius: 8px; color: var(--text-muted);
    background: var(--bg-card); border: 1px solid var(--border); transition: all 0.2s; cursor: default;
}
.skill-items span:hover { color: var(--text); border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }

/* ---------- Contact ---------- */
.contact-card {
    text-align: center; padding: 64px 32px; border-radius: 24px; position: relative; overflow: hidden;
    background: linear-gradient(var(--bg-elev), var(--bg-elev)) padding-box, var(--gradient) border-box;
    border: 1px solid transparent;
}
.contact-card::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(circle at 50% 0%, var(--glow-1), transparent 60%);
}
.contact-card > * { position: relative; }
.contact-card h2 { font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 800; margin-bottom: 14px; }
.contact-card > p { max-width: 560px; margin: 0 auto 32px; font-size: 1.05rem; }
.contact-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.contact-link {
    display: inline-flex; align-items: center; gap: 10px; padding: 13px 20px; border-radius: 12px;
    color: var(--text); background: var(--bg-card); border: 1px solid var(--border-strong);
    font-weight: 500; font-size: 0.92rem; text-decoration: none !important; transition: all 0.25s var(--ease);
}
.contact-link:hover { border-color: var(--primary); transform: translateY(-3px); }
.contact-link i { color: var(--primary); }
.copy-hint { font-style: normal; font-size: 0.7rem; font-family: var(--mono); color: var(--text-faint); border: 1px solid var(--border); padding: 2px 6px; border-radius: 6px; }
.languages { margin-top: 28px; font-size: 0.85rem; color: var(--text-faint); }

/* ---------- Footer ---------- */
.footer { padding: 36px 0; border-top: 1px solid var(--border); text-align: center; }
.footer p { font-size: 0.85rem; color: var(--text-faint); }

.toast {
    position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 120px); z-index: 2000;
    padding: 12px 20px; border-radius: 12px; font-size: 0.9rem; font-weight: 500;
    background: var(--bg-elev); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
    transition: transform 0.4s var(--ease);
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- Blog post content ---------- */
.post-body { max-width: 760px; margin: 0 auto; font-size: 1.08rem; line-height: 1.85; }
.post-body h1 { display: none; } /* title is shown in the header */
.post-body h2 { font-size: 1.5rem; margin: 40px 0 14px; }
.post-body .section-head .section-title { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 0; }
.post-body .section-head { margin-bottom: 32px; }
.post-body p, .post-body li { color: var(--text-muted); margin-bottom: 18px; }
.post-body ul { padding-left: 22px; }
.post-body li::marker { color: var(--primary); }
.back-link { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 20px; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }
.projects-grid .reveal:nth-child(3n+2), .skills-grid .reveal:nth-child(3n+2) { transition-delay: 0.08s; }
.projects-grid .reveal:nth-child(3n), .skills-grid .reveal:nth-child(3n) { transition-delay: 0.16s; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .hero-container { grid-template-columns: 1fr; gap: 80px; text-align: left; }
    .hero-visual { order: -1; justify-content: flex-start; padding-left: 40px; }
    .avatar-ring { width: 200px; }
    .terminal { left: 230px; bottom: 10px; }
    .about-grid, .feature-card, .gh-split { grid-template-columns: 1fr; }
    .skills-grid { grid-template-columns: repeat(2, 1fr); }
    .achievement-row { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .nav-toggle { display: flex; }
    .nav-menu {
        position: fixed; top: 68px; left: 0; right: 0; height: calc(100dvh - 68px);
        flex-direction: column; align-items: stretch; gap: 4px; padding: 20px 24px;
        background: var(--bg); border-top: 1px solid var(--border);
        transform: translateX(100%); transition: transform 0.4s var(--ease); overflow-y: auto;
    }
    .nav-menu.active { transform: none; }
    .nav-link { font-size: 1.1rem; padding: 14px 16px; }
    .nav-link.active::after { left: 0; right: auto; top: 12px; bottom: 12px; width: 3px; height: auto; }
    .nav-cta { margin: 12px 0 0; text-align: center; }
    .nav.scrolled, .nav:has(.nav-menu.active) { background: var(--bg); }
}

@media (max-width: 680px) {
    .section, .projects { padding: 80px 0; }
    .container, .nav-container, .hero-container, .hero-stats { padding-left: 16px; padding-right: 16px; }
    .hero { padding-top: 100px; }
    .hero-visual { padding-left: 0; justify-content: center; }
    .terminal { position: relative; left: auto; bottom: auto; width: 100%; max-width: 320px; margin-top: 24px; animation: none; }
    .hero-visual { flex-direction: column; align-items: center; }
    .hero-container { gap: 40px; }
    .hero-stats { grid-template-columns: repeat(3, 1fr); margin-top: 56px; gap: 10px; }
    .hero-stat { padding: 14px 12px; }
    .hero-stat span { font-size: 0.75rem; }
    .hero-stat strong { font-size: 1.5rem; }
    .hero-buttons .btn { flex: 1; }
    .about-cards, .skills-grid, .recent-repos { grid-template-columns: 1fr; }
    .gh-stats { grid-template-columns: 1fr; gap: 12px; }
    .gh-stat { padding: 16px; column-gap: 10px; }
    .gh-stat i { width: 36px; height: 36px; }
    .gh-stat strong { font-size: 1.3rem; }
    .projects-grid { grid-template-columns: 1fr; }
    .feature-card { padding: 26px 20px; }
    .card { padding: 22px 18px; }
    .timeline { padding-left: 26px; }
    .timeline-dot { left: -26px; }
    .timeline::before { left: 7px; }
    .contact-card { padding: 48px 20px; }
    .contact-link { width: 100%; justify-content: center; }
    .copy-hint { display: none; }
    .logo-text { display: none; }
}

@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 { opacity: 1; transform: none; }
}
