:root {
    --bg: #000000;
    --card-bg: #0d0d0d;
    --text: #ffffff;
    --text-dim: #949494;
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.25);
    --accent: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    perspective: 1000px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Nav */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    width: 100%;
    max-width: 1200px; /* Constrain wide screens */
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    width: 150px; /* Fix width to stabilize flex distribution */
}

.nav-logo-img {
    height: 32px; /* Fixed height is usually better for nav alignment */
    width: auto;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.nav-links {
    gap: 1.5rem;
    align-items: center;
}

.hamburger {
    display: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dim);
    font-size: 0.85rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text);
}

/* Layout */
.main-wrapper {
    padding-top: 100px;
    padding-bottom: 60px;
}

/* THE BENTO GRID - Fixed & Defensive */
.bento-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    grid-template-rows: 400px 400px; /* Explicit row heights */
    gap: 1.25rem;
    width: 100%;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: 3rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.5s ease, background 0.5s ease;
    transform-style: preserve-3d;
}

.card:hover {
    border-color: var(--border-hover);
    background: #121212;
    transform: translateY(-5px);
}

/* Specific Spans */
.card-hero {
    grid-row: 1 / 3; /* Matches the tall left card in your drawing */
    grid-column: 1 / 2;
    background: linear-gradient(180deg, #141414 0%, #000000 100%);
    justify-content: center;
}

.card-hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
    margin-bottom: 2rem;
}

.card-hero p {
    font-size: 1.2rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.card-icon {
    font-size: 1.8rem;
    color: var(--text-dim);
    margin-bottom: auto;
}

.card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.card p {
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.card-tag {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

/* Projects Link Interaction */
.card-projects i {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    font-size: 1.5rem;
    opacity: 0.2;
    transition: all 0.3s;
}

.card:hover i {
    opacity: 1;
    transform: translate(5px, -5px);
}

/* Contact Section */
.contact-section {
    margin-top: 100px;
    padding: 60px 0;
    border-top: 1px solid var(--border);
}

.contact-box {
    max-width: 600px;
}

.input-group {
    margin-bottom: 1.5rem;
}

input, textarea {
    width: 100%;
    background: #0d0d0d;
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 0.75rem;
    color: var(--text);
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

input:focus, textarea:focus {
    border-color: var(--text-dim);
}

.btn-submit {
    background: var(--text);
    color: var(--bg);
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s;
}

.btn-submit:hover {
    opacity: 0.9;
}

/* Footer */
footer {
    padding: 60px 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

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

.social-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.social-link i {
    font-size: 1.2rem;
}

.social-link:hover {
    color: var(--text);
    transform: translateY(-2px);
}

.footer-copyright {
    font-size: 0.8rem;
    color: var(--text-dim);
    opacity: 0.6;
}

/* Responsive Design System */
@media (min-width: 769px) {
    .nav-links {
        display: flex;
    }
    .hamburger {
        display: none !important;
    }
}

@media (max-width: 1200px) {
    .container { max-width: 960px; }
    .bento-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
    .card-hero {
        grid-column: span 2;
        height: auto;
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .container { padding: 0 1.25rem; }
    
    .main-wrapper {
        padding-top: 140px;
    }
    
    /* Navigation: Hamburger Menu - Top Down */
    .nav-links {
        position: fixed;
        left: 0;
        top: 70px; /* Start below the header */
        width: 100%;
        height: calc(100vh - 70px);
        background-color: var(--bg);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: 4rem;
        transform: translateY(-120%); /* Hide above */
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s ease-in-out;
        z-index: 998;
        border-top: 1px solid var(--border);
        border-left: none;
    }
    
    .nav-links.nav-active {
        transform: translateY(0%);
        opacity: 1;
        visibility: visible;
    }

    .nav-links a {
        font-size: 1.25rem;
        margin: 1.25rem 0;
        opacity: 1; /* Fix visibility issue */
        display: block;
    }

    .hamburger {
        display: block;
        cursor: pointer;
        z-index: 999;
        color: var(--text);
        font-size: 1.5rem;
    }
    
    /* Animation for links */
    @keyframes navLinkFade {
        from { opacity: 0; transform: translateX(50px); }
        to { opacity: 1; transform: translateX(0); }
    }

    .bento-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card-hero, .card {
        grid-column: auto;
        padding: 2rem;
        min-height: auto;
    }

    .card-hero h1 {
        font-size: 2.25rem;
    }

    .footer-social {
        gap: 1rem;
        flex-wrap: wrap;
    }
    
    .social-link span {
        display: none; /* Only icons on small mobile */
    }
}

@media (max-width: 480px) {
    .logo { font-size: 1rem; }
    .nav-logo-img { width: 28px; height: 28px; }
    .card-hero h1 { font-size: 1.8rem; }
}
