:root,
body.dark {
    --background: #060b17;
    --header-edge: #ffffff1a;
    --element-edge: 3px solid #ffffff1a;
    --element-edge-hover: 3px solid #ffffff44;
    --project-gradient-start: #000000e4;
    --project-gradient-end: #00000037;
    --table-outline: 2px solid #4e4e4e;
    --table-even: #091124;
    --table-header: #0d1e45;
    --tag-background: #11151ea8;
    --code-background: #0a0c13;
    --page-width: 980px;
    --text: #eee;
    --text-big: #6faeff;
    --text-semi: #bababa;
    --accent: #6faeff;
    --font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --transition: all 0.2s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    font-family: var(--font);
    transition: var(--transition);
    line-height: 1.7;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--code-background);
}

a {
    color: var(--accent);
    text-decoration: none;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        interpolate-size: allow-keywords;
    }
}

body {
    -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

p {
    text-wrap: pretty;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    text-wrap: balance;
}

table {
    border-collapse: collapse;
    width: 100%;
    margin: 20px 0;
}

td,
th {
    border: var(--table-outline);
    padding: 8px;
}

tr:nth-child(even) {
    background-color: var(--table-even);
}

th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: left;
    background-color: var(--table-header);
    color: var(--text);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--accent);
    border-radius: 10px;
}

*::-webkit-scrollbar-track {
    border-radius: 10px;
    background-color: var(--code-background);
}

body {
    background: var(--background);
    color: var(--text);
    display: flex;
    align-items: center;
    flex-direction: column;
    min-height: 100dvh;
    transition: var(--transition);

    header {
        z-index: 100;
        position: fixed;
        display: flex;
        justify-content: center;
        width: 100%;
        padding: 0px 20px;
        height: 90px;
        background-color: var(--background-header);

        .backdrop {
            position: absolute;
            inset: 0;
            height: 200%;
            background: linear-gradient(to bottom, var(--background) 0%, transparent 90%);
            backdrop-filter: blur(16px) saturate(150%);
            mask-image: linear-gradient(to bottom, black 0% 50%, transparent 50% 100%);
            pointer-events: none;
            transition: var(--transition);
        }

        .backdropEdge {
            --thickness: 3px;
            position: absolute;
            inset: 0;
            height: 100%;
            transform: translateY(100%);
            background: var(--header-edge);
            backdrop-filter: blur(8px) brightness(130%);
            pointer-events: none;
            mask-composite: intersect;
            mask-image:
                linear-gradient(to bottom, black 0, black var(--thickness), transparent var(--thickness)),
                linear-gradient(to right, transparent 10%, black 50%, transparent 90%);
        }

        .container {
            display: flex;
            position: relative;
            justify-content: space-between;
            align-items: center;
            width: var(--page-width);
            max-width: 100%;
            height: 100%;

            #navTitleButton {
                font-size: 1.5rem;
                height: 100%;
                font-weight: 600;
                color: var(--text);
                border: none;
                background: none;
                display: flex;
                align-items: center;


                &:hover {
                    cursor: pointer;
                }

                img {
                    max-height: 48px;
                    margin-right: 8px;
                    vertical-align: middle;
                }
            }

            svg {
                fill: var(--text);
                width: 18px;
                height: 18px;
            }

            nav {
                display: flex;
                flex-direction: row;
                gap: 10px;

                button {
                    border: none;
                    background: none;
                    padding: 6px 12px;
                    width: 60px;
                    color: var(--text);
                    transition: var(--transition);
                    display: flex;
                    align-items: center;
                    justify-content: center;

                    &.active {
                        font-weight: 700;
                    }

                    &:hover {
                        cursor: pointer;
                        color: var(--accent);
                    }
                }
            }
        }
    }

    .banner {
        position: absolute;
        width: 100%;
        z-index: 1;
        top: 80px;
        height: max-content;
        background: var(--background);
        transition: 0.2s ease top;
        animation: parallax linear;
        animation-timeline: scroll();
        transition: opacity 0.5s ease-in-out;

        img {
            width: 100%;
            display: block;
            height: auto;
        }

        #projectBanner {
            width: 100%;
            display: block;
            height: 600px;
            object-fit: cover;
            opacity: 0.4 !important;
            transition: var(--transition);
        }

        .overlay {
            position: absolute;
            margin-bottom: -1px;
            inset: 0;
            background-color: var(--background);
            mask-image: linear-gradient(to bottom, #0008 0%, #000 90%);
            transition: var(--transition);
        }
    }

    main {
        z-index: 2;
        flex: 1;
        width: var(--page-width);
        max-width: 100%;
        padding: 200px 0px 150px 0px;
        margin: 0px;

        .center {
            display: block;
            margin: auto;
            width: 100%;
            text-align: center;
        }

        #about {
            display: flex;
            flex-direction: row;
            width: 100%;
            padding: 0;
            margin: 0;

            img {
                border-radius: 16px;
                border: var(--element-edge);
            }

            .skills {
                display: flex;
                flex-direction: column;

                .links {
                    padding-top: 16px;
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    align-items: center;
                    gap: 8px;

                    a {
                        display: flex;
                        flex-direction: row;
                        align-items: center;
                        justify-content: center;
                        gap: 8px;
                        width: 60%;
                        border-radius: 8px;
                        border: var(--element-edge);
                        background-color: var(--background);
                        color: var(--text);
                        padding: 4px 8px;
                        transition: var(--transition);
                        background-color: var(--tag-background);


                        svg {
                            width: 22px;
                            height: 22px;
                            fill: var(--text);
                        }

                        &:hover {
                            cursor: pointer;
                            border: var(--element-edge-hover);
                            transition: var(--transition);
                            color: var(--accent);

                            svg {
                                fill: var(--accent);
                            }
                        }
                    }

                }
            }

            h2 {
                padding: 16px 0px 8px 0px;
            }

            .info {
                width: 150%;

                h1 {
                    font-size: 50px;
                }

                .experience-link {
                    color: var(--accent);
                    text-decoration: none;
                    font-weight: 600;
                    font-size: 24px;

                    &:hover {
                        color: var(--accent);
                        text-decoration: underline;
                    }
                }

                date {
                    color: var(--text-semi);
                    font-size: 12px;
                }
            }
        }

        .title {
            .nameTitle {
                font-size: 6rem;
                color: var(--text);
            }

            p {
                margin-top: -10px;
                font-size: 1.5rem;
                color: var(--text-semi);

                &.jobTitle {
                    margin-top: -30px;
                }
            }

            img {
                display: block;
                margin: 20px auto 0 auto;
                width: 96px;
                height: 96px;
                border-radius: 16px;
            }
        }

        .hiddenProjects{
            margin-bottom: -20px !important;
        }

        .projects,
        .hiddenProjects {
            margin-top: 100px;
            margin-bottom: 100px;
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            justify-content: center;

            .projectCard {
                position: relative;
                grid-template-rows: 1fr;
                display: grid;
                border-radius: 12px;
                transition: var(--transition);
                width: 30rem;
                height: 18rem;
                overflow: hidden;
                border: var(--element-edge);

                &.hidden {
                    opacity: 0.6;
                    pointer-events: none;
                    filter: grayscale(0.1) blur(1px);
                }

                &:hover {
                    cursor: pointer;
                    border: var(--element-edge-hover);

                    .projectCover {
                        scale: 1.04;
                        z-index: -1;
                    }

                    &:active {
                        img {
                            scale: 1;
                        }
                    }
                }

                .background {
                    background: linear-gradient(to right, var(--project-gradient-start) 30%, var(--project-gradient-end) 90%);
                    display: inline-grid;
                    grid-column-start: 1;
                    grid-row-start: 1;
                    z-index: -1;
                }

                .projectCover {
                    position: absolute;
                    inset: 0;
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                    z-index: -2;
                }

                .projectNameLogo {
                    width: 250px;
                    height: auto;
                }

                .info {
                    display: grid;
                    grid-template-rows: auto 1fr auto;
                    grid-column-start: 1;
                    grid-row-start: 1;
                    padding: 20px;
                    gap: 10px;

                    h2 {
                        margin: 0;
                        font-size: 1.5rem;
                        align-self: start;
                    }

                    p {
                        max-width: 70%;
                        color: var(--text-semi);
                        font-size: 0.8rem;
                        align-self: start;
                    }

                    .tags {
                        display: flex;
                        flex-wrap: wrap;
                        gap: 4px;
                        align-self: end;
                    }

                    .tag {
                        font-size: 0.7rem;
                        color: var(--text-semi);
                        background: var(--tag-background);
                        border: var(--element-edge);
                        backdrop-filter: blur(8px) saturate(150%);
                        padding: 4px 8px;
                        border-radius: 8px;
                        width: fit-content;
                    }
                }

            }
        }

        .toolButton {
            border: var(--element-edge);
            border-radius: 12px;
            color: var(--text);
            background: none;
            padding: 6px 12px;
            margin: 4px 2px;

            &:hover {
                cursor: pointer;
                border: var(--element-edge-hover);
                scale: 1.02;

                &:active {
                    scale: 1;
                }
            }
        }
    }

    #modalContainer {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        pointer-events: none;
        transition: var(--transition);

        background: #000000aa;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 200;

        #modalImage {
            max-width: 90%;
            max-height: 80%;
            border-radius: 6px;
            opacity: 0;
            scale: 0.95;
            transition: all 0.2s ease-out;
        }

        &.open {
            opacity: 1;
            pointer-events: auto;

            #modalImage {
                opacity: 1;
                scale: 1;
            }
        }

        #closeModal {
            position: absolute;
            top: 16px;
            right: 20px;
            width: 40px;
            height: 40px;
            background: none;
            border: none;
            display: flex;
            justify-content: center;
            align-items: center;
            color: var(--text);
            font-size: 1.5rem;

            &:hover {
                cursor: pointer;
                color: var(--accent);
                scale: 1.2;

                &:active {
                    scale: 1;
                }
            }
        }
    }

    .project {
        display: grid;
        grid-template-columns: minmax(0, var(--page-width)) 240px;
        grid-template-rows: auto 1fr;
        grid-template-areas: "header header" "content toc";
        justify-content: center;
        gap: 32px;
        align-items: start;
        max-width: var(--page-width);
        flex: 1;

        .projectHeader {
            grid-area: header;
            width: 100%;
            z-index: 2;
            padding: 150px 0 100px 0;

            .nameTitle {
                font-size: 4rem;
                text-align: center;
                font-weight: bold;
                color: var(--text-big);

                .small {
                    font-size: 2rem;
                    color: var(--text-semi);
                }
            }

            .projectNameLogo {
                display: block;
                margin: 0px auto 0 auto;
                width: auto;
                height: 300px;
            }

            .description {
                margin-top: -10px;
                font-size: 1.2rem;
                color: var(--text-semi);
                text-align: center;
            }
        }

        .markdownOutput {
            flex: 1;
            z-index: 2;
            padding: 0px 0 0px 0;
            margin: -40px 0 0 0;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 10px;

            h1,
            h2,
            h3 {
                scroll-margin-top: 150px;
                margin-top: 32px;
                position: relative;
                cursor: pointer;
                color: var(--text-big);

                &::before {
                    content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3e%3cpath fill='%23bababa' d='M20 2H10c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 12H10V4h10z'/%3e%3cpath fill='%23bababa' d='M14 20H4V10h2V8H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-2h-2z'/%3e%3c/svg%3e");
                    left: -10px;
                    padding-right: 10px;
                    color: var(--text-semi);
                    position: absolute;
                    transition: var(--transition);
                    opacity: 0;
                }

                &:hover {
                    &::before {
                        left: -25px;
                        transition: var(--transition);
                        opacity: 1;
                    }
                }
            }

            img {
                border-radius: 6px;
                margin: 10px 0px 10px 0px;
                cursor: pointer;
            }

            code {
                border-radius: 6px;
                background: var(--code-background);
                font-family: monospace;

                * {
                    font-family: monospace;
                }
            }
        }

        .tableOfContents {
            grid-area: toc;
            position: sticky;
            top: 150px;
            align-self: start;
            width: 300px;
            height: fit-content;
            z-index: 3;
            border-radius: 12px;

            h3 {
                margin-top: 0;
                font-size: 1.2rem;
                margin-bottom: 10px;
            }

            ul {
                list-style: none;
                padding-left: 0;

                li {
                    margin-bottom: 4px;

                    a {
                        color: var(--text);
                        text-decoration: none;

                        &:hover {
                            color: var(--accent);
                        }
                    }
                }
            }
        }
    }

    footer {
        width: 100%;
        padding: 10px;
        text-align: center;
        color: var(--text-semi);
        font-size: 0.9rem;
        margin-top: 50px;

        .links {
            display: flex;
            justify-content: center;
            gap: 10px;

            a {
                color: var(--text-semi);
                text-decoration: none;

                svg {
                    fill: var(--text-semi);
                    width: 24px;
                    height: 24px;
                }

                &:hover {
                    scale: 1.1;

                    &:active {
                        scale: 1;
                    }

                    svg {
                        fill: var(--accent);
                    }
                }
            }
        }
    }
}

@keyframes parallax {
    to {
        transform: translateY(500px);
    }
}

@media screen and (max-width: 768px) {
    body {
        header {
            height: 70px;

            .container {
                #navTitleButton {
                    font-size: 1.2rem;

                    img {
                        max-height: 36px;
                        margin-right: 4px;
                    }
                }

                nav {
                    button {
                        width: 50px;
                        padding: 4px 8px;
                        font-size: 0.9rem;
                    }
                }
            }
        }

        .banner {
            top: 70px;
        }

        main {

            #about {
                display: flex;
                flex-direction: column-reverse;
                align-items: flex-start;
                gap: 16px;

                img {
                    width: 150px;
                    height: 200px;
                    object-fit: cover;
                }

                .info {
                    width: auto;
                    flex: 1 1 auto;
                }

                .skills {
                    width: 100%;
                    flex-direction: row;

                    .links {
                        align-items: flex-start;
                        padding: 10px 30px;
                        width: 100%;

                        a {
                            width: 100%;
                        }
                    }
                }
            }

            width: 90%;
            padding: 100px 0px 0px 0px;

            .nameTitle {
                font-size: 4rem;
            }

            p {
                font-size: 1.2rem;

                &.jobTitle {
                    margin-top: -20px;
                }
            }

            .projects,
            .hiddenProjects {
                margin-top: 100px;
                width: 100%;
                justify-content: center;

                .projectCard {
                    height: 220px;

                    .background {
                        background: linear-gradient(to right, var(--project-gradient-start) 30%, var(--project-gradient-end) 100%);
                    }

                    .projectNameLogo {
                        width: 150px;
                        height: auto;
                    }

                    .info {
                        h2 {
                            font-size: 1.2rem;
                        }

                        p {
                            font-size: 0.7rem;
                        }

                        .tag {
                            font-size: 0.6rem;
                        }
                    }
                }
            }
        }

        .project {
            display: flex;
            flex-direction: column;
            padding: 10px;
            grid-template-columns: none;
            grid-template-rows: auto auto auto;
            grid-template-areas:
                "header"
                "content"
                "toc";
            width: 100%;

            .projectHeader {
                padding: 100px 0 0px 0;

                .nameTitle {
                    font-size: 2rem !important;
                    line-height: 1;
                }

                .projectNameLogo {
                    width: 90%;
                    height: auto;
                }

                .description {
                    margin-top: 10px;
                    font-size: 0.9rem;
                }
            }

            .markdownOutput {
                margin: 0px 0 0 0;
                padding: 0px 0 0px 0;

                h1,
                h2,
                h3 {
                    scroll-margin-top: 100px;
                    align-self: center;
                }

                p {
                    font-size: 0.8rem;
                }

                img {
                    max-width: 95dvw;
                    height: auto;
                }

                pre {
                    font-size: 0.7rem;
                    text-overflow: wrap;
                    max-height: 40dvh;
                    max-width: 95dvw;
                    box-sizing: border-box;
                    overflow-y: scroll;
                }
            }

            .tableOfContents {
                display: none;
            }
        }
    }

}