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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: #020617;
    color: #ecfdf5;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #020617;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #059669, #10b981);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #10b981, #34d399);
}

/* ===== Glassmorphism Utilities ===== */
.glass-card {
    background: rgba(6, 78, 59, 0.15);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(16, 185, 129, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-nav {
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(16, 185, 129, 0.15);
}

.glass-sidebar {
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

/* ===== Navigation ===== */
.nav-link {
    position: relative;
    overflow: hidden;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(to left, #10b981, #34d399);
    transition: all 0.3s ease;
    transform: translateX(50%);
}
.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}
.nav-link.active {
    color: #34d399;
    background: rgba(16, 185, 129, 0.1);
}

/* ===== Typing Cursor ===== */
.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: linear-gradient(to bottom, #34d399, #10b981);
    margin-right: 4px;
    animation: blink 1s infinite;
    vertical-align: middle;
    border-radius: 2px;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ===== Scroll Reveal Animation ===== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Skill Bar Animation ===== */
.skill-bar {
    width: 0;
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.skill-bar.animate {
    width: var(--target-width);
}

/* ===== Portfolio Card Hover ===== */
.portfolio-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.portfolio-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.15);
}

/* ===== Space Canvas ===== */
#spaceCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ===== Sidebar Animation ===== */
#sidebar {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
#sidebar.open {
    transform: translateX(0);
}

/* ===== Mobile Menu ===== */
#mobileMenu {
    transition: all 0.3s ease;
}

/* ===== Responsive Typography ===== */
@media (max-width: 640px) {
    .text-5xl { font-size: 2.5rem; }
    .text-4xl { font-size: 2rem; }
    .text-3xl { font-size: 1.5rem; }
}

/* ===== Selection Color ===== */
::selection {
    background: rgba(16, 185, 129, 0.4);
    color: #ffffff;
}

/* ===== Smooth Image/Icon Rendering ===== */
svg {
    shape-rendering: geometricPrecision;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
