/*
 * BFH Perfume Archive (archive.css)
 *
 * Page shell for templates/archive-bfh_perfume.php: dark hero, sidebar/results
 * split, results toolbar and the AJAX busy state. Facet and card styling live
 * in filters.css and cards.css.
 */

.bfh-archive {
    background-color: var(--bfh-bg-page);
    color: var(--bfh-text-primary);
    font-family: var(--bfh-font-sans);
    padding-bottom: var(--bfh-space-10);
}

/* -------------------- Hero -------------------- */
.bfh-archive__hero {
    padding-block: var(--bfh-space-10);
    text-align: center;
    background:
        radial-gradient(ellipse at 50% 0%, var(--bfh-color-primary-transparent), transparent 65%),
        var(--bfh-bg-page);
    border-bottom: var(--bfh-border-width) solid var(--bfh-border);
    margin-bottom: var(--bfh-space-8);
}

.bfh-archive__title {
    margin: 0 0 var(--bfh-space-3);
    font-family: var(--bfh-font-serif);
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: var(--bfh-font-weight-bold);
    line-height: 1.1;
    color: var(--bfh-text-primary);
}

.bfh-archive__subtitle {
    max-width: 56ch;
    margin: 0 auto var(--bfh-space-6);
    font-size: var(--bfh-text-lg);
    color: var(--bfh-text-secondary);
}

.bfh-archive__searchbar {
    display: flex;
    align-items: stretch;
    gap: var(--bfh-space-2);
    max-width: 720px;
    margin-inline: auto;
    padding: var(--bfh-space-2);
    background-color: var(--bfh-surface);
    border: var(--bfh-border-width) solid var(--bfh-border);
    border-radius: var(--bfh-radius-pill);
    box-shadow: var(--bfh-shadow-1);
    transition: border-color var(--bfh-anim-fast), box-shadow var(--bfh-anim-fast);
}

.bfh-archive__searchbar:focus-within {
    border-color: var(--bfh-color-primary);
    box-shadow: var(--bfh-shadow-glow);
}

/* The bar itself carries the border and focus ring, so the field inside is
   stripped back to avoid a double outline. */
.bfh-archive__search {
    flex: 1 1 auto;
    min-width: 0;
    padding-inline: var(--bfh-space-5);
    background: none;
    border: none;
    border-radius: var(--bfh-radius-pill);
    font-size: var(--bfh-text-base);
}

.bfh-archive__search:focus {
    outline: none;
    box-shadow: none;
    border-color: transparent;
}

.bfh-archive__search-submit {
    flex: 0 0 auto;
    padding-inline: var(--bfh-space-6);
    border-radius: var(--bfh-radius-pill);
}

/* -------------------- Body layout -------------------- */
.bfh-archive__body {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: var(--bfh-space-6);
    align-items: start;
}

/* Sidebar suppressed — used when the facets live in a separate widget, so the
   results must not sit in the second column of an otherwise empty grid. */
.bfh-archive__body--full {
    grid-template-columns: minmax(0, 1fr);
}

/* Dropped into a page builder column rather than owning the page: the shell
   must not repaint the background or reserve page-level padding, because the
   surrounding section already does both. */
.bfh-archive--embedded {
    background-color: transparent;
    padding-bottom: 0;
}

.bfh-archive__sidebar {
    position: sticky;
    top: var(--bfh-space-5);
    /* Long facet lists must scroll inside the sticky column rather than pushing
       the results column taller than the viewport. */
    max-height: calc(100vh - var(--bfh-space-8));
    overflow-y: auto;
    scrollbar-width: thin;
}

.bfh-archive__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--bfh-space-6);
}

/* Shown only on narrow screens, where the sidebar collapses into a drawer. */
.bfh-archive__filter-toggle {
    display: none;
    justify-self: start;
}

/* -------------------- Toolbar -------------------- */
.bfh-archive__toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--bfh-space-4);
    flex-wrap: wrap;
    padding-bottom: var(--bfh-space-4);
    border-bottom: var(--bfh-border-width) solid var(--bfh-border);
}

.bfh-archive__counts {
    display: flex;
    flex-direction: column;
    gap: var(--bfh-space-1);
    min-width: 0;
}

.bfh-archive__found {
    margin: 0;
    font-family: var(--bfh-font-serif);
    font-size: var(--bfh-text-xl);
    font-weight: var(--bfh-font-weight-semibold);
    color: var(--bfh-text-primary);
}

.bfh-archive__summary {
    margin: 0;
    font-size: var(--bfh-text-sm);
    color: var(--bfh-text-muted);
}

/* Collapsed while empty so the toolbar does not reserve a blank line before
   the first AJAX response fills it in. */
.bfh-archive__summary:empty {
    display: none;
}

.bfh-archive__controls {
    display: flex;
    align-items: center;
    gap: var(--bfh-space-3);
}

.bfh-archive__layout {
    display: inline-flex;
    padding: 2px;
    background-color: var(--bfh-surface);
    border: var(--bfh-border-width) solid var(--bfh-border);
    border-radius: var(--bfh-radius-md);
}

.bfh-layout-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 30px;
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--bfh-radius-sm);
    color: var(--bfh-text-muted);
    font-size: var(--bfh-text-base);
    line-height: 1;
    cursor: pointer;
    transition: all var(--bfh-anim-fast);
}

.bfh-layout-toggle:hover {
    color: var(--bfh-text-primary);
}

.bfh-layout-toggle.is-active {
    background-color: var(--bfh-color-primary);
    color: #fff;
}

/* -------------------- Results & busy state -------------------- */
.bfh-archive__results {
    position: relative;
    min-height: 200px;
    transition: opacity var(--bfh-anim-normal);
}

/* Dimmed rather than emptied: keeping the previous page visible while the next
   loads avoids a layout jump on every filter change. */
.bfh-archive__results[aria-busy="true"] {
    opacity: 0.45;
    pointer-events: none;
}

.bfh-archive__results[aria-busy="true"]::after {
    content: '';
    position: absolute;
    top: var(--bfh-space-8);
    left: 50%;
    width: 32px;
    height: 32px;
    margin-left: -16px;
    border: 3px solid var(--bfh-border);
    border-top-color: var(--bfh-color-primary);
    border-radius: var(--bfh-radius-round);
    animation: bfh-archive-spin 700ms linear infinite;
}

@keyframes bfh-archive-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .bfh-archive__results[aria-busy="true"]::after {
        animation-duration: 2s;
    }
}

.bfh-archive__pagination:empty {
    display: none;
}

/* -------------------- Responsive -------------------- */
@media (max-width: 1024px) {
    .bfh-archive__body {
        grid-template-columns: minmax(0, 1fr);
    }

    .bfh-archive__filter-toggle {
        display: inline-flex;
    }

    /* Off-canvas by default; the toggle adds .is-open on the wrapper. */
    .bfh-archive__sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: var(--bfh-z-modal);
        width: min(340px, 88vw);
        max-height: none;
        padding: var(--bfh-space-4);
        background-color: var(--bfh-bg-page);
        border-right: var(--bfh-border-width) solid var(--bfh-border);
        box-shadow: var(--bfh-shadow-2);
        transform: translateX(-100%);
        transition: transform var(--bfh-anim-normal);
    }

    .bfh-archive.is-filters-open .bfh-archive__sidebar {
        transform: translateX(0);
    }

    .bfh-archive.is-filters-open::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: calc(var(--bfh-z-modal) - 1);
        background-color: rgba(0, 0, 0, 0.55);
    }
}

@media (max-width: 640px) {
    .bfh-archive__hero {
        padding-block: var(--bfh-space-6);
    }

    .bfh-archive__searchbar {
        flex-wrap: wrap;
        border-radius: var(--bfh-radius-lg);
    }

    .bfh-archive__search,
    .bfh-archive__search-submit {
        flex-basis: 100%;
        border-radius: var(--bfh-radius-md);
    }

    .bfh-archive__toolbar {
        align-items: flex-start;
        flex-direction: column;
    }
}
