@import url("https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap");

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

:root {
    /* Light theme (default) */
    --background-color: #f1f1f1;
    --card-background-color: #ffffff;
    --text-color: #333;
    --gray-text-color: #888;
    --light-text-color: #ebebeb;
    --accent-color: #53ff70;
    --accent-hover-color: #12cd2b;
    --button-text-color: #0a5c17; /* Darker green for button text */
    --button-hover-text-color: #0a5c17; /* Text color for button hover state */
    --border-color: #dbdbdb;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --profile-shadow: 0px 26px 7px rgba(0, 0, 0, 0.01),
        0px 17px 7px rgba(0, 0, 0, 0.04), 0px 10px 6px rgba(0, 0, 0, 0.15),
        0px 4px 4px rgba(0, 0, 0, 0.26);
    --profile-hover-shadow: 0 0 20px rgba(83, 255, 112, 0.7);
    --icon-filter: none; /* No filter for icons in light mode */
    --button-icon-filter: brightness(0.5); /* Darken button icon */
    --primary-font: "Geist Sans", sans-serif;

    /* Common colors */
    --dark-background-color: #1b1b1b;
    --light-background-color: #f1f1f1;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #121212;
        --card-background-color: #1e1e1e;
        --text-color: #f1f1f1;
        --gray-text-color: #aaaaaa;
        --light-text-color: #ebebeb;
        --accent-color: #53ff70;
        --accent-hover-color: #12cd2b;
        --button-text-color: #0a3c10; /* Even darker green for button text in dark mode */
        --button-hover-text-color: #0a3c10; /* Text color for button hover state in dark mode */
        --border-color: #333333;
        --shadow-color: rgba(0, 0, 0, 0.2);
        --profile-shadow: 0px 10px 15px rgba(0, 255, 85, 0.1),
            0px 15px 20px rgba(0, 255, 85, 0.05),
            0px 5px 10px rgba(0, 255, 85, 0.15),
            0px 2px 5px rgba(0, 255, 85, 0.2);
        --profile-hover-shadow: 0 0 25px rgba(83, 255, 112, 0.5);
        --icon-filter: invert(1) brightness(1.5); /* Invert and brighten icons for dark mode */
        --button-icon-filter: brightness(
            0.4
        ); /* Darken button icon more in dark mode */
    }
}

::-webkit-scrollbar {
    width: 0.5em;
}

::-webkit-scrollbar-track {
    background: rgb(0, 0, 0);
}

::-webkit-scrollbar-thumb {
    border-radius: 5px;
    background: rgb(125, 125, 125);
}

::selection {
    background: var(--dark-text-color);
    color: rgb(203, 203, 203);
}

.geist-700 {
    font-family: "Geist", sans-serif;
    font-optical-sizing: auto;
    font-weight: 700;
    font-style: normal;
    letter-spacing: -1.2px;
}
.geist-400 {
    font-family: "Geist", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    letter-spacing: -0.6px;
    font-size: clamp(1rem, 1.5vw, 1.5rem);
}

#logo {
    width: 30px;
    cursor: pointer;
    transform-origin: center;
}

.logo-fill {
    fill: var(--text-color);
    transition: fill 0.3s ease;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    /* Add safe area insets for modern mobile devices */
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
        env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin: 0.5em auto;
    padding: 0.75rem 2rem;
    max-width: 1200px;
    width: 90%;
    border-radius: 18px;
    flex-shrink: 0;

    background-color: var(--card-background-color);
    transition: background-color 0.3s ease, color 0.3s ease;

    & nav {
        display: flex;
        gap: 1rem;
    }

    & a {
        color: var(--gray-text-color);
        text-decoration: none;
        display: flex;
        align-items: center;
        justify-content: center;

        & img {
            filter: var(--icon-filter);
            transition: filter 0.3s ease;
            margin-right: 0.5em;
            width: 16px;
        }

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

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1em;
    margin: 0.5em auto;
    max-width: 1200px;
    width: 90%;
    height: calc(100% - 80px);
    flex: 1;
    overflow: hidden;
}

@media screen and (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
    }

    main {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
        margin-bottom: 1em;
        padding-left: max(
            20px,
            env(safe-area-inset-left)
        ); /* Add safe area padding */
        padding-right: max(
            20px,
            env(safe-area-inset-right)
        ); /* Add safe area padding */
        width: 100%; /* Ensure full width */
    }

    header {
        flex-direction: column;
        padding: 0.75rem;
    }

    section {
        padding: 1rem;
        height: auto;
        overflow: visible;
    }

    .left_section {
        margin-bottom: 0.75em;
        opacity: 1 !important; /* Force visibility on mobile */
        transform: none !important; /* Reset any transforms */
        display: flex !important; /* Ensure display is flex */
        visibility: visible !important; /* Ensure visibility */
        padding-left: max(
            1rem,
            env(safe-area-inset-left)
        ); /* Add safe area padding */
        padding-right: max(
            1rem,
            env(safe-area-inset-right)
        ); /* Add safe area padding */
    }

    .right_section {
        height: auto !important;
        gap: 0.75em !important;
    }

    .right_section .project_1,
    .right_section .project_2 {
        min-height: 150px;
    }

    .testimonial {
        margin-block: 0.5em !important;
        padding: 1em !important;
    }

    .testimonial q {
        font-size: 0.9rem !important;
        padding: 0.5em !important;
        line-height: 1 !important;
        text-align: center !important;
    }

    .testimonial-info {
        flex-direction: column !important;
        text-align: center !important;
        padding: 0.5em !important;
    }

    .testimonial-info img {
        width: 35px !important;
        height: 35px !important;
    }
}

section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 18px;
    height: 100%;
    overflow: hidden;

    &.left_section {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: start;
        height: 100%;
        background-color: var(--card-background-color);
        transition: background-color 0.3s ease, color 0.3s ease,
            transform 0.5s ease, opacity 0.5s ease;
        padding: 1.5rem 2rem;
        overflow-y: hidden;
        gap: 0.75em;
        transform-origin: center left;
        will-change: transform, opacity;
        opacity: 0;

        & .org-info {
            letter-spacing: -0.5px;
            display: inline-flex;
            align-items: start;
            justify-content: center;
            font-size: clamp(0.8rem, 1vw, 1rem);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            gap: 0.1em;

            & div {
                display: flex;
            }

            & img {
                filter: var(--icon-filter);
                transition: filter 0.3s ease;
            }
        }

        & .title-and-image {
            display: flex;
            gap: 0.5em;
            align-items: center;
            justify-content: center;
            font-size: clamp(1.8rem, 2vw, 2rem);
            margin-bottom: 0.5em;

            & img {
                border-radius: 13px;
                border: 5px solid var(--background-color);
                aspect-ratio: 1/1;
                object-fit: cover;
                object-position: center;
                transform: rotate(-5deg);
                box-shadow: var(--profile-shadow);
                cursor: pointer;
                transition: transform 0.3s ease, box-shadow 0.3s ease;
                transform-origin: center;
                display: block !important;
                visibility: visible !important;
                opacity: 1 !important;
            }
        }

        & h2 {
            font-size: clamp(1.5rem, 2vw, 2rem);
        }

        & .contact-button {
            display: flex;
            align-items: center;
            gap: 0.25em;
            justify-content: center;
            background-color: var(--accent-color);
            color: var(--button-text-color);
            transition: background-color 0.3s ease, color 0.3s ease,
                transform 0.3s ease, box-shadow 0.3s ease;
            border: none;
            border-radius: 10px;
            padding: 0.5em 1em;
            font-size: clamp(1rem, 1.5vw, 1.5rem);
            cursor: pointer;
            opacity: 0;
            transform: scale(0.8);
            transition: all 0.2s ease-in-out;
            box-shadow: 0px 26px 7px rgba(77, 255, 130, 0.01),
                0px 17px 7px rgba(77, 255, 130, 0.04),
                0px 10px 6px rgba(77, 255, 130, 0.15),
                0px 4px 4px rgba(77, 255, 130, 0.26);

            & img {
                filter: var(--button-icon-filter);
                width: 20px;
                transition: filter 0.3s ease;
            }

            &:active {
                transform: scale(0.95);
            }

            &:hover {
                background-color: var(--accent-hover-color);
                color: var(--button-hover-text-color);
                box-shadow: 0px 26px 7px rgba(77, 255, 130, 0.01),
                    0px 17px 7px rgba(77, 255, 130, 0.04),
                    0px 10px 6px rgba(77, 255, 130, 0.15),
                    0px 4px 4px rgba(77, 255, 130, 0.26);
            }
        }

        & .tools {
            margin-top: 1rem;
            display: flex;
            flex-direction: column;
            gap: 0.5em;
            opacity: 1;

            & ul {
                list-style: none;
                padding: 0;
                margin: 0;
                display: flex;
                flex-wrap: wrap;
                gap: 0.5em;
            }

            & li {
                color: var(--gray-text-color);
                border: 0.5px solid var(--border-color);
                padding: 0.5em 1em;
                border-radius: 10px;
                font-size: clamp(0.5rem, 1.5vw, 0.8rem);
                display: flex;
                align-items: center;
                width: auto;
                text-align: center;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                transition: all 0.2s ease-in-out;
                cursor: default;
                opacity: 0;
                transform: translateX(-20px);

                &:hover {
                    background-color: var(--dark-background-color);
                    color: var(--light-text-color);
                }

                & img {
                    width: 1.5em;
                    margin-right: 0.5em;
                    filter: var(--icon-filter);
                    transition: filter 0.3s ease;
                }
            }
        }

        & .testimonials-container {
            margin-block: 2rem;
            position: relative;
            height: 200px;
            width: 100%;
            overflow: hidden;
            cursor: pointer;
            will-change: contents;
        }

        & .testimonial {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0;
            visibility: hidden;
            transform: translateX(50px);
            pointer-events: none;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 0.5em;
            background-color: var(--background-color);
            transition: background-color 0.3s ease, color 0.3s ease;
            border-radius: 10px;
            padding: 1em;
            border: 0.5px solid var(--border-color);

            will-change: opacity, transform, visibility;

            &.active {
                opacity: 1;
                visibility: visible;
                transform: translateX(0);
                pointer-events: auto;
                z-index: 1;
            }

            & q {
                color: var(--gray-text-color);
                font-size: clamp(0.8rem, 1vw, 1rem);
                line-height: 1.4;
                letter-spacing: -0.5px;
                flex: 1;
                display: block;
                position: relative;
                padding: 1em 1.5em;
                height: auto;
                margin: 0;
                overflow: visible;

                &::before {
                    content: "\201C"; /* Opening quote mark */
                    font-size: 3em;
                    position: absolute;
                    left: 0;
                    top: -0.2em;
                    color: var(--border-color);
                    font-family: serif;
                    line-height: 1;
                }

                &::after {
                    content: "\201D"; /* Closing quote mark */
                    font-size: 3em;
                    position: absolute;
                    right: 0.1em;
                    bottom: -0.2em;
                    color: var(--border-color);
                    font-family: serif;
                    line-height: 0;
                }
            }

            & .testimonial-info {
                margin-top: 0.75em;
                display: flex;
                gap: 0.75em;
                align-items: center;
                font-size: clamp(0.7rem, 1.2vw, 0.9rem);
                padding: 0.75em;
                border-top: 1px dashed var(--border-color);
                align-self: stretch;

                & span {
                    color: var(--gray-text-color);
                    display: block;
                    line-height: 1.4;
                }

                & h3 {
                    margin-bottom: 0.2em;
                    font-weight: 600;
                }

                & img {
                    width: 40px;
                    height: 40px;
                    aspect-ratio: 1/1;
                    object-fit: cover;
                    object-position: center;
                    border: 2px solid var(--card-background-color);
                    box-shadow: 0 2px 5px var(--shadow-color);
                    transition: border-color 0.3s ease, box-shadow 0.3s ease;

                    &.user {
                        border-radius: 50%;
                    }
                    &.company {
                        border-radius: 10px;
                    }
                }
            }
        }
    }

    &.right_section {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: stretch;
        gap: 0.75em;
        background-color: transparent;
        height: 100%;
        overflow: hidden;

        & .project_1,
        & .project_2 {
            text-decoration: none;
            cursor: pointer;
            width: 100%;
            flex: 1;
            position: relative;
            display: flex;
            background-color: var(--card-background-color);
            transition: background-color 0.3s ease, box-shadow 0.3s ease;
            border-radius: 26px;
            overflow: hidden;
            box-shadow: 0 4px 10px var(--shadow-color);
            will-change: transform, box-shadow, opacity;
        }

        & .project_1::before,
        & .project_2::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.2);
            opacity: 0;
            z-index: 1;
            border-radius: 26px;
        }

        & .project_1 img,
        & .project_2 img {
            border-radius: inherit;
            border: 8px solid var(--card-background-color);
            transition: border-color 0.3s ease;
            width: 100%;
            height: 100%;
            aspect-ratio: 16/9;
            object-fit: cover;
            object-position: center;
            position: relative;
            z-index: 0;
        }

        & .project_1 div,
        & .project_2 div {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            padding: 1.5em;
            background: linear-gradient(
                to top,
                rgba(0, 0, 0, 0.8),
                rgba(0, 0, 0, 0.3),
                transparent
            );
            transform: translateY(100%);
            opacity: 0;
        }

        & .project_1 h4,
        & .project_2 h4 {
            font-size: clamp(1rem, 1.8vw, 1.5rem);
            color: #fff;
            letter-spacing: -0.3px;
            margin-bottom: 0.2em;
            transform: translateY(10px);
            opacity: 0;
        }

        & .project_1 span,
        & .project_2 span {
            font-size: clamp(0.5rem, 1.5vw, 0.8rem);
            color: #fff;
            letter-spacing: -0.3px;
            opacity: 0;
            transform: translateY(10px);
        }
    }
}
