/* Glassmorphism */
.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Preloader */
#preloader {
    transition: opacity 0.5s ease-out;
}

.preloader-svg {
    animation: morphPath 1.5s ease-in-out infinite;
}

@keyframes morphPath {
    0% { d: path("M20 50 C20 30, 80 30, 80 50 S20 70, 20 50"); }
    50% { d: path("M20 50 C20 40, 80 40, 80 50 S20 60, 20 50"); }
    100% { d: path("M20 50 C20 30, 80 30, 80 50 S20 70, 20 50"); }
}

/* Hero Section */
.hero-bg {
    background: linear-gradient(45deg, #00d4b4, #9b59b6, #ff2e63);
    background-size: 200% 200%;
    animation: gradient 10s ease infinite;
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.neural-bg {
    transition: transform 0.1s;
}

.particle-burst {
    opacity: 0;
    animation: burst 2s ease-out forwards;
}

.burst-particle {
    animation: scatter 1.5s ease-out forwards;
}

.burst-particle:nth-child(2) { animation-delay: 0.2s; }
.burst-particle:nth-child(3) { animation-delay: 0.4s; }

@keyframes burst {
    to { opacity: 0.7; }
}

@keyframes scatter {
    to { transform: translate(25px, -25px); opacity: 0; }
}

.photo-frame {
    animation: pulseFrame 3s ease-in-out infinite;
}

@keyframes pulseFrame {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.photo-frame .particle {
    animation: orbit 5s linear infinite;
}

.photo-frame .particle:nth-child(2) { animation-delay: 1s; }
.photo-frame .particle:nth-child(3) { animation-delay: 2s; }

@keyframes orbit {
    0% { transform: rotate(0deg) translateX(30px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(30px) rotate(-360deg); }
}

.animate-neon-ring {
    stroke-dasharray: 10 5;
    animation: neonDash 3s linear infinite;
}

@keyframes neonDash {
    to { stroke-dashoffset: -15; }
}

.matrix-type {
    position: relative;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.matrix-type::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 3px;
    background: #9b59b6;
    transition: width 0.3s ease-out;
}

.matrix-type.typed::after {
    width: 100%;
}

.matrix-type::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff2e63;
    animation: pulseCursor 1s infinite;
}

@keyframes pulseCursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.matrix-type.typed::before {
    display: none;
}

/* Responsive Fonts */
@media (max-width: 640px) {
    .matrix-type[data-text="Mohammad Salehi Najafabadi"] {
        font-size: calc(2.5rem + 2vw);
    }
    .matrix-type[data-text="Senior Full Stack Web Developer"] {
        font-size: calc(1.25rem + 1vw);
    }
}

@media (max-width: 400px) {
    .matrix-type[data-text="Mohammad Salehi Najafabadi"] {
        font-size: calc(2rem + 2vw);
    }
    .matrix-type[data-text="Senior Full Stack Web Developer"] {
        font-size: calc(1rem + 1vw);
    }
}

/* Navigation */
.nav-link.active {
    color: #ff2e63;
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #ff2e63;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { width: 0; }
    to { width: 100%; }
}

#mobile-menu .menu-item {
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
}

#mobile-menu:not(.hidden) .menu-item {
    transform: translateX(0);
    opacity: 1;
    animation: bounceIn 0.5s ease-out;
}

#mobile-menu .menu-item:nth-child(1) { transition-delay: 0.1s; }
#mobile-menu .menu-item:nth-child(2) { transition-delay: 0.2s; }
#mobile-menu .menu-item:nth-child(3) { transition-delay: 0.3s; }
#mobile-menu .menu-item:nth-child(4) { transition-delay: 0.4s; }
#mobile-menu .menu-item:nth-child(5) { transition-delay: 0.5s; }
#mobile-menu .menu-item:nth-child(6) { transition-delay: 0.6s; }
#mobile-menu .menu-item:nth-child(7) { transition-delay: 0.7s; }
#mobile-menu .menu-item:nth-child(8) { transition-delay: 0.8s; }

@keyframes bounceIn {
    0% { transform: translateX(20px); opacity: 0; }
    60% { transform: translateX(-5px); opacity: 1; }
    100% { transform: translateX(0); opacity: 1; }
}

/* Mobile Menu */
#mobile-menu {
    transition: max-height 0.3s ease-out;
}

#mobile-menu:not(.hidden) {
    max-height: 100vh;
    overflow-y: auto;
}

/* Timeline */
.timeline-item {
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.timeline-item.in-view {
    opacity: 1;
    transform: translateY(0);
}

.timeline-connector path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 1s ease-out;
}

.timeline-item.in-view .timeline-connector path {
    stroke-dashoffset: 0;
}

.timeline-marker {
    animation: pulseMarker 2s ease-in-out infinite;
}

@keyframes pulseMarker {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Skills */
.radar-chart .data {
    stroke-dasharray: 565;
    stroke-dashoffset: 565;
    transition: stroke-dashoffset 1.5s ease-out;
}

.radar-chart.in-view .data {
    stroke-dashoffset: 0;
}

/* Portfolio Grid (جدید) */
.portfolio-grid {
    width: 100%;
    max-width: 100%;
}

.portfolio-item {
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    opacity: 0;
    border: 2px solid transparent;
    border-image: linear-gradient(45deg, #00d4b4, #ff2e63) 1;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
}

.portfolio-item.in-view {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-item:hover {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 0 20px rgba(0, 212, 180, 0.8);
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.portfolio-item img {
    transition: transform 0.3s ease-out;
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .portfolio-item img {
        height: 150px;
    }
}

.portfolio-item .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    padding: 8px;
    border-radius: 0 0 8px 8px;
}

.portfolio-item h3 {
    text-shadow: 0 0 5px rgba(0, 212, 180, 0.5);
}

.portfolio-item a {
    text-shadow: 0 0 3px rgba(255, 46, 99, 0.5);
}

@keyframes glow {
    0% { box-shadow: 0 0 15px rgba(0, 212, 180, 0.7); }
    50% { box-shadow: 0 0 25px rgba(255, 46, 99, 0.7); }
    100% { box-shadow: 0 0 15px rgba(0, 212, 180, 0.7); }
}

/* Swiper Styles (کامنت‌شده) */
/*
.swiper-container {
    width: 100%;
    max-width: 100%;
    padding: 0 16px;
    overflow: hidden;
}

.portfolio-item.swiper-slide-active {
    opacity: 1;
    animation: glow 2s ease-in-out infinite;
}

.swiper-button-prev, .swiper-button-next {
    transition: color 0.3s, background 0.3s;
}

.swiper-button-prev:hover, .swiper-button-next:hover {
    color: #ff2e63;
    background: rgba(255, 255, 255, 0.1);
}

.swiper-pagination-bullet {
    background: #00d4b4;
    opacity: 0.5;
}

.swiper-pagination-bullet-active {
    background: #ff2e63;
    opacity: 1;
}
*/

/* Back to Top Button */
#back-to-top {
    animation: pulseArrow 2s ease-in-out infinite;
}

@keyframes pulseArrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Custom Animations */
.animate-fade-in {
    animation: fadeIn 1s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Error Message */
#portfolio-error {
    color: #ff2e63;
    text-align: center;
    margin-top: 16px;
    font-size: 1rem;
}