/*
 * sidebar.css — the left column (templates/components/sidebar.html) and the
 * small-screen top bar + drawer (templates/base.html).
 *
 * Uses the tokens from style.css. Wide/small breakpoint: 900px (same as
 * style.css). On small screens the drawer is opened/closed by
 * static/module/sidebar.js, which toggles the `is-open` class on .sidebar.
 */


/* ------------------------------------------------------------------------
 * Sidebar container
 * --------------------------------------------------------------------- */

.sidebar {
    font-family: var(--font-ui);
    font-size: 0.88rem;
    line-height: 1.5;
    background-color: var(--color-sidebar-bg);
    border-right: 1px solid var(--color-border);
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.3rem;
}

/* "Close" button, shown only inside the small-screen drawer */
.sidebar-close-button {
    display: none;
}

.sidebar a {
    color: inherit;
    text-decoration: none;
}

.sidebar a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

.sidebar p {
    margin: 0 0 0.6em;
}

/* Small-caps label above a block */
.sidebar-label {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 0 0 0.5rem;
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-list li {
    margin: 0 0 0.35em;
}


/* ------------------------------------------------------------------------
 * Identity block
 * --------------------------------------------------------------------- */

.avatar {
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-large {
    width: 80px;
    height: 80px;
    margin-bottom: 0.8rem;
    box-shadow: 0 0 0 3px var(--color-page-bg), 0 0 0 4px var(--color-border);
}

.avatar-small {
    width: 32px;
    height: 32px;
}

.sidebar-name {
    font-family: var(--font-text);
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.15rem;
}

.sidebar-position {
    color: var(--color-text-muted);
    margin: 0 0 0.8rem;
}

.coordinates {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.82rem;   /* a notch smaller so the e-mail fits on one line */
}

.coordinates li {
    margin: 0 0 0.3em;
}

.coordinates a {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    max-width: 100%;
}

.coordinates-icon {
    flex: none;
    width: 16px;
    height: 16px;
    font-size: 14px;
    line-height: 16px;
    text-align: center;
}

.coordinates-value {
    overflow-wrap: anywhere;   /* long e-mail address wraps instead of overflowing */
}


/* ------------------------------------------------------------------------
 * Menu
 * --------------------------------------------------------------------- */

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: 0.6rem 0;
}

.sidebar-menu a {
    font-size: 1rem;
    font-weight: 500;
    padding: 0.35rem 0.6rem;
    margin: 0 -0.6rem;         /* hover background extends past the text */
    border-radius: 4px;
}

.sidebar-menu a:hover {
    background-color: var(--color-accent-soft);
    text-decoration: none;
}

.sidebar-menu a[aria-current="page"] {
    color: var(--color-accent);
    background-color: var(--color-accent-soft);
    font-weight: 600;
}


/* ------------------------------------------------------------------------
 * Recent posts and About
 * --------------------------------------------------------------------- */

.sidebar-posts li {
    margin-bottom: 0.6em;
}

.sidebar-post-date {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.sidebar-about {
    font-family: var(--font-text);
    font-size: 0.95rem;
}


/* ------------------------------------------------------------------------
 * Small screens: top bar + drawer
 * --------------------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--topbar-height);
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    background-color: var(--color-sidebar-bg);
    border-bottom: 1px solid var(--color-border);
    font-family: var(--font-ui);
}

.topbar-identity {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: inherit;
    text-decoration: none;
}

.topbar-name {
    font-family: var(--font-text);
    font-weight: 600;
    font-size: 1.05rem;
}

.topbar-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: inherit;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
}

/* Three-line "hamburger" icon drawn with borders */
.topbar-menu-icon {
    width: 16px;
    height: 12px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    position: relative;
}

.topbar-menu-icon::before {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 3px;
    border-top: 2px solid currentColor;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    background-color: rgba(0, 0, 0, 0.35);
}

@media screen and (max-width: 900px) {
    .sidebar {
        /* Drawer: hidden off-screen to the left; sidebar.js adds .is-open */
        top: 0;
        left: 0;
        width: min(var(--sidebar-width), 85vw);
        z-index: 40;
        transform: translateX(-100%);
        transition: transform 0.2s ease-out;
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
    }

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

    /* The avatar is already in the top bar; keep the drawer compact */
    .sidebar .avatar-large {
        width: 56px;
        height: 56px;
    }

    .sidebar-close-button {
        display: block;
        position: absolute;
        top: 0.6rem;
        right: 0.6rem;
        font: inherit;
        font-size: 1.4rem;
        line-height: 1;
        color: var(--color-text-muted);
        background: none;
        border: 0;
        padding: 0.3rem 0.5rem;
        cursor: pointer;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar {
        transition: none;
    }
}
