// Navigation Styles

// Nav default


// Header direct child of header
header > nav {
    --font-size: 1.75rem;
    --bg: auto;
    background-color: var(--bg);
    width: clamp(30vmin, 40rem, 45%);

    & * {
        transition: opacity var(--transition);
    }
    
    & ul {
        display: flex;
        align-items: center;
        justify-content: space-around;
        flex-wrap: wrap;

        & li {
            width: fit-content;
            height: fit-content;

            a:not([role="button"]) {
                font-size: clamp(1rem, 0.7rem + 0.96vw, 1.6rem);;
                font-weight: 600;
            }

            &:is(:hover, :focus) a {
                opacity: .8;
            }

            &:active a {
                opacity: .6;
            }
        }
    }
}

// SIDE NAVIGATION (w/ hamburguer icon) --------------------------------------------

label[role="navigation"] {

    all: unset;

    //border: red 1px solid;

    height: fit-content;
    width: fit-content;

    --_hamburguer-width: 3em;
    --_hamburguer-height: .3em;
    --_hamburguer-spacing: .4em;
    --_hamburguer-roundness: var(--roudness);

    display: flex;
    flex-direction: column;
    gap: var(--_hamburguer-spacing, var(--sm));
    cursor: pointer;

    //transform-origin: center;

    // Check Behavior

    &:has( > input[type="checkbox"]:checked) {

        &::after {
            transform: translateY(-250%) rotate(-40deg);
        }

        &::before {
            transform: translateY(250%) rotate(40deg);
        }

        & + aside {

            --_navigation-display: flex;
        }

    }

    &:has( > input[type="checkbox"]:not(:checked)) + aside {

        --_navigation-display: none;
    }

    // Hover Behavior

    &:hover {

        --_hamburguer-spacing: .8em;

        &::after, &::before, & > input[type="checkbox"] {

            background-color: red;
        }

    }

    // Hamburguer Styling

    &::after, 
    &::before, 
    & > input[type="checkbox"] {

        all: unset;

        --_hamburguer-roundness: var(--roundness);

        content: "";
        display: block;
        width: var(--_hamburguer-width, 6rem);
        height: var(--_hamburguer-height, .8rem);
        border-radius: var(--_hamburguer-roundness);

        background-color: var(--primary);

        transform-origin: center;

        transition: opacity .2s ease-in-out, rotate .4s var(--transition-middle-break), transform .4s var(--transition-out-circle);
    }


    // Style for the input, label's child

    & > input[type="checkbox"] {

        // Reseting default behavior

        &:checked {

            opacity: 0;
        }

        &::after {

            all: unset;
        }

    }

    // Sibling Aside

    & + aside {

        --_navigation-display: none;

        display: var(--_navigation-display, none);
    }
}

nav[role="navigation"].floating-nav {

    --_spacing-x: var(--sm);
    --_spacing-y: var(--md);

    border-radius: 0 var(--roundness) var(--roundness) 0;
    width: fit-content;
    padding-inline: var(--_spacing-x);
    padding-block: var(--_spacing-y);
    position: fixed;
    left: 0;
    
    
    &[data-orientation="right"] {
        left: unset;
        right: 0;
    }

    & ul {

        display: grid;
        gap: var(--sm);
    }

    & li {

        --_spacing-y: var(--lg);
        --_spacing-x: var(--lg);
        --_border: var(--border);

        padding-block: var(--_spacing-y);
        padding-inline: var(--_spacing-x);
        border: var(--_border);
    }

}

// MEDIA QUERIES

@media only screen and (max-width: 37.5em) {
    header nav ul {
        display: none;
        visibility: hidden;
    }
}