@import url('https://fonts.googleapis.com/css2?family=Epilogue:ital,wght@0,100..900;1,100..900&family=Gloock&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Bitter:ital,wght@0,100..900;1,100..900&display=swap');

:root[data-theme="light"] {
    --bg: #DAD7CD;
    --nav-footer-bg: #636856; 
    --nav-footer-content: #DAD7CD;
    --text: #111D13; 
    --proj-card-bg: #A5A58D;
    --text-bubble: #DAD7CD;
    --shadow: rgba(63,66,56,.15);
    --field-bg: rgba(0,0,0,.05);
    --field-border: rgba(0,0,0,.15);
    --field-valid: rgba(0,0,0,.05);
    --field-invalid: #ffe9ed;
    --submit-button: #3F4238;
    --submit-text: #DAD7CD;
    --error-color: #b00020; 

    --dur-2: 300ms;
    --ease: cubic-bezier(.2,.7,.2,1);
}

:root[data-theme="dark"] {
    --bg: #2D3328;
    --nav-footer-bg: #20251C; 
    --nav-footer-content: #d2cfc6;
    --text: #DAD7CD; 
    --proj-card-bg: #848470;
    --text-bubble: #525A49;
    --shadow: rgba(218, 215, 205, 0.18);
    --field-bg: #4A4F46;
    --field-border: rgba(218, 215, 205, 0.2);
    --field-valid: #454A41;
    --field-invalid: #cba8ad;
    --submit-button: #525A49;
    --submit-text: #DAD7CD;
    --error-color: #e7183e;

    --dur-2: 300ms;
    --ease: cubic-bezier(.2,.7,.2,1);
}

:root[data-theme="beige"] {
    --bg: #F3EEDC;               
    --nav-footer-bg: #B3A089;  
    --nav-footer-content: #FDFBF4;
    --text: #463F36;           
    --proj-card-bg: #E4D9C5;    
    --text-bubble: #F7F3E8;   
    --shadow: rgba(130, 112, 90, 0.20);
    --field-bg: #F9F5EA;     
    --field-border: rgba(130, 112, 90, 0.25);
    --field-valid: #F0E9D9;      
    --field-invalid: #DFC8C4;
    --submit-button: #B7A384;  
    --submit-text: #FDFBF4;
    --error-color: #B6726A; 

    --dur-2: 300ms;
    --ease: cubic-bezier(.2,.7,.2,1);
}

@keyframes flash {
    from { background-color: #ffe9ed; }
    to { background-color: white; }
}

@media (prefers-reduced-motion: reduce){
  *{ animation:none !important; transition:none !important; }
}

@media (min-width: 481px) {
    .nav { display: none; }
    .hamburger { display: none; }
    #site-nav ul{ display: none;}
}

@media (max-width: 480px) {
    header{ position:relative; padding-inline:4svw; }

    .nav{ width:100%; }
    .hamburger{
        display:inline-flex;
        padding:.6rem .8rem;
        border-radius:.6rem;
        background: rgba(0,0,0,.06);
        cursor:pointer;
        user-select:none;
    }

    /* Make the 3 lines (pure CSS) */
    .hamburger::after{
        content:""; display:inline-block; width:19px; height:3px; background:currentColor;
        box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;  /* three bars */
    }

    /* Menu panel is collapsed when <details> is closed */
    nav ul{
        max-height:0; overflow:hidden; transition:max-height 250ms ease;
        margin-top:.6rem; margin-bottom: 1rem; padding:.2rem; list-style:none; display:flex; flex-direction:column; gap:.4rem;
        border-radius:.6rem;
    }

    /* Open state: expands when the user toggles <summary> */
    .nav[open] #site-nav ul{ max-height:60dvh; }

    /* Optional: style summary focus visibly */
    .hamburger:focus { outline: 2px solid currentColor; outline-offset: 2px; }

    #about-me-content {
        width: min(92svw, 48rem);
        margin-top: 4rem; 
    }

    #about-me-content section:nth-child(1) {
        flex-direction: column;
        gap: 1rem;
    }

    #projects-content .load-controls {
        flex-direction: column;
        width: 90%;
        margin-inline: auto;
    }

    #project-cards {
        flex-direction: column;
    }

    a {
        text-decoration: underline !important;   /* always visible */
        text-underline-offset: 0.12em;
    }

    header nav a::after { display: none; }

    #experiences-content article{
        /* keep logo column small, give text room */
        display: grid;
        grid-template-columns: 3rem 1fr;
        grid-auto-rows: min-content;
        column-gap: .9rem;
        row-gap: .25rem;
        margin-block: 1.2rem;
    }

    /* Make the disclosure text span full width under the header row */
    #experiences-content{
        /* Logo smaller & rounded */
        img {
            width: 3rem;
            height: 3rem;
            border-radius: .6rem;
            object-fit: cover;
            grid-row: 1; /* sit next to the title row */
        }

        /* Company name + date: stack date, remove float */
        h3 {
            font-size: 1rem;
            line-height: 1.3;
            overflow-wrap: anywhere;        /* prevent overflow on tiny screens */

            span {
                display: block;
                float: none;                    /* kill the desktop float */
                font-weight: 400;
                font-size: .9rem;
                opacity: .8;
                margin-top: .15rem;
            }
        }

        details {
            grid-column: 1 / -1;

            p {
                line-height: 1.6;
                font-size: .95rem;
            }
        }

        summary {
            padding: .5rem .25rem;
            border-radius: .4rem;
            background: rgba(0,0,0,.05);
            cursor: pointer;                /* clearer affordance */
        }

    }
}

/* Opt in this site to automatic cross-document view transitions */
@view-transition {
    navigation: auto;
}

/* Fallback for browsers that don't support MPA view transitions */
@supports not (navigation: auto) {
     body {
        opacity: 0;
        animation: basic-fade-in 0.1s ease-out forwards;
    }

    @keyframes basic-fade-in {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}

@keyframes blur-out {
    from {
        opacity: 1;
        filter: blur(0px);
    }
    to {
        opacity: 0;
        filter: blur(6px);
    }
}

@keyframes blur-in {
    from {
        opacity: 0;
        filter: blur(6px);
    }
    to {
        opacity: 1;
        filter: blur(0px);
    }
}

::view-transition-old(root) {
    animation: blur-out 0.35s ease-out both;
}

::view-transition-new(root) {
    animation: blur-in 0.35s ease-out both;
}

::view-transition-old(root),
::view-transition-new(root) {
    background: var(--bg, white);
}

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

html {
    background-color: var(--bg, white);
    min-height: 100%;
    font-family: "Bitter", sans-serif;

}

body{
    min-height: 100vh;
    min-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    color: var(--text, black);
}

nav, ul {
    list-style: none;
}

a {
    text-decoration: none;
}

header {
    width: 100%;
    background-color: var(--nav-footer-bg, grey);
    color: var(--nav-footer-content, white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 14vh;

    nav {
        ul {
            width: 24rem;
            display: flex;
            justify-content: space-between;
            margin-left: 5rem;
            font-size: 1.3rem;
            
            a {
                color: inherit;
                position: relative;
                text-decoration: none;
            }
    
            a:hover {
                color: white;
            }

            a::after {
                content:"";
                position: absolute;
                left: 0;
                right: 0;
                bottom: -0.25rem;
                height: 2px;
                background-color: currentColor;
                transform: scaleX(0);
                transform-origin: left;
                transition: transform var(--dur-2) var(--ease);
            }

            a:hover::after{ 
                transform: scaleX(1);
            }
        }

    }

    
}

theme-toggle {
    background-color: #DAD7CD; 
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin: 2rem 4rem;
    padding: .3rem .5rem;
    border-radius: .6rem;
    cursor: pointer;
    transition: background-color 0.25s ease;
}

theme-toggle button {
    border: none;
    background: transparent;
    padding: .4rem .6rem;
    border-radius: .5rem;
    cursor: pointer;
    transition: all 0.25s ease;

    img {
        transition: filter 0.25s ease;
        filter: brightness(80%);
        width: 16px;
        height: 16px;
    }
}

theme-toggle button.active-theme {
    background-color: var(--nav-footer-content, gray);
    outline: 2px solid var(--nav-footer-content, gray);
}

theme-toggle button.active-theme img {
    filter: brightness(160%);
}

html[data-theme="light"] theme-toggle {
    background-color: #A5A58D;
}

html[data-theme="dark"] theme-toggle {
    background-color: #53584d; 
}

html[data-theme="beige"] theme-toggle {
    background-color: #e2dccf; 
}

/* Hide the toggle if JS is off */
theme-toggle.no-js {
    display: none;
}

noscript p {
    font-size: 0.7rem;
    width: 10rem;
    margin-right: 1rem;
}

#landing-page {
    background-image: url("/assets/bg.png");
    background-size: cover;        /* fill screen while keeping aspect ratio */
    background-position: center;   /* keep subject centered */
    background-repeat: no-repeat;
    min-height: 100vh;             /* take full viewport height */
}

/* Layout for landing page */
#landing-text {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    width: 100vw;
    color: inherit;
    backdrop-filter: blur(18px);
    color: var(--bg, black);

    h1 {
        text-align: center;
        font-family: "epilogue";
        font-size: 8rem;
    }

    h2 {
        text-align: center;
        font-family: "Gloock", sans-serif;
        font-size: 4rem;
        font-weight: normal;
    }
}

/* Layout for about me page */
#about-me-content {
    width: 75%;
    margin-top: 8rem;
    color: inherit;

    section:nth-child(1) {
        display: flex;
        justify-content: space-evenly;
        align-items: center;
        line-height: 1.8rem;
        margin-bottom: 8rem;

        hgroup {
            width: 60%;

            h1 {
                margin-bottom: 0.5rem;
            }
        }

        picture img{
            display: block;
            border-radius: 10%;
        }
    }

    section:nth-child(2) {
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        align-items: center;
        margin-bottom: 10rem;

        hgroup {
            width: 91%;
            margin-bottom: 0.5rem;
            line-height: 2rem;
        }

        iframe {
            width: 92%;
            border-radius: 2%;
        }
    }

}

/* Layout for expertise page */
#expertise-content {
    width: 70%;
    margin-top: 6rem;
    color: inherit;
    
    a {
        text-decoration: none;
        color: inherit;
    }

    a:hover {
        filter: brightness(1.1);
    }

    #experiences-content {
        margin-bottom: 6rem;

        article {
            display: grid;
            grid-template-columns: 4rem 1fr;  /* logo | text */
            column-gap: 1rem;
            align-items: start;
            margin-block: 2rem;

            a:hover {
                text-decoration: underline;
            }

            details p {
                line-height: 1.4rem;
            }
        }

        img {
            grid-row: 1 / span 2;  /* occupy logo column for both rows */
            width: 3.5rem;
            height: 3.5rem;
            border-radius: 10%;
            object-fit: cover;
        }

        article:nth-child(4) img {
            background-color: white;
        }
    }

    #projects-content {
        margin-bottom: 6rem;
        
        #project-cards {
            display: grid;
            gap: 1.2rem;
            margin-top: 1.4rem;
            grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
            align-items: stretch; /* make each grid item same height in its row */
        }

        .load-controls {
            display: flex;
            justify-content: start;
            gap: 1rem;
            margin: .5rem 0 1rem;

            button {
                padding: 0.5rem 1rem;
                border: none;
                border-radius: 0.55rem;
                background-color: var(--submit-button, #3F4238);
                color: var(--submit-text, #DAD7CD);
                font-weight: 500;
                font-family: inherit;
                font-size: 0.85rem;
                cursor: pointer;
                transition: filter 0.2s ease, transform 0.1s ease;
                box-shadow: 0 1px 4px var(--shadow, rgba(0,0,0,0.15));
                
            }

            button:hover {
                filter: brightness(1.15);
            }

            button:active {
                transform: scale(0.96);
            }
        }
    }
}

/* Layout for contact page */
#contact-form-body {
    margin: 6rem;
    
    h1 {
        text-align: center;
        margin-bottom: 0.5rem;
    }

    form {
        display: flex;
        flex-direction: column;
    }

    form-field {
        display: flex;
        flex-direction: column;
        margin-bottom: 0.8rem;
    }

    /* inputs & textarea share the same look */
    input, textarea {
        width: 100%;
        padding: 0.7rem 1rem;
        border-radius: 12px;
        border: 1.5px solid var(--field-border, gray);
        background: var(--field-bg, gray);
        color: var(--text, black);
        outline: none;
        font-size: 1rem;
    }

    textarea {
        min-height: 5.5rem;
        resize: vertical; /* allow user to expand if needed */
    }

    /* focus styles for accessibility */
    input:focus, textarea:focus {
        border-color: gray;
        box-shadow: 0 0 0 3px var(--shadow, gray);
    }

    /* asterisk appears if field is invalid, but goes away after valid input */
    :has(:invalid) > label::after {
        content: " *";
        color: var(--error-color, red);
        font-weight: 700;
    }

    input:user-invalid, textarea:user-invalid {
        border-color: var(--error-color, red);
        background-color: var(--field-invalid, pink);
    }

    input:valid, textarea:valid {
        border: 1.5px solid var(--field-border, gray);
        background: var(--field-valid, gray);
    }

    output {
        font-size: 0.8rem;
        margin-top: 0.2rem;
        line-height: 0.8rem;
    }
    
    /* I only want the flash for the name field*/
    input#name.flash {
        animation: flash 0.3s alternate 2;
    }

    .error {
        color: var(--error-color, red);
        opacity: 1;
        transition: opacity 1s ease-in-out;
    }
    
    .error.hidden {
        opacity: 0;
    }

    /* Base state: faint, low emphasis */
    .len-limit {
        opacity: 0.8;
        font-size: 0.8rem;
        transition: opacity 0.3s ease, font-weight 0.3s ease;
    }

    /* Medium intensity when getting close */
    .len-limit-medium {
        font-weight: 600 !important;
        color: darkgray;
    }

    /* High intensity (danger zone) */
    .len-limit-strong {
        opacity: 1;
        font-weight: 700 !important;
        color: rgb(54, 54, 54);
    }

    .info {
        color: grey;
    }


    button[type="submit"] {
        align-self: center;  
        margin-top: 0.8rem;
        padding: 0.9rem 2.5rem;
        border-radius: 0.7rem;
        border: none;
        background-color: var(--submit-button, black);
        color: var(--submit-text, white);
        font-weight: 700;
        cursor: pointer;
        font-family: inherit;
    }

    button[type="submit"]:hover {
        filter: brightness(1.2);
    }
}

footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background-color: var(--nav-footer-bg, grey);
    color: var(--nav-footer-content, white);
    font-size: 0.9rem;

    div {
        width: 75%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        padding-top: 1.6rem;
        margin-left: -5rem;

        section:nth-child(1) {
            width: 30%;
            line-height: 1.1rem;

            p {
                font-size: 0.8rem;
            }
        }

        section:nth-child(2) {
            line-height: 1.2rem;
            margin-left: -4rem;

            ul {
                width: 18vw;
                display: flex;
                flex-wrap: wrap;
                justify-content: flex-start;

                li {
                    margin: 0rem 0.3rem;
                    
                    a {
                        color: inherit;
                    }
        
                    a:hover {
                        color: white;
                    }
                }
            }

        }

        section:nth-child(3) {
            margin-left: -5rem;

            ul {
                display: flex;
                width: 8vw;
                justify-content: flex-start;
                align-items: center;
                
                li {
                    margin: 0rem 0.3rem;
                } 
            }

            /* using filter to change the color of the .svg images */
            .socials {
                filter: brightness(150%) invert(100%) sepia(0%) saturate(100%) contrast(110%);
            }
        }
    }

    hr {
        border: none;
        height: 0.5px;
        background-color: var(--nav-footer-content, white);
        width: 95%;
        margin: 1rem 0rem;
    }

    small {
        padding-bottom: 1.5rem;
    }
}

