:root {
    --almost-white: #f6f6f6;
    --dark-gray: #353535;
    --dark-red: #982300;
    --light-blue: #00d4ff;
    --darker-blue: #0275c4;
    --pink: #ff9df9;
    --dark-pink: #a00055;
    --line-thickness: 3px;
    --distance-from-line: 1rem;
}

html {
    box-sizing: border-box;
    height: 100%;
}

*>* {
    box-sizing: inherit;
}


body {
    background-color: var(--background);
    color: var(--foreground);
    font-family: "Fira Code", monospace, monospace;
    font-optical-sizing: auto;
    line-height: 1.3;
    font-weight: 400;
    font-style: normal;
    font-size: 18px;
    padding: 0;
    margin: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;

    --background: var(--almost-white);
    --foreground: var(--dark-gray);
    --accent: var(--dark-pink);
    --link-color: var(--accent);
    --accent-on-foreground: var(--light-blue);
    color-scheme: light;

    &.dark-theme {
        --background: var(--dark-gray);
        --foreground: var(--almost-white);
        --accent: var(--pink);
        --link-color: var(--accent);
        --accent-on-foreground: var(--darker-blue);
        color-scheme: dark;
    }


    @media (prefers-color-scheme: dark) {
        &:not(.dark-theme):not(.light-theme) {
            --background: var(--dark-gray);
            --foreground: var(--almost-white);
            --accent: var(--pink);
            --link-color: var(--accent);
            --accent-on-foreground: var(--darker-blue);
            color-scheme: dark;
        }
    }
}


.mega {
    font-size: 3rem;
    margin-bottom: 10rem;
}

.nav {
    position: sticky;
    top: 4rem;

}

.nav__list {
    list-style: none;
    appearance: none;
    margin: 0 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.nav__item {
    display: inline-block;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--foreground);
    padding: 0 var(--distance-from-line) 0 1rem;
    border-right: solid var(--line-thickness) transparent;
    position: relative;
}

.nav__item--active {
    color: var(--link-color);
    /* border-color: var(--accent); */

    /* &::after {
        content: "<";
        position: absolute;
        right: 0px;
    } */

    &::before {
        content: ">";
        /* position: absolute; */
        left: 0px;
    }
}

.nav__link {
    text-decoration: none;
    color: var(--foreground);

    &:hover {
        text-decoration: underline;
    }
}


.container {
    flex-grow: 1;
}


.main {
    padding: 0;
    position: relative;
    margin: var(--distance-from-line) 0;

    border-color: var(--foreground);
    border-width: 0 0 0 var(--line-thickness);
    border-style: solid;

    &>* {
        padding: 0 var(--distance-from-line);
        margin-left: calc(var(--line-thickness) * -1);
        border-left: solid var(--line-thickness) transparent;
    }

    ul {
        padding: 0 calc(var(--distance-from-line) + 2rem);
    }

    a {
        color: var(--accent);
    }

    em {
        text-decoration: none;
        font-style: normal;
        color: var(--accent);
        font-weight: 700;
    }
}

.footer {
    text-align: center;
    padding: 1rem 0;
    font-size: 0.8rem;

}

.body--clone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    animation-name: animate-side;
    animation-duration: .3s;
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(.18, .14, .75, .55);
    will-change: clip-path;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;

    @media (prefers-reduced-motion: reduce) {
        animation: none;
    }

    &.light-theme {
        animation-name: animate-side-reverse;
    }
}

.theme-toggle {
    margin: .5rem var(--distance-from-line);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    border: none;
}

.theme-toggle__legend {
    display: none;
}

.theme-toggle__label {
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
}

.theme-toggle__input {
    appearance: none;
    cursor: pointer;

    &:focus-visible+.theme-toggle__label {
        height: unset;
        width: unset;
        overflow: auto;
        position: static;
        clip: unset;
        clip-path: unset;
        position: absolute;
        display: block;
        bottom: -20px;
    }
}

.theme-toggle__input:checked {
    color: var(--accent);
}

.theme-toggle__input--dark {
    overflow: hidden;
    position: relative;
    transform: rotate(-135deg) scale(1);
    width: 20px;
    height: 20px;
    border: 2px solid;
    border-bottom-color: transparent;
    display: block;
    box-sizing: border-box;
    border-radius: 50%;



    &::after {
        display: block;
        box-sizing: border-box;
        border-radius: 50%;
        content: "";
        position: absolute;
        width: 12px;
        height: 18px;
        border: 2px solid transparent;
        box-shadow: 0 0 0 2px;
        top: 8px;
        left: 2px;
    }

}

.theme-toggle__input--system {
    box-sizing: border-box;
    position: relative;
    display: block;
    transform: scale(1);
    border: 2px solid;
    border-radius: 100px;
    width: 20px;
    height: 20px;

    &::after,
    &::before {
        content: "";
        box-sizing: border-box;
        position: absolute;
        display: block;
    }

    &::before {
        border: 5px solid;
        border-top-left-radius: 100px;
        border-bottom-left-radius: 100px;
        border-right: 0;
        width: 9px;
        height: 18px;
        top: -1px;
        left: -1px;
    }

    &::after {
        border: 4px solid;
        border-top-right-radius: 100px;
        border-bottom-right-radius: 100px;
        border-left: 0;
        width: 4px;
        height: 8px;
        right: 4px;
        top: 4px;
    }
}




.theme-toggle__input--light {
    box-sizing: border-box;
    position: relative;
    display: block;
    transform: scale(1);
    width: 24px;
    height: 24px;
    background:
        linear-gradient(to bottom, currentColor 4px, transparent 0) no-repeat 5px -6px/2px 6px,
        linear-gradient(to bottom, currentColor 4px, transparent 0) no-repeat 5px 14px/2px 6px,
        linear-gradient(to bottom, currentColor 4px, transparent 0) no-repeat -8px 5px/6px 2px,
        linear-gradient(to bottom, currentColor 4px, transparent 0) no-repeat 14px 5px/6px 2px;
    border-radius: 100px;
    box-shadow: inset 0 0 0 2px;
    border: 6px solid transparent;

    &::after,
    &::before {
        content: "";
        display: block;
        box-sizing: border-box;
        position: absolute;
        width: 24px;
        height: 2px;
        border-right: 4px solid;
        border-left: 4px solid;
        left: -6px;
        top: 5px;
    }

    &::before {
        transform: rotate(-45deg);
    }

    &::after {
        transform: rotate(45deg);
    }

}

@keyframes circle {
    0% {
        clip-path: circle(200% at 0% 0%);
    }

    100% {
        clip-path: circle(0 at 0% 0%);
    }

}


@keyframes animate-side {
    0% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    }

    100% {
        clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    }

}

@keyframes animate-side-composite {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-100%, 0, 0);
    }

}



@keyframes animate-side-reverse {
    0% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    }

    100% {
        clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%);
    }

}

@keyframes animate-bottom {
    0% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    }

    100% {
        clip-path: polygon(0 0, 100% 0, 100% 0%, 0% 0%);
    }

}

@media (min-width: 1024px) {
    :root {
        --distance-from-line: 2rem;
    }

    .container {
        display: grid;
        grid-template-columns: 220px auto;
        min-height: calc(100svh - 6rem);
    }

    .header {
        grid-row: 1;
        grid-column: 1;
        text-align: right;
        margin-right: calc(var(--line-thickness) * -1);
        z-index: 1;
    }
}

@media (min-width: 1440px) {
    :root {
        --distance-from-line: 3rem;
    }

    .container {
        display: grid;
        grid-template-columns: 1fr 54rem 1fr;
        min-height: calc(100svh - 6rem);
    }

    .main {
        grid-column: 2;
        grid-row: 1;
        padding: 0;
    }
}