body {
    width: calc(100vw + 275px + 1rem);
    height: 100vh;
    display: grid;
    gap: 1rem;
    grid-template-areas:
        "nav content";
    grid-template-columns: 275px minmax(0px, 1fr);
    color: var(--grey-900);
    overflow: hidden;
    padding: 1rem 0 1rem 1rem;
    background-color: var(--grey-100);
    transform: translateX(calc(-275px - 1rem));
    transition: all 150ms ease-in-out;

    &.is-open {
        transform: translateX(0);

        & nav-component {
            & .menu {
                left: 16.5rem;
            }

            & .open {
                opacity: 0;
                visibility: hidden;
            }

            & .close {
                opacity: 1;
                visibility: visible;
            }
        }
    }

    @media (min-width: 768px) {
        width: 100vw;
        transform: translateX(0);
    }

    @media (prefers-color-scheme: dark) {
        background-color: var(--grey-950);
        color: var(--grey-300);
    }
}

header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-right: 1rem;
    padding: 0.5rem;
    padding-left: 0.75rem;
    overflow: hidden;
    border-radius: 1.5rem;
    background-color: var(--white);
    border: 1px solid var(--grey-300);

    @media (prefers-color-scheme: dark) {
        background-color: var(--grey-900);
        border: none;
    }

    & a {
        color: var(--font-grey-800);

        @media (prefers-color-scheme: dark) {
            color: var(--white);
        }
    }
}

nav-component {
    width: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 10;
    grid-area: nav;
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    background-color: var(--white);
    border: 1px solid var(--grey-300);

    @media (prefers-color-scheme: dark) {
        background-color: var(--grey-900);
        border: none;
    }

    & .menu {
        left: 19rem;

        @media (min-width: 768px) {
            display: none !important;
        }
    }

    & .open {
        position: absolute;
        opacity: 1;
        visibility: visible;
    }

    & .close {
        position: absolute;
        opacity: 0;
        visibility: hidden;
    }

    & nav-skel {
        display: block;
        width: 100%;
        position: relative;
        border-radius: 0.25rem;
        overflow: hidden;
        height: 32px;
        margin-bottom: 0.25rem;

        &::after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0;
            background-color: hsl(var(--white-hsl) / 0.15);
            animation: navSkeletonPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
        }
    }

    & nav-children-container {
        display: none;
        width: 100%;
        padding-left: 0.5rem;
    }

    & button {
        margin-right: auto;
        height: 32px;
        padding: 0 0.5rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        white-space: nowrap;
        text-overflow: ellipsis;
        text-transform: capitalize;
        position: relative;
        cursor: pointer;
        text-align: left;
        font-weight: var(--font-medium);
        font-size: var(--text-sm);
        color: var(--grey-700);
        border: 1px solid;
        border: none;
        margin-bottom: 0.25rem;
        background: transparent;

        &:hover,
        &:focus-visible {
            color: var(--grey-900);

            &::before {
                opacity: 0.05;
            }
        }

        &:active {
            color: var(--grey-900);

            &::before {
                opacity: 0.15;
            }
        }

        &.is-open {
            & + nav-children-container {
                display: block;
            }

            & i {
                & svg {
                    transform: rotate(90deg);
                }
            }
        }

        &.is-active {
            color: var(--grey-900);

            &::before {
                background-color: var(--white);
                opacity: 1;
                box-shadow: var(--shadow-black-sm);
                border-color: var(--grey-300);
            }
        }

        &::before {
            content: "";
            display: inline-block;
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border-radius: 0.5rem;
            background-color: var(--grey-500);
            opacity: 0;
            transition: all 80ms ease-in-out;
            border: 1px solid transparent;
        }

        @media (prefers-color-scheme: dark) {
            color: var(--grey-300);

            &:hover,
            &:focus-visible {
                color: var(--grey-100);
            }

            &::before {
                background-color: var(--white);
            }

            &.is-active {
                color: var(--white);

                &::before {
                    background-color: var(--white);
                    opacity: 0.1;
                }
            }
        }

        & i {
            width: 24px;
            height: 24px;
            display: inline-flex;
            justify-content: center;
            align-items: center;
            color: var(--grey-500);
            transition: all 80ms ease-in-out;

            & svg {
                width: 18px;
                height: 18px;
                transition: all 150ms ease-in-out;
            }
        }
    }
}

component-viewer {
    width: 100%;
    height: 100%;
    grid-area: content;

    & txt-skel {
        display: inline-block;
        width: 100%;
        position: relative;
        border-radius: 0.25rem;
        overflow: hidden;
        background-color: var(--grey-100);
        height: 24px;

        @media (prefers-color-scheme: dark) {
            background-color: var(--grey-900);
        }

        &::after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0;
            background-color: var(--grey-200);
            animation: navSkeletonPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;

            @media (prefers-color-scheme: dark) {
                background-color: var(--grey-800);
            }
        }
    }

    & .head {
        padding: 0 1rem;
        margin-left: 2rem;

        @media (min-width: 768px) {
            padding: 0 1rem;
            margin-left: 0;
        }
    }

    & view-switcher {
        background-color: var(--grey-100);
        border-radius: 0.5rem;
        padding: 0.25rem;
        display: inline-flex;
        flex-flow: row nowrap;
        align-items: center;
        transition: all 80ms ease-in-out;

        @media (prefers-color-scheme: dark) {
            background-color: var(--grey-900);
        }

        & button {
            height: 32px;
            font-weight: var(--font-medium);
            padding: 0 0.75rem 0 0.25rem;
            display: inline-flex;
            justify-content: center;
            align-items: center;
            background-color: transparent;
            border: 1px solid transparent;
            cursor: pointer;
            border-radius: 0.5rem;
            color: var(--grey-700);
            transition: all 80ms ease-in-out;
            font-size: var(--text-xs);

            &:hover,
            &:focus-visible {
                &::before {
                    opacity: 0.05;
                }
            }

            &:active {
                &::before {
                    opacity: 0.1;
                }
            }

            &:last-of-type {
                margin-right: 0;
            }

            &:not(:last-of-type) {
                margin-right: 0.5rem;
            }

            &:not(.is-selected) {
                &:hover,
                &:focus-visible {
                    color: var(--grey-800);
                }
            }

            &.is-selected {
                background-color: var(--white);
                box-shadow: var(--shadow-black-sm);
                border-color: var(--grey-300);
                color: var(--grey-900);

                & i {
                    color: var(--primary-500);
                }
            }

            &::before {
                content: "";
                display: inline-block;
                width: 100%;
                height: 100%;
                position: absolute;
                top: 0;
                left: 0;
                border-radius: 0.5rem;
                background-color: var(--grey-500);
                opacity: 0;
                transition: all 80ms ease-in-out;
            }

            @media (prefers-color-scheme: dark) {
                color: var(--grey-300);

                &::before {
                    background-color: var(--white);
                }

                &:hover,
                &:focus-visible {
                    color: var(--grey-100);
                }

                &.is-selected {
                    background-color: var(--grey-800);
                    border-color: var(--grey-700);
                    color: var(--white);

                    & i {
                        color: var(--primary-400);
                    }
                }

                &:not(.is-selected) {
                    &:hover,
                    &:focus-visible {
                        color: var(--grey-100);
                    }
                }
            }

            & i {
                width: 24px;
                height: 24px;
                display: inline-flex;
                justify-content: center;
                align-items: center;
                margin-right: 0.25rem;

                & svg {
                    width: 16px;
                    height: 16px;
                }
            }
        }
    }

   & docs-view {
        width: 100%;
        height: 100%;
        position: relative;
        display: block;
        padding: 1rem 1rem 4rem;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-radius: 1rem 0 0 0;
        border-width: 1px 0 0 1px;
        border-style: solid;
        border-color: var(--grey-300);
        background-color: var(--white);

        @media (prefers-color-scheme: dark) {
            background-color: var(--grey-800);
            border: none;
        }

        & h1,
        & h2,
        & h3,
        & h4,
        & h5,
        & h6 {
            display: block;
            line-height: 1.375;
            font-weight: var(--font-medium);
            color: var(--grey-800);
            margin-bottom: 1rem;

            @media (prefers-color-scheme: dark) {
                color: var(--grey-300);
            }

            &:not(:first-child) {
                margin-top: 3rem;
            }
        }

        & h1 {
            font-size: var(--font-2xl);
            border-bottom: 1px solid var(--grey-300);
            padding-bottom: 0.5rem;
        }

        & h2 {
            font-size: var(--font-xl);
        }

        & h3 {
            font-size: var(--text-xl);
        }

        & h4 {
            font-size: var(--text-lg);
        }

        & h5 {
            font-size: var(--font-base);
        }

        & h6 {
            font-weight: var(--font-base);
        }

        & p {
            margin-bottom: 1rem;
            color: var(--grey-700);
            line-height: 1.618;

            @media (prefers-color-scheme: dark) {
                color: var(--grey-300);
            }

            & code {
                height: 24px;
                padding: 0.125rem 0.25rem;
                border-radius: 0.25rem;
                background-color: hsl(var(--warning-100-hsl) / 0.15);
                color: var(--warning-700);
                font-size: var(--text-sm);

                @media (prefers-color-scheme: dark) {
                    background-color: hsl(var(--warning-300-hsl) / 0.15);
                    color: var(--warning-400);
                }
            }
        }

        & pre {
            margin-bottom: 1rem;

            & code {
                border-radius: 0.25rem;
                box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
                line-height: 1.618;
                font-size: var(--text-sm);

                @media (prefers-color-scheme: dark) {
                    box-shadow: none !important;
                    background-color: var(--grey-950) !important;
                }

                & * {
                    font-size: var(--text-sm);
                    line-height: 1.618;
                }
            }
        }

        & a {
            text-decoration: underline;
            color: var(--primary-700);
            cursor: pointer;
            transition: all 80ms ease-in-out;

            &:hover,
            &:focus-visible {
                color: var(--primary-600);
            }

            &:active {
                color: var(--primary-700);
            }

            @media (prefers-color-scheme: dark) {
                color: var(--primary-400);

                &:hover,
                &:focus-visible {
                    color: var(--primary-500);
                }

                &:active {
                    color: var(--primary-400);
                }
            }
        }

        & table {
            display: block;
            width: 100%;
            background-color: var(--white);
            border: 1px solid var(--grey-300);
            border-radius: 0.5rem;
            margin-bottom: 1.5rem;
            overflow: hidden;

            @media (prefers-color-scheme: dark) {
                background-color: transparent;
                border-color: var(--grey-600);
            }

            & thead {
                background-color: var(--grey-100);
                border-bottom: 1px solid var(--grey-300);
                display: block;
                width: 100%;

                @media (prefers-color-scheme: dark) {
                    background-color: transparent;
                    border-color: var(--grey-600);
                }

                & tr {
                    display: flex;
                    width: 100%;
                    padding: 0 1rem;

                    & th {
                        width: 100%;
                        flex: 1;
                        padding: 1rem;
                        text-align: left;
                        color: var(--grey-800);

                        @media (prefers-color-scheme: dark) {
                            color: var(--grey-300);
                        }
                    }
                }
            }

            & tbody {
                display: block;
                width: 100%;

                & tr {
                    display: flex;
                    width: 100%;
                    padding: 0 1rem;
                    transition: all 80ms ease-in-out;

                    &:not(:last-of-type) {
                        border-bottom: 1px solid var(--grey-300);

                        @media (prefers-color-scheme: dark) {
                            border-bottom: 1px solid var(--grey-600);
                        }
                    }

                    &:hover {
                        background-color: var(--grey-100);

                        @media (prefers-color-scheme: dark) {
                            background-color: transparent;
                        }
                    }

                    & td {
                        width: 100%;
                        flex: 1;
                        padding: 1rem;
                        text-align: left;
                        color: var(--grey-700);
                        font-size: var(--text-sm);

                        @media (prefers-color-scheme: dark) {
                            color: var(--grey-300);
                        }

                        & code {
                            height: 24px;
                            padding: 0.125rem 0.25rem;
                            border-radius: 0.25rem;
                            background-color: var(--warning-100);
                            color: var(--warning-700);
                            font-size: var(--text-sm);

                            @media (prefers-color-scheme: dark) {
                                background-color: hsl(var(--warning-300) / 0.15);
                                color: var(--warning-400);
                            }
                        }
                    }
                }
            }
        }
    }

    & iframe-resizer {
        width: 100%;
        height: 100%;
        position: relative;
        display: block;
        user-select: none;
        overflow: hidden;
        border-radius: 1rem 0 0 0;
        border-width: 1px 0 0 1px;
        border-style: solid;
        border-color: var(--grey-300);

        &::before {
            content: "";
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
            background-color: var(--grey-300);
            box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.15);

            @media (prefers-color-scheme: dark) {
                display: none;
            }
        }

        &[dragging="false"] {
            & iframe {
                pointer-events: all;
                user-select: auto;
            }
        }

        @media (prefers-color-scheme: dark) {
            background-color: var(--grey-950);
            border: none;
        }

        & resize-container {
            width: 100%;
            height: 100%;
            display: block;
            position: relative;
            padding-right: 24px;
            overflow: hidden;
            box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
        }

        & resize-bar {
            width: 24px;
            height: 100%;
            background-color: var(--grey-100);
            border-width: 0 1px 0 1px;
            border-style: solid;
            border-color: var(--grey-300);
            box-shadow: 0 0 3px rgba(0, 0, 0, 0.07);
            cursor: ew-resize;
            position: absolute;
            top: 0;
            right: 0;
            z-index: 3;
            display: inline-flex;
            justify-content: center;
            align-items: center;
            color: var(--grey-700);

            @media (prefers-color-scheme: dark) {
                background-color: var(--grey-800);
                color: var(--grey-300);
                border: none;
            }

            & svg {
                width: 14px;
                height: 14px;
            }
        }

        & iframe {
            z-index: 1;
            width: 100%;
            height: 100%;
            user-select: none;
            pointer-events: none;
            transition: opacity 300ms ease-in-out;
        }
    }

    & code-view {
        width: 100%;
        height: 100%;
        position: relative;
        display: block;
        padding: 1rem;
        border-radius: 1rem 0 0 0;
        border-width: 1px 0 0 1px;
        border-style: solid;
        border-color: var(--grey-300);
        background-color: var(--white);

        @media (prefers-color-scheme: dark) {
            background-color: var(--grey-800);
            border: none;
        }

        & code-tabs {
            display: block;

            & button {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                padding: 0 1rem;
                text-transform: uppercase;
                text-align: center;
                cursor: pointer;
                font-size: var(--text-sm);
                font-weight: var(--font-medium);
                position: relative;
                margin-right: 0.5rem;
                height: 36px;
                line-height: 1;
                color: var(--grey-700);

                &:last-of-type {
                    margin-right: 0;
                }

                &:hover,
                &:focus-visible,
                &.is-active {
                    color: var(--grey-900);

                    &::before {
                        opacity: 0.05;
                    }
                }

                &:active {
                    color: var(--grey-900);

                    &::before {
                        opacity: 0.1;
                    }
                }

                &::before {
                    content: "";
                    display: inline-block;
                    width: 100%;
                    height: 100%;
                    position: absolute;
                    top: 0;
                    left: 0;
                    border-radius: 0.5rem;
                    background-color: var(--grey-500);
                    opacity: 0;
                    transition: all 80ms ease-in-out;
                }

                @media (prefers-color-scheme: dark) {
                    color: var(--grey-300);

                    &:hover,
                    &:focus-visible,
                    &.is-active {
                        color: var(--grey-100);
                    }

                    &::before {
                        background-color: var(--white);
                    }
                }
            }
        }

        & code-container {
            display: block;
            width: 100%;

            & .copy-to-clipboard {
                width: 36px;
                height: 36px;
                z-index: 2;
                position: absolute;
                top: 2rem;
                right: 1.25rem;
                display: inline-flex;
                justify-content: center;
                align-items: center;
                background-color: #22272e;
                color: var(--grey-400);
                border-radius: 0.25rem;
                border: 1px solid lighten(#22272e, 10);
                transition: all 80ms ease-in-out;
                cursor: pointer;

                @media (prefers-color-scheme: dark) {
                    background-color: var(--grey-950);
                    border: none;
                }

                &:hover,
                &:focus-visible {
                    background-color: lighten(#22272e, 3);
                    border-color: lighten(#22272e, 15);
                }

                &.is-success {
                    box-shadow: 0 0 0 3px rgba(46, 164, 79, 0.3);
                    border-color: var(--success-500);
                    color: var(--success-400);

                    & .success {
                        display: block;
                    }

                    & .copy {
                        display: none;
                    }
                }

                &:active {
                    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
                }

                & svg {
                    width: 18px;
                    height: 18px;

                    &.success {
                        display: none;
                    }
                }
            }

            & pre {
                & code {
                    border-radius: 0.5rem;
                    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
                    line-height: 1.618;
                    font-size: var(--text-sm);
                    overflow-y: auto;
                    overscroll-behavior: contain;
                    height: calc(100vh - 9.5rem);

                    @media (prefers-color-scheme: dark) {
                        box-shadow: none !important;
                        background-color: var(--grey-950) !important;
                    }

                    & * {
                        font-size: var(--text-sm);
                        line-height: 1.618;
                    }
                }
            }
        }
    }
}

@keyframes navSkeletonPulse {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

