/* Basic Reset & Global Styles */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: 'Poppins', sans-serif; background-color: #121212; color: #e0e0e0; line-height: 1.6; overflow-x: hidden; }
a { text-decoration: none; color: #bb86fc; transition: color 0.3s ease; }
a:hover { color: #a050f0; }
img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 0.8em;
    line-height: 1.2;
    text-align: center;
}
h1 { font-size: 2.8rem; color: #fff; }

h2.section-title {
    font-size: 2.2rem;
    margin-bottom: 30px;
    color: #fff;
    position: relative;
    padding-bottom: 10px;
}
h2.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: #bb86fc;
}
.section-subtitle { text-align: center; font-size: 1.1rem; color: #b0b0b0; margin-bottom: 40px; max-width: 700px; margin-left: auto; margin-right: auto; margin-top: 1.5rem;}
section { padding: 70px 20px; min-height: auto; }

/* Header & Navigation */
header { background-color: rgba(18, 18, 18, 0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #fff; padding: 15px 5%; position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }
nav { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; }
.logo a { font-size: 1.8rem; font-weight: 700; color: #bb86fc; }
.nav-links { list-style: none; display: flex; }
.nav-links li { margin-left: 25px; }
.nav-links a { color: #e0e0e0; font-weight: 400; font-size: 0.95rem; transition: color 0.3s ease, transform 0.3s ease; }
.nav-links a:hover { color: #bb86fc; transform: translateY(-2px); }
.burger { display: none; cursor: pointer; }
.burger div { width: 25px; height: 3px; background-color: #e0e0e0; margin: 5px; transition: all 0.3s ease; }

/* Hero Section */
.hero-section { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 100vh; background: linear-gradient(rgba(18, 18, 18, 0.7), rgba(18, 18, 18, 0.9)), url('https://source.unsplash.com/random/1600x900/?abstract,dark,technology') no-repeat center center/cover; padding-top: 80px; }
.hero-content p { font-size: 1.3rem; margin-bottom: 30px; color: #c0c0c0; max-width: 700px; margin-left: auto; margin-right: auto; text-align: center; }
.cta-button { display: inline-block; background-color: #bb86fc; color: #121212; padding: 12px 30px; border-radius: 50px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; transition: background-color 0.3s ease, transform 0.3s ease; box-shadow: 0 4px 15px rgba(187, 134, 252, 0.3); }
.cta-button:hover { background-color: #a050f0; transform: translateY(-3px) scale(1.05); box-shadow: 0 6px 20px rgba(187, 134, 252, 0.5); }
.animated-text-container { color: #bb86fc; }
#animated-role { /* Text injected by JS */ }
.cursor { display: inline-block; background-color: #bb86fc; width: 3px; margin-left: 2px; animation: blink 1s infinite; vertical-align: text-bottom; height: 0.9em; margin-bottom: 10px; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Portfolio Section */
.portfolio-section { background-color: #1a1a1a; }

.portfolio-section .portfolio-grid, /* Targeting directly within the section */
#portfolio-content-area .portfolio-grid { 
    display: grid;
    grid-template-columns: repeat(1, 1fr); /* Default: 2 columns for mobile */
    gap: 15px; 
    margin-top: 40px;
}

.portfolio-section .portfolio-item,
#portfolio-content-area .portfolio-item { 
    background-color: #121212; 
    border-radius: 8px;
    overflow: hidden; 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease;
    display: flex; 
    justify-content: center;
    align-items: flex-start; 
    /* min-height: auto; /* Let the embed dictate height */
}
.portfolio-section .portfolio-item:hover,
#portfolio-content-area .portfolio-item:hover {
    transform: translateY(-5px); 
    box-shadow: 0 8px 25px rgba(187, 134, 252, 0.15);
}

/* Styles for Instagram Embeds within portfolio items */
.portfolio-section .portfolio-item .instagram-media,
#portfolio-content-area .portfolio-item .instagram-media {
    margin: 0 auto !important; 
    max-width: 100% !important; 
    /* width: auto !important;  Let Instagram script handle initial width, up to max-width */
    min-width: 280px !important; /* Adjusted min-width for smaller embeds */
    border-radius: 0 !important; 
    box-shadow: none !important; 
    display: block !important; 
    background: #FFF !important; 
}


.portfolio-section .portfolio-item-hidden,
#portfolio-content-area .portfolio-item-hidden { 
    display: none !important;
    opacity: 0;
    transform: translateY(20px);
}
.portfolio-section .portfolio-item-visible,
#portfolio-content-area .portfolio-item-visible { 
    display: flex !important; 
    opacity: 1;
    transform: translateY(0);
}
.portfolio-section .show-more-container,
#portfolio-content-area .show-more-container { 
    text-align: center;
    margin-top: 40px;
}
.portfolio-section #showMoreInstaButton,
#portfolio-content-area #showMoreInstaButton { 
    display: inline-block;
}


/* About Section */
.about-section { background-color: #121212; }
.about-container { display: flex; flex-direction: column; align-items: center; gap: 40px; max-width: 900px; margin: 0 auto; }
.about-image { flex-shrink: 0; width: 200px; height: 200px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 20px rgba(187, 134, 252, 0.3); }
.about-image img { width: 100%; height: 100%; object-fit: cover; object-position: top center;}
.about-content { text-align: center; }
.about-content p { font-size: 1.05rem; margin-bottom: 15px; color: #c0c0c0; }

/* Software Section - Scroller */
.software-section { background-color: #1a1a1a; padding-top: 70px; padding-bottom: 70px; }
.software-scroller-container { width: 100%; max-width: 100vw; margin-top: 40px; overflow: hidden; position: relative; -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%); mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%); }
.software-scroller { display: flex; }
.software-list { display: flex; flex-shrink: 0; align-items: center; width: fit-content; animation: scroll-left 35s linear infinite; }
.software-scroller-container:hover .software-list { animation-play-state: paused; }
.software-icon-item { display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 30px; padding: 10px; min-width: 80px; text-align: center; cursor: default; transition: transform 0.3s ease; }
.software-icon-item img { height: 50px; width: 50px; object-fit: contain; filter: grayscale(100%) opacity(0.6); transition: filter 0.3s ease; }
.software-icon-item span { font-size: 0.8rem; color: #999; margin-top: 10px; opacity: 0; transform: translateY(5px); transition: opacity 0.3s ease, color 0.3s ease, transform 0.3s ease; }
.software-icon-item:hover img { filter: grayscale(0%) opacity(1); }
.software-icon-item:hover span { opacity: 1; color: #bb86fc; transform: translateY(0); }
.software-icon-item:hover { transform: scale(1.1); }
@keyframes scroll-left { 0% { transform: translateX(0%); } 100% { transform: translateX(-50%); } }

/* Contact Form Section */
.contact-form-section { background-color: #1a1a1a; padding-bottom: 70px; }
#myForm { max-width: 700px; margin: 30px auto 0; padding: 30px; background-color: #242424; border-radius: 8px; box-shadow: 0 5px 20px rgba(0,0,0,0.2); }
.form-group { margin-bottom: 20px; }
#myForm label { display: block; margin-bottom: 8px; color: #c0c0c0; font-weight: 500; text-align: left; }
#myForm input[type="text"], #myForm textarea { width: 100%; padding: 12px 15px; border-radius: 5px; border: 1px solid #333; background-color: #1e1e1e; color: #e0e0e0; font-size: 1rem; transition: border-color 0.3s ease; }
#myForm input[type="text"]:focus, #myForm textarea:focus { outline: none; border-color: #bb86fc; box-shadow: 0 0 0 2px rgba(187, 134, 252, 0.3); }
#myForm textarea { resize: vertical; min-height: 120px; }
#myForm button[type="submit"] { display: block; width: 100%; padding: 12px 20px; background-color: #bb86fc; color: #121212; border: none; border-radius: 5px; font-size: 1.1rem; font-weight: 600; text-transform: uppercase; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; }
#myForm button[type="submit"]:hover { background-color: #a050f0; transform: translateY(-2px); }
#myForm button[type="submit"]:disabled { background-color: #555; cursor: not-allowed; }

/* Success Popup */
.popup-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 2000; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s 0.3s linear; }
.popup-container.show { opacity: 1; visibility: visible; transition: opacity 0.3s ease, visibility 0s linear; }
.popup-content { background-color: #242424; padding: 30px 40px; border-radius: 8px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.3); position: relative; transform: scale(0.9); transition: transform 0.3s ease; }
.popup-container.show .popup-content { transform: scale(1); }
.popup-icon { font-size: 3rem; color: #28a745; margin-bottom: 15px; display: block; }
.popup-content p { color: #e0e0e0; margin-bottom: 25px; }
.close-popup { position: absolute; top: 10px; right: 15px; font-size: 2rem; color: #777; cursor: pointer; transition: color 0.3s ease; }
.close-popup:hover { color: #e0e0e0; }
.popup-close-btn { background-color: #bb86fc; color: #121212; padding: 10px 25px; border: none; border-radius: 5px; font-weight: 600; cursor: pointer; transition: background-color 0.3s ease; }
.popup-close-btn:hover { background-color: #a050f0; }

/* Connect Section */
.connect-section { text-align: center; background-color: #121212; }
.connect-section p { text-align: center; }
.social-links a { font-size: 2.5rem; margin: 0 20px; color: #bb86fc; transition: color 0.3s ease, transform 0.3s ease; }
.social-links a:hover { color: #fff; transform: scale(1.2); }

/* Footer */
footer { text-align: center; padding: 30px 20px; background-color: #0d0d0d; color: #888; font-size: 0.9rem; }

/* Animation on Scroll */
.animate-on-scroll { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.animate-on-scroll.is-visible { opacity: 1; transform: translateY(0); }

/* Responsive Design */
@media screen and (min-width: 1200px) { /* Large desktops - 5 columns */
    .portfolio-section .portfolio-grid,
    #portfolio-content-area .portfolio-grid { 
        grid-template-columns: repeat(5, 1fr); 
        gap: 20px;
    }
}

@media screen and (max-width: 1199px) and (min-width: 992px) { /* Desktops - 4 columns */
    .portfolio-section .portfolio-grid,
    #portfolio-content-area .portfolio-grid { 
        grid-template-columns: repeat(4, 1fr); 
        gap: 20px;
    }
}

@media screen and (max-width: 991px) and (min-width: 769px) { /* Tablets - 3 columns */
    .portfolio-section .portfolio-grid,
    #portfolio-content-area .portfolio-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 15px;
    }
}


@media screen and (max-width: 768px) { /* Mobile - general (default is 2 columns) */
    html { font-size: 15px; }
    section { padding: 50px 15px; }

    .nav-links { position: fixed; right: 0; top: 0; height: 100vh; background-color: #1c1c1c; display: flex; flex-direction: column; align-items: center; justify-content: space-around; width: 70%; transform: translateX(100%); transition: transform 0.5s ease-in-out; padding-top: 70px; box-shadow: -5px 0 15px rgba(0,0,0,0.2); z-index: 999; }
    .nav-links.nav-active { transform: translateX(0%); }
    .nav-links li { margin-left: 0; opacity: 0; margin-bottom: 10px; }
    .burger { display: block; z-index: 1001; }
    
    h1 { font-size: 1.8rem; }
    .hero-content h1 { font-size: 2.0rem; } 
    .hero-content p { font-size: 0.95rem; }
    h2.section-title { font-size: 1.6rem; }
    .section-subtitle { font-size: 0.9rem; margin-bottom: 25px; }
    
    .social-links a { font-size: 2rem; margin: 0 10px; }
    #myForm { padding: 20px; }
    #myForm label { font-size: 0.9rem; }
    #myForm input[type="text"], #myForm textarea { font-size: 0.9rem; }
    #myForm button[type="submit"] { font-size: 1rem; }

    .popup-content { width: 90%; padding: 25px; }
    .popup-content h2 { font-size: 1.5rem; }
    .popup-content p { font-size: 0.9rem; }
    .about-content p { font-size: 0.95rem; }
}

@media screen and (max-width: 480px) { /* Very small mobile - 2 columns still, but smaller gap */
    html { font-size: 14px; }
    section { padding: 40px 10px; }

    .logo a { font-size: 1.5rem; }
    .hero-content h1 { font-size: 1.8rem; }
    .hero-content p { font-size: 0.85rem; }
    h1 { font-size: 1.6rem; }
    h2.section-title { font-size: 1.4rem; }
    .section-subtitle { font-size: 0.85rem; }
    
    .cta-button { padding: 10px 20px; font-size: 0.9rem; }
    .portfolio-section #showMoreInstaButton, 
    #portfolio-content-area #showMoreInstaButton { 
        padding: 8px 18px; font-size: 0.9rem;
    }
    
    .portfolio-section .portfolio-grid,
    #portfolio-content-area .portfolio-grid { 
        gap: 10px; /* Even smaller gap for very small screens */
    }

    .software-icon-item { margin: 0 15px; }
    .software-icon-item img { height: 40px; width: 40px; }
    .software-icon-item span { font-size: 0.75rem;}
    
    .contact-form-section { padding-bottom: 60px; }
    #myForm input[type="text"], #myForm textarea { padding: 10px 12px; font-size: 0.85rem;}
    #myForm button[type="submit"] { padding: 10px 15px; font-size: 0.9rem;}

    .social-links a { font-size: 1.8rem; margin: 0 8px; }
    footer { font-size: 0.8rem; }
    .popup-content { padding: 20px; }
    .popup-content h2 { font-size: 1.3rem; }
    .popup-content p { font-size: 0.85rem; }
    .popup-close-btn { padding: 8px 20px; font-size: 0.9rem; }
}

@keyframes navLinkFade { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }
.toggle .line1 { transform: rotate(-45deg) translate(-5px, 6px); }
.toggle .line2 { opacity: 0; }
.toggle .line3 { transform: rotate(45deg) translate(-5px, -6px); }
a, button, .burger { -webkit-tap-highlight-color: rgba(0,0,0,0); touch-action: manipulation; }
