/* ============================================
   VARIABLES & RESET
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1620;
    --bg-secondary: #221c2a;
    --accent: #352940;
    --highlight: #9b6bde;
    --text: #e9e6ef;
    --text-dim: #a098b0;
}

body {
    font-family: 'Press Start 2P', cursive;
    background: var(--bg-primary);
    color: var(--text);
    line-height: 1.8;
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

/* ============================================
   NAVIGATION
   ============================================ */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--bg-secondary);
    padding: 20px 0;
    z-index: 1000;
    border-bottom: 3px solid var(--highlight);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

nav a {
    color: var(--text);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s;
    padding: 5px 10px;
}

nav a:hover {
    color: var(--highlight);
}

/* ============================================
   SECTIONS
   ============================================ */
section {
    min-height: 100vh;
    padding: 120px 20px 60px;
    max-width: 1200px;
    margin: 0 auto;
    animation: pixel-fade 0.8s ease-out;
}

h1 {
    font-size: 32px;
    margin-bottom: 40px;
    color: var(--highlight);
    text-align: center;
    text-shadow: 3px 3px 0 var(--accent);
}

h2 {
    font-size: 24px;
    margin-bottom: 30px;
    color: var(--highlight);
    text-shadow: 2px 2px 0 var(--accent);
}

h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text);
}

p {
    font-size: 12px;
    line-height: 2;
    margin-bottom: 20px;
    color: var(--text-dim);
}

/* ============================================
   ABOUT SECTION
   ============================================ */
#about {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 350px;
}

.about-content {
    background: var(--bg-secondary);
    padding: 40px;
    border: 3px solid var(--accent);
    max-width: 800px;
    box-shadow: 8px 8px 0 var(--accent);
}

.avatar {
    width: 150px;
    height: 150px;
    background: var(--accent);
    border: 3px solid var(--highlight);
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    box-shadow: 5px 5px 0 var(--highlight);
    overflow: hidden; /* Add */
    background-size: cover; /* Add */
    background-position: center; /* Add */
    background-repeat: no-repeat; /* Add */
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Add - ensures image fills the square */
}

/* ============================================
   PROJECTS SECTION
   ============================================ */
#projects {
    padding: 120px 40px 60px;
    padding-top: 250px;
}

section {
    min-height: auto; /* Change from 100vh to auto */
    padding: 120px 20px 90px;
    max-width: 1600px;
    margin: 0 auto;
    animation: pixel-fade 0.8s ease-out;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 30px;
    margin-top: 40px;
}

.project-card {
    background: var(--bg-primary);
    border: 3px solid var(--accent);
    padding: 30px;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.project-image {
    width: 100%;
    height: 200px;
    background-color: var(--accent);
    margin-bottom: 20px;
    border: 2px solid var(--text-dim);
    background-size: auto 100%; /* Width auto, height 90% - maintains aspect ratio */
    background-position: center;
    background-repeat: no-repeat;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 10px;
}

.project-status {
    background: var(--highlight);
    color: var(--text);
    padding: 5px 10px;
    font-size: 9px;
    border: 2px solid var(--bg-primary);
    white-space: nowrap;
}

.project-card {
    background: var(--bg-primary);
    border: 3px solid var(--accent);
    padding: 30px;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    display: flex; /* Add */
    flex-direction: column; /* Add */
}

.project-description {
    margin-bottom: 20px;
    flex-grow: 1; /* Add - pushes content below to bottom */
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    margin-top: auto; /* Add - keeps at bottom */
}

.tag {
    background: var(--accent);
    color: var(--text);
    padding: 5px 10px;
    font-size: 10px;
    border: 2px solid var(--highlight);
}

.project-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--accent);
    flex-wrap: wrap;
}

.github-btn {
    background: var(--accent);
    color: var(--text);
    text-decoration: none;
    padding: 10px 15px;
    border: 2px solid var(--highlight);
    font-size: 10px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

.github-btn:hover {
    background: var(--highlight);
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0 var(--accent);
}

.demo-btn {
    background: var(--highlight);
    color: var(--text);
    text-decoration: none;
    padding: 10px 15px;
    border: 2px solid var(--accent);
    font-size: 10px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

.demo-btn:hover {
    background: var(--accent);
    border-color: var(--highlight);
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0 var(--highlight);
}

/* ============================================
   COMMERCIAL PROJECTS SECTION
   ============================================ */
#commercial {
    background: var(--bg-primary);
    max-width: 100%; /* Section spans full width */
    padding: 120px 40px 60px;
}

.commercial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 40px;
    margin-top: 40px;
    max-width: 1600px; /* Constrain grid width */
    margin-left: auto; /* Center the grid */
    margin-right: auto;
    justify-content: center; /* Add this - centers the grid itself */
}

.commercial-intro {
    text-align: center;
    max-width: 800px;
    max-height: 90px;
    margin: 0 auto 40px;
    padding: 30px;
    background: var(--bg-secondary);
    border: 3px solid var(--highlight);
    box-shadow: 6px 6px 0 var(--accent);
}

.commercial-card {
    background: var(--bg-secondary);
    border: 3px solid var(--highlight);
    padding: 30px;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    display: flex; /* Add */
    flex-direction: column; /* Add */
}

.commercial-card > p {
    flex-grow: 1; /* Add - pushes content below to bottom */
}

.commercial-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto; /* Add - keeps at bottom */
    padding-top: 20px;
    border-top: 2px solid var(--accent);
}

.commercial-card:hover {
    transform: translate(-5px, -5px);
    box-shadow: 10px 10px 0 var(--accent);
}

.commercial-image {
    width: 100%;
    height: 250px;
    background-color: var(--accent);
    margin-bottom: 20px;
    border: 3px solid var(--highlight);
    background-size: auto 100%; /* Width auto, height 90% - maintains aspect ratio */
    background-position: center;
    background-repeat: no-repeat;
}

.commercial-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.client-badge {
    background: var(--highlight);
    color: var(--text);
    padding: 5px 15px;
    font-size: 10px;
    border: 2px solid var(--bg-primary);
    white-space: nowrap;
}


.detail-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 11px;
}

.detail-label {
    color: var(--highlight);
    min-width: 80px;
    font-weight: bold;
}

.detail-value {
    color: var(--text-dim);
    flex: 1;
}

.project-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.project-link {
    background: var(--accent);
    color: var(--text);
    text-decoration: none;
    padding: 10px 15px;
    border: 2px solid var(--highlight);
    font-size: 10px;
    transition: all 0.3s;
    display: inline-block;
}

.project-link:hover {
    background: var(--highlight);
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0 var(--accent);
}

/* ============================================
   CONTACT SECTION
   ============================================ */
#contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 350px;
    padding-bottom: 350px;
}

.contact-content {
    background: var(--bg-secondary);
    padding: 40px;
    border: 3px solid var(--accent);
    max-width: 600px;
    width: 100%;
    box-shadow: 8px 8px 0 var(--accent);
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

.contact-link {
    background: var(--accent);
    color: var(--text);
    text-decoration: none;
    padding: 15px 20px;
    border: 3px solid var(--highlight);
    transition: all 0.3s;
    display: block;
    text-align: center;
    font-size: 12px;
}

.contact-link:hover {
    background: var(--highlight);
    transform: translate(-3px, -3px);
    box-shadow: 5px 5px 0 var(--accent);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: var(--bg-secondary);
    padding: 10px;
    text-align: center;
    border-top: 3px solid var(--highlight);
    font-size: 15px;
    color: var(--text-dim);
    display: flex;
    justify-content: center;
    align-items: center;
}

footer > * {
    text-align: center;
}
/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pixel-fade {
    from {
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Large screens - cap commercial grid at 3 columns */
@media (min-width: 1200px) {
    .commercial-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet and smaller screens */
@media (max-width: 1024px) {
    .commercial-grid {
        gap: 30px;
    }

    #commercial {
        padding: 120px 30px 60px;
    }

    #projects {
        padding: 120px 30px 60px;
    }
}

/* Mobile and small tablets */
@media (max-width: 768px) {
    h1 {
        font-size: 20px;
        text-shadow: 2px 2px 0 var(--accent);
    }

    h2 {
        font-size: 16px;
        text-shadow: 1px 1px 0 var(--accent);
    }

    h3 {
        font-size: 14px;
    }

    p {
        font-size: 11px;
    }

    nav {
        padding: 15px 10px;
    }

    nav ul {
        gap: 15px;
    }

    nav a {
        font-size: 9px;
        padding: 5px 8px;
    }

    section {
        padding: 100px 15px 60px;
    }

    #about {
        padding-top: 120px;
    }

    #contact {
        padding-top: 100px;
        padding-bottom: 100px;
    }

    #projects,
    #commercial {
        padding: 100px 15px 60px;
    }

    .about-content,
    .contact-content {
        padding: 25px;
        box-shadow: 5px 5px 0 var(--accent);
    }

    .projects-grid {
        gap: 20px;
    }

    .commercial-grid {
        gap: 25px;
    }

    .commercial-intro {
        padding: 20px;
    }

    .project-card,
    .commercial-card {
        padding: 20px;
    }

    .commercial-image,
    .project-image {
        height: 180px;
    }

    .avatar {
        width: 120px;
        height: 120px;
    }

    .detail-label {
        min-width: 70px;
        font-size: 10px;
    }

    .detail-item {
        font-size: 10px;
    }
}

/* Small mobile phones */
@media (max-width: 480px) {
    h1 {
        font-size: 16px;
    }

    h2 {
        font-size: 14px;
    }

    h3 {
        font-size: 12px;
    }

    p {
        font-size: 10px;
        line-height: 1.8;
    }

    nav {
        padding: 12px 5px;
    }

    nav ul {
        gap: 10px;
    }

    nav a {
        font-size: 8px;
        padding: 4px 6px;
    }

    section {
        padding: 80px 10px 40px;
    }

    #about {
        padding-top: 100px;
    }

    #contact {
        padding-top: 80px;
        padding-bottom: 80px;
    }

    #projects,
    #commercial {
        padding: 80px 10px 40px;
    }

    .about-content,
    .contact-content {
        padding: 20px;
        border: 2px solid var(--accent);
        box-shadow: 4px 4px 0 var(--accent);
    }

    .project-card,
    .commercial-card {
        padding: 15px;
        border: 2px solid var(--accent);
    }

    .commercial-card {
        border: 2px solid var(--highlight);
    }

    .projects-grid {
        gap: 15px;
    }

    .commercial-grid {
        gap: 15px;
    }

    .commercial-image,
    .project-image {
        height: 150px;
        border: 2px solid var(--highlight);
    }

    .avatar {
        width: 100px;
        height: 100px;
        border: 2px solid var(--highlight);
        box-shadow: 3px 3px 0 var(--highlight);
    }

    .tag {
        font-size: 8px;
        padding: 4px 8px;
    }

    .github-btn,
    .demo-btn,
    .project-link {
        font-size: 8px;
        padding: 8px 10px;
        min-width: 0;
        flex: 1 1 auto;
    }

    .contact-link {
        font-size: 10px;
        padding: 12px 15px;
        border: 2px solid var(--highlight);
    }

    .detail-label {
        min-width: 65px;
        font-size: 9px;
    }

    .detail-item {
        font-size: 9px;
    }

    footer {
        font-size: 8px;
        padding: 15px 10px;
    }
}