@import url('styles.css');
@view-transition {
  navigation: auto;
  types: slide, forwards;
}

::view-transition-group(root) {
    animation-duration: 0.4s;
}

nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    background-color: var(--bg-color,#F9FBFF);
    writing-mode: horizontal-tb;

    @media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait),
     (max-width: 768px) {
        flex-direction: column;
    }

    #moon {
        display: none;
    }

    &.darkmode {
        #theme-switch {
            #sun {
                display: none;
            }
            #moon {
                display: block;
            }
        }
        img {
            filter: brightness(82%)
        }
    }
    
    #navbar {
        width: var(--nav-short-end-size);
        height: 100vh;
        outline: var(--border-width) solid var(--border-color,#121313);
        position: fixed;
        box-sizing: border-box;
        background-color: var(--nav-bg-color);
        z-index: 1;
        transition: 0.4s;

        @media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait),
         (max-width: 768px) {
            width: 100vw;
            height: var(--nav-short-end-size);
        }

        ul {
            position: absolute;
            top: calc(3*var(--height-spacing-unit));
            right: calc(4*var(--width-spacing-unit));
            display: flex;
            gap: calc(var(--height-spacing-unit));
            flex-direction: column;
            width: auto;
            z-index: -1;

            li{
                min-width: 0;

            }

            a {
                padding: var(--height-spacing-unit) calc(2*var(--width-spacing-unit));
                font-size: calc(2*var(--font-size-base,1rem));
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }

        #load-btns {
            position: absolute;
            display: flex;
            gap: calc(1*var(--height-spacing-unit));
            z-index: -1;
            bottom: calc(1*var(--height-spacing-unit));
            right: calc(4*var(--width-spacing-unit));

            button {
                display: flex;
                text-wrap: nowrap;
                justify-content: center;
                background-color: transparent;
                outline: 1px solid var(--border-color,#121313);
                border: none;
                padding-inline: calc(1*var(--width-spacing-unit));
                padding-block: calc(0.5*var(--height-spacing-unit));
                border-radius: 4px;
            }
            button:hover {
                background-color: var(--border-color,#121313);
                h3{color: var(--text-color-white,#FFFFFF);}
                cursor: pointer;                
                transition: 0.2s;
            }
        }

        #closed-nav {
            height: 100%;
            padding-inline: calc(0.4*var(--width-spacing-unit));
            padding-block: calc(0.6*var(--height-spacing-unit));
            box-sizing: border-box;
            width: var(--nav-short-end-size);
            outline: var(--border-width,0.5px) solid var(--border-color,#121313);
            display: flex;
            align-items: center;
            flex-flow: column nowrap;
            justify-content: space-between;
            background-color: var(--nav-bg-color);
            position: relative;
            z-index: 1;

             @media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait),
            (max-width: 768px) {
                width: 100vw;
                height: var(--nav-short-end-size);
                flex-flow: row nowrap;
                
                justify-content: space-between;
            }

            #nav-button {
                
                cursor: pointer;

                input {
                    opacity: 0;
                    width: 0;
                    height: 0;
                    position: fixed;
                }

                svg {
                    aspect-ratio: 1/1;
                    width: 100%;
    
                }
                .close {
                    display: none;
                }
                input:checked + .hamburger {
                    display: none;
                }
                input:checked ~ .close {
                    display: block;
                }
            }

            #theme-switch {
                display: flex;
                flex-direction: column;
                align-items: center;
                width: 100%;
                height: auto;
                gap: calc(0.5*var(--height-spacing-unit));

                @media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait),
                (max-width: 768px) {
                    flex-direction: row;
                    width: auto;
                    height: 100%; 
                    gap: calc(0.8*var(--width-spacing-unit));
                    
                    svg {
                        height: 100%;
                        width: 100%;
                        object-fit: contain;
                    }
                }

                .switch {
                aspect-ratio: 1/2;
                position: relative;
                display: inline-block;
                width: 100%;

                @media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait),
                (max-width: 768px) {
                    aspect-ratio: 2/1;
                    height: 100%;
                }

                    input {
                        opacity: 0;
                        width: 0;
                        height: 0;
                    }

                    .slider {
                        position: absolute;
                        cursor: pointer;
                        top: 0;
                        left: 0;
                        right: 0;
                        bottom: 0;
                        padding-block: 8%;
                        padding-inline: 8%;
                        background-color: var(--nav-bg-color);
                        -webkit-transition: .4s;
                        transition: .4s;
                        display: flex;
                        flex-direction: column-reverse;
                        align-items: center;

                        @media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait),
                        (max-width: 768px) {
                            flex-direction: row;
                            align-items: center;
                            padding-block: 4%;
                            padding-inline: 4%;
                        }
                    }

                    .slider:before {
                        aspect-ratio: 1/1;
                        content: "";
                        width: 100%;
                        background-color: white;
                        -webkit-transition: .4s;
                        transition: .4s;

                        @media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait),
                        (max-width: 768px) {
                            height: 100%;
                            width: auto;
                        }
                    }

                    input:checked + .slider {
                        background-color: var(--nav-bg-color);
                        outline: var(--border-width) solid var(--border-color);
                    }

                    input:checked + .slider:before {
                        transform: translateY(-120%);
                        background-color: var(--border-color);

                        @media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait),
                        (max-width: 768px) {
                            transform: translateX(116%);
                        }
                    }

                    /* Rounded sliders */
                    .slider.round {
                        border-radius: var(--width-spacing-unit);
                        outline: var(--border-width) solid var(--border-color);
                    }

                    .slider.round:before {
                        border-radius: var(--width-spacing-unit);
                        background-color: var(--border-color);
                    }
                }
            }
            
        }
        
        
    }

    hgroup {
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        gap: calc(0.5*var(--height-spacing-unit,1.6dvh));

        p {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        }
    }
    

    .content {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        margin-left: var(--nav-short-end-size);
        height: 100vh;

        @media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait),
         (max-width: 768px) {
            margin-left: 0;
            margin-top: var(--nav-short-end-size);
        }

        figure {
            margin: 0;
            outline: var(--border-width,0.5px) solid var(--border-color,#121313);

            img {
                width: 100%;
                height: auto;
                display: block;
            }
        }

        header[data-page="home"] {
            min-height: 37.5vh;
            padding-inline: calc(2*var(--width-spacing-unit,1.6dvw));
            padding-block: var(--height-spacing-unit,1.6dvh);
            display: flex;
            justify-content: flex-start;
            align-items: flex-end;
            outline: calc(0.5*var(--border-width,0.5px)) solid var(--border-color,#121313);
        }

        header[data-page="case-study"] {
            padding-inline: calc(2*var(--width-spacing-unit,1.6dvw));
            padding-block: calc(2*var(--height-spacing-unit,1.6dvh));
            justify-content: flex-start;
            align-items: center;
            color: var(--text-color-white,#FFFFFF);
            background-color: var(--primary-color,#282787);
            display: grid;
            grid-template-columns: repeat(12,1fr);
            grid-column-gap: var(--width-spacing-unit,1.6dvw);
            grid-row-gap: calc(2*var(--height-spacing-unit,1.6dvh));
            grid-template-areas: 
                ". titles titles titles titles . . goal-deliverable goal-deliverable skill-time skill-time . .";

            hgroup {
                grid-area: titles;

                h1 {
                    color: var(--text-color-white,#FFFFFF);
                }
            }

            #goal-deliverable-container {
                grid-area: goal-deliverable;
                display: flex;
                flex-direction: column;
                gap: calc(2*var(--height-spacing-unit,1.6dvh));
                
                section {
                    display: flex;
                    flex-direction: column;
                    gap: calc(0.5*var(--height-spacing-unit,1.6dvh));
                }
            }

            #skills-time-container {
                grid-area: skill-time;
                display: flex;
                flex-direction: column;
                gap: calc(2*var(--height-spacing-unit,1.6dvh));
                
                section {
                    display: flex;
                    flex-direction: column;
                    gap: calc(0.5*var(--height-spacing-unit,1.6dvh));
                }
            }

            #goal {
                grid-area: goal;
            }

            #deliverable {
                grid-area: deliverable;
            }

            #skills {
                grid-area: skills;
            }

            #time-spent {
                grid-area: time;
            }
        }

        main {
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            section {
                padding-inline: calc(2*var(--width-spacing-unit,1.6dvw));
                padding-block: var(--height-spacing-unit,1.6dvh);
                outline: calc(0.5*var(--border-width,1px)) solid var(--border-color,#121313);
                flex: 1;

                div {
                    padding-block: var(--height-spacing-unit,1.6dvh);
                    display: grid;
                    grid-template-columns: repeat(2,1fr);
                    grid-column-gap: var(--width-spacing-unit,1.6dvw);
                    grid-row-gap: calc(2*var(--height-spacing-unit,1.6dvh));             
                }
            }

            section[data-page="case-study"] {
                display: grid;
                grid-template-columns: repeat(12,1fr);
                grid-template-rows: auto auto auto;
                grid-column-gap: var(--width-spacing-unit,1.6dvw);
                grid-row-gap: calc(2*var(--height-spacing-unit,1.6dvh));
                grid-template-areas: 
                    ". h2 h2 h2 h2 h2 . . . . . ."
                    ". p p p p . . . . . . ."
                    ". strong strong . . . . . . . . .";
                outline: none;
                h2 {
                    grid-area: h2;
                }

                p {
                    grid-area: p;
                }

                strong {
                    grid-area: strong;
                }
            }

            section[data-page="contact-form"] {
                flex-grow: 1;
                display: flex;
                flex-direction: row;
                justify-content: space-evenly;
                align-items: center;
                gap: calc(4*var(--width-spacing-unit,1.6dvw));

                @media (max-width: 1000px) {
                    flex-direction: column;
                    align-items: flex-start;
                    justify-content: flex-end;
                    gap: calc(2*var(--height-spacing-unit,1.6dvh));
                }

                hgroup {
                    height: auto;
                    text-wrap: nowrap;
                    flex: 1;

                    @media (max-width: 1000px) {
                        flex: none;
                    }
                }

                form {
                    flex: 1;
                    box-sizing: border-box;
                    border: var(--border-width,1px) solid var(--border-color,#121313);
                    border-radius: 16px;
                    padding-inline: calc(2*var(--width-spacing-unit,1.6dvw));
                    padding-block: calc(2*var(--height-spacing-unit,1.6dvh));
                    display: flex;
                    flex-direction: column;
                    gap: calc(2*var(--height-spacing-unit,1.6dvh));
                    container-type: inline-size;

                    @media (max-width: 1000px) {
                        width: 100%;
                        height: auto;
                    }

                    label {
                        display: flex;
                        flex-direction: column;
                        gap: calc(0.6*var(--height-spacing-unit,1.6dvh));
                    }
                    .radio-group {
                        display: flex;
                        flex-direction: row;
                        gap: calc(2*var(--width-spacing-unit,1.6dvw));
                        margin-block: calc(0.5*var(--height-spacing-unit,1.6dvh));

                        span {
                            display: flex;
                            align-items: center;
                            gap: 16px;
                        }

                        input {
                            margin: 0;
                        }
                        
                        input[type="radio"]:focus {
                            border: none;
                            outline: none;
                        }
                    }

                    .radio-group:has(#create:checked) ~ .create,
                    .radio-group:has(#create:checked) ~ .create-update {
                        display: flex;
                    }

                    .radio-group:has(#update:checked) ~ .update-delete,
                    .radio-group:has(#update:checked) ~ .create-update {
                        display: flex;
                    }

                    .radio-group:has(#delete:checked) ~ .update-delete {
                        display: flex;
                    }

                    fieldset {
                        border: none;
                        display: flex;
                        flex-direction: column;
                        gap: calc(2*var(--height-spacing-unit,1.6dvh));
                        padding: 0;
                        width: 100%;
                        min-inline-size: none;

                        div {
                            @container (width < 400px) {
                                flex-direction: column;
                                display: flex;
                            }
                        }

                        legend {
                            margin-block: calc(1*var(--height-spacing-unit,1.6dvh));
                        }

                        legend {
                            padding: 0;
                        }
                    }

                    .update-delete, .create, .create-update {
                        display: none;
                    }

                    

                    input[type="text"], input[type="email"], textarea {
                        padding: calc(0.5*var(--height-spacing-unit,1.6dvh));
                        border: var(--border-width,0.5px) solid var(--border-color,#121313);
                        font-size: var(--font-size-base,1rem);
                        font-family: inherit;
                    }

                    input[type="submit"] {
                        padding: calc(var(--height-spacing-unit,1.6dvh)) calc(1*var(--width-spacing-unit,1.6dvw));
                        font-size: var(--font-size-base,1rem);
                        font-family: inherit;
                        background-color: transparent;
                        border: var(--border-width,0.5px) solid var(--border-color,#121313);
                    }

                    input[type="submit"]:not([disabled]):hover {
                        background-color: var(--primary-color,#282787);
                        color: var(--text-color-white,#E5E5E5);
                        font-family: inherit;
                        font-weight: 500;
                        cursor: pointer;
                        transition: background-color 0.2s ease;
                    }
                    
                    textarea:focus:placeholder-shown, input:focus:placeholder-shown, textarea:focus, input:focus {
                        outline: 2px solid var(--primary-color,rgba(189, 218, 134, 0.8));
                        border-radius: 2px;
                        border: none;
                    }

                    input:invalid {
                        outline-color: var(--system-error-color);
                    }

                    output {
                        display: flex;
                        align-items: center;
                        gap: 4px;
                        height: 1rem;
                    }

                    #char-limit {
                        font-size: 0.9rem;
                        color: #555;
                        transition: color 0.2s ease;
                    }

                    #char-limit.warning {
                        color: var(--system-error-color);
                        font-weight: bold;
                    }
                }
            }

            

            figure {
                display: grid;
                grid-template-columns: repeat(12,1fr);
                grid-template-rows: auto auto;
                grid-column-gap: var(--width-spacing-unit,1.6dvw);
                grid-row-gap: calc(var(--height-spacing-unit,1.6dvh));
                grid-template-areas:
                    ". img img img img img img . . . . ."
                    ". figcaption figcaption figcaption . . . . . . . .";

                padding-inline: calc(2*var(--width-spacing-unit,1.6dvw));
                padding-block: var(--height-spacing-unit,1.6dvh);
                outline: none;

                img {
                    grid-area: img;
                }

                figcaption {
                    grid-area: figcaption;
                    display: flex;
                    flex-direction: column;
                    gap: calc(0.5*var(--height-spacing-unit,1.6dvh));
                }
            }
        }

        main[data-page="case-study"] {
            outline: calc(0.5*var(--border-width,0.5px)) solid var(--border-color,#121313);
        }
        
        footer {
            padding-inline: calc(2*var(--width-spacing-unit,1.6dvw));
            padding-block: calc(1.5*var(--height-spacing-unit,1.6dvh));
            outline: calc(0.5*var(--border-width,1px)) solid var(--border-color,#121313);

            nav ul {
                display: flex;
                gap: 40px;
            }
        }
    }

    
}