:root {
    /* Color Palette - Premium HEX codes */
    --primary: #F9C54E;
    --secondary: #00e5ff;
    --accent: #FF6B9D;
    --javascript: #F7DF1E;
    --typescript: #007ACC;
    --react: #61DAFB;
    --vue: #4FC08D;
    --nextjs: #000000;
    --nodejs: #339933;
    --tailwindcss: #06B6D4;

    /* Backgrounds & Surfaces */
    --bg-dark: #0F1219;
    --surface: #1D212F;
    --text-main: #F2F2F2;
    --text-dim: #BFBFBF;

    /* Glassmorphism Effect */
    --glass-blur: 12px;
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-base: 16px;
    --line-height: 1.6;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Basic resets using variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
}

a {
    text-decoration: none;
    color: inherit;
}

li {
    list-style: square;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: "Zalando Sans", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings: "wdth" 100;
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    min-height: 100vh;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: linear-gradient(rgba(15, 18, 25, 0.5), rgba(15, 18, 25, 0.5)),
        url('assets/aleksandr-popov-SLXreEd0Yu4-unsplash.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(1px);
    transform: scale(1.05);
    /* Slight scale to avoid blurred edges showing white background */
}

header {
    display: flex;
    justify-content: start;
    flex: 0 0 auto;
}

main {
    flex: 1 1 auto;
    z-index: 2;
}

footer {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: flex-end;
    gap: var(--spacing-md);
    z-index: 1;

    @media (max-width: 768px) {
        grid-template-columns: 1fr;
    }
}

.footer-text {
    justify-self: start;
    background-color: rgba(255, 255, 255, 0.1);
    padding: var(--spacing-xs);
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 12px;

    @media (max-width: 768px) {
        display: none;
    }

    &.mobile-only {
        justify-self: center;
        display: block;

        @media (min-width: 769px) {
            display: none;
        }
    }
}

.bg-reference {
    justify-self: end;
    background-color: rgba(255, 255, 255, 0.1);
    padding: var(--spacing-xs);
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 12px;

    &:hover {
        background-color: rgba(255, 255, 255, 0.2);
    }

    @media (max-width: 768px) {
        justify-self: center;
    }
}

h1 {
    color: var(--primary);
    margin-bottom: 0;
    line-height: 1.2;
}

.main-heading {
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    font-weight: 900;
    color: var(--primary);

    @media (max-width: 768px) {
        font-size: 2rem;
    }
}

.content {
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.about {
    background-color: rgba(255, 255, 255, 0.1);
    padding: var(--spacing-md);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    gap: var(--spacing-md);

    @media (max-width: 768px) {
        flex-direction: column;
    }

    a {
        color: var(--primary);
        text-decoration: underline;
    }
}

.about-text-left {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    flex: 2;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    flex: 1;
}

.stack-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);

    li {
        list-style-type: none;
        padding: var(--spacing-xs);
        border-radius: 4px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(10px);
        color: white;
        font-size: 12px;
        display: flex;
        align-items: center;

        &:hover {
            transform: scale(1.1);
        }

        &.javascript {
            color: var(--javascript);
        }

        &.typescript {
            color: var(--typescript);
        }

        &.react {
            color: var(--react);
        }

        &.vue {
            color: var(--vue);
        }

        &.nextjs {
            color: var(--text-main);
        }

        &.nodejs {
            color: var(--nodejs);
        }

        &.tailwindcss {
            color: var(--tailwindcss);
        }

        span {
            margin-left: var(--spacing-xs);
            color: var(--text-main);
        }
    }
}

.projects {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);

    h2 {
        font-size: 30px;
        text-align: center;
        color: var(--primary);
        font-weight: 900;
        font-family: 'Orbitron', sans-serif;
    }
}

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

.card-wrapper {
    position: relative;
    /* Set a fixed height that matches the closed card size approximately 
       to prevent layout shift when the child becomes absolute/grows. 
       Adjust this value based on your actual content if needed. */
    height: 160px;
    /* Optional: to ensure the grid cell takes space */
    width: 100%;

    @media (hover: none) and (pointer: coarse) {
        height: auto;
    }
}

.project-card {
    background-color: rgba(255, 255, 255, 0.05);
    padding: var(--spacing-md);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);

    /* Absolute positioning logic */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* Start with auto height to fit content, but min-height to fill wrapper if needed */
    height: auto;
    min-height: 100%;

    border: 1px solid var(--glass-border);
    cursor: pointer;
    z-index: 1;

    @media (hover: none) and (pointer: coarse) {
        background-color: rgba(255, 255, 255, 0.1);
        z-index: 10;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
        position: relative;

        .full-description {
            display: block;
        }
    }
}

.project-card h3 {
    color: var(--secondary);
    font-size: 1.25rem;
}

.project-card:hover {
    background-color: rgba(255, 255, 255, 0.1);
    z-index: 10;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    /* No height change needed here as height is auto */
}

.short-description {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.full-description {
    display: none;
    /* Removed from flow entirely when not hovered */
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.4;
    margin-top: var(--spacing-xs);

    /* Animation for appearance */
    animation: fadeIn 0.3s ease forwards;
}

.project-card:hover .full-description {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.social-wrapper {
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    background-color: rgba(255, 255, 255, 0.1);
    padding: var(--spacing-sm);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.social-title {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;

    @media (max-width: 768px) {
        font-size: 1.5rem;
    }
}

.social-links {
    display: flex;
    gap: var(--spacing-sm);

    @media (max-width: 768px) {
        gap: var(--spacing-md);
    }
}

.social-links a {
    padding: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.social-links a:hover {
    background-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 107, 0.3);
    color: var(--bg-dark);
}

/* Target the svg class */
.social-icon {
    width: 20px;
    height: 20px;
    display: block;
    transition: stroke 0.3s ease;

    @media (max-width: 768px) {
        width: 30px;
        height: 30px;
    }
}