/* general */
:root {
    --header-background: #0a231766;
    --body-background: url('../images/background.png');
    --nav-background: #0a2317dd;
    --main-background: #12311fbb;
    --featured-project-background: linear-gradient(to bottom, #12311f, #0a2317);
    --button-background1: #2d5a3c;
    --button-background2: #3b7a4e;
    --body-text: #d4e6d4;
    --heading-text1: #4cd964;
    --heading-text2: #6ff286;
    --drop-shadow: rgba(0, 0, 0, 0.3);

    --dithering: radial-gradient(rgba(0, 0, 0, 0.5) 0.5px, transparent 0.5px) 0 0 /3px 3px,
        radial-gradient(rgba(0, 0, 0, 0.5) 0.5px, transparent 0.5px) 1px 1px /3px 3px,
        radial-gradient(rgba(0, 0, 0, 0.5) 0.5px, transparent 0.5px) 2px 2px /3px 3px;

    --shine: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.5) 0%, transparent 80%);
}

* {
    box-sizing: border-box
}

@keyframes titleAnimation {

    0%,
    100% {
        transform: scale(0.98);
    }

    50% {
        transform: scale(1);
    }
}

@keyframes loadIn {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes carouselAnimation {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes progressBarAnimation {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--body-background);
    background-size: cover;
    background-position-x: center;
    background-attachment: fixed;
    color: var(--body-text);
    font-family: monaco, Consolas, Lucida Console, monospace;

    &::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: var(--dithering);
        pointer-events: none;
        opacity: 0.3;
        z-index: 9998;
    }

    a {
        color: var(--heading-text1);
        text-decoration: none;
        border-bottom: 1px dotted var(--heading-text1);
        transition: all 200ms ease;

        &:hover {
            color: var(--heading-text2);
            border-bottom-color: var(--heading-text2);
        }
    }

    h2 {
        text-align: center;
        color: var(--heading-text1);
        font-size: 2rem;
        font-weight: normal;
        margin: 40px 0 20px;
        padding-bottom: 10px;
        border-bottom: 2px solid rgba(255, 255, 255, 0.1);
        font-weight: 500;
        opacity: 0.9;
        /* animation: loadIn 600ms ease-out 0.2s backwards; */
    }

    h3 {
        font-family: monaco, Consolas, Lucida Console, monospace;
        text-decoration: underline;
        margin-top: 40px;
    }

    button {
        margin: 5px 5px;
        padding: 10px 20px;
        border: none;
        border-radius: 15px;
        height: 50px;
        color: white;
        background-color: var(--button-background1);
        font-family: monaco, Consolas, Lucida Console, monospace;
        font-size: 14pt;
        transition: all 100ms ease-in-out;

        &:hover {
            cursor: pointer;
            scale: 1.05;
            background-color: var(--button-background2);
            box-shadow: 5px 5px var(--drop-shadow);
        }
    }

    .hidden {
        display: none;
    }

    p {
        line-height: 1.4;
        font-size: 1.1rem;
    }
}

header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0 auto;
    min-height: 200px;
    padding-bottom: 20px;
    /* max-width: 1200px; */
    background: var(--header-background);

    h1 {
        text-align: center;
        font-family: 'Verdana', sans-serif;
        color: var(--heading-text1);
        font-size: 3.5em;
        animation: titleAnimation 4s ease-in-out infinite;
        cursor: pointer;
        text-shadow: 2px 2px 2px var(--heading-text2);
    }

    h2 {
        text-align: center;
        color: var(--body-text);
        font-size: 2rem;
        font-weight: normal;
        margin-top: -15px;
        opacity: 0.9;
        animation: loadIn 600ms ease-out 0.2s backwards;
        border-bottom: unset;
    }
}

nav {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin: 0 auto;
    padding: 0 5px;
    min-height: 80px;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--nav-background);
    border-bottom: 2px solid var(--drop-shadow);

    .nav-buttons {
        display: flex;
        flex-direction: row;
        justify-content: left;

        button {
            height: unset;
            width: unset;
            border-radius: 0;
            text-align: left;
            padding: 10px;
            background-color: unset;

            &.active {
                background-color: var(--button-background1);
            }

            &:hover {
                scale: 1;
                background-color: var(--button-background2);
                box-shadow: none;
            }
        }
    }

    h2 {
        display: none;
        font-size: 15pt;
        margin: revert;
        padding: 0 10px;
        border: revert;
        color: var(--heading-text1);
        animation: loadIn 500ms ease-in-out forwards;
        align-self: center;
    }

    @media screen and (max-width: 740px) {
        flex-direction: column-reverse;

        .nav-buttons {
            justify-content: center;
        }
    }
}

#homeView {
    background: var(--main-background);
    backdrop-filter: blur(2px);
    max-width: 1200px;
    padding: 40px;
    margin: 20px auto;
    border-radius: 24px;
    box-shadow: 0 8px 24px var(--drop-shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);

    h1 {
        font-size: 2.5rem;
        color: var(--heading-text2);
        text-align: center;
        font-weight: 500;
        letter-spacing: -0.02em;
        position: relative;

        &::after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 20%;
            right: 20%;
            height: 3px;
            background: linear-gradient(90deg,
                    transparent,
                    var(--heading-text1),
                    var(--heading-text2),
                    transparent);
        }
    }

    .FeaturedProjects,
    .AllProjects {
        .featuredProjectsGrid {
            display: flex;
            flex-direction: column;
            gap: 20px;
            position: relative;

            .featuredProject {
                display: flex;
                flex-direction: row;
                justify-content: space-between;
                margin: 0 auto;
                padding: 0 0 0 20px;
                max-width: 1200px;
                gap: 20px;
                background: var(--featured-project-background);
                border-radius: 16px;
                overflow: hidden;
                animation: carouselAnimation 500ms ease-out;
                height: 500px;
                border: 2px solid rgba(255, 255, 255, 0.2);

                &::before {
                    content: '';
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    background: var(--shine);
                    pointer-events: none;
                    opacity: 0.3;
                    z-index: 9999;
                }

                &::after {
                    content: '';
                    position: absolute;
                    bottom: 0;
                    left: 0;
                    width: 100%;
                    height: 16px;
                    background: #fff;
                    pointer-events: none;
                    opacity: 0.3;
                    z-index: 9996;
                    animation: progressBarAnimation 10s linear;
                    border-radius: 0 0 0 16px;
                    /* corner-shape: superellipse(2); */
                }

                &:nth-child(even) {
                    flex-direction: row-reverse;
                    padding: 0 20px 0 0;

                    img {
                        mask-image: linear-gradient(to right, var(--featured-project-background) 70%, transparent 100%);
                    }
                }

                .featuredProjectDetails {
                    flex: 2;

                    h2 {
                        margin-bottom: 0;
                    }

                    .featuredProjectYearCategory {
                        display: flex;
                        justify-content: space-around;
                        flex-direction: row;

                        background: rgba(255, 255, 255, 0.1);

                        p {
                            flex: 1;
                            padding-left: 4px;
                            margin: 0;
                        }
                    }
                }

                .featuredProjectScreenshotContainer {
                    position: relative;

                    img {
                        width: 500px;
                        height: 500px;
                        object-fit: fill;
                        aspect-ratio: 1 / 1;
                        mask-image: linear-gradient(to left, var(--featured-project-background) 70%, transparent 100%);
                    }

                    button {
                        position: absolute;
                        bottom: 0;
                        left: 50%;
                        transform: translateX(-50%);
                        margin-bottom: 4px;
                    }
                }
            }

            .leftArrow,
            .rightArrow {
                cursor: pointer;
                position: absolute;
                top: 50%;
                width: auto;
                padding: 16px;
                margin-top: -22px;
                color: white;
                font-weight: bold;
                font-size: 18px;
                transition: 0.6s ease;
                border-radius: 0 3px 3px 0;
                user-select: none;
                background-color: rgba(0, 0, 0, 0.1);

                &:hover {
                    background-color: rgba(0, 0, 0, 0.8);
                }

                &.rightArrow {
                    right: 0;
                    border-radius: 3px 0 0 3px;
                }
            }

            .dots {
                position: absolute;
                bottom: 0;
                left: 50%;
                translate: -50% 0;
                display: flex;
                justify-content: center;
                padding-bottom: 8px;
                z-index: 9997;

                .dot {
                    cursor: pointer;
                    height: 16px;
                    width: 16px;
                    margin: 0 2px;
                    background-color: #717171;
                    border-radius: 50%;
                    display: inline-block;
                    transition: background-color 0.6s ease;
                }

                .active,
                .dot:hover {
                    background-color: #bbb;
                }
            }
        }

        .projectsGrid {
            width: 100%;
            margin: 0 auto;
            padding: 0 20px;
            max-width: 1200px;
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            grid-template-rows: auto;
            grid-gap: 20px;

            .project {
                position: relative;
                aspect-ratio: 800 / 340;
                width: 100%;
                border-radius: 16px;
                /* corner-shape: superellipse(2); */
                transition: all 200ms ease-in-out;
                border: 2px solid rgba(255, 255, 255, 0.2);
                animation: loadIn 500ms ease-out;
                animation-fill-mode: backwards;
                background-color: var(--button-background1);

                img {
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                    border-radius: 16px;
                    font-size: 14pt;
                    text-align: center;
                    align-content: center;
                    z-index: 1;
                    /* corner-shape: superellipse(2); */
                }

                .year,
                .category {
                    position: absolute;
                    top: 0;
                    left: 0;
                    padding: 4px 8px;
                    background: #0a2317cc;
                    border-radius: 16px 0 8px 0;
                    /* corner-shape: superellipse(2); */
                    font-size: 0.8rem;
                    font-weight: 500;
                    color: var(--body-text);
                    z-index: 2;

                    &.category {
                        top: auto;
                        bottom: 0;
                        left: auto;
                        right: 0;
                        border-radius: 8px 0 16px 0;
                    }
                }

                &:hover {
                    cursor: pointer;
                    scale: 1.05;
                    transform: translateY(-8px);
                    box-shadow: 0px 8px 16px var(--drop-shadow);
                    border: 2px solid white;
                }
            }

            .link-img:focus-visible,
            button:focus-visible {
                outline: 3px solid var(--heading-text2);
                outline-offset: 3px;
            }
        }
    }

    @media screen and (max-width: 1200px) {
        .FeaturedProjects .featuredProject .featuredProjectDetails {
            overflow: scroll;
        }
    }

    @media screen and (max-width: 900px) {
        .FeaturedProjects {
            display: none;
        }
    }
}

#aboutView {
    background: var(--main-background);
    max-width: 1200px;
    padding: 40px;
    margin: 20px auto;
    border-radius: 24px;
    box-shadow: 0 8px 24px var(--drop-shadow);
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.05);

    h1 {
        font-size: 2.5rem;
        color: var(--heading-text2);
        text-align: center;
        font-weight: 500;
        letter-spacing: -0.02em;
        position: relative;

        &::after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 20%;
            right: 20%;
            height: 3px;
            background: linear-gradient(90deg,
                    transparent,
                    var(--heading-text1),
                    var(--heading-text2),
                    transparent);
        }
    }

    .table-of-contents>ul {
        margin: 30px 0;
        background: rgba(0, 0, 0, 0.2);
        padding: 30px 30px 30px 50px;
        border-radius: 16px;
        border-left: 4px solid var(--heading-text1);
        columns: 1;

        >li {
            font-size: 1.2rem;
            font-weight: bold;
            margin: 15px 0;

            &::marker {
                color: var(--heading-text2);
            }
        }

        ul {
            margin-top: 10px;
            columns: 2;

            li {
                font-weight: normal;
                font-size: 1rem;

                a {
                    color: var(--body-text);

                    &:hover {
                        color: var(--heading-text1);
                        padding-left: 5px;
                    }
                }
            }
        }
    }

    .about-project {
        h3 {
            font-size: 1.5rem;
            margin: 30px 0 15px;
            font-weight: 500;
        }

        img {
            display: block;
            border-radius: 16px;
            /* corner-shape: superellipse(2); */
            max-width: 100%;
            max-height: 200px;
            margin-right: 20px;
            margin-bottom: 10px;
        }

        ul,
        ol {
            columns: 2;
        }
    }

    @media screen and (max-width: 768px) {
        padding: 24px;
        margin: 16px 12px;
        border-radius: 20px;

        >ol:first-of-type {
            padding: 20px 20px 20px 40px;

            >li {
                font-size: 1.1rem;

                ul {
                    columns: 1;
                }
            }
        }

        ul,
        ol {
            columns: 1;
        }
    }

    @media screen and (max-width: 480px) {
        padding: 16px;

        ul,
        ol {
            padding-left: 20px;
        }

        >ol:first-of-type {
            padding: 15px 15px 15px 30px;

            ul {
                padding-left: 15px;
            }
        }
    }
}

/* transition for showing/hiding */
#aboutView,
#homeView {
    animation: loadIn 500ms ease-out;

    &.hidden {
        display: none;
    }
}

footer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    background: var(--nav-background);

    h3 {
        margin: 0;
        font-weight: normal;
        font-size: 1rem;
        opacity: 0.8;
    }
}

#homeView .projectsGrid .link-img {
    &:nth-child(1) {
        animation-delay: 0s;
    }

    &:nth-child(2) {
        animation-delay: 0.1s;
    }

    &:nth-child(3) {
        animation-delay: 0.2s;
    }

    &:nth-child(4) {
        animation-delay: 0.3s;
    }

    &:nth-child(5) {
        animation-delay: 0.4s;
    }

    &:nth-child(6) {
        animation-delay: 0.5s;
    }

    &:nth-child(7) {
        animation-delay: 0.6s;
    }

    &:nth-child(8) {
        animation-delay: 0.7s;
    }

    &:nth-child(9) {
        animation-delay: 0.8s;
    }

    &:nth-child(10) {
        animation-delay: 0.9s;
    }

    &:nth-child(11) {
        animation-delay: 1s;
    }

    &:nth-child(12) {
        animation-delay: 1.1s;
    }

    &:nth-child(13) {
        animation-delay: 1.2s;
    }

    &:nth-child(14) {
        animation-delay: 1.3s;
    }

    &:nth-child(15) {
        animation-delay: 1.4s;
    }

    &:nth-child(16) {
        animation-delay: 1.5s;
    }

    &:nth-child(17) {
        animation-delay: 1.6s;
    }

    &:nth-child(18) {
        animation-delay: 1.7s;
    }

    &:nth-child(19) {
        animation-delay: 1.8s;
    }

    &:nth-child(20) {
        animation-delay: 1.9s;
    }

    &:nth-child(21) {
        animation-delay: 2s;
    }

    &:nth-child(22) {
        animation-delay: 2.1s;
    }

    &:nth-child(23) {
        animation-delay: 2.2s;
    }

    &:nth-child(24) {
        animation-delay: 2.3s;
    }

    &:nth-child(25) {
        animation-delay: 2.4s;
    }

    &:nth-child(26) {
        animation-delay: 2.5s;
    }

    &:nth-child(27) {
        animation-delay: 2.6s;
    }

    &:nth-child(28) {
        animation-delay: 2.7s;
    }

    &:nth-child(29) {
        animation-delay: 2.8s;
    }

    &:nth-child(30) {
        animation-delay: 2.9s;
    }
}