/* Browse: intro with search, topic buttons, and the list with its filters beside it
 * (handoff, Unterseiten: Browse). Shares the search box and the library basics with
 * home.css.
 */

.browse-intro .container {
  padding-block: 64px var(--s-5);
}

.browse-intro h1 {
  font-size: var(--fs-h1);
  font-weight: var(--fw-display);
  line-height: 1.12;
}

.browse-intro__lead {
  max-width: 760px;
  margin: var(--s-3) 0 0;
  color: var(--c-muted);
  font-size: var(--fs-lead);
}

.search-box--wide {
  max-width: 760px;
  margin-top: 28px;
}

.browse-intro__hint {
  margin: var(--s-3) 0 0;
  color: var(--c-muted);
  font-size: var(--fs-body-sm);
}

/* --- topic buttons --------------------------------------------------------------------- */

.browse-topics .container {
  padding-block: var(--s-3) var(--s-2);
}

.browse-topics .label {
  margin-bottom: 14px;
}

.topic-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip--topic {
  font-size: var(--fs-meta-lg);
}

.chip--topic[aria-current="true"] {
  font-weight: var(--fw-bold);
}

.topic-icon {
  flex: none;
}

/* --- results ---------------------------------------------------------------------------- */

.browse-results__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--s-6);
  padding-block: var(--s-5) 90px;
}

/* the filter column beside the list from 1100 px; above it, folded, below that */
@media (min-width: 1100px) {
  .browse-results__inner {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: var(--s-7);
  }
}

.browse-filters {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.browse-filters .browse-filters__heading {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--c-navy);
  font: var(--fw-bold) var(--fs-label) / 1.2 var(--f-sans);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-gold-dark);
}

.browse-refine {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.browse-refine[open] > :not(summary) + :not(summary) {
  margin-top: var(--s-5);
}

.browse-filters__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap);
  list-style: none;
  cursor: pointer;
}

.browse-filters__heading::-webkit-details-marker {
  display: none;
}

.browse-filters__heading h2 {
  font: inherit;
  color: inherit;
}

.browse-filters__heading::after {
  content: "";
  width: 0;
  height: 0;
  border-inline: 5px solid transparent;
  border-top: 6px solid currentColor;
}

.browse-refine[open] > .browse-filters__heading::after {
  transform: rotate(180deg);
}

.browse-refine > .browse-filters__heading {
  margin-bottom: var(--s-4);
}

.browse-filters__form {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.browse-filters__label {
  color: var(--c-muted);
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
}

.browse-filters .select {
  font-size: var(--fs-meta-lg);
}

.browse-filters__help {
  margin: 0;
  color: var(--c-muted);
  font-size: var(--fs-small);
}

.browse-filters__clear {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
}

/* "Show 25 insights" at the end of Refine while Refine sits above the list (decision 67):
   the count the filters give, at the controls; it closes the panel and moves to the
   results (library.js). Beside the list, from 1100 px, the list itself shows it. */
.browse-filters__show .btn {
  width: 100%;
}

@media (min-width: 1100px) {
  .browse-filters__show {
    display: none;
  }
}

.browse-main {
  min-width: 0;
}

.browse-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-bottom: 14px;
  border-bottom: var(--rule) solid var(--c-line);
}

.browse-toolbar__count {
  margin: 0;
  color: var(--c-muted);
  font-size: var(--fs-body-sm);
  /* where a searched or filtered Browse lands (#browse-count): with room above it, so the
     Refine heading and the Sort select beside it are not cut by the top of the screen */
  scroll-margin-top: var(--s-6);
}

.browse-sort {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.browse-sort .select {
  width: auto;
  font-size: var(--fs-meta-lg);
}

.browse-more {
  display: flex;
  justify-content: center;
  margin-top: 36px;
}

@media (max-width: 699px) {
  .browse-intro .container {
    padding-block: var(--s-7) var(--s-4);
  }

  /* The topics in one row that scrolls sideways, like Home's tabs (decision 68): stacked,
     eleven chips pushed the first result two screens down. The row runs to the screen's
     edges as Home's do (decision 69); library.js brings the chosen topic into view. */
  .topic-buttons {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
  }

  .topic-buttons > li {
    flex: none;
  }

  .browse-sort {
    width: 100%;
  }

  .browse-sort .select {
    flex: 1;
  }

  /* 16 px, not less: iOS zooms the page into any smaller field on focus */
  .browse-filters .select,
  .browse-sort .select {
    font-size: var(--fs-body-sm);
  }
}
