/* ============================================
   Bekarys Daniyar — Portfolio
   Modern glassmorphism + gradients + animations
   ============================================ */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
    min-height: 100vh;
    transition: background 0.5s ease, color 0.3s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- Theme Variables ---------- */
:root {
    /* Dark theme (default) */
    --bg: #0a0a15;
    --bg-secondary: #0f0f1f;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --primary: #7c3aed;
    --primary-2: #06b6d4;
    --accent: #ec4899;

    --gradient-1: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --gradient-2: linear-gradient(135deg, #ec4899 0%, #7c3aed 100%);
    --gradient-3: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
    --gradient-text: linear-gradient(120deg, #a78bfa 0%, #22d3ee 50%, #f472b6 100%);

    --blob-1: #7c3aed;
    --blob-2: #06b6d4;
    --blob-3: #ec4899;

    --shadow-lg: 0 24px 60px -20px rgba(124, 58, 237, 0.35);
    --shadow-md: 0 10px 30px -10px rgba(6, 182, 212, 0.25);

    --radius: 18px;
    --radius-sm: 12px;

    --container: 1200px;
    --nav-height: 76px;
}

[data-theme="light"] {
    --bg: #f5f6ff;
    --bg-secondary: #ffffff;
    --surface: rgba(255, 255, 255, 0.55);
    --surface-hover: rgba(255, 255, 255, 0.85);
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.15);
    --text: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;

    --blob-1: #a78bfa;
    --blob-2: #22d3ee;
    --blob-3: #f472b6;

    --shadow-lg: 0 24px 60px -20px rgba(124, 58, 237, 0.25);
    --shadow-md: 0 10px 30px -10px rgba(6, 182, 212, 0.2);
}

/* ---------- Animated Background ---------- */
.bg-decor {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

.bg-decor::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.06) 0, transparent 50%),
        radial-gradient(circle at 80% 30%, rgba(6, 182, 212, 0.05) 0, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(236, 72, 153, 0.05) 0, transparent 50%);
}

.blob {
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.45;
    will-change: transform;
    animation: floatBlob 22s ease-in-out infinite;
}

.blob-1 { background: var(--blob-1); top: -160px; left: -140px; }
.blob-2 { background: var(--blob-2); bottom: -180px; right: -120px; animation-delay: -7s; animation-duration: 26s; }
.blob-3 { background: var(--blob-3); top: 40%; left: 55%; width: 380px; height: 380px; animation-delay: -12s; animation-duration: 30s; opacity: 0.3; }

[data-theme="light"] .blob { opacity: 0.55; }

@keyframes floatBlob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(80px, -40px) scale(1.08); }
    66% { transform: translate(-60px, 60px) scale(0.95); }
}

.grid-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

[data-theme="light"] .grid-overlay {
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
}

/* ---------- Layout ---------- */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

section {
    padding: 100px 0;
    position: relative;
}

@media (max-width: 768px) {
    section { padding: 70px 0; }
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.2rem, 5vw + 1rem, 4.5rem); }
h2 { font-size: clamp(1.8rem, 3vw + 1rem, 2.8rem); }
h3 { font-size: clamp(1.2rem, 1.4vw + 0.6rem, 1.5rem); }

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradientMove 8s ease infinite;
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gradient-1);
    box-shadow: 0 0 12px currentColor;
}

.section-head {
    text-align: center;
    margin-bottom: 60px;
}

.section-head .eyebrow { margin-bottom: 18px; }
.section-head h2 { margin-bottom: 16px; }
.section-head p {
    max-width: 640px;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* ---------- Navigation ---------- */
.nav {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(1140px, calc(100% - 40px));
    height: var(--nav-height);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
    border-radius: 999px;
    background: var(--surface);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border);
    transition: all 0.35s ease;
}

.nav.scrolled {
    background: rgba(10, 10, 21, 0.75);
    box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .nav.scrolled {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 12px 40px -12px rgba(15, 23, 42, 0.12);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--gradient-1);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 8px 20px -6px rgba(124, 58, 237, 0.55);
    position: relative;
    overflow: hidden;
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.4) 50%, transparent 70%);
    animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
    0%, 100% { transform: translateX(-120%); }
    50% { transform: translateX(120%); }
}

.brand-text small {
    display: block;
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.nav-links a {
    display: block;
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 999px;
    transition: all 0.25s ease;
    position: relative;
}

.nav-links a:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.nav-links a.active {
    color: var(--text);
    background: var(--surface-hover);
}

.nav-links a.active::before {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gradient-1);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle,
.menu-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all 0.25s ease;
}

.theme-toggle:hover,
.menu-toggle:hover {
    background: var(--surface-hover);
    transform: translateY(-2px);
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.menu-toggle { display: none; }
.menu-toggle svg { width: 20px; height: 20px; }

@media (max-width: 900px) {
    .nav-links {
        position: fixed;
        top: calc(var(--nav-height) + 30px);
        left: 20px;
        right: 20px;
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        gap: 6px;
        background: rgba(10, 10, 21, 0.9);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border: 1px solid var(--border);
        border-radius: 24px;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-10px);
        transition: all 0.3s ease;
    }
    [data-theme="light"] .nav-links {
        background: rgba(255, 255, 255, 0.92);
    }
    .nav-links.open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
    .nav-links a { padding: 12px 18px; }
    .menu-toggle { display: grid; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 26px;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 999px;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 10px 30px -8px rgba(124, 58, 237, 0.5);
}

.btn-primary::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--gradient-2);
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: -1;
}

.btn-primary:hover::before { opacity: 1; }
.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px -10px rgba(236, 72, 153, 0.55);
}

.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn-ghost:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-3px);
}

/* ---------- Glass card ---------- */
.glass {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.05) inset,
        0 24px 60px -30px rgba(0, 0, 0, 0.5);
    transition: all 0.35s ease;
}

/* ---------- Hero ---------- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: calc(var(--nav-height) + 60px);
    padding-bottom: 60px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 60px;
    align-items: center;
}

@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; gap: 40px; text-align: center; }
    .hero-visual { order: -1; margin: 0 auto; }
}

.hero-content .eyebrow { margin-bottom: 22px; }
.hero-content h1 {
    margin-bottom: 20px;
}
.hero-content h1 .role {
    display: block;
    font-size: 0.5em;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.hero-content .lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 560px;
    margin-bottom: 32px;
}
@media (max-width: 900px) {
    .hero-content .lead { margin-left: auto; margin-right: auto; }
}

.typed-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 1rem;
    color: var(--primary-2);
    margin-bottom: 24px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.typed-line::before {
    content: ">";
    color: var(--accent);
    font-weight: 700;
}
.typed-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--primary-2);
    animation: blink 1s steps(2) infinite;
    vertical-align: middle;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}
@media (max-width: 900px) { .hero-actions { justify-content: center; } }

.hero-stats {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}
@media (max-width: 900px) { .hero-stats { justify-content: center; } }

.stat .num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat .lbl {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Hero visual */
.hero-visual {
    position: relative;
    width: 100%;
    max-width: 460px;
    aspect-ratio: 1;
    justify-self: end;
}

@media (max-width: 900px) { .hero-visual { justify-self: center; max-width: 340px; } }

.avatar-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
        transparent 0%,
        var(--primary) 25%,
        var(--primary-2) 50%,
        var(--accent) 75%,
        transparent 100%);
    animation: rotate 12s linear infinite;
    filter: blur(0.5px);
    opacity: 0.9;
}

.avatar-ring::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: var(--bg);
}

@keyframes rotate { to { transform: rotate(360deg); } }

.avatar-inner {
    position: absolute;
    inset: 22px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, rgba(124, 58, 237, 0.4), transparent 60%),
        radial-gradient(circle at 70% 70%, rgba(6, 182, 212, 0.4), transparent 60%),
        var(--bg-secondary);
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--border-strong);
}

.avatar-inner .initials {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(4rem, 10vw, 7rem);
    font-weight: 700;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.05em;
}

.orbit {
    position: absolute;
    inset: -30px;
    border-radius: 50%;
    border: 1px dashed var(--border-strong);
    animation: rotate 30s linear infinite reverse;
}

.orbit-badge {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-size: 1.4rem;
    box-shadow: var(--shadow-md);
    animation: rotate 30s linear infinite;
}

.orbit-badge.b1 { top: -28px; left: 50%; transform: translateX(-50%); }
.orbit-badge.b2 { top: 50%; right: -28px; transform: translateY(-50%); }
.orbit-badge.b3 { bottom: -28px; left: 50%; transform: translateX(-50%); }
.orbit-badge.b4 { top: 50%; left: -28px; transform: translateY(-50%); }

/* ---------- Feature cards ---------- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.feature-card {
    padding: 32px 28px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--primary-2), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.feature-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.feature-card:hover::before { opacity: 1; }

.feature-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--gradient-1);
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px -6px rgba(124, 58, 237, 0.4);
}

.feature-icon svg { width: 24px; height: 24px; }

.feature-card h3 { margin-bottom: 10px; }
.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ---------- Skills page ---------- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.skill-card {
    padding: 24px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.35s ease;
    position: relative;
    overflow: hidden;
}

.skill-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.skill-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.skill-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
}

.skill-logo.html { background: linear-gradient(135deg, #ff6b35, #f7931e); }
.skill-logo.css { background: linear-gradient(135deg, #264de4, #2965f1); }
.skill-logo.js { background: linear-gradient(135deg, #f0db4f, #e6b800); color: #1a1a1a; }
.skill-logo.git { background: linear-gradient(135deg, #f34f29, #f76d3c); }
.skill-logo.github { background: linear-gradient(135deg, #24292e, #57606a); }
.skill-logo.vscode { background: linear-gradient(135deg, #007acc, #0098ff); }
.skill-logo.responsive { background: linear-gradient(135deg, #10b981, #059669); }
.skill-logo.uiux { background: linear-gradient(135deg, #ec4899, #f472b6); }
.skill-logo.clean { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.skill-logo.anim { background: linear-gradient(135deg, #06b6d4, #22d3ee); }

.skill-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
}

.skill-level {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.skill-bar {
    position: relative;
    height: 8px;
    background: var(--surface-hover);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
}

.skill-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--gradient-1);
    border-radius: 999px;
    width: 0;
    transition: width 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.skill-bar-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skill-percent {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Skill categories */
.skills-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 60px;
}

.cat-card {
    padding: 28px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.35s ease;
}

.cat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
}

.cat-card h3 {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.cat-card h3 svg { width: 22px; height: 22px; color: var(--primary-2); }

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
}

.tag-list li {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    transition: all 0.25s ease;
}

.tag-list li:hover {
    color: var(--text);
    background: var(--gradient-1);
    border-color: transparent;
}

/* ---------- Projects page ---------- */
.projects-filter {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.projects-filter button {
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.projects-filter button:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.projects-filter button.active {
    background: var(--gradient-1);
    color: white;
    border-color: transparent;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.project-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.project-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    display: grid;
    place-items: center;
    isolation: isolate;
}

.project-thumb.g1 { background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%); }
.project-thumb.g2 { background: linear-gradient(135deg, #06b6d4 0%, #10b981 100%); }
.project-thumb.g3 { background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%); }
.project-thumb.g4 { background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%); }
.project-thumb.g5 { background: linear-gradient(135deg, #10b981 0%, #7c3aed 100%); }

.project-thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.25), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.2), transparent 50%);
    z-index: 1;
}

.project-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: 1;
}

.project-thumb .thumb-icon {
    position: relative;
    z-index: 2;
    font-size: 3.5rem;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
    transition: transform 0.5s ease;
}

.project-card:hover .thumb-icon { transform: scale(1.15) rotate(-6deg); }

.project-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.project-body h3 { margin-bottom: 8px; }
.project-body .desc {
    color: var(--text-muted);
    font-size: 0.93rem;
    margin-bottom: 18px;
    flex: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
    list-style: none;
}

.project-tags li {
    padding: 4px 10px;
    font-size: 0.75rem;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.project-links {
    display: flex;
    gap: 10px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.project-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: color 0.25s ease;
}

.project-links a:hover { color: var(--primary-2); }
.project-links svg { width: 16px; height: 16px; }

/* ---------- Journey / Timeline ---------- */
.timeline {
    position: relative;
    max-width: 860px;
    margin: 0 auto;
    padding: 20px 0;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 24px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg,
        transparent 0%,
        var(--border-strong) 8%,
        var(--border-strong) 92%,
        transparent 100%);
}

@media (min-width: 800px) {
    .timeline::before { left: 50%; transform: translateX(-1px); }
}

.tl-item {
    position: relative;
    padding-left: 64px;
    padding-bottom: 40px;
}

@media (min-width: 800px) {
    .tl-item {
        width: 50%;
        padding-left: 0;
        padding-right: 60px;
    }
    .tl-item:nth-child(even) {
        margin-left: 50%;
        padding-right: 0;
        padding-left: 60px;
    }
}

.tl-dot {
    position: absolute;
    left: 16px;
    top: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gradient-1);
    box-shadow: 0 0 0 4px var(--bg), 0 0 20px rgba(124, 58, 237, 0.5);
    z-index: 2;
}

@media (min-width: 800px) {
    .tl-dot { left: auto; right: -9px; }
    .tl-item:nth-child(even) .tl-dot { left: -9px; right: auto; }
}

.tl-card {
    padding: 24px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.35s ease;
}

.tl-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.tl-date {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--primary-2);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: 999px;
    margin-bottom: 10px;
}

.tl-card h3 { margin-bottom: 8px; }
.tl-card p { color: var(--text-muted); font-size: 0.95rem; }

.tl-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    list-style: none;
}

.tl-tags li {
    padding: 3px 9px;
    font-size: 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
}

/* ---------- About page ---------- */
.about-hero {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 60px;
    align-items: center;
}

@media (max-width: 900px) {
    .about-hero { grid-template-columns: 1fr; gap: 40px; }
}

.about-portrait {
    position: relative;
    aspect-ratio: 4 / 5;
    max-width: 400px;
    justify-self: center;
    width: 100%;
}

.portrait-inner {
    position: absolute;
    inset: 0;
    border-radius: 32px;
    background:
        radial-gradient(circle at 30% 20%, rgba(124, 58, 237, 0.5), transparent 55%),
        radial-gradient(circle at 70% 80%, rgba(6, 182, 212, 0.4), transparent 55%),
        var(--bg-secondary);
    border: 1px solid var(--border-strong);
    overflow: hidden;
    display: grid;
    place-items: center;
}

.portrait-inner .big-initials {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(6rem, 15vw, 12rem);
    font-weight: 700;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.06em;
}

.portrait-tag {
    position: absolute;
    padding: 10px 16px;
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
    animation: float 4s ease-in-out infinite;
}

.portrait-tag.pt1 { top: 10%; left: -20px; }
.portrait-tag.pt2 { bottom: 15%; right: -30px; animation-delay: -2s; }
.portrait-tag.pt3 { bottom: -20px; left: 25%; animation-delay: -1s; }

.portrait-tag .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.about-text h1 { margin-bottom: 24px; }
.about-text .lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.about-text p { color: var(--text-muted); margin-bottom: 16px; }
.about-text p strong { color: var(--text); font-weight: 600; }

.about-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 32px;
}

.meta-item {
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.meta-item .k {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}
.meta-item .v {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Values grid */
.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 60px;
}

.value-card {
    padding: 26px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.35s ease;
    text-align: center;
}

.value-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-strong);
}

.value-emoji {
    font-size: 2.4rem;
    margin-bottom: 14px;
    display: inline-block;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.15));
}

.value-card h4 {
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.value-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---------- Contact page ---------- */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 900px) {
    .contact-grid { grid-template-columns: 1fr; }
}

.contact-info {
    padding: 34px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.contact-info h2 { margin-bottom: 12px; font-size: 1.6rem; }
.contact-info .lead { color: var(--text-muted); margin-bottom: 28px; }

.contact-list { list-style: none; }
.contact-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.contact-list li:last-child { border-bottom: none; }

.contact-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--gradient-1);
    color: white;
    flex-shrink: 0;
}
.contact-icon svg { width: 20px; height: 20px; }

.contact-list .k {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.contact-list .v { font-weight: 500; font-size: 0.95rem; word-break: break-word; }

.socials {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.socials a {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all 0.25s ease;
}

.socials a:hover {
    background: var(--gradient-1);
    color: white;
    border-color: transparent;
    transform: translateY(-3px);
}

.socials svg { width: 18px; height: 18px; }

/* Contact form */
.contact-form {
    padding: 34px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.contact-form h2 { margin-bottom: 24px; font-size: 1.5rem; }

.field {
    margin-bottom: 18px;
    position: relative;
}

.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.field input,
.field textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.25s ease;
    resize: vertical;
    font-family: inherit;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.field textarea { min-height: 130px; }

.form-msg {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    display: none;
}

.form-msg.show { display: block; animation: fadeUp 0.35s ease both; }

/* ---------- Footer ---------- */
.footer {
    padding: 60px 0 30px;
    border-top: 1px solid var(--border);
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

@media (max-width: 800px) {
    .footer-grid { grid-template-columns: 1fr; }
}

.footer h4 {
    font-size: 0.95rem;
    margin-bottom: 16px;
    color: var(--text);
}

.footer .footer-brand p {
    color: var(--text-muted);
    margin-top: 16px;
    max-width: 320px;
    font-size: 0.92rem;
}

.footer-links {
    list-style: none;
}
.footer-links li { margin-bottom: 10px; }
.footer-links a {
    color: var(--text-muted);
    font-size: 0.92rem;
    transition: color 0.25s ease;
}
.footer-links a:hover { color: var(--primary-2); }

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ---------- Back to top ---------- */
.to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-1);
    color: white;
    display: grid;
    place-items: center;
    box-shadow: 0 12px 30px -10px rgba(124, 58, 237, 0.6);
    z-index: 90;
    opacity: 0;
    transform: translateY(20px) scale(0.85);
    pointer-events: none;
    transition: all 0.35s ease;
}

.to-top svg { width: 20px; height: 20px; }

.to-top.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.to-top:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 18px 40px -10px rgba(124, 58, 237, 0.7);
}

/* ---------- Reveal animation ---------- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

.reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- CTA banner ---------- */
.cta-banner {
    padding: 60px 40px;
    border-radius: 28px;
    background:
        radial-gradient(circle at 20% 30%, rgba(124, 58, 237, 0.3), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.3), transparent 50%),
        var(--bg-secondary);
    border: 1px solid var(--border-strong);
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-top: 40px;
}

.cta-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

.cta-banner > * { position: relative; z-index: 1; }

.cta-banner h2 { margin-bottom: 12px; }
.cta-banner p {
    color: var(--text-muted);
    margin-bottom: 28px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Utility ---------- */
.mt-0 { margin-top: 0; }
.text-center { text-align: center; }

/* selection */
::selection {
    background: rgba(124, 58, 237, 0.4);
    color: white;
}

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--primary-2));
    border-radius: 999px;
    border: 2px solid var(--bg);
}
