/* PBC Swiss — collection browse grid (7-up category cells, 2 rows) */

/* Reshuffle button in the Collection section header. Mirrors the chronology
   reshuffle button styling — small, monochrome, with a rotating arrow that
   spins while the AJAX request is in flight. */
.sec-collection .sec-head .meta { position: relative; }
.sec-collection .sec-head .meta-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.collection-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.collection-refresh:hover,
.collection-refresh:focus-visible {
  background: var(--ink);
  color: #fff;
  outline: none;
}
.collection-refresh-icon {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  transform-origin: center;
}
.sec-collection.is-loading .collection-refresh { pointer-events: none; opacity: .55; }
.sec-collection.is-loading .collection-refresh-icon {
  animation: pbc-collection-spin .8s linear infinite;
}
@keyframes pbc-collection-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}


.browse-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  border: 1px solid var(--line);
}

.b-cell {
  padding: var(--s-5) 16px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
  transition: background .15s;
  background: #fff;
}
.b-cell:last-child { border-right: none; }
/* Strip the right border on every 7th cell so column 7 sits flush with the
   outer grid border, on both rows of the 7x2 layout. */
.b-cell:nth-child(7n) { border-right: none; }
/* Add a horizontal divider between row 1 and row 2 (cells 1-7 get a bottom
   border at the desktop 7-col width). */
.b-cell:nth-child(-n+7) { border-bottom: 1px solid var(--line); }
.b-cell:hover { background: #fafafa; }

.b-cell .n {
  font-weight: 700;
  font-size: var(--t-meta);
  letter-spacing: .06em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.b-cell h4 {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.02em;
  margin: auto 0 12px;
  line-height: 1.1;
}
.b-cell .row {
  display: flex;
  justify-content: space-between;
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--hair);
  padding-top: 14px;
}
.b-cell .swatch {
  width: 20px;
  height: 20px;
  display: inline-block;
}

@media (max-width: 1100px) {
  .browse-grid { grid-template-columns: repeat(2, 1fr); }
  .b-cell { border-bottom: 1px solid var(--line); }
  /* In 2-col mode, only the right column (every 2nd cell) lacks a right border. */
  .b-cell:nth-child(odd) { border-right: 1px solid var(--line); }
  .b-cell:nth-child(2n) { border-right: none; }
  .b-cell:nth-last-child(-n+2) { border-bottom: none; }
}
@media (max-width: 600px) {
  .browse-grid { grid-template-columns: 1fr; }
  .b-cell { border-right: none; }
}

/* Category typeahead inside the collection sec-head — mirrors the inline
   widget used on the artifact archive page so visitors can jump straight
   to a category from the home page. */
.sec-collection .category-switch-inline {
  position: relative;
  flex: 0 0 auto;
}
.sec-collection .category-switch-input {
  width: 100%;
  max-width: 260px;
  padding: 0.6rem 0.9rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.95rem;
  color: #212529;
  outline: none;
  transition: box-shadow 0.15s;
}
.sec-collection .category-switch-input:focus {
  box-shadow: 0 0 0 2px rgba(10, 10, 10, 0.12);
}
.sec-collection .category-switch-results {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 320px;
  max-width: 90vw;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  max-height: 360px;
  overflow-y: auto;
  z-index: 50;
  display: none;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
}
.sec-collection .category-switch-results.open { display: block; }
.sec-collection .category-switch-result {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  color: #212529;
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.3;
}
.sec-collection .category-switch-result.active,
.sec-collection .category-switch-result:hover { background: #f5f5f5; }
.sec-collection .category-switch-result-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.sec-collection .category-switch-result-parent {
  color: #6c757d;
  font-weight: 400;
  margin-right: 0.25rem;
}
.sec-collection .category-switch-result-count {
  color: #6c757d;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.sec-collection .category-switch-empty {
  padding: 0.7rem 0.9rem;
  color: #6c757d;
  font-size: 0.9rem;
  font-style: italic;
}
