/* ==========================
   SIDEBAR LAYOUT
   Reusable two-column shell: filter sidebar + main content
   (e.g. the Archive/Directory page)
========================== */

.sidebar-layout {
    display: grid;
    grid-template-columns: minmax(240px, 280px) 1fr;
    gap: clamp(1.5rem, 3vw, 2.5rem);
    align-items: start;
}

/* top accounts for the fixed header's height (.header-inner's 100px min-height,
   see templates/header.css) plus breathing room — otherwise the sticky sidebar
   scrolls up underneath the header instead of settling below it. */
.sidebar-layout__sidebar {
    position: sticky;
    top: calc(100px + 1.5rem);
}

.sidebar-layout__content {
    min-width: 0;
}

/* button.filter-toggle-btn (not .filter-toggle-btn alone) is needed to outrank
   buttons.css's `button[class*="btn-"] { display: inline-flex; }` — that
   attribute selector is more specific than a plain class selector, so it was
   winning and showing this button at every screen width, not just mobile. */
button.filter-toggle-btn {
    display: none;
}

.sidebar-layout__backdrop {
    display: none;
}

@media (max-width: 1024px) {
    .sidebar-layout {
        grid-template-columns: 1fr;
    }

    button.filter-toggle-btn {
        display: inline-flex;
        margin-bottom: 1.25rem;
    }

    /* On mobile the sidebar becomes an off-canvas drawer instead of just stacking */
    .sidebar-layout__sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(320px, 85vw);
        z-index: 1100;
        border-radius: 0;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

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

    .sidebar-layout__backdrop.is-open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(42, 27, 18, 0.4);
        z-index: 1050;
    }
}
