@import "reset.css";
@import "font.css";

:root {

   --font-family: "Work Sans";
   --font-size: 16px;
   --font-weight: 400;

   --background-colour: #24221f;
   --text-colour: #F4F4F4;
   --brand-colour: #ffc053;

}

html, body {

    font-family: var(--font-family);
    font-size: var(--font-size);
    font-weight: var(--font-weight);
    background-color: var(--background-colour);
    color: var(--text-colour);
    padding: 0;

    * {
        box-sizing: border-box;
    }

    a {

        color: var(--text-colour);
        text-decoration: none;

    }

}

@keyframes load {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes showText {
    0% { opacity: 0; translate: 0 8px; }
    100% { opacity: 1; translate: 0 0; }
}

@keyframes pulse {
    0% { opacity: .6; }
    50% { opacity: 1; }
    100% { opacity: .6; }
}

main {

    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 1vw, 44px);
    justify-content: flex-start;
    align-items: center;
    background-color: var(--background-colour);
    border-radius: 8px;
    opacity: 0;
    animation: load .6s ease-out forwards;

    header, footer {

        flex: 0 0 60px;
        display: flex;
        flex-direction: column;
        align-items: center;
        z-index: 2;
        background-color: var(--background-colour);

    }


    /* Header */
    header {

        /* Logo */
        a.logo {

            display: block;
            color: transparent;
            text-decoration: none;
            width: 96px;
            height: 64px;
            background-color: var(--brand-colour);
            mask-image: url(../img/logo-jimbo.svg);
            mask-repeat: no-repeat;
            mask-position: center;
            mask-size: contain;

        }

    }

    /* Footer */
    footer {

        width: 100%;
        max-width: 1024px;
        flex-direction: row;
        justify-content: space-between;

        p.text {

            font-size: 0.9rem;
            opacity: .8;

            a {
                color: var(--brand-colour);
                text-decoration: underline;
            }

        }

    }

    /* Content */

    div.content:has(.conversation:empty) {
        
        justify-content: center;

        .conversation { display: none; }

    }

    div.content {

        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 1024px;
        gap: clamp(16px, 5vw, 44px);
        align-items: center;
        justify-content: center;

        h1 {
            flex: 0 0 auto;
            font-size: clamp(1.8rem, 5vw, 2.6rem);
            text-align: center;
            transition: translate ease-in-out .2s, opacity ease-in-out .2s;

            &.-off {
                opacity: 0;
                translate: 0 -16px;
            }

            span {
                color: var(--brand-colour);
            }

        }

        div.faq-item {

            align-self: center;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: clamp(8px, 1vw, 24px);
            width: 100%;
            max-width: 640px;
            padding-bottom: 24px;
            border-bottom: 1px solid rgba(255,255,255,.1);

            &:first-of-type { margin-top: 44px; }

            h2 { 
                font-size: clamp(1.4rem, 5vw, 1.8rem);
                text-decoration: underline;
            }

            p {
                opacity: .7;
                font-size: 1.1rem;
                line-height: 1.5;

                span { color: var(--brand-colour); }
            }

        }

        p {

            &.small {
                margin-top: 44px;
                opacity: .6 !important;
                font-size: .9rem !important;
                text-align: center !important;
            }

            &.large {
                font-size: clamp(1.2rem, 5vw, 1.6rem);
                text-align: center;
            }
        }

        div.conversation {

            flex: 1;
            min-height: 0;
            overflow-y: auto;
            position: relative;
            z-index: 1;
            width: 100%;
            display: flex;
            flex-direction: column;
            gap: clamp(8px, 2vw, 16px);

            p {

                font-size: clamp(1rem, 5vw, 1.1rem);
                opacity: 0;
                translate: 0 8px;
                animation: showText .2s ease-in-out forwards .1s;

                &.user {

                    align-self: flex-end;
                    background-color: rgba(255,255,255,.1);
                    padding: 16px 24px;
                    border-radius: 8px;
                    max-width: 640px;

                }

                &.response {
                    margin: 44px 0;
                    margin-left: 24px;
                }

            }

        }

        div.input {

            flex: 0 0 auto;
            width: 100%;
            position: relative;
            z-index: 2;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: clamp(8px, 1vw, 24px);

            div.working {

                position: absolute;
                top: -80px;
                left: 0;
                display: flex;
                gap: 12px;
                align-items: center;
                margin-left: 24px;
                transition: translate .15s ease-in-out, opacity .15s ease-in-out;
                opacity: 1;
                translate: 0 0;

                &.-off {
                    translate: 0 -8px;
                    opacity: 0;
                }

                img {
                    width: 24px;
                }

                p {
                    translate: 0 0;
                    animation: pulse 2s linear infinite;
                }

            }

            p.small { font-size: 0.8rem; opacity: .6; }

            textarea {

                resize: none;
                max-height: 240px;
                overflow-y: auto;
                field-sizing: content;

                position: relative;
                z-index: 1;
                width: 100%;
                border-radius: 8px;
                padding: 24px 32px;
                font-size: 1.2rem;
                background-color: rgba(0,0,0,.5);
                border: 0;
                color: var(--text-colour);
                box-shadow: 0 16px 80px rgba(0,0,0,.2);
                transition: outline ease-in-out .25s, opacity ease-in-out .25s;
                outline: 1px solid transparent;

                &:disabled { opacity: .4; }

                &:focus-visible {
                    outline: 1px solid var(--brand-colour);
                    box-shadow: 0 16px 80px rgba(0,0,0,.4);
                }

            }

            button {
                position: absolute;
                z-index: 2;
                bottom: 0;
                right: 0;
                translate: -24px -240%;
                font-size: 1.3rem;
                padding: 8px 16px;
                border: 0;
                border-radius: 8px;
                cursor: pointer;
                transition: scale ease-in-out .1s, opacity ease-in-out .25s, translate ease-in-out .25s;

                &:hover { scale: 1.05; }
                &:active { scale: .98; }

                &:disabled { 
                    pointer-events: none;
                    opacity: 0;
                    translate: 0 -240%;
                }

            }

        }

    }

}