/* ===== RESET & ROOT VARIABLES ===== */
:root {
    /* Color Palette - Strict Black, Gray and White */
    --bg-main: #000000;
    --bg-secondary: #0a0a0a;
    --bg-card: #111111;
    --border-color: #222222;
    --border-hover: #444444;
    
    --text-main: #f0f0f0;
    --text-muted: #888888;
    --accent: #ffffff;
    
    /* Typography */
    --font-mono: 'Source Code Pro', monospace;
    
    /* Spacings & Layout */
    --container-max: 1100px;
    --pad-mobile: 1.5rem;   /* 24px */
    --pad-desktop: 2.5rem;  /* 40px */
    
    /* Effects */
    --trans-fast: 0.2s ease;
    --trans-med: 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--bg-main);
    /* Subtle engineering grid background */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: center center;
    color: var(--text-main);
    font-family: var(--font-mono);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Subtle noise overlay to make the pure black look textured / premium */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* ===== BLINKING CURSOR ===== */
.blinking-cursor {
    font-weight: 700;
    color: var(--accent);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ===== TYPOGRAPHY & GLOBALS ===== */
h1, h2, h3, h4 {
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.2;
    overflow-wrap: break-word; /* Fix text overflow on small phones */
}

a {
    color: var(--text-main);
    text-decoration: none;
    transition: color var(--trans-fast);
}

a:hover {
    color: var(--text-muted);
}

p {
    color: var(--text-muted);
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--pad-desktop);
}

.section {
    padding: 6rem 0;
}

.border-top {
    border-top: 1px solid var(--border-color);
}

.section-header {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px; /* Rounded corners */
    cursor: pointer;
    transition: all var(--trans-med);
}

.btn i {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--bg-main);
    border: 1px solid var(--accent);
}

.btn-primary:hover {
    background-color: transparent;
    color: var(--accent);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--text-main);
}

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    height: 70px;
    display: flex;
    align-items: center;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

.nav-links a {
    font-size: 0.9rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

.mobile-nav {
    display: none;
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 1rem 0;
}

.mobile-nav.active {
    display: flex;
}

.mobile-nav a {
    padding: 1rem var(--pad-mobile);
    border-bottom: 1px solid var(--border-color);
    font-size: 1rem;
}

.mobile-nav a:last-child {
    border-bottom: none;
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 70px; /* Offset for header */
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    max-width: 800px;
    width: 100%;
}

.code-block-wrapper {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.hero-code {
    font-size: 0.85rem;
    color: var(--text-main);
}

.hero-code .keyword { color: #888; }
.hero-code .variable { color: #fff; }
.hero-code .property { color: #ccc; }
.hero-code .string { color: #aaa; }

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.1rem;
    max-width: 600px;
    margin-bottom: 1rem;
}

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

/* ===== SKILLS SECTION ===== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

.skill-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    transition: transform var(--trans-med), border-color var(--trans-med);
}

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

.skill-card i {
    width: 32px;
    height: 32px;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.skill-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.skill-card p {
    font-size: 0.9rem;
}

/* ===== PROJECTS SECTION ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    transition: all var(--trans-med);
}

.project-card:hover {
    border-color: var(--border-hover);
    background-color: var(--bg-card);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.project-icon {
    width: 40px;
    height: 40px;
    color: var(--text-main);
    stroke-width: 1.5;
}

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

.project-links a i {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: color var(--trans-fast);
}

.project-links a:hover i {
    color: var(--text-main);
}

.project-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.project-desc {
    font-size: 0.95rem;
    flex-grow: 1;
    margin-bottom: 2rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-tags span {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-muted);
}

/* ===== CONTACT & FOOTER ===== */
.contact-box {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 4rem 2rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.footer {
    padding: 2rem 0;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer p {
    font-size: 0.85rem;
}

.social-links {
    display: flex;
    gap: 1.5rem;
}

.social-links a i {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.social-links a:hover i {
    color: var(--text-main);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    :root {
        --pad-mobile: 1.25rem; /* 20px for perfect mobile boundaries */
    }

    .container {
        padding: 0 var(--pad-mobile);
    }
    
    .section {
        padding: 4rem 0; /* Less dead space on mobile */
    }

    .hero {
        padding-top: 90px;
    }

    /* Typography adjustments */
    .hero-title {
        font-size: clamp(2rem, 8vw, 2.5rem); /* Smaller on phones to avoid weird wraps */
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Fixed code block horizontal scroll & sizing */
    .code-block-wrapper {
        padding: 1rem;
        -webkit-overflow-scrolling: touch; /* Smooth iOS horizontal scroll */
        margin-bottom: 1.5rem;
    }

    .hero-code {
        font-size: 0.75rem; /* Let more code fit horizontally */
    }

    /* Navigation */
    .nav-links {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
        padding: 0.5rem;
    }
    
    .mobile-nav {
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        /* Smooth opening for mobile nav */
        display: none; 
        opacity: 0;
        transition: opacity var(--trans-med);
    }
    
    .mobile-nav.active {
        display: flex;
        opacity: 1;
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from { transform: translateY(-10px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }
    
    /* Cards optimization */
    .projects-grid, .skills-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .project-card, .skill-card {
        padding: 1.5rem; /* Give back screen real estate on mobile */
    }

    .project-title {
        font-size: 1.1rem;
    }

    .contact-box {
        padding: 2rem 1.5rem;
    }
}

