/* ===========================================
   CSS Organization Structure
   1. Variables & Reset
   2. Base Elements
   3. Layout & Containers
   4. Navigation
   5. Hero Section
   6. Projects Section
   7. About Section
   8. Contact Section
   9. Footer
   10. Modal Components
   11. Animation Keyframes
   12. Media Queries
   =========================================== */

/* 1. Variables & Reset Styles */
:root {
    --primary-gradient: linear-gradient(45deg, #ff7e5f, #feb47b);
    --bg-dark: #0a0a0a;
    --text-light: #ffffff;
    --text-muted: #cccccc;
    --card-bg: rgba(255, 255, 255, 0.05);
    --header-bg: rgba(0, 0, 0, 0.5);
    --animation-timing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 2. Base Elements */
body {
    overflow-x: hidden;
    background-color: var(--bg-dark);
    color: var(--text-light);
}

a {
    text-decoration: none;
    color: var(--text-light);
    transition: color 0.3s;
}

a:hover {
    color: #feb47b;
}

button {
    cursor: pointer;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    position: relative;
    display: inline-block;
}

h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -10px;
    width: 50px;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s var(--animation-timing);
}

h2.in-view::after {
    transform: scaleX(1);
}

/* 3. Layout & Containers */
section {
    padding: 5rem 10%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

section:not(.hero) {
    background-color: var(--bg-dark);
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.no-scroll {
    overflow: hidden;
}

/* 4. Navigation */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    background-color: var(--header-bg);
    backdrop-filter: blur(5px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    opacity: 0;
    transform: translateY(-20px);
    animation: slideDown 0.8s var(--animation-timing) forwards 0.2s;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    font-weight: 500;
    display: inline-block;
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    bottom: -5px;
    left: 0;
    background: var(--primary-gradient);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}

nav a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* Hamburger Menu */
.menu-toggle {
    display: none;
    cursor: pointer;
    z-index: 999;
    margin-left: auto;
}

.menu-toggle .bar {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px auto;
    transition: all 0.3s ease-in-out;
    display: block;
}

/* 5. Hero Section */
.hero {
    height: 100vh;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 2rem;
}

.hero h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    width: 100%;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeIn 0.8s var(--animation-timing) forwards 0.6s;
}

.hero p {
    font-size: 1.5rem;
    max-width: 600px;
    margin-bottom: 2rem;
    color: var(--text-muted);
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeIn 0.8s var(--animation-timing) forwards 0.9s;
}

.cta-button {
    padding: 0.8rem 2rem;
    background: var(--primary-gradient);
    border: none;
    border-radius: 5px;
    color: var(--text-light);
    font-weight: bold;
    font-size: 1rem;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeIn 0.8s var(--animation-timing) forwards 1.2s;
    display: inline-block;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255, 126, 95, 0.3);
}

.cta-button::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.6s var(--animation-timing);
    z-index: 1;
}

.cta-button:hover::after {
    left: 100%;
}

.cta-button span {
    position: relative;
    z-index: 2;
}

/* 6. Projects Section */
.projects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    opacity: 0; /* Start hidden */
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.project-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s, opacity 0.4s ease-out, box-shadow 0.3s;
    opacity: 0;
    transform: translateY(30px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(255, 126, 95, 0.2);
}

.project-image {
    width: 100%;
    height: 200px;
    background-color: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    color: #444;
    transition: transform 0.5s var(--animation-timing);
}

.project-card:hover .project-image {
    transform: scale(1.05);
}

.project-info {
    padding: 1.5rem;
}

.project-info h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.project-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.project-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-gradient);
    border-radius: 5px;
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: bold;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.project-link::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.4s var(--animation-timing);
    z-index: 1;
}

.project-link:hover::after {
    left: 100%;
}

.project-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 126, 95, 0.3);
}

.extra-projects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* 7. About Section */
.about-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 3rem;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--animation-timing), transform 0.8s var(--animation-timing);
    flex-wrap: wrap;
}

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

.about-content {
    flex: 1;
    min-width: 300px;
    max-width: 650px;
}

.about-text {
    width: 100%;
    margin-bottom: 2rem;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--animation-timing), transform 0.6s var(--animation-timing);
}

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

.about-text:nth-child(2) {
    transition-delay: 0.2s;
}

.about-text:nth-child(3) {
    transition-delay: 0.4s;
}

.about-text:last-child {
    margin-bottom: 0;
}

.about-text:last-of-type {
    margin-bottom: 2rem;
}

#about h3 {
    font-size: 2rem;
    margin-top: 4rem;
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--animation-timing), transform 0.6s var(--animation-timing);
}

#about h3.in-view {
    opacity: 1;
    transform: translateY(0);
}

#about h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -10px;
    width: 40px;
    height: 3px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s var(--animation-timing) 0.2s;
}

#about h3.in-view::after {
    transform: scaleX(1);
}

.profile-image {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.5s ease;
    position: relative;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s var(--animation-timing), transform 0.8s var(--animation-timing), box-shadow 0.5s;
    flex-shrink: 0;
    margin: 0 auto;
}

.profile-image.in-view {
    opacity: 1;
    transform: scale(1);
    animation: pulse 2s infinite alternate;
}

.profile-image::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: var(--primary-gradient);
    border-radius: 50%;
    z-index: -1;
}

.profile-image:hover {
    box-shadow: 0 8px 25px rgba(255, 126, 95, 0.5);
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
    border-radius: 50%;
}

.profile-image:hover img {
    transform: scale(1.1);
}

/* Skills Section */
.skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    margin: 3rem 0;
    justify-content: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--animation-timing), transform 0.8s var(--animation-timing);
}

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

.skill {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 120px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s var(--animation-timing), transform 0.5s var(--animation-timing);
}

.skill.in-view {
    opacity: 1;
    transform: scale(1);
}

.skill i {
    font-size: 4.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    color: white;
}

.skill:hover i {
    transform: scale(1.2);
}

.skill span {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Brand color transitions on hover */
.skill:hover .devicon-python-plain {
    color: #f4f017;
}

.skill:hover .devicon-cplusplus-plain {
    color: #00599C;
}

.skill:hover .devicon-figma-plain {
    color: #F24E1E;
}

.skill:hover .devicon-bootstrap-plain {
    color: #6600fe;
}

.skill:hover .devicon-html5-plain {
    color: #ea4213;
}

.skill:hover .devicon-css3-plain {
    color: #0074f8;
}

.skill:hover .devicon-javascript-plain {
    color: #F7DF1E;
}

.skill:hover .devicon-php-plain {
    color: #777BB4;
}

.skill:hover .devicon-mysql-plain {
    color: #4479A1;
}

.skill:hover .devicon-react-original {
    color: #74eaff;
}

.skill:hover .devicon-tailwindcss-original {
    color: #5bb0ff;
}

.skill:hover .devicon-firebase-plain {
    color: #ffb45e;
}

.skill:hover .devicon-git-plain {
    color: #ff5500;
}

.skill:hover .devicon-vercel-original {
    color: #252525;
}

.skill:hover .devicon-amazonwebservices-plain-wordmark {
    color: #ff9f10;
}

/* 8. Contact Form */
.contact-form {
    display: flex;
    flex-direction: column;
    max-width: 500px;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s var(--animation-timing), transform 0.5s var(--animation-timing);
}

.form-group.in-view {
    opacity: 1;
    transform: translateX(0);
}

.form-group:nth-child(1) {
    transition-delay: 0.1s;
}

.form-group:nth-child(2) {
    transition-delay: 0.2s;
}

.form-group:nth-child(3) {
    transition-delay: 0.3s;
}

.form-group label {
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    padding: 0.8rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: var(--text-light);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ff7e5f;
    box-shadow: 0 0 10px rgba(255, 126, 95, 0.3);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.contact-form .cta-button {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s var(--animation-timing), transform 0.5s var(--animation-timing), background 0.3s;
    transition-delay: 0.4s;
    animation: none;
}

.contact-form .cta-button.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* 9. Footer */
footer {
    background-color: var(--header-bg);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--animation-timing), transform 0.8s var(--animation-timing);
}

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

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.social-links a {
    font-size: 1.5rem;
    transition: color 0.3s, transform 0.3s;
    opacity: 0;
    transform: scale(0);
}

.social-links a.in-view {
    animation: popIn 0.5s var(--animation-timing) forwards;
}

.social-links a:nth-child(1) {
    animation-delay: 0.2s;
}

.social-links a:nth-child(2) {
    animation-delay: 0.4s;
}

.social-links a:nth-child(3) {
    animation-delay: 0.6s;
}

.social-links a:hover {
    color: #feb47b;
    transform: scale(1.2);
}

/* 10. Modal Components */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-container.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background-color: #0f0f0f;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(255, 126, 95, 0.3);
    transform: translateY(30px);
    opacity: 0;
    animation: modalIn 0.5s forwards;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(45deg, rgba(255, 126, 95, 0.1), rgba(254, 180, 123, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    margin: 0;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s, transform 0.3s;
}

.close-modal:hover {
    color: #ff7e5f;
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.project-gallery {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.gallery-image {
    min-width: 300px;
    height: 200px;
    border-radius: 5px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.gallery-image:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(255, 126, 95, 0.3);
}

.placeholder-content {
    color: #aaa;
    font-weight: bold;
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(30,30,30,0.9), rgba(40,40,40,0.8));
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-left: 3px solid #ff7e5f;
}

.project-description {
    margin-bottom: 2rem;
    line-height: 1.6;
}

.project-description p {
    margin-bottom: 1rem;
}

.project-description ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.project-description li {
    margin-bottom: 0.5rem;
}

.project-actions {
    display: flex;
    gap: 1rem;
}

.project-button {
    padding: 0.8rem 1.5rem;
    background: var(--primary-gradient);
    border: none;
    border-radius: 5px;
    color: var(--text-light);
    font-weight: bold;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.project-button::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.3s var(--animation-timing);
    z-index: 1;
}

.project-button:hover::after {
    left: 100%;
}

.project-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 126, 95, 0.3);
}

/* More Projects Page Specific Styles */
.back-link-wrapper {
    display: flex;
    justify-content: flex-start;
}

.back-link-wrapper .cta-button {
    animation: none;
    opacity: 1;
    transform: none;
}

#more-projects .projects {
    opacity: 1;
    transform: none;
}

/* 11. Animation Keyframes */
@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(255, 126, 95, 0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 126, 95, 0.5); }
    100% { box-shadow: 0 0 5px rgba(255, 126, 95, 0.3); }
}

.project-card.visible {
    animation: glow 2s ease-in-out;
}

@keyframes modalIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    70% {
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    from {
        box-shadow: 0 0 10px rgba(255, 126, 95, 0.3);
    }
    to {
        box-shadow: 0 0 20px rgba(255, 126, 95, 0.5);
    }
}

/* 12. Media Queries */
@media (max-width: 992px) {
    .hero h1 {
        font-size: 3.5rem;
    }
}

@media (max-width: 992px) {
    .about-container {
        flex-direction: column-reverse;
        align-items: center;
    }
    
    .about-content {
        max-width: 100%;
    }
    
    .profile-image {
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    /* Hamburger menu styling */
    .menu-toggle {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 0;
        flex-direction: column;
        background-color: rgba(0, 0, 0, 0.9);
        width: 100%;
        height: 100vh;
        z-index: 99;
        text-align: center;
        transition: 0.3s;
        gap: 0;
        padding-top: 80px;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu li {
        margin: 2rem 0;
    }
    
    .nav-menu li a {
        font-size: 1.6rem;
    }
    
    /* Active hamburger animation */
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    /* Hero content adjustments */
    .hero h1 {
        font-size: 3rem;
        padding: 0 1rem;
    }
    
    .hero p {
        font-size: 1.2rem;
        padding: 0 1rem;
    }
    
    section {
        padding: 3rem 5%;
    }
    
    .project-gallery {
        flex-direction: column;
    }
    
    .gallery-image {
        width: 100%;
    }
    
    .project-actions {
        flex-direction: column;
    }
    
    .profile-image {
        width: 200px;
        height: 200px;
        margin: 0 auto 2rem auto;
    }
    
    .about-text {
        text-align: center;
    }
    
    .back-link-wrapper {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .hero-content {
        padding: 0 1rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    header {
        padding: 1.5rem;
    }
}

@media screen and (max-width: 767px) {
    .modal-container {
        padding: 0;
    }
    
    .modal {
        height: 100%;
        width: 100%;
        border-radius: 0;
    }
    
    .modal-content {
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 80px;
    }
    
    .modal-fixed-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #1a1a1a;
        padding: 15px;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
        z-index: 100;
        text-align: center;
    }
    
    .project-button {
        display: inline-block;
        width: 80%;
        padding: 12px 20px;
        margin: 0 auto;
    }
}