/* Container Fix (Animation cut na ho) */
.projects-section {
    padding: 80px 5%;
    overflow: hidden; /* Strict overflow control */
    position: relative;
    z-index: 5;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 10px; /* Essential: Gives breathing room to animations */
    perspective: 1000px; /* Adds 3D effect to animations */
}

/* Updated Card Style (Neon Glow & Smooth Scale) */
.project-card {
    background: rgba(30, 41, 59, 0.4);
    border-radius: 15px;
    border: 1px solid rgba(56, 189, 248, 0.1);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy feel */
    backdrop-filter: blur(10px);
    cursor: pointer;
    overflow: visible; /* Corrected: Allows card to go slightly out of bounds on hover */
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-12px) scale(1.05) rotateX(2deg);
    border-color: #38bdf8;
    box-shadow: 0 25px 50px -12px rgba(56, 189, 248, 0.4), 0 0 20px 0px rgba(129, 140, 248, 0.1); /* Cyan & Indigo Glow */
}

/* Image Overlay Setup (No change) */
.project-img {
    position: relative;
    height: 180px;
    border-radius: 15px 15px 0 0;
    overflow: hidden; /* Lock image inside card */
}

.project-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s;
}

.project-card:hover .project-img img {
    transform: scale(1.1) rotate(1deg);
}

.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s ease;
    border-radius: 15px 15px 0 0;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.live-demo-btn {
    padding: 12px 25px;
    background: #38bdf8;
    color: #0f172a;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 700;
    transform: translateY(20px);
    transition: 0.4s ease-out;
    box-shadow: 0 5px 15px rgba(56, 189, 248, 0.3);
}

.project-card:hover .live-demo-btn {
    transform: translateY(0);
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(56, 189, 248, 0); }
    100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* --- Text Styling & Animations --- */
.project-info {
    padding: 25px;
    text-align: center;
    border-radius: 0 0 15px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.animate-text {
    font-family: 'Poppins', sans-serif;
    font-size: 1.4rem;
    color: white;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    transition: 0.4s;
}

.animate-text span {
    background: linear-gradient(90deg, #38bdf8, #818cf8); /* Theme Cyan-Indigo */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    transition: 0.4s;
    display: inline-block;
}

.project-info p {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.5;
    font-weight: 400;
}

/* Hover over text effect */
.project-card:hover .animate-text {
    letter-spacing: 0.5px;
    transform: translateY(-2px);
}

.project-card:hover .animate-text span {
    animation: gradientShift 2s infinite; /* Keyframe color animation */
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Extra/Hidden Cards Setup (Left-Right Logic unchanged) */
.extra-card {
    display: none;
    opacity: 0;
}

@keyframes slideFromLeft {
    from { opacity: 0; transform: translateX(-150px) rotateY(-30deg); }
    to { opacity: 1; transform: translateX(0) rotateY(0deg); }
}

@keyframes slideFromRight {
    from { opacity: 0; transform: translateX(150px) rotateY(30deg); }
    to { opacity: 1; transform: translateX(0) rotateY(0deg); }
}

@keyframes slideFromBottom {
    from { opacity: 0; transform: translateY(80px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-left { display: flex; animation: slideFromLeft 0.8s forwards; }
.animate-right { display: flex; animation: slideFromRight 0.8s forwards; }
.animate-bottom { display: flex; animation: slideFromBottom 0.8s forwards; }

/* Control Button (View More/Less - Unchanged) */
.btn-control { text-align: center; margin-top: 60px; }
.btn-main { background: transparent; color: #38bdf8; border: 2px solid #38bdf8; padding: 12px 35px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.3s; }
.btn-main:hover { background: #38bdf8; color: #0f172a; box-shadow: 0 0 25px rgba(56, 189, 248, 0.5); }

/* Responsive */
@media (max-width: 992px) { .projects-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; } }
@media (max-width: 600px) { .projects-grid { grid-template-columns: 1fr; gap: 15px; } .animate-text { font-size: 1.2rem; } }