/* Desktop and tablet sidebars share these controls; the phone menu remains unchanged. */
.article-sidebar-toggle-item { display: none; }
.sidebar-tooltip { display: none; }

#dark-mode-toggle > button {
    display: inline-flex;
    align-items: center;
    gap: var(--menu-icon-separation);
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
    html.article-sidebar-compact:not(.zen-mode) .sidebar-tooltip:not([hidden]) {
        animation: sidebar-tooltip-in 180ms ease-in-out;
    }
}

@keyframes sidebar-tooltip-in {
    from { opacity: 0; transform: translateX(-3px); }
    to { opacity: 1; transform: translateX(0); }
}

@media (min-width: 768px) {
    html.article-sidebar-compact:not(.zen-mode) .sidebar-tooltip:not([hidden]) {
        position: fixed;
        z-index: 50;
        display: block;
        padding: 6px 10px;
        border-radius: 6px;
        background-color: var(--accent-color);
        color: var(--accent-color-text);
        box-shadow: var(--shadow-l1);
        font-size: 1.4rem;
        font-weight: 600;
        line-height: 1.4;
        overflow-wrap: anywhere;
        pointer-events: none;
    }
    .sidebar-tooltip::before {
        position: absolute;
        top: var(--sidebar-tooltip-arrow-top, 50%);
        right: 100%;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-right-color: var(--accent-color);
        content: "";
    }

    html.article-sidebar-resizable:not(.zen-mode) body .article-sidebar-toggle-item { display: block; }

    .article-sidebar-toggle {
        display: inline-flex;
        align-items: center;
        gap: var(--menu-icon-separation);
        padding: 0;
        border: 0;
        background: none;
        color: var(--body-text-color);
        font: inherit;
        cursor: pointer;
    }

    .article-sidebar-toggle:hover, #dark-mode-toggle > button:hover { color: var(--accent-color); }

    html.article-sidebar-resizable:not(.zen-mode) body .main-container > .left-sidebar {
        flex: 0 0 min(var(--article-left-sidebar-width, 100%), var(--left-sidebar-max-width));
        width: min(var(--article-left-sidebar-width, 100%), var(--left-sidebar-max-width));
        max-width: min(var(--article-left-sidebar-width, 100%), var(--left-sidebar-max-width));
    }

    html.article-sidebar-resizable:not(.zen-mode) .left-sidebar #main-menu {
        --sidebar-control-size: 4.4rem;
        row-gap: .6rem;
    }
    html.article-sidebar-resizable:not(.zen-mode) .left-sidebar #main-menu .menu-bottom-section > ol {
        row-gap: .6rem;
    }
    html.article-sidebar-resizable:not(.zen-mode) .left-sidebar :is(#main-menu > li > a, .article-sidebar-toggle, #dark-mode-toggle > button) {
        position: relative;
        box-sizing: border-box;
        max-inline-size: 100%;
        min-block-size: var(--sidebar-control-size);
        padding-inline: 16px;
        gap: 18px;
        border-radius: 999px;
    }
    html.article-sidebar-resizable:not(.zen-mode) .left-sidebar :is(#main-menu > li > a, .article-sidebar-toggle, #dark-mode-toggle > button) > span {
        flex: 0 1 auto;
    }
    html.article-sidebar-resizable:not(.zen-mode) .left-sidebar :is(#main-menu > li > a, .article-sidebar-toggle, #dark-mode-toggle > button):focus-visible {
        /* Keep the whole focus outline inside Stack's scrollable menu. */
        outline: 2px solid var(--accent-color);
        outline-offset: -2px;
    }

    html.article-sidebar-compact:not(.zen-mode) body .left-sidebar {
        --sidebar-avatar-size: 5.2rem;
    }

    html.article-sidebar-compact:not(.zen-mode) body .left-sidebar .site-meta { display: none; }
    html.article-sidebar-compact:not(.zen-mode) body .left-sidebar .menu-social { display: none; }
    html.article-sidebar-compact:not(.zen-mode) body .left-sidebar .site-avatar { margin-inline: auto; }
    html.article-sidebar-compact:not(.zen-mode) .left-sidebar :is(#main-menu > li > a, .article-sidebar-toggle, #dark-mode-toggle > button) {
        display: flex;
        inline-size: var(--sidebar-control-size);
        margin-inline: auto;
        padding-inline: 0;
        gap: 0;
        justify-content: center;
    }
    html.article-sidebar-compact:not(.zen-mode) .left-sidebar #dark-mode-toggle { justify-content: center; }
    html.article-sidebar-compact:not(.zen-mode) body .left-sidebar #main-menu li span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }
}
