/* Prevent truncation of glow and translation on both sides on desktop */
@media screen and (min-width: 961px) {
    .sidebar {
        padding-left: 10px !important;
        padding-right: 15px !important;
        width: 210px !important; /* Original width 185px + 10px left + 15px right */
        box-sizing: border-box;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important; /* Prevents stretching menu out across empty space */
        min-height: 100vh !important;
    }

    /* Adjust the main content to not overlap with the wider sidebar */
    .wrapper > section {
        width: calc(100% - 220px) !important; /* 860px wrapper - 210px sidebar - 10px gap */
    }

    .link-wrapper {
        margin-top: 50px;
    }

    .sidebar-footer {
        margin-top: auto !important;
        padding-bottom: 20px !important;
        position: static !important;
        bottom: auto !important;
    }
}

/* Mobile layout fixes for toggle absolutely positioned in wrapper */
:root {
    --focus-outline-color: #0056b3;
}

/* Mobile collapsible menu styles */
.mobile-menu-details {
    margin-top: 10px;
    margin-bottom: 10px;
}

.mobile-menu-summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 18px; /* Make text larger */
    height: 34px; /* Match the height of the theme toggle */
    list-style: none; /* Hide default arrow */
    display: inline-flex;
    align-items: center;
    padding: 0;
    color: var(--clr-h1-and-bold);
    user-select: none;
}

.mobile-menu-summary::-webkit-details-marker {
    display: none; /* Hide default arrow in Safari */
}

.mobile-menu-summary:focus-visible {
    outline: 2px solid var(--focus-outline-color);
    outline-offset: 2px;
    border-radius: 4px;
}

@media screen and (min-width: 961px) {
    .mobile-menu-details {
        display: none !important;
    }
}

@media screen and (max-width: 960px) {
    header {
        /* Provide padding so the site title does not overlap with the absolutely positioned theme toggle on narrow screens */
        padding-right: 70px !important;
    }
}

@media screen and (max-width: 768px) {
    .theme-toggle-container {
        /* Respect hardware notches/dynamic island on iOS */
        top: max(20px, env(safe-area-inset-top)) !important;
        right: max(20px, env(safe-area-inset-right)) !important;
    }
}

/* Theme Toggle Slider */
.theme-toggle-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    justify-content: center;
    margin: 0;
    z-index: 100;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch input:focus-visible + .slider {
    outline: 2px solid var(--focus-outline-color);
    outline-offset: 2px;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    z-index: 2;
}

input:checked + .slider {
    background-color: #2c3e50;
}

input:checked + .slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.slider .sun-icon {
    color: #f1c40f;
    font-size: 14px;
    z-index: 1;
}

.slider .moon-icon {
    color: #f1c40f;
    font-size: 14px;
    z-index: 1;
}
