.topnav {
	float: right;
    background-color: inherit;
    overflow: hidden;
    height: 100%;
    display: flex;
    align-items: end;
    column-gap: 1px;

    .toggle_icon {
        float: left;
        display: block;
        text-align: center;
        align-self: center;

        margin: 2px 4px;
        padding: 0;
        text-decoration: none;

        display: none;

        border: 1px solid var(--header-foreground);
        border-radius: 0.2rem;

        .line {
            fill: var(--header-foreground);

            transition:
                y 200ms ease-in 200ms,
                rotate 200ms ease-in,
                opacity 0ms 200ms;
            transform-origin: center;
        }

    }

    .dropdown {
        float: left;
        overflow: hidden;

        .dropbtn {
            font-size: 0.8rem;
            line-height: 0.9em;
            border: none;
            outline: none;
            padding: 10px 16px;
            color: var(--menu-foreground);
            background-color: var(--menu-background);
            font-family: inherit;
            margin: 0;
            border-top-left-radius: 15px;
            border-top-right-radius: 15px;
            min-width: 40px;

            transition: background-color 0.7s ease;
        }
    }

    .dropdown:hover .dropbtn {
        background-color: var(--menu-hover-background);
        color: var(--menu-hover-foreground);
    }

    .dropdown:hover .dropdown-content {
        display: block;
    }

    .dropdown-content {
        display: none;
        position: absolute;
        background-color: var(--menu-dropdown-background);
        min-width: 160px;
        box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
        z-index: 1;

        animation: rotateMenu 200ms ease-in-out forwards;
        transform-origin: top center;

        border-radius: 0 0 0.5rem 0.5rem;

        a {
            float: none;
            color: var(--menu-dropdown-foreground);
            padding: 12px 16px;
            text-decoration: none;
            display: block;
            text-align: left;
            border-bottom: 1px solid var(--divider-dark-color);
            transition: background-color 0.7s ease;

            &:hover {
                background-color: var(--menu-dropdown-hover-background);
                color: var(--menu-dropdown-hover-foreground);
            }
        }

        a:last-child {
            border-radius: inherit;
        }
    }

    .dropdown:nth-last-child(2) .dropdown-content,
    .dropdown:nth-last-child(3) .dropdown-content {
        right: 0;
    }
}


@media screen and (max-width: 750px) {
    .topnav {
        line-height: 1.3em;

        .dropdown .dropbtn {
            line-height: 1.3em;
            display: none;
        }
        .toggle_icon {
            float: right;
            display: block;
        }
    }

    .topnav.responsive {
        position: relative;
        width: 100%;
        height: auto;
        background: transparent;
        display: grid;
        opacity: 1;

        div.dropdown:first-child {
            margin-top: 50px;
        }
        .toggle_icon {
            position: absolute;
            right: 0;
            top: 6px;

            .line {
                transition:
                    y 200ms ease-in,
                    rotate 200ms ease-in 200ms,
                    opacity 0ms 200ms;
            }

            .line.top,
            .line.bottom {
                y: 45;
            }
            .line.middle {
                opacity: 0;
            }
            .line.top {
                rotate: 45deg;
            }
            .line.bottom {
                rotate: -45deg;
            }
        }
        .dropdown {
            float: none;
            border-bottom: 1px solid var(--divider-dark-color);
            opacity: 1;

            .dropbtn {
                display: block;
                width: 100%;
                text-align: left;
                border-radius: 0;
            }
        }
        .dropdown-content {
            position: relative;
        }
    }
}

@keyframes rotateMenu {
    0% {
        transform: rotateX(-90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}
