/* ==========================================================================
   Shop / collection page
   ========================================================================== */

.shop {
  padding-block: var(--space-7) var(--space-9);
}

.shop__head {
  padding-bottom: var(--space-6);
  border-bottom: var(--rule-ink);
}

.shop__head .section-head__sub {
  margin-top: var(--space-3);
}

/* The description is written as paragraphs, so give them air between them. */
.shop__head .section-head__sub p {
  margin: 0;
}

.shop__head .section-head__sub p + p {
  margin-top: 0.85em;
}

/* From tablet up the masthead reads as two columns: the collection name on the
   left, the description beside it rather than stacked under it, both starting
   from the same top edge above the rule. */
@media (min-width: 900px) {
  .shop__head {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    column-gap: var(--space-8);
    align-items: start;
  }

  .shop__head .section-head__eyebrow {
    grid-column: 1;
    grid-row: 1;
  }

  .shop__head .section-head__title {
    grid-column: 1;
    grid-row: 2;
  }

  .shop__head .section-head__sub {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
    margin-top: 0;
    max-width: 52ch;
    /* The house small size, so the description block stands about as tall as
       the title beside it instead of running past it. */
    font-size: var(--body-sm);
    line-height: 1.45;
  }
}

.shop__body {
  display: grid;
  gap: var(--space-6);
  padding-top: var(--space-6);
}

@media (min-width: 1000px) {
  .shop__body {
    grid-template-columns: 240px 1fr;
    gap: var(--space-8);
    align-items: start;
  }
}

/* --- Filters -------------------------------------------------------- */

.shop__filters {
  display: none;
}

@media (min-width: 1000px) {
  .shop__filters {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + var(--space-5));
  }
}

.filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 44px;
  padding-bottom: var(--space-3);
  border-bottom: var(--rule);
}

.filters__clear {
  min-height: 44px;
  color: var(--color-red-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.filters__group {
  padding: 0;
  margin: 0;
  border: 0;
}

.filters__legend {
  padding: var(--space-4) 0 var(--space-3);
  color: var(--text-muted);
}

.filters__options {
  display: flex;
  flex-direction: column;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  cursor: pointer;
}

.filter-option__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.filter-option__box {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  color: transparent;
  background: var(--color-paper);
  border: 1px solid var(--color-ink);
  border-radius: var(--radius-sm);
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.filter-option__input:checked + .filter-option__box {
  background: var(--color-ink);
  color: var(--color-cream);
}

.filter-option__input:focus-visible + .filter-option__box {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.filter-option__label {
  flex: 1;
}

/* --- Toolbar -------------------------------------------------------- */

.shop__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: var(--rule);
}

.shop__count {
  color: var(--text-muted);
  margin-right: auto;
}

.shop__sort {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.shop__sort-label {
  color: var(--text-muted);
}

.shop__sort-select {
  min-height: 44px;
  padding: 0 var(--space-3);
  font-family: var(--font-body);
  font-size: var(--body-sm);
  background: var(--color-paper);
  border: 1px solid var(--color-ink);
  border-radius: var(--radius-md);
  cursor: pointer;
}

@media (min-width: 1000px) {
  .shop__filter-trigger {
    display: none;
  }
}

.shop__applied {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.product-grid--shop {
  margin-top: var(--space-5);
}

.shop__empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-8) 0;
}

.shop__empty-title {
  font-size: var(--heading-md);
}

/* --- Mobile filter sheet -------------------------------------------- */

.filter-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(16, 16, 16, 0.4);
}

.filter-sheet__panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin-left: auto;
  width: min(420px, 100%);
  background: var(--bg);
}

.filter-sheet__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  padding-inline: var(--margin);
  border-bottom: var(--rule-ink);
}

.filter-sheet__body {
  flex: 1;
  overflow-y: auto;
  padding-inline: var(--margin);
}

.filter-sheet__foot {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  padding: var(--space-4) var(--margin);
  border-top: var(--rule);
  background: var(--surface);
}
