:root {
    --font-weight-normal: 400;
    --font-weight-bold: 700;

    --accent-color: #0077cc;
    --accent-hover: #005fa3;
    --text-color: #222;

    --button-color: #333;

    --font-size-adjust-body: 0.52;
    --font-size-adjust-heading: 0.54;

    --header-footer-color: #f8f8f8;
    --body-background-color: #f0f0f0;
}

/* Simple reset */
body, h1, h2, h3, ul {
    margin: 0;
    padding: 0;
}

header {
    /* border: 2px solid red; */
    border-bottom: 2px solid gray;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--header-footer-color, white);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    font-size: clamp(1rem, 1.5vw, 1.45rem);
    z-index:1000;
    
    nav {
        ul {
            display: flex;
            gap: 2rem;
            list-style: none;
        }
    
        a {
            text-decoration: none;
            color: var(--text-color, #0077cc);
            font-weight: 500;
            transition: color 0.3s ease;
            position: relative; 

            &::after {
                content: "";
                position: absolute;
                left: 0;
                bottom: -3px;
                width: 0%;
                height: 2px;
                background-color: var(--accent-color);
                transition: width 0.3s ease, opacity 0.3s ease;
                opacity: 0;
            }

            &:hover {
                color: var(--accent-hover, darkblue);

                &::after {
                    width: 100%;
                    opacity: 1;
                }
            }

            &.active::after {
                width: 100%;
                opacity: 1;
            }
        }
    }
}

footer {
    /* border: 2px solid red; */
    border-top: 2px solid gray;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--header-footer-color, white);
    padding: 1rem 2rem;
    margin-top: 2rem;

    flex: 0 0 auto;
    position: relative;
    z-index: 2;

    nav ul {
        display: flex;
        gap: 1rem;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background-color: transparent;
        transition: background-color 0.2s ease;
    }


    img {
        width: 24px;
        height: 24px;
        object-fit: contain;
        display: block;
        filter: grayscale(30%) brightness(0.9);
        transition: filter 0.2s ease;
    }

    a:hover {
        background-color: #0077cc15;
    }

    a:hover img {
        filter: none;
    }

    p {
        font-size: 0.9rem;
        color: var(--text-color, #222);
        margin: 0;
    }
}

html, body {
    height: 100%;
}

body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;

    font-family: "Montserrat", sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    font-weight: var(--font-weight-normal, 400);
    font-size-adjust: var(--font-size-adjust-body, 0.5); /* baseline 2024 feature*/
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--body-background-color);
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Montserrat", sans-serif;
    font-optical-sizing: auto;
    font-weight: var(--font-weight-bold, 700);
    font-style: normal;
    font-size-adjust: var(--font-size-adjust-heading, 0.5); /* baseline 2024 feature*/
}

header > span {
    font-weight: 900;
    letter-spacing: 0.02em;
}

em, i {
    font-style: italic;
}

main {
    flex: 1 0 auto;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2dvh 4dvw 4rem;
    min-height: 80dvh;

    .intro-title {
        h1 {
            text-align: center;
            margin: 1.25rem 0 0.25rem;
            font-weight: var(--font-weight-bold, 700);
            animation: fadeInUp 0.6s ease-out both;
        }

        p {
            text-align: center;
            margin: 0 0 1.25rem;
            color: color-mix(in oklab, var(--text-color, #222) 80%, white);
            animation: fadeInUp 0.6s ease-out both 0.12s;
        }
    }
}

#contact-form {
    display: grid;
    place-items: center;
    margin-top: 0.75rem;

    .contact-card {
        width: min(720px, 92dvw);
        background: #f6f7f9;
        border: 1px solid #e5e9ef;
        border-radius: 12px;
        box-shadow: 0 1px 0 rgba(0,0,0,0.04);
        padding: 1.25rem 1.25rem 1.5rem;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;

        opacity: 0;
        animation: fadeInUp 0.55s ease-out forwards;

        & > legend {
            text-align: center;
            font-weight: var(--font-weight-bold, 700);
            font-size: clamp(1.1rem, 1.6vw, 1.25rem);
            margin-bottom: 0.25rem;
        }

        input, textarea {
            font: inherit;
            color: var(--text-color, #222);
            background: #fff;
            border: 1.5px solid #dfe5eb;
            border-radius: 8px;
            padding: 0.7rem 0.85rem;
            outline: none;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
        }
    }

    button {
        margin-top: 0.5rem;
        justify-self: center;
        font-family: "Montserrat", sans-serif;
        font-weight: 600;
        letter-spacing: .02em;
        padding: .65em 1.25em;
        border: 2px solid var(--button-color, #333);
        border-radius: 8px;
        background: transparent;
        color: var(--button-color, #333);
        transition: background-color .25s ease, color .25s ease, transform .15s ease, opacity .2s ease;
        cursor: pointer;
    }
    
    &:has(:invalid) button {
        opacity: .45;
        cursor: not-allowed;
        pointer-events: none;
        user-select: none;
    }

    &:has(:valid:not(:placeholder-shown)) button:hover {
        background: var(--button-color, #333);
        color: #fff;
        transform: translateY(-2px);
    }

    &:has(:valid:not(:placeholder-shown)) button:active {
        transform: translateY(0);
    }

    /* Focus border */
    & :is(input, textarea):focus-visible {
        border-color: var(--accent-color, #0077cc);
        box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent-color, #0077cc) 22%, #ffffff);
    }

    & :is(input, textarea) {
        
        /* Valid input border (green) */
        &:user-valid, &:valid:not(:placeholder-shown) {
            border-color: green;
            box-shadow: 0 0 0 3px rgba(46,125,50,0.12);
        }

        /* Invalid input border (red) */
        &:user-invalid, &:invalid:not(:focus):not(:placeholder-shown) {
            border-color: red;
            box-shadow: 0 0 0 3px rgba(220,77,65,0.12);
        }
    }
}

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

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

@media (max-width: 600px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
        
        
        nav ul {
            flex-direction: column;
            gap: 0.6rem;
            width: 100%;
            
            a {
                font-size: 1.05rem;
                display: block;
                
                &.active::after {
                    width: 100%;
                    opacity: 1;
                }
            }
        }
    }

    .contact-card { 
        padding: 1rem; 
    }

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

/* No Animation Responsiveness */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}