/* ===== Global Styles & Fonts ===== */
:root {
    --bg-color: #1a1a1a;
    --card-bg-color: #2a2a2a;
    --border-color: #444;
    --text-color: #ddd;
    --accent-color: #66b3ff;
    --accent-hover: #8fcaff;
    --tag-js-bg: #f0db4f;
    --tag-js-text: #323330;
    --tag-python-bg: #306998;
    --tag-python-text: #ffd43b;
    --tag-webgl-bg: #9c27b0;
    --tag-webgl-text: #ffffff;
    --tag-cli-bg: #757575;
    --tag-cli-text: #ffffff;
    --tag-plugin-bg: #4caf50; /* A shade of green */
    --tag-plugin-text: #ffffff;
    --tag-ml-bg: #e64a19;
    --tag-ml-text: #ffffff;
}

html,
body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
}

body {
    background-image:
        linear-gradient(rgba(26, 26, 26, 0.95), rgba(26, 26, 26, 0.95)),
        url('assets/graphics/bg/noise.png');
    /* You may need to create a subtle noise texture */
    background-repeat: repeat;
}

/* ===== CRT Screen Effect Overlays ===== */
body::before,
body::after {
    content: "";
    position: fixed;
    /* Stays in place during scroll */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* VERY IMPORTANT: Allows clicking through the overlay */
}

/* Vignette and curvature illusion layer */
body::before {
    background: radial-gradient(circle at center, transparent 60%, rgba(0, 0, 0, 0.2) 100%);
    box-shadow: inset 0 0 8em 2em rgba(0, 0, 0, 0.25);
    z-index: 998;
    /* Below scanlines */
}

/* Scanline layer */
body::after {
    background: repeating-linear-gradient(to bottom,
            transparent,
            transparent 3px,
            rgba(0, 0, 0, 0.20) 3px,
            rgba(0, 0, 0, 0.20) 4px);
    z-index: 999;
    /* Ensures it's on top of page content but below modals */
}

h1,
h2,
h3 {
    font-family: 'VT323', monospace;
    color: var(--accent-color);
    margin: 0;
    letter-spacing: 1px;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: var(--accent-hover);
}

/* ===== Main Layout ===== */
.main-header {
    text-align: center;
    padding: 3rem 1rem;
    border-bottom: 2px solid var(--border-color);
}

.main-header h1 {
    font-size: 3.5rem;
    /* Reserve space for two lines to prevent layout shift during typing effect */
    line-height: 1.2;
    min-height: 2.4em;
    /* 2 * 1.2em */
}

.main-header p {
    font-size: 1.2rem;
    color: #aaa;
    max-width: 600px;
    margin: 0.5rem auto 0 auto;
}

/* Typing effect for the header */
@keyframes blink-cursor {
    50% {
        opacity: 0;
    }
}

.blinking-cursor::after {
    content: '_';
    animation: blink-cursor 1s step-end infinite;
}

.project-showcase {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

/* ===== Project Card Styling ===== */
.project-card {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Needed for z-index to work */
    /* Update transition to include all animated properties */
    transition: transform 0.4s ease, box-shadow 0.4s ease, opacity 0.6s ease-out;
}

a.project-header {
    display: block;
    padding: 1.5rem;
    background-color: #333;
    border-bottom: 1px solid var(--border-color);
}

a.project-header:hover h2 {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.project-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.project-tag {
    display: inline-block;
    font-family: 'Roboto', sans-serif;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    margin-right: 8px;
}

.tag-js {
    background-color: var(--tag-js-bg);
    color: var(--tag-js-text);
}

.tag-python {
    background-color: var(--tag-python-bg);
    color: var(--tag-python-text);
}

.tag-webgl {
    background-color: var(--tag-webgl-bg);
    color: var(--tag-webgl-text);
}

.tag-cli {
    background-color: var(--tag-cli-bg);
    color: var(--tag-cli-text);
}

.tag-plugin {
    background-color: var(--tag-plugin-bg);
    color: var(--tag-plugin-text);
}

.tag-ml {
    background-color: var(--tag-ml-bg);
    color: var(--tag-ml-text);
}


.project-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-summary {
    margin-bottom: 1.5rem;
}

.project-screenshots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.project-screenshots img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #555;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: zoom-in;
}

.project-screenshots img:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* ===== Modal / Lightbox for Screenshots ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: zoom-out;
}

.modal-overlay.visible {
    display: flex;
    /* Show when active */
}

.modal-content {
    position: relative;
    /* This container now just holds the image and lets the overlay center it. */
}

/* The image itself is now constrained by the viewport */
#modal-image {
    display: block;
    max-width: 90vw;
    /* 90% of viewport width */
    max-height: 90vh;
    /* 90% of viewport height */
    width: auto;
    height: auto;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    /* Add a subtle shadow for depth */
}

.modal-close {
    position: fixed;
    /* Always position relative to the viewport */
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 3rem;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 1010;
    /* Ensure it's on top of other modal elements */
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
    /* Make it more readable on light image backgrounds */
}

.modal-close:hover {
    color: var(--accent-color);
}

/* A class to prevent body scroll when modal is open */
body.no-scroll {
    overflow: hidden;
}

/* ===== Scroll & Hover Animations ===== */
.fade-in-section {
    opacity: 0.3;
    transform: translateY(30px);
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Centered state from scrolling */
.fade-in-section.is-visible.is-centered {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* Hover state takes precedence with a larger scale and higher z-index */
.fade-in-section.is-visible.is-hovered {
    transform: scale(1.05);
    /* Larger scale for hover */
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
    z-index: 11;
    /* Ensures it's on top of the centered card */
}

/* ===== Footer ===== */
.main-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    border-top: 2px solid var(--border-color);
    font-size: 0.9rem;
    color: #888;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .main-header h1 {
        font-size: 2.5rem;
    }

    .main-header p {
        font-size: 1rem;
    }

    .project-showcase {
        grid-template-columns: 1fr;
        padding: 0.5rem;
        gap: 1.5rem;
    }

    .project-header h2 {
        font-size: 1.8rem;
    }

    #modal-image {
        max-width: 95vw;
        /* Allow slightly larger image on smaller screens */
        max-height: 85vh;
    }

    .modal-close {
        font-size: 2.5rem;
        top: 10px;
        right: 15px;
    }
}

.site-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.25rem;
}

.site-nav a {
    font-family: 'Roboto', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9aa0a6;
    text-decoration: none;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: #ffffff;
    border-bottom-color: currentColor;
    outline: none;
}

.site-nav a[aria-current="page"] {
    color: #ffffff;
    border-bottom-color: #5c9fd6;
}