/**
 * @file
 * Book listing page styles.
 */

/* ==========================================================================
   Sidebar + content layout for the books listing view.
   ========================================================================== */

/* Mobile: use flex column so order properties take effect. */
.book-listing {
  display: flex;
  flex-direction: column;
}

.book-listing .view-filters {
  order: 1;
}

.book-listing .view-header {
  order: 2;
}

.book-listing .view-content {
  order: 3;
}

.book-listing .pager {
  order: 4;
}

/* Desktop: sidebar on the left, books grid on the right. */
@media (min-width: 952px) {
  .book-listing {
    display: grid;
    grid-template-columns: 15rem 1fr;
    grid-template-rows: auto auto auto 1fr auto;
    gap: 0 2rem;
    grid-template-areas:
      "title   title"
      "filters content"
      "header  content"
      ".       content"
      ".       pager";
  }

  /* Page title spans full width at the top. */
  .book-listing .view-header .page-title {
    grid-area: title;
  }

  /* Make view-header span both columns so its children can participate
     in the parent grid via subgrid or be repositioned. */
  .book-listing .view-header {
    display: contents;
  }

  /* Categories stay in the sidebar. */
  .book-listing .view-header .category-nav {
    grid-area: header;
  }

  .book-listing .view-filters {
    grid-area: filters;
  }

  .book-listing .view-content {
    grid-area: content;
  }

  .book-listing .pager {
    grid-area: pager;
  }
}

/* ==========================================================================
   Category navigation in the sidebar.
   ========================================================================== */

.book-listing .category-nav__list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.book-listing .category-nav__item {
  margin-bottom: 0.35rem;
}

.book-listing .category-nav__link {
  font-size: var(--font-size-small);
  color: var(--color-blue-tq-text);
  text-decoration: none;
}

.book-listing .category-nav__link:hover {
  color: var(--color-blue-dk);
  text-decoration: underline;
}

/* ==========================================================================
   Filters sidebar.
   ========================================================================== */

.book-listing .view-filters {
  margin-bottom: 1.5rem;
}

@media (min-width: 952px) {
  .book-listing .view-filters {
    margin-bottom: 0;
  }
}

/* Stack all filter fields vertically in the sidebar. */
.book-listing .bef-exposed-form .form-item {
  margin-bottom: 1rem;
}

/* Labels above fields. */
.book-listing .bef-exposed-form label {
  display: block;
  font-size: var(--font-size-small);
  font-weight: 600;
  color: var(--color-heading);
  margin-bottom: 0.25rem;
}

/* Inputs and selects fill the sidebar width. */
.book-listing .bef-exposed-form input[type="text"],
.book-listing .bef-exposed-form select {
  width: 100%;
  box-sizing: border-box;
}

/* Apply button. */
.book-listing .bef-exposed-form .form-actions {
  margin-top: 0.5rem;
}

.book-listing .bef-exposed-form input[type="submit"] {
  width: 100%;
}

/* ==========================================================================
   Book grid.
   ========================================================================== */

.book-listing .view-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 2rem;
  width: 100%;
}

/* Tablet: auto-fill columns. */
@media (min-width: 600px) {
  .book-listing .view-content {
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  }
}

/* Desktop: 4 columns alongside the sidebar. */
@media (min-width: 952px) {
  .book-listing .view-content {
    grid-template-columns: repeat(4, 1fr);
  }
}

.book-listing__item {
  margin: 0;
}
