/* hidden by default: takes no space */
#sidebar {
    display: none;
}

/* show the sidebar when the body has the class "sidebar-open" */
body.sidebar-open #sidebar {
    display: block;
}


.sidenav {
    height: 100%;
    width: 160px;
    position: fixed;
    z-index: 5;
    top: 0;
    left: 0;
    background-color: #F4E8D0;
    overflow-x: hidden;
    padding-top: 20px;
    box-shadow: 4px 0 12px rgba(30, 24, 20, 0.25);
}

.sidenav a {
    padding: 6px 8px 6px 16px;
    text-decoration: none;
    font-size: 25px;
    color: var(--ink);
    display: block;
}

.sidenav a:hover {
    color: var(--ink-secondary);
}

@media screen and (max-height: 450px) {
    .sidenav {
        padding-top: 15px;
    }

    .sidenav a {
        font-size: 18px;
    }
}

/* phones: a floating bottom tab bar replaces the ☰ sidebar (same look as the iOS app's tab bar) */
.tabBar {
    display: none;
}

@media (max-width: 760px) {
    .toggleButton,
    #sidebar {
        display: none;
    }

    /* room under the last content so the bar never covers it */
    body {
        padding-bottom: 96px;
    }

    .tabBar {
        display: flex;
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: 16px;
        z-index: 5;
        padding: 6px;
        background: #FBF6EC;
        border-radius: 999px;
        box-shadow: 0 4px 16px rgba(30, 24, 20, 0.18);
    }

    .tabBar a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 8px 0;
        border-radius: 999px;
        font-size: 12px;
        font-weight: 600;
        color: var(--ink);
        text-decoration: none;
        position: relative;
        /* no grey iOS tap flash; the highlight below shows the tap instead */
        -webkit-tap-highlight-color: transparent;
    }

    .tabBar svg {
        width: 24px;
        height: 24px;
        fill: currentColor;
        transition: transform 100ms ease-out;
    }

    /* the highlight pill: one tab wide, moved to the current tab by --tab-index (set on each page) */
    .tabIndicator {
        position: absolute;
        top: 6px;
        bottom: 6px;
        left: 6px;
        width: calc((100% - 12px) / 4);
        border-radius: 999px;
        background: rgba(30, 24, 20, 0.08);
        transform: translateX(calc(var(--tab-index) * 100%));
        transition: transform 160ms cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* tabBar.js adds .arriving for the new page's first frame: the highlight starts where the old page left it, then slides to this tab when the class is removed */
    .tabBar.arriving .tabIndicator {
        transform: translateX(calc(var(--tab-from) * 100%));
        transition: none;
    }

    /* quick press "squish" on the tapped icon */
    .tabBar a:active svg {
        transform: scale(0.85);
    }
}

/* no sliding or squishing for people who turned on Reduce Motion */
@media (prefers-reduced-motion: reduce) {
    .tabIndicator {
        transition: none;
    }

    .tabBar svg {
        transition: none;
    }
}
