@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");

:root {
    --bg-primary: #f9fbffd0;
    --bg-secondary: #f5f0c7d0;
    --bg-header: #f1dec1b0;
    --text-primary: #1a1a1a;
    --text-secondary: #383838;
    --text-tertiary: #f2f2f2;
    --border-color: #b7b7b7af;
    --accent-color: #fd8755;
    --button-color: #4264CB;
    --about-primary: #17b76f2c;
    --about-text: #6ca057;
    --about-hover: #45cb54;
    --image-invert: invert(1)
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-header: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-tertiary: #1a1a1a;
    --border-color: #e0dfdf36;
    --accent-color: #ffcdb8;
    --button-color: #8ea3e3;
    --about-primary: #3bb37db5;
    --about-text: #9add80;
    --about-hover: #7fff8e;
    --image-invert: invert(0)
}

[data-theme="light"] .sun-icon,
[data-theme="dark"] .moon-icon {
    display: block;
}

[data-theme="light"] .moon-icon,
[data-theme="dark"] .sun-icon {
    display: none;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

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

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

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

body {
    background:
        radial-gradient(circle 70vw at 0% 0%, var(--bg-primary), var(--bg-secondary)), linear-gradient(to bottom, var(--bg-secondary), transparent);
    background-repeat: repeat;
    background-size: cover;
    min-height: 100vh;
    font-family: "Inter", sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin: 0 auto;
    color: var(--text-primary);
    transition: background 0.3s ease-in, color 0.3s ease-out;
    -webkit-tap-highlight-color: transparent;
    position: relative;

    &::before {
        content: "";
        position: absolute;
        inset: 0;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600'%3E%3Cfilter id='a'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23a)'/%3E%3C/svg%3E");
        opacity: 0.1;
        pointer-events: none;
        z-index: -1;
    }

    & h2 {
        font-size: 2.4em;
        text-align: center;
        position: sticky;
        top: 0.7em;
        width: 50vw;
        z-index: 100;
        border: 1px solid;
        border-radius: 3px;
        background: var(--bg-header);
        padding: 0.5em 0;
        margin: 0 auto 3em auto;
        backdrop-filter: blur(7px);
        -webkit-backdrop-filter: blur(7px);
    }
}

header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    background: var(--bg-header);
    border-bottom: 1px solid var(--accent-color);
    width: 100%;
    padding: 1em;

    & .language-button {
        display: flex;
        align-items: center;
        border: none;
        font-family: "Inter";
        gap: 0.35em;
        box-shadow: 0 0 1px 1px var(--text-secondary);
        border-radius: 20px;
        cursor: pointer;
        padding: 0.2em 0.9em;
        color: var(--bg-primary);
        background: var(--accent-color);
        transition: outline 0.2s ease-out, background-color 0.15s ease-in;

        &:hover {
            outline: 2px solid var(--text-secondary);
        }

        &:active {
            background-color: var(--text-primary)
        }

        & p {
            font-weight: 700;
        }
    }

    & nav {
        display: flex;
        gap: 1.3em;
        align-items: center;
        justify-content: space-evenly;

        & a {
            color: var(--text-primary);
            font-weight: 400;
            text-decoration: none;
            transition: color 0.2s;

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

        & .theme-button {
            border: none;
            background: none;
            width: 55px;
            height: 25px;
            border-radius: 25px;
            display: flex;
            align-items: center;
            margin-left: 2em;
            cursor: pointer;
            transition: all 0.3s ease-in-out;
            padding: 2px;

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

            &:active {
                background-color: var(--bg-header)
            }

            & svg {
                width: 100%;
                height: 100%;
                filter: invert(1);

                & .sun-icon,
                & .moon-icon {
                    transition: opacity 0.3s ease;
                }
            }


        }
    }
}

main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    & .text-block {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;

        & h1 {
            font-size: 3.4em;
            color: var(--text-primary);
            text-align: center;
        }

        & p {
            font-size: 1.4em;
            color: var(--accent-color);
            text-align: center;
            font-weight: 400;
        }
    }

    & a {
        color: var(--accent-color);
        opacity: 0.4;
        position: absolute;
        top: 90dvh;
        left: 50%;
        transform: translateX(-50%);
        transition: opacity 0.2s;

        &:active {
            opacity: 1;
        }

        & span {
            margin: 0 auto;
            border: none;
            animation: bounce 1s ease-in-out infinite;

            &.material-symbols-rounded {
                font-size: 5em;
            }
        }
    }
}

section.projects {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 5em;


    & article {
        overflow: hidden;
        border: 1px solid var(--border-color);
        padding: 3em 2.5em 1.5em 2.5em;
        background: color-mix(in srgb, var(--bg-header) 30%, transparent);
        box-shadow: 1px 1px 25px 5px color-mix(in srgb, var(--text-secondary) 10%, transparent);


        &:last-of-type {
            margin-bottom: 8em;
        }

        & h3 {
            font-size: 2em;
            margin-bottom: 0.5em;
        }

        & p {
            font-size: 1.15em;
            line-height: 1.6;
            max-width: 75ch;
            margin: 0.5em 0 1.4em 0;
            color: var(--text-secondary);

            & a {
                color: var(--button-color);
                text-decoration: none;
                font-weight: 600;
            }
        }

        & code {
            font-weight: 600;
            padding: 0 6px;
        }


        &:nth-of-type(odd).animated {
            animation-name: fadeInRight;
        }

        &:nth-of-type(even).animated {
            animation-name: fadeInLeft;
        }

        & .project-image {
            width: 800px;
            border-radius: 2px;
            position: relative;
            z-index: 1;
            overflow: hidden;
            margin: 2em auto 0 auto;
            transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);


            & img {
                width: 100%;
                max-height: 450px;
                object-fit: cover;
                display: block;
                position: relative;
                z-index: 2;
                cursor: pointer;
                transition: transform 0.3s ease-out;
            }

            &:hover {
                transform: translateY(-8px) scale(1.02);
                box-shadow: 2px 2px 30px 0 var(--accent-color);

                &:hover img {
                    transform: scale(1.05);
                }
            }

            &:active {
                filter: brightness(0.8);
                transform: translateY(-2px);
                box-shadow: 0 6px 15px #ffffff30;
            }
        }

        & .platforms {
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 2em auto 1em auto;
            gap: 0.9em;

            & img {
                width: 30px;
                cursor: pointer;
                filter: var(--image-invert);
                transition: all 1.2s ease-in-out;

                &:hover {
                    filter: drop-shadow(0 0 8px var(--accent-color));
                    transform: translateY(-3px);
                }
            }
        }

        & .buttons {
            display: flex;
            gap: 0.6em;
            justify-content: center;

            & a {
                display: flex;
                align-items: center;
                padding: 0.8em;
                text-decoration: none;
                border-radius: 4px;
                gap: 0.5em;
                font-weight: 700;
                transition: all 0.2s ease-in-out;
                position: relative;
                overflow: hidden;
                width: 100%;
                justify-content: center;

                &::before {
                    content: "";
                    position: absolute;
                    top: 0;
                    left: -100%;
                    width: 100%;
                    height: 100%;
                    background: linear-gradient(90deg,
                            transparent,
                            rgba(255, 255, 255, 0.3),
                            transparent);
                    transition: left 0.5s ease;
                }

                &:first-of-type {
                    background-color: var(--button-color);
                    color: var(--text-tertiary);
                }

                &:last-of-type {
                    background-color: var(--bg-primary);
                    color: var(--text-primary);
                    border: 1px solid var(--border-color);
                }

                &:hover {
                    filter: brightness(1.25);
                    transform: translateY(-2px);
                    box-shadow: 0 6px 15px #ffffff30;

                    &::before {
                        left: 100%;
                    }
                }

                &:active {
                    filter: brightness(0.4);
                }
            }

            & img {
                width: 3em;
                display: flex;
            }
        }
    }
}

.tooltip {
    position: absolute;
    background: #000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 1em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    z-index: 1000;
}

.image-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--bg-header) 80%, transparent);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-out;
}

.image-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.image-overlay img {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 0 20px #000000;
    transform: scale(0.5);
    opacity: 0;
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.image-overlay.open img {
    opacity: 1;
    transform: scale(1);
}

.image-overlay span {
    position: absolute;
    color: var(--text-primary);
    top: 35px;
    right: 30px;
    font-size: 3em;
    cursor: pointer;
    z-index: 10000;
    transition: transform 0.15s ease;
}

.image-overlay span:active {
    transform: scale(0.9);
}

section.about-me {
    padding-bottom: 6em;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 1.4em;
    width: 100%;
    padding: 1em;

    & article {
        background: radial-gradient(circle 60vw at 3% 50%, var(--about-primary), var(--bg-secondary));
        border: 1px solid var(--bg-primary);
        box-shadow: 1px 1px 25px 5px color-mix(in srgb, var(--text-secondary) 10%, transparent);
        border-radius: 3px;
        padding: 1.4em;
        width: 100%;
        max-width: 800px;
        margin: 0.7em auto;
        transition: transform 0.3s ease, border-color 0.3s ease;

        &:hover {
            transform: translateY(-5px);
            border-color: var(--about-hover);
        }

        &:nth-of-type(1) {
            display: grid;
            grid-template-columns: 180px auto;
            align-items: center;
            gap: 0.9em;

            & h3 {
                font-size: 2.3em;
            }

            & .about-me-image {
                grid-column: 1;

                & img {
                    width: 130px;
                    height: auto;
                    display: block;
                    border-radius: 50%;
                    border: 5px dotted var(--about-hover);
                }
            }
        }

        & p {
            font-size: 1.1em;
            line-height: 1.7;
            max-width: 55ch;
            text-wrap: balance;
            color: var(--text-primary);
        }

        & h3 {
            font-size: 1.8em;
            margin: 0.4em 0;
            color: var(--about-text);
        }

        & ul {
            margin: 0.6em;

            & li {
                list-style-type: none;
                padding: 0.6em 0.8em;
                background: color-mix(in srgb, var(--about-primary) 80%, transparent);
                border-radius: 10px;
                margin-bottom: 0.5em;
                transition: all 0.2s ease;

                &:hover {
                    background: rgba(23, 183, 111, 0.35);
                    transform: translateX(5px);
                }
            }
        }

        & .stats-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 0.6em;
            margin-top: 30px;

            & .stat-box {
                background: rgba(126, 201, 143, 0.15);
                padding: 20px;
                border-radius: 15px;
                text-align: center;
                border: 1px solid rgba(126, 201, 143, 0.3);
                transition: all 0.3s ease;
                cursor: default;

                &:hover {
                    transform: translateY(-5px);
                    background: #7ec98f40;
                }

                & .stat-number {
                    font-size: 2.5em;
                    font-weight: bold;
                    color: color-mix(in srgb, var(--about-text) 60%, transparent);
                    display: block;
                    margin-bottom: 5px;
                }

                & .stat-label {
                    font-size: 0.9em;
                    color: var(--text-secondary);
                    text-transform: uppercase;
                    letter-spacing: 1px;
                }
            }
        }

        & .skills-container {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 1em 0.4em;
            margin-top: 0.9em;
            font-weight: 300;

            & .skill-tag {
                border-radius: 25px;
                border: 1px solid #a2f9bd3a;
                background-color: #17b76c3f;
                text-align: center;
                padding: 0.8em 1em;
                font-size: 0.9em;
                transition: all 0.3s ease;
                cursor: default;

                &:hover {
                    background: #7ec98f4d;
                    transform: scale(1.05);
                }
            }
        }

        & .spotify-card {
            display: flex;
            align-items: center;
            background: #0f0f0f;
            border: 1px solid rgba(0, 255, 8, 0.2);
            border-radius: 14px;
            padding: 1em;
            gap: 1em;
            width: 100%;
            box-shadow: 0 0 15px rgba(255, 215, 0, 0.15);
            transition: 0.2s ease-in-out;
            position: relative;

            &:hover {
                box-shadow: 0 0 22px rgba(0, 255, 55, 0.3);
                transform: translateY(-2px);
            }

            & img {
                width: 70px;
                height: 70px;
                border-radius: 8px;
                border: 1px solid #00ff4066;
            }

            & .spotify-logo {
                position: absolute;
                top: 2%;
                right: 2%;
                width: 20px;
                border: none;
            }

            & .spotify-info {
                display: flex;
                flex-direction: column;
                gap: 0.25em;

                & .song {
                    color: #40ec6b;
                    font-weight: 600;
                    font-size: 1.05em;
                }

                & .artist {
                    color: rgba(255, 255, 255, 0.7);
                    font-size: 0.85em;
                }
            }
        }

        & .social-list {
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            gap: 0.9em;
            margin-top: 1em;
            font-weight: 300;

            & a {
                color: var(--text-primary);
                text-decoration: none;
                background-color: rgba(142, 242, 154, 0.48);
                border-radius: 25px;
                border: 1px solid #a2f9bd3a;
                padding: 0.5em 1.2em;
                display: flex;
                gap: 0.5em;
                transition: all 0.2s;

                &:hover {
                    background: #7ec98f4d;
                    transform: scale(1.1);
                }
            }

            & img {
                width: 20px;
                filter: var(--image-invert);
            }
        }
    }
}

section.contact {
    text-align: center;
    font-size: 1em;
    opacity: 0.8;

    & form {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 1.3em;
        width: 50vw;
        margin: 8em auto 0.4em auto;
        padding: 2em;
        border: 3px solid var(--border-color);
        border-radius: 3px;
        background: linear-gradient(to bottom, var(--bg-header), var(--bg-primary));
        position: relative;

        & input,
        & textarea,
        & button {
            width: 70%;
            height: 2.7em;
            border-radius: 12px;
            background: color-mix(in srgb, var(--bg-secondary) 40%, transparent);
            color: var(--text-primary);
            border: 2px solid var(--border-color);
            font-size: 1em;
            padding: 1em;
            transition: all 0.3s ease;
            text-align: center;
            font-family: "Inter";

            &:focus {
                border-color: var(--accent-color);
                background: color-mix(in srgb, var(--accent-color) 40%, transparent);
                outline: none;
            }
        }

        & textarea {
            resize: none;
            height: 10em;
        }

        & button {
            margin-top: 3em;
            height: auto;
            font-weight: 700;
            transition: transform 0.2s ease, background-color 0.3s ease;
            cursor: pointer;
            background: linear-gradient(to bottom, rgb(231, 231, 126), rgb(204, 204, 7));
            border: 2px solid var(--bg-primary);
            color: var(--text-primary);

            &:hover {
                background-color: #f6bc3e;
                transform: scale(1.03);
                border: 2px solid var(--border-color);
            }
        }
    }

    & .form-message {
        text-align: center;
        position: fixed;
        top: 0.7em;
        right: -30vh;
        padding: 1em;
        margin-top: 1em;
        border-radius: 12px;
        font-weight: 600;
        opacity: 0;
        transition: all 0.3s ease;
        pointer-events: none;
        z-index: 100;
        backdrop-filter: blur(5px);

        &.show {
            opacity: 1;
            right: 10%;
            pointer-events: all;
        }

        &.success {
            background: rgba(34, 197, 94, 0.3);
            color: #22c55e;
            border: 2px solid #22c55e;
        }

        &.error {
            background: rgba(239, 68, 68, 0.3);
            color: #ef4444;
            border: 2px solid #ef4444;

        }
    }
}

footer {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin-top: 8%;
    padding-bottom: 4em;
    gap: 0;
    opacity: 0.5;

    & p {
        font-size: 1.4em;
        color: var(--text-secondary);
    }

    & a {
        color: var(--accent-color);
        text-decoration: none;
        font-size: 0.9em;
        position: relative;
        transition: opacity 0.2s ease-in-out;

        &:active {
            opacity: 0.4;
        }

        & span.material-symbols-rounded {
            font-size: 1.4em;
            position: absolute;
        }
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    opacity: 0;
    animation: fadeIn 1.5s ease forwards;
}

@keyframes bounce {
    0% {
        transform: translateY(0);
    }

    20% {
        transform: translateY(10px);
    }

    40% {
        transform: translateY(0);
    }

    0% {
        transform: translateY(3px);
    }

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

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translate3d(100px, 0, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translate3d(-100px, 0, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.animate-on-scroll {
    opacity: 0;
    transform: translateX(-100px);
}

.animate-on-scroll.animated {
    animation-duration: 0.3s;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll:nth-child(1) {
    animation-delay: 0.1s;
}

.animate-on-scroll:nth-child(2) {
    animation-delay: 0.2s;
}

.animate-on-scroll:nth-child(3) {
    animation-delay: 0.3s;
}

.animate-on-scroll:nth-child(4) {
    animation-delay: 0.4s;
}

.animate-on-scroll:nth-child(5) {
    animation-delay: 0.5s;
}

@media screen and (max-width: 920px) {
    body {

        & h2 {
            width: 80%;
        }
    }


    header {
        padding: 1em 0;

        & nav {
            gap: 0.9em;

            & a {
                font-size: 0.9em;
            }

            & .theme-button {
                margin-left: 0.2em;
            }
        }
    }

    main {
        min-height: 100vh;

        & .text-block {

            & h1 {
                font-size: 2.2em;
            }
        }

        & a {
            & span.material-symbols-rounded {
                font-size: 2.2em;
            }
        }
    }

    section.projects {
        gap: 3em;

        & .project-image {
            max-width: 350px;

            & img {
                height: 100%;
            }
        }

        & article {

            padding: 3em 0.5em 1.5em 0.5em;

            & p {
                max-width: 40ch;
                font-size: 1em;
                line-height: 1.8;
            }

            & h3 {
                margin-bottom: 0.4em;
            }

            & .buttons {
                gap: 1em;
                margin-right: 5%;
                flex-direction: column;
                align-items: center;
            }
        }
    }

    section.about-me {

        & article {
            max-width: 100%;

            &:nth-of-type(1) {
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                text-align: center;
            }

            & .social-list {
                display: flex;
                flex-direction: column !important;
                align-items: center !important;
                justify-content: center;
                margin-top: 1em;
                font-size: 0.8em;

                & a {
                    width: 100%;
                }
            }

            & .stats-container {
                gap: 0.7em 0.3em;


                & .stat-box {
                    padding: 0.4em;

                    &:last-of-type {
                        grid-column: 1 / 3;
                    }

                    & .stat-number {
                        font-size: 2em;
                    }
                }
            }

        }

    }

    form {
        width: 90vw !important;

        & input,
        & textarea,
        & button {
            width: 100% !important;
        }
    }

    footer {
        margin-top: 14em;
    }

    footer a {
        font-size: 1.1em;
    }
}