/* =========================
   CSS Variables & Base Styles
   ========================= */

:root {
    --primary-bg: #0d1117;
    --secondary-bg: #161b22;
    --tertiary-bg: #1f2937;
    --text-primary: #e6edf3;
    --text-secondary: #9a9d9f;
    --accent: #bfaeff;
    --accent-hover: #bfaeff;
    --accent-light: #bfb5ff;
    --border: #30363d;
    --success: #3fb950;
    --warning: #d29922;

    --transition: 0.2s ease;
    --max-width: 1200px;
}

/* =========================
   General Styles
   ========================= */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* =========================
   Navigation
   ========================= */

/* Skip to content link (accessibility) */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--accent);
    color: var(--primary-bg);
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 6px 6px;
    font-weight: 700;
    z-index: 9999;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
}

.navbar {
    position: sticky;
    top: 0;
    background-color: rgba(13, 17, 23, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

.nav-logo a:hover {
    color: var(--accent-hover);
}

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

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    padding-bottom: 0.25rem;
    transition: color var(--transition), border-color var(--transition);
    cursor: pointer;
}

.nav-link:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

/* =========================
   Hero Section
   ========================= */

.hero {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem 5rem 2rem;
    position: relative;
    overflow: hidden;
    background-color: transparent;
    z-index: 5;
}

.hero-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background-color: var(--secondary-bg);
}

.hero-content {
    text-align: center;
    z-index: 10;
    max-width: 800px;
    position: relative;
    background: radial-gradient(ellipse at center, rgba(22, 27, 34, 0.4) 0%, rgba(22, 27, 34, 0.2) 60%, transparent 80%);
    padding: 3rem 4rem;
    border-radius: 20px;
}

.hero-title {
    font-size: clamp(2.5rem, 10vw, 5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    white-space: pre-line;
}

.hero-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 2rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.hero-links p {
    margin: 0;
}

.hero-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.hero-links a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .hero {
        padding: 3rem 1rem;
        min-height: auto;
    }

    .hero-title {
        font-size: 2rem;
    }

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

/* =========================
   Section Styles
   ========================= */

section {
    padding: 6rem 2rem;
}

.section-title {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 1rem;
    text-align: center;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 3rem;
}

/* =========================
   Projects Section
   ========================= */

.projects {
    position: relative;
    z-index: 20;
    margin-top: -7rem;
    padding-top: 0;
    padding-bottom: 4rem;
    background: linear-gradient(to bottom, transparent 0%, var(--primary-bg) 400px);
}

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

.project-card {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.project-card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 20px rgba(125, 90, 255, 0.07);
    transform: translateY(-3px);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.project-media {
    height: 240px;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, var(--tertiary-bg) 0%, var(--secondary-bg) 100%);
}

.project-media img,
.project-media video {
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: calc(100% + 10px);
    object-fit: cover;
}

.project-body {
    padding: 1.2rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.project-status {
    font-size: 0.7rem;
    padding: 0.35rem 0.6rem;
    border-radius: 3px;
    background-color: var(--tertiary-bg);
    color: var(--text-secondary);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid var(--border);
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    flex-grow: 1;
    font-size: 0.9rem;
    line-height: 1.6;
}

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

.tag {
    display: inline-block;
    background-color: transparent;
    color: var(--accent);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: none;
}

/* Pastel color palette for tags */
.tag:nth-child(1) { color: #8a6bb3; border-color: #5d3a80; background-color: rgba(212, 165, 255, 0.075); }
.tag:nth-child(2) { color: #6db39f; border-color: #3d5f52; background-color: rgba(168, 230, 217, 0.075); }
.tag:nth-child(3) { color: #b39966; border-color: #7f5c39; background-color: rgba(255, 212, 163, 0.075); }
.tag:nth-child(4) { color: #b38399; border-color: #7f4d5c; background-color: rgba(255, 184, 209, 0.075); }
.tag:nth-child(5) { color: #8a92b3; border-color: #5d6680; background-color: rgba(201, 217, 255, 0.075); }
.tag:nth-child(6) { color: #b3b366; border-color: #7f7f33; background-color: rgba(255, 255, 179, 0.075); }
.tag:nth-child(7) { color: #9b80b3; border-color: #664d80; background-color: rgba(230, 201, 255, 0.075); }
.tag:nth-child(n+8) { color: #7a9ab3; border-color: #4d6680; background-color: rgba(201, 240, 255, 0.075); }

.project-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.project-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    padding-bottom: 0.25rem;
    font-size: 0.95rem;
}

.project-link:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
}

/* =========================
   Footer
   ========================= */

.footer {
    background-color: var(--secondary-bg);
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    position: relative;
    z-index: 25;
}

.footer-contact {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.footer-contact a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.footer-contact a:hover {
    text-decoration: underline;
}

.footer-back-to-top {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.footer-back-to-top:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

/* =========================
   Focus Styles (Accessibility)
   ========================= */

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* =========================
   Utilities & Animations
   ========================= */

.scroll-link {
    cursor: pointer;
}

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

.project-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out,
                border-color var(--transition), box-shadow var(--transition);
}

.project-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.project-card:nth-child(1) { transition-delay: 0.1s; }

.project-card:nth-child(2) { transition-delay: 0.2s; }

.project-card:nth-child(3) { transition-delay: 0.3s; }

/* =========================
   Scrollbar
   ========================= */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--primary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Additional animation delays for cards 4–7 */
.project-card:nth-child(4) { transition-delay: 0.4s; }

.project-card:nth-child(5) { transition-delay: 0.5s; }

.project-card:nth-child(6) { transition-delay: 0.6s; }

.project-card:nth-child(7) { transition-delay: 0.7s; }

/* =========================
   Per-technology tag colours
   ========================= */

/* C / C++ */
.tag-cpp {
    color: #58a6ff;
    border-color: #58a6ff;
}

/* OpenGL */
.tag-opengl {
    color: #f78166;
    border-color: #f78166;
}

/* GLFW */
.tag-glfw {
    color: #7ee787;
    border-color: #7ee787;
}

/* GLM */
.tag-glm {
    color: #79c0ff;
    border-color: #79c0ff;
}

/* ImGui */
.tag-imgui {
    color: #d2a679;
    border-color: #d2a679;
}

/* OpenMP */
.tag-openmp {
    color: #a371f7;
    border-color: #a371f7;
}

/* CMake */
.tag-cmake {
    color: #5a9fd4;
    border-color: #5a9fd4;
}

/* WinAPI */
.tag-winapi {
    color: #00adef;
    border-color: #00adef;
}

/* TypeScript */
.tag-typescript {
    color: #3b82f6;
    border-color: #3b82f6;
}

/* Three.js */
.tag-threejs {
    color: #049ef4;
    border-color: #049ef4;
}

/* Vite */
.tag-vite {
    color: #bd34fe;
    border-color: #bd34fe;
}

/* dat.GUI */
.tag-datgui {
    color: #c9d1d9;
    border-color: #c9d1d9;
}

/* GitHub Pages */
.tag-ghpages {
    color: #8b949e;
    border-color: #8b949e;
}

/* GitHub Actions */
.tag-ghactions {
    color: #2088ff;
    border-color: #2088ff;
}

/* Python */
.tag-python {
    color: #e3b341;
    border-color: #e3b341;
}

/* NumPy */
.tag-numpy {
    color: #4dabcf;
    border-color: #4dabcf;
}

/* SciPy */
.tag-scipy {
    color: #8ca0cc;
    border-color: #8ca0cc;
}

/* PyQt */
.tag-pyqt {
    color: #41b06e;
    border-color: #41b06e;
}

/* Matplotlib */
.tag-matplotlib {
    color: #4878cf;
    border-color: #4878cf;
}

/* Folium */
.tag-folium {
    color: #77b829;
    border-color: #77b829;
}

/* Requests */
.tag-requests {
    color: #f97316;
    border-color: #f97316;
}

/* JSON */
.tag-json {
    color: #e3b341;
    border-color: #e3b341;
}

/* =========================
   Reduced Motion (Accessibility)
   ========================= */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

    .project-card {
        opacity: 1;
        transform: none;
        transition: none;
    }
}