.container {
    margin: 30px auto;
    max-width: 800px;
    width: 96%;
    background: var(--container-bg);
}

.skip-link {
    position: absolute;
    left: 10px;
    top: -40px;
    padding: 6px 10px;
    background: var(--container-bg);
    color: var(--title);
    z-index: 30;
}

.skip-link:focus {
    top: 10px;
}

.site-header {
    width: 100%;
    height: 140px;
    line-height: 30px;
    padding: 0 80px;
    position: relative;
    z-index: 20;
}

.header-wrap {
    position: relative;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-toggle {
    display: none;
    position: absolute;
    right: 0;
    top: 48px;
    border: 0;
    background: transparent;
    color: var(--title);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.site-nav {
    display: flex;
    justify-content: center;
    width: 100%;
}

.site-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
}

.site-nav li {
    list-style: none;
}

.site-nav a,
.nav-link {
    display: block;
    margin: 0;
    color: var(--title);
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    border: 0;
    background: transparent;
    padding: 0;
    line-height: 30px;
    cursor: pointer;
}

.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--title);
    border: 0;
    background: transparent;
    transition: color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.theme-toggle__icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.theme-toggle__icon--sun {
    position: absolute;
    opacity: 0;
    transform: scale(0.72) rotate(-18deg);
}

.theme-toggle__icon--moon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

html[data-theme="dark"] .theme-toggle__icon--sun {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

html[data-theme="dark"] .theme-toggle__icon--moon {
    opacity: 0;
    transform: scale(0.72) rotate(18deg);
}

.theme-toggle--nav {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 999px;
    line-height: 1;
}

.theme-toggle--nav:hover,
.theme-toggle--nav:focus-visible {
    color: var(--title);
    opacity: 1;
    outline: none;
}

.theme-toggle--floating {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    background: var(--container-bg);
    color: var(--title);
    box-shadow: var(--shadow);
    display: none;
    z-index: 90;
}

.theme-toggle--floating:hover,
.theme-toggle--floating:focus-visible {
    color: var(--title);
    opacity: 1;
    transform: translateY(-1px);
    outline: none;
}

.site-nav .selected {
    border-bottom: 1px solid #bbbbbb;
}

.main-shell {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.main-shell.is-ready {
    opacity: 1;
}

.main {
    width: 660px;
    margin-right: auto;
    margin-bottom: 60px;
    margin-left: auto;
    text-align: justify;
}

.site-footer {
    text-align: center;
    background-color: var(--footer-bg);
    min-height: 80px;
    padding: 18px 20px;
}

.site-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 22px;
}

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    border: 0;
    background: var(--container-bg);
    color: var(--title);
    box-shadow: var(--shadow);
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.25s ease;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    color: var(--title);
    opacity: 1;
    transform: translateY(-1px);
    outline: none;
}

.back-to-top__icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.progress-bar {
    position: fixed;
    left: 0;
    top: 0;
    height: 2px;
    width: 0;
    z-index: 99;
    background: var(--title);
    transition: width 0.15s linear;
}

html.is-loading .main-shell {
    opacity: 0.25;
}

@media only screen and (min-width: 720px) {
    .container {
        border-radius: 10px;
        box-shadow: var(--shadow);
    }
}

@media screen and (max-width: 720px) {
    .container {
        margin: auto;
        width: 100%;
        padding-bottom: calc(92px + env(safe-area-inset-bottom));
    }

    .site-header {
        padding: 0;
        height: 0;
    }

    .header-wrap {
        min-height: 0;
    }

    .nav-toggle {
        display: none;
    }

    .site-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        padding: 0 14px calc(12px + env(safe-area-inset-bottom));
        z-index: 95;
        pointer-events: none;
    }

    .site-nav ul {
        width: min(100%, 520px);
        margin: 0 auto;
        text-align: left;
        padding: 10px 12px;
        background: color-mix(in srgb, var(--container-bg) 88%, transparent);
        border: 1px solid var(--line-soft);
        border-radius: 999px;
        box-shadow: var(--shadow);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        display: flex;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 8px;
        max-height: none;
        opacity: 1;
        overflow-x: auto;
        overflow-y: hidden;
        pointer-events: auto;
        transition: none;
        transform: none;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .site-nav ul::-webkit-scrollbar {
        display: none;
    }

    .site-nav.is-open ul {
        max-height: none;
        opacity: 1;
        padding: 10px 12px;
        pointer-events: auto;
        transform: none;
    }

    .site-nav li {
        float: none;
        flex: 0 0 auto;
    }

    .site-nav a,
    .nav-link {
        margin: 0;
        min-height: 38px;
        line-height: 38px;
        color: var(--title);
        width: auto;
        padding: 0 14px;
        text-align: center;
        letter-spacing: 0.08em;
        border-radius: 999px;
        white-space: nowrap;
    }

    .site-nav a:hover,
    .site-nav a:focus-visible,
    .nav-link:focus-visible,
    .nav-link:hover {
        background: var(--code-bg);
        color: var(--title);
        opacity: 1;
        outline: none;
    }

    .theme-toggle--nav {
        display: inline-flex;
    }

    .site-nav .selected {
        border-bottom: 0;
        background: var(--code-bg);
    }

    .main {
        padding: 0 22px;
        width: auto;
        margin-bottom: 36px;
    }

    .site-footer {
        min-height: 0;
        padding: 14px 16px;
    }

    .site-footer p {
        font-size: 12px;
        line-height: 22px;
    }

    .back-to-top {
        right: 16px;
        bottom: calc(84px + env(safe-area-inset-bottom));
    }

    .theme-toggle--floating {
        display: none;
        right: 16px;
        bottom: 16px;
    }
}
