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

/* CSS Variables for theming */
:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --border-color: #000000;
    --nav-bg: rgba(255, 255, 255, 0.95);
    --section-border: #f0f0f0;
}

[data-theme="dark"] {
    --bg-color: #000000;
    --text-color: #ffffff;
    --border-color: #ffffff;
    --nav-bg: rgba(0, 0, 0, 0.95);
    --section-border: #333333;
}

/* Base styles */
body {
    line-height: 1.4;
    color: var(--text-color);
    background: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    text-transform: uppercase;
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
    font-weight: 300;
}

/* Don't force uppercase on form controls or code blocks */
input, textarea, select, button, code, pre {
    text-transform: none;
}

/* Navigation */
.nav {
    position: fixed;
    z-index: 1000;
    top: 0;
    right: 0;
    left: 0;
    border-bottom: 1px solid var(--section-border);
    background: var(--nav-bg);
    backdrop-filter: blur(10px);

/* Footer (meta + links) sits at the bottom of the project card */
.project-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    /* Push to bottom when parent is a column flex */
    margin-top: auto;
    gap: 12px;
}

.project-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.project-tech {
    color: var(--muted);
    font-size: 11px;
}

.project-stars {
    color: var(--muted);
    font-size: 11px;
}
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    padding: 20px 40px;
    margin: 0 auto;
}

.nav-logo {
    letter-spacing: 1px;
    font-size: 18px;
    font-weight: 500;
}

.theme-toggle {
    position: relative;
    display: flex;
    overflow: hidden; /* keep rotating icon from affecting layout */
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 0px; /* square with slight rounding */
    color: var(--text-color);
    background: none;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.theme-toggle:hover {
    color: var(--bg-color);
    background: var(--text-color);
}

.theme-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    line-height: 18px;
    transition: transform 0.28s cubic-bezier(.2,.9,.2,1), opacity 0.2s ease;
    transform: translate(-50%, -50%) rotate(0deg);
    transform-origin: 50% 50%;
    text-align: center;
    font-size: 14px;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    will-change: transform, opacity;
}

.theme-toggle:hover .theme-icon {
    transform: translate(-50%, -50%) rotate(180deg);
}

/* Menu toggle (hamburger) - visually similar to theme toggle */
.menu-toggle {
    display: none; /* shown via media queries */
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 0px;
    background: none;
    color: var(--text-color);
    cursor: pointer;
    position: relative;
}

.menu-icon {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    width: 18px;
    height: 14px;
    align-items: center;
    justify-content: center;
}

.menu-icon .bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-color);
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-menu a {
    color: var(--text-color);
    transition: opacity 0.3s ease;
    letter-spacing: 1px;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
}

.nav-menu a:hover {
    opacity: 0.6;
}

/* Main content */
.main {
    max-width: 1200px;
    padding: 0 40px;
    margin: 0 auto;
}

/* Hero section */
.hero {
    padding: 160px 0 120px;
    text-align: center;
}

.hero h1 {
    margin-bottom: 20px;
    letter-spacing: 8px;
    font-size: clamp(60px, 8vw, 120px);
    font-weight: 300;
}

.hero p {
    opacity: 0.7;
    letter-spacing: 2px;
    font-size: 18px;
    font-weight: 300;
}

/* About section */
.about {
    padding: 80px 0;
    border-top: 1px solid var(--section-border);
}

.about h2 {
    margin-bottom: 60px;
    text-align: center;
    letter-spacing: 4px;
    font-size: 24px;
    font-weight: 400;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-content p {
    line-height: 1.8;
    margin-bottom: 30px;
    opacity: 0.8;
    font-size: 16px;
    font-weight: 300;
}

/* Skills section */
.skills {
    padding: 80px 0;
    border-top: 1px solid var(--section-border);
}

.skills h2 {
    margin-bottom: 60px;
    text-align: center;
    letter-spacing: 4px;
    font-size: 24px;
    font-weight: 400;
}

.skills-grid {
    display: grid;
    max-width: 900px;
    margin: 0 auto;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}

.skill-category {
    padding: 30px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.skill-category h3 {
    margin-bottom: 25px;
    letter-spacing: 2px;
    font-size: 16px;
    font-weight: 500;
}

.skill-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skill-list span {
    opacity: 0.8;
    letter-spacing: 1px;
    font-size: 14px;
    font-weight: 300;
}

/* Work section (renamed to projects) */
.work {
    padding: 80px 0;
    border-top: 1px solid var(--section-border);
}

.work h2 {
    margin-bottom: 60px;
    text-align: center;
    letter-spacing: 4px;
    font-size: 24px;
    font-weight: 400;
}

.loading {
    padding: 60px 0;
    opacity: 0.6;
    text-align: center;
    letter-spacing: 1px;
    font-size: 14px;
}

/* Projects grid */
.projects {
    display: grid;
    justify-content: center;
    margin-top: 40px;
    /* fixed-size boxes, centered */
    grid-template-columns: repeat(auto-fill, 320px);
    gap: 20px;
}

.project {
    display: flex;
    flex-direction: column;
    height: 360px; /* fixed height for consistent grid */
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: opacity 0.3s ease, transform 0.18s ease;
}

.project:hover {
    opacity: 0.7;
}

.project-title {
    display: block;
    margin-bottom: 12px;
    color: var(--text-color);
    letter-spacing: 1px;
    font-size: 20px;
    font-weight: 500;
    text-decoration: none;
}

.project-description {
    overflow: hidden;
    /* allow description to take available space so footer stays at bottom */
    flex: 1 1 auto;
    line-height: 1.6;
    margin-bottom: 16px;
    opacity: 0.8;
    font-size: 13px;
    font-weight: 300;
}

.project-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    opacity: 0.6;
    letter-spacing: 1px;
    font-size: 12px;
}

.project-tech {
    display: flex;
    gap: 15px;
}

.project-stars {
    display: flex;
    align-items: center;
    gap: 5px;
}

.project-links {
    display: flex;
    margin-top: 12px;
    gap: 12px;
}

.project-link {
    opacity: 0.8;
    color: var(--text-color);
    transition: opacity 0.3s ease;
    letter-spacing: 1px;
    font-size: 12px;
    text-decoration: none;
}

.project-link:hover {
    opacity: 1;
}

/* Resume section */
.resume {
    padding: 80px 0;
    border-top: 1px solid var(--section-border);
    text-align: center;
}

.resume h2 {
    margin-bottom: 60px;
    letter-spacing: 4px;
    font-size: 24px;
    font-weight: 400;
}

.resume-content {
    max-width: 600px;
    margin: 0 auto;
}

.resume-content p {
    margin-bottom: 40px;
    opacity: 0.8;
    font-size: 16px;
    font-weight: 300;
}

.resume-download {
    display: inline-block;
    padding: 15px 30px;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    transition: all 0.3s ease;
    letter-spacing: 2px;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
}

.resume-download:hover {
    color: var(--bg-color);
    background: var(--text-color);
}

/* Contact section */
.contact {
    padding: 80px 0 120px;
    border-top: 1px solid var(--section-border);
    text-align: center;
}

.contact h2 {
    margin-bottom: 60px;
    letter-spacing: 4px;
    font-size: 24px;
    font-weight: 400;
}

.contact-info {
    display: flex;
    justify-content: center;
    gap: 60px;
}

.contact-info a {
    color: var(--text-color);
    transition: opacity 0.3s ease;
    letter-spacing: 2px;
    font-size: 16px;
    font-weight: 400;
    text-decoration: none;
}

.contact-info a:hover {
    opacity: 0.6;
}

/* Responsive design */
@media (max-width: 1024px) {
    .nav-menu {
        gap: 20px;
    }
    
    .nav-menu a {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
        padding: 15px 20px;
        gap: 15px;
    }
    
    .menu-toggle {
        display: inline-flex;
        order: 1;
        margin-left: 8px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        order: 2;
        width: 100%;
        margin-top: 10px;
        gap: 20px;
    }
    
    /* Hide the horizontal nav by default on small screens; menu-toggle will show it */
    .nav:not(.menu-open) .nav-menu {
        display: none;
    }
    
    /* When the menu is open, show a compact vertical list anchored to top-right */
    .nav.menu-open .nav-menu {
        display: flex;
        position: absolute;
        top: 60px;
        right: 20px;
        flex-direction: column;
        align-items: flex-end;
        background: var(--nav-bg);
        padding: 12px 16px;
        border: 1px solid var(--section-border);
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
        z-index: 1100;
        gap: 12px;
        min-width: 160px;
    }
    
    .theme-toggle {
        order: 1;
        width: 35px;
        height: 35px;
    }
    
    .theme-icon {
        font-size: 16px;
    }
    
    .nav-menu a {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .main {
        padding: 0 20px;
    }
    
    .hero {
        padding: 140px 0 80px;
    }
    
    .hero h1 {
        letter-spacing: 4px;
    }
    
    .hero p {
        letter-spacing: 1px;
        font-size: 14px;
    }
    
    .about, .skills, .work, .resume, .contact {
        padding: 60px 0;
    }
    
    .about h2, .skills h2, .work h2, .resume h2, .contact h2 {
        margin-bottom: 40px;
        letter-spacing: 2px;
        font-size: 20px;
    }
    
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .about-content p {
        font-size: 14px;
    }
    
    .projects {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .contact-info {
        flex-direction: column;
        gap: 30px;
    }
    
    .contact-info a {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .nav-menu {
        margin-top: 8px;
        gap: 15px;
    }
    
    .nav-menu a {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .theme-toggle {
        width: 32px;
        height: 32px;
    }
    
    .menu-toggle {
        width: 32px;
        height: 32px;
    }
    
    .theme-icon {
        font-size: 14px;
    }
    
    .main {
        padding: 0 15px;
    }
    
    .hero {
        padding: 120px 0 60px;
    }
    
    .project-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 360px) {
    .nav-container {
        padding: 10px 12px;
    }
    
    .nav-menu {
        justify-content: space-between;
        gap: 12px;
    }
    
    .nav-menu a {
        padding: 3px 6px;
        letter-spacing: 0.5px;
        font-size: 10px;
    }
    
    .theme-toggle {
        width: 30px;
        height: 30px;
    }
    
    .menu-toggle {
        width: 30px;
        height: 30px;
    }
    
    .theme-icon {
        font-size: 12px;
    }
    
    .hero h1 {
        letter-spacing: 2px;
        font-size: 48px;
    }
    
    .main {
        padding: 0 12px;
    }

    /* Safety: ensure hero has extra top spacing on very small screens */
    .hero {
        padding-top: 140px; /* ensure space under fixed nav */
    }
}

/* General safety for all sizes: tiny top offset so fixed header doesn't overlap */
.main {
    padding-top: 8px; /* small buffer in addition to body padding set by JS */
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}